Skip to content

Commit 6be223a

Browse files
authored
Merge pull request #11756 from aibaars/fix-ql-module-parameter
QL: fix visibility of module parameters
2 parents 149cae9 + c825577 commit 6be223a

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ private predicate defines(FileOrModule m, string name, Type t, boolean public) {
387387
exists(Module mod, SignatureExpr param, int i |
388388
m.asModule() = mod and
389389
mod.hasParameter(i, name, param) and
390-
public = true
390+
public = false
391391
|
392392
// resolve to the signature class
393393
t = param.asType().getResolvedType()

ql/ql/test/modules/ClassSig.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
signature class FooSig;
2+
3+
class FooImpl extends string {
4+
FooImpl() { this = "FooImpl" }
5+
}
6+
7+
module Bar<FooSig Foo> { }
8+
9+
module Scope {
10+
import Bar<FooImpl>
11+
12+
class Foo extends int {
13+
Foo() { this = 1 }
14+
}
15+
16+
predicate fooTest(Foo f) { none() }
17+
}

ql/ql/test/modules/test.expected

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
getTarget
2+
| ClassSig.qll:10:3:10:21 | Import | ClassSig.qll:7:8:7:10 | Bar |
3+
| ClassSig.qll:10:10:10:21 | Bar | ClassSig.qll:7:8:7:10 | Bar |
4+
| Foo.qll:5:34:5:38 | TypeExpr | Foo.qll:1:26:1:30 | MySig |
5+
| Foo.qll:9:24:9:28 | TypeExpr | Foo.qll:1:26:1:30 | MySig |
6+
| Foo.qll:17:1:17:16 | Import | Foo.qll:15:8:15:16 | SimpleMod |
7+
| Foo.qll:17:8:17:16 | SimpleMod | Foo.qll:15:8:15:16 | SimpleMod |
8+
| Foo.qll:19:38:19:52 | MkThing | Foo.qll:9:16:9:22 | MkThing |
9+
| Foo.qll:19:38:19:60 | TypeExpr | Foo.qll:10:20:10:25 | SubMod |
10+
| Foo.qll:19:46:19:51 | TypeExpr | Foo.qll:5:16:5:21 | MyImpl |
11+
getTargetType
12+
| ClassSig.qll:3:23:3:28 | TypeExpr | file://:0:0:0:0 | string |
13+
| ClassSig.qll:7:12:7:17 | TypeExpr | ClassSig.qll:1:17:1:22 | FooSig |
14+
| ClassSig.qll:10:3:10:21 | Import | ClassSig.qll:7:8:7:10 | Bar |
15+
| ClassSig.qll:10:10:10:21 | Bar | ClassSig.qll:7:8:7:10 | Bar |
16+
| ClassSig.qll:10:14:10:20 | TypeExpr | ClassSig.qll:3:7:3:13 | FooImpl |
17+
| ClassSig.qll:12:21:12:23 | TypeExpr | file://:0:0:0:0 | int |
18+
| ClassSig.qll:16:21:16:23 | TypeExpr | ClassSig.qll:12:9:12:11 | Foo |
119
| Foo.qll:5:34:5:38 | TypeExpr | Foo.qll:1:26:1:30 | MySig |
220
| Foo.qll:9:24:9:28 | TypeExpr | Foo.qll:1:26:1:30 | MySig |
321
| Foo.qll:17:1:17:16 | Import | Foo.qll:15:8:15:16 | SimpleMod |

ql/ql/test/modules/test.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import ql
22

33
query Type getTarget(TypeRef me) { result = me.getResolvedModule().toType() }
4+
5+
query Type getTargetType(TypeRef me) { result = me.getResolvedType() }

0 commit comments

Comments
 (0)