Merge from main

This commit is contained in:
Dave Bartolomeo
2022-11-01 13:22:40 -04:00
486 changed files with 6866 additions and 2473 deletions

View File

@@ -25,6 +25,10 @@ class AstNode extends TAstNode {
cached
Location getLocation() { result = this.getFullLocation() } // overridden in some subclasses
/** Gets the file containing this AST node. */
cached
File getFile() { result = this.getFullLocation().getFile() }
/** Gets the location that spans the entire AST node. */
cached
final Location getFullLocation() {

View File

@@ -289,10 +289,41 @@ predicate resolveTypeExpr(TypeExpr te, Type t) {
else
if primTypeName(te.getClassName())
then t = TPrimitive(te.getClassName())
else
exists(FileOrModule m, boolean public, string clName | qualifier(te, m, public, clName) |
defines(m, clName, t, public)
else resolveTypeExpr2(te, t)
}
pragma[noopt]
predicate resolveTypeExpr2(TypeExpr te, Type t) {
exists(FileOrModule m, boolean public, string clName |
qualifier(te, m, public, clName) and
defines(m, clName, t, public) and
// there can be some cross-talk between modules due to collapsing parameterized modules. This should remove the worst.
// require that the Type is contained in the same pack or a dependency.
(
exists(YAML::QLPack base, YAML::QLPack sup |
te.getFile() = base.getAFileInPack() and
exists(AstNode decl, File f |
decl = t.getDeclaration() and
f = decl.getFile() and
f = sup.getAFileInPack()
) and
(
base.getADependency*() = sup
or
// only interested in blocking language -> language flow, so we include if one of the packs is shared (has no dbscheme).
not exists(YAML::QLPack dep | dep = base.getADependency*() | exists(dep.getDBScheme()))
or
not exists(YAML::QLPack dep | dep = sup.getADependency*() | exists(dep.getDBScheme()))
)
)
or
// for tests, and other cases where no qlpack exists.
not exists(YAML::QLPack base | te.getFile() = base.getAFileInPack())
or
// e.g. alias for primitives.
not exists(t.getDeclaration())
)
)
}
pragma[noinline]

View File

@@ -137,6 +137,7 @@ abstract class InlineExpectationsTest extends string {
final predicate hasFailureMessage(FailureLocatable element, string message) {
exists(ActualResult actualResult |
actualResult.getTest() = this and
actualResult.getTag() = this.getARelevantTag() and
element = actualResult and
(
exists(FalseNegativeExpectation falseNegative |
@@ -150,9 +151,18 @@ abstract class InlineExpectationsTest extends string {
)
)
or
exists(ActualResult actualResult |
actualResult.getTest() = this and
not actualResult.getTag() = this.getARelevantTag() and
element = actualResult and
message =
"Tag mismatch: Actual result with tag '" + actualResult.getTag() +
"' that is not part of getARelevantTag()"
)
or
exists(ValidExpectation expectation |
not exists(ActualResult actualResult | expectation.matchesActualResult(actualResult)) and
expectation.getTag() = getARelevantTag() and
expectation.getTag() = this.getARelevantTag() and
element = expectation and
(
expectation instanceof GoodExpectation and

View File

@@ -1,3 +1,4 @@
name: ql-other-pack-thing
version: 0.1.0
libraryPathDependencies: ql-testing-src-pack
dependencies:
ql-testing-src-pack: '*'