Skip to content

Commit 5717a21

Browse files
committed
QL: fix bad join
1 parent 4d12d8d commit 5717a21

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ql/ql/src/codeql_ql/ast/internal/Module.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private predicate resolveQualifiedName(Import imp, ContainerOrModule m, int i) {
105105
(
106106
exists(Container c, Container parent |
107107
// should ideally look at `qlpack.yml` files
108-
parent = imp.getLocation().getFile().getParentContainer+() and
108+
parent = pragma[only_bind_out](imp.getLocation()).getFile().getParentContainer+() and
109109
exists(YAML::QLPack pack |
110110
pack.getFile().getParentContainer() = parent and
111111
c.getParentContainer() = pack.getADependency*().getFile().getParentContainer()
@@ -122,7 +122,8 @@ private predicate resolveQualifiedName(Import imp, ContainerOrModule m, int i) {
122122
definesModule(container, q, m, _) and
123123
(
124124
exists(container.(Folder_).getFolder().getFile("qlpack.yml")) or
125-
container.(Folder_).getFolder() = imp.getLocation().getFile().getParentContainer() or
125+
container.(Folder_).getFolder() =
126+
pragma[only_bind_out](imp.getLocation()).getFile().getParentContainer() or
126127
not container instanceof Folder_
127128
)
128129
)
@@ -194,7 +195,7 @@ private module Cached {
194195
not m = TFile(any(File f | f.getExtension() = "ql")) and
195196
not exists(me.getQualifier()) and
196197
exists(ContainerOrModule enclosing, string name | resolveModuleExprHelper(me, enclosing, name) |
197-
definesModule(enclosing.getEnclosing*(), name, m, _)
198+
definesModule(enclosing, name, m, _)
198199
)
199200
or
200201
exists(FileOrModule mid |
@@ -205,7 +206,7 @@ private module Cached {
205206

206207
pragma[noinline]
207208
private predicate resolveModuleExprHelper(ModuleExpr me, ContainerOrModule enclosing, string name) {
208-
enclosing = getEnclosingModule(me) and
209+
enclosing = getEnclosingModule(me).getEnclosing*() and
209210
name = me.getName()
210211
}
211212
}

0 commit comments

Comments
 (0)