Skip to content

Commit 04f388f

Browse files
committed
QL: Add more dead-code tests
1 parent 7c2f26e commit 04f388f

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
| Foo.qll:2:21:2:25 | ClasslessPredicate dead1 | This code is never used, and it's not publicly exported. |
2-
| Foo.qll:6:13:6:17 | ClasslessPredicate dead2 | This code is never used, and it's not publicly exported. |
1+
| Foo.qll:4:21:4:25 | ClasslessPredicate dead1 | This code is never used, and it's not publicly exported. |
2+
| Foo.qll:8:13:8:17 | ClasslessPredicate dead2 | This code is never used, and it's not publicly exported. |
3+
| Foo.qll:42:16:42:21 | Module Input1 | This code is never used, and it's not publicly exported. |
4+
| Foo.qll:46:16:46:21 | Module Input2 | This code is never used, and it's not publicly exported. |
5+
| Foo.qll:50:16:50:21 | Module Input3 | This code is never used, and it's not publicly exported. |
6+
| Foo.qll:56:16:56:17 | Module M2 | This code is never used, and it's not publicly exported. |
7+
| Foo.qll:64:15:64:20 | Class CImpl1 | This code is never used, and it's not publicly exported. |
8+
| Foo.qll:68:15:68:20 | Class CImpl2 | This code is never used, and it's not publicly exported. |

ql/ql/test/queries/style/DeadCode/Foo.qll

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import ql
2+
13
private module Mixed {
24
private predicate dead1() { none() }
35

@@ -30,3 +32,37 @@ private module Foo {
3032
module ValidationMethod<Foo::bar/0 sig> {
3133
predicate impl() { sig() }
3234
}
35+
36+
signature module InputSig {
37+
predicate foo();
38+
}
39+
40+
module ParameterizedModule<InputSig Input> { }
41+
42+
private module Input1 implements InputSig {
43+
predicate foo() { any() }
44+
}
45+
46+
private module Input2 implements InputSig {
47+
predicate foo() { any() }
48+
}
49+
50+
private module Input3 implements InputSig {
51+
predicate foo() { any() }
52+
}
53+
54+
module M1 = ParameterizedModule<Input1>;
55+
56+
private module M2 = ParameterizedModule<Input2>;
57+
58+
import ParameterizedModule<Input3>
59+
60+
private module MImpl { }
61+
62+
module MPublic = MImpl;
63+
64+
private class CImpl1 extends AstNode { }
65+
66+
final class CPublic1 = CImpl1;
67+
68+
private class CImpl2 extends AstNode { }

0 commit comments

Comments
 (0)