Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81cb813

Browse files
tamasvajkigfoo
authored andcommitted
Add test case for CFG issue with && in if condition
1 parent 10ef737 commit 81cb813

10 files changed

Lines changed: 251 additions & 15 deletions

File tree

java/ql/test/kotlin/library-tests/controlflow/basic/Test.kt

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,52 @@ public class Test {
66
var y: Long = 50
77
var z: Int = 0
88
var w: Int = 0
9-
9+
1010
// if-else, multiple statements in block
1111
if (x > 0) {
1212
y = 20
1313
z = 10
1414
} else {
1515
y = 30
1616
}
17-
17+
1818
z = 0
19-
19+
2020
// if-else with return in one branch
2121
if(x < 0)
2222
y = 40
23-
else
23+
else
2424
return
25-
25+
2626
// this is not the start of a BB due to the return
2727
z = 10
28-
28+
2929
// single-branch if-else
3030
if (x == 0) {
3131
y = 60
3232
z = 10
3333
}
34-
34+
3535
z = 20
36-
36+
3737
// while loop
3838
while(x > 0) {
3939
y = 10
4040
x--
4141
}
42-
42+
4343
z = 30
44-
44+
4545
/*
4646
TODO
4747
// for loop
4848
for(j in 0 .. 19) {
4949
y = 0
5050
w = 10
5151
}
52-
52+
5353
z = 40
54-
54+
5555
// nested control flow
5656
for(j in 0 .. 9) {
5757
y = 30
@@ -69,11 +69,11 @@ TODO
6969
x = 0
7070
}
7171
*/
72-
72+
7373
z = 50
74-
74+
7575
// nested control-flow
76-
76+
7777
w = 40
7878
return
7979
}
@@ -96,3 +96,15 @@ fun t2(o: Any?): Int {
9696
return 2
9797
}
9898
}
99+
100+
fun fn(x:Any?, y: Any?) {
101+
if (x == null && y == null) {
102+
throw Exception()
103+
}
104+
105+
if (x != null) {
106+
println("x not null")
107+
} else if (y != null) {
108+
println("y not null")
109+
}
110+
}

java/ql/test/kotlin/library-tests/controlflow/basic/bbStmts.expected

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,42 @@
132132
| Test.kt:95:4:97:2 | catch (...) | 2 | Test.kt:95:36:97:2 | { ... } |
133133
| Test.kt:95:4:97:2 | catch (...) | 3 | Test.kt:96:10:96:10 | 2 |
134134
| Test.kt:95:4:97:2 | catch (...) | 4 | Test.kt:96:3:96:10 | return ... |
135+
| Test.kt:100:1:110:1 | fn | 0 | Test.kt:100:1:110:1 | fn |
136+
| Test.kt:100:25:110:1 | { ... } | 0 | Test.kt:100:25:110:1 | { ... } |
137+
| Test.kt:100:25:110:1 | { ... } | 1 | Test.kt:101:5:103:5 | <Expr>; |
138+
| Test.kt:100:25:110:1 | { ... } | 2 | Test.kt:101:5:103:5 | when ... |
139+
| Test.kt:100:25:110:1 | { ... } | 3 | Test.kt:101:5:103:5 | ... -> ... |
140+
| Test.kt:100:25:110:1 | { ... } | 4 | Test.kt:101:9:101:30 | when ... |
141+
| Test.kt:100:25:110:1 | { ... } | 5 | Test.kt:101:9:101:30 | ... -> ... |
142+
| Test.kt:100:25:110:1 | { ... } | 6 | Test.kt:101:9:101:9 | x |
143+
| Test.kt:100:25:110:1 | { ... } | 7 | Test.kt:101:14:101:17 | null |
144+
| Test.kt:100:25:110:1 | { ... } | 8 | Test.kt:101:9:101:17 | ... (value equals) ... |
145+
| Test.kt:101:22:101:30 | ... -> ... | 0 | Test.kt:101:22:101:30 | ... -> ... |
146+
| Test.kt:101:22:101:30 | ... -> ... | 1 | Test.kt:101:22:101:30 | true |
147+
| Test.kt:101:22:101:30 | ... -> ... | 2 | Test.kt:101:22:101:30 | <Expr>; |
148+
| Test.kt:101:22:101:30 | ... -> ... | 3 | Test.kt:101:22:101:30 | false |
149+
| Test.kt:101:22:101:30 | <Expr>; | 0 | Test.kt:101:22:101:30 | <Expr>; |
150+
| Test.kt:101:22:101:30 | <Expr>; | 1 | Test.kt:101:22:101:22 | y |
151+
| Test.kt:101:22:101:30 | <Expr>; | 2 | Test.kt:101:27:101:30 | null |
152+
| Test.kt:101:22:101:30 | <Expr>; | 3 | Test.kt:101:22:101:30 | ... (value equals) ... |
153+
| Test.kt:101:33:103:5 | { ... } | 0 | Test.kt:101:33:103:5 | { ... } |
154+
| Test.kt:101:33:103:5 | { ... } | 1 | Test.kt:102:15:102:25 | new Exception(...) |
155+
| Test.kt:101:33:103:5 | { ... } | 2 | Test.kt:102:9:102:25 | throw ... |
156+
| Test.kt:105:5:109:5 | <Expr>; | 0 | Test.kt:105:5:109:5 | <Expr>; |
157+
| Test.kt:105:5:109:5 | <Expr>; | 1 | Test.kt:105:5:109:5 | when ... |
158+
| Test.kt:105:5:109:5 | <Expr>; | 2 | Test.kt:105:9:107:5 | ... -> ... |
159+
| Test.kt:105:5:109:5 | <Expr>; | 3 | Test.kt:105:9:105:9 | x |
160+
| Test.kt:105:5:109:5 | <Expr>; | 4 | Test.kt:105:14:105:17 | null |
161+
| Test.kt:105:5:109:5 | <Expr>; | 5 | Test.kt:105:9:105:17 | ... (value not-equals) ... |
162+
| Test.kt:105:20:107:5 | { ... } | 0 | Test.kt:105:20:107:5 | { ... } |
163+
| Test.kt:105:20:107:5 | { ... } | 1 | Test.kt:106:9:106:29 | <Expr>; |
164+
| Test.kt:105:20:107:5 | { ... } | 2 | Test.kt:106:18:106:27 | x not null |
165+
| Test.kt:105:20:107:5 | { ... } | 3 | Test.kt:106:9:106:29 | println(...) |
166+
| Test.kt:107:16:109:5 | ... -> ... | 0 | Test.kt:107:16:109:5 | ... -> ... |
167+
| Test.kt:107:16:109:5 | ... -> ... | 1 | Test.kt:107:16:107:16 | y |
168+
| Test.kt:107:16:109:5 | ... -> ... | 2 | Test.kt:107:21:107:24 | null |
169+
| Test.kt:107:16:109:5 | ... -> ... | 3 | Test.kt:107:16:107:24 | ... (value not-equals) ... |
170+
| Test.kt:107:27:109:5 | { ... } | 0 | Test.kt:107:27:109:5 | { ... } |
171+
| Test.kt:107:27:109:5 | { ... } | 1 | Test.kt:108:9:108:29 | <Expr>; |
172+
| Test.kt:107:27:109:5 | { ... } | 2 | Test.kt:108:18:108:27 | y not null |
173+
| Test.kt:107:27:109:5 | { ... } | 3 | Test.kt:108:9:108:29 | println(...) |

java/ql/test/kotlin/library-tests/controlflow/basic/bbStrictDominance.expected

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,21 @@
3333
| Test.kt:91:22:98:1 | { ... } | Test.kt:91:1:98:1 | t2 |
3434
| Test.kt:91:22:98:1 | { ... } | Test.kt:93:3:93:13 | x |
3535
| Test.kt:91:22:98:1 | { ... } | Test.kt:95:4:97:2 | catch (...) |
36+
| Test.kt:100:25:110:1 | { ... } | Test.kt:100:1:110:1 | fn |
37+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | ... -> ... |
38+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | <Expr>; |
39+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:33:103:5 | { ... } |
40+
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:5:109:5 | <Expr>; |
41+
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:20:107:5 | { ... } |
42+
| Test.kt:100:25:110:1 | { ... } | Test.kt:107:16:109:5 | ... -> ... |
43+
| Test.kt:100:25:110:1 | { ... } | Test.kt:107:27:109:5 | { ... } |
44+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:100:1:110:1 | fn |
45+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:33:103:5 | { ... } |
46+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:5:109:5 | <Expr>; |
47+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
48+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
49+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
50+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
51+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
52+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
53+
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |

java/ql/test/kotlin/library-tests/controlflow/basic/bbSuccessor.expected

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,14 @@
2121
| Test.kt:91:22:98:1 | { ... } | Test.kt:95:4:97:2 | catch (...) |
2222
| Test.kt:93:3:93:13 | x | Test.kt:91:1:98:1 | t2 |
2323
| Test.kt:95:4:97:2 | catch (...) | Test.kt:91:1:98:1 | t2 |
24+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | ... -> ... |
25+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | <Expr>; |
26+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:33:103:5 | { ... } |
27+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:5:109:5 | <Expr>; |
28+
| Test.kt:101:33:103:5 | { ... } | Test.kt:100:1:110:1 | fn |
29+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
30+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
31+
| Test.kt:105:20:107:5 | { ... } | Test.kt:100:1:110:1 | fn |
32+
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:100:1:110:1 | fn |
33+
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
34+
| Test.kt:107:27:109:5 | { ... } | Test.kt:100:1:110:1 | fn |

java/ql/test/kotlin/library-tests/controlflow/basic/getASuccessor.expected

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,51 @@
169169
| Test.kt:95:36:97:2 | { ... } | BlockStmt | Test.kt:96:10:96:10 | 2 | IntegerLiteral |
170170
| Test.kt:96:3:96:10 | return ... | ReturnStmt | Test.kt:91:1:98:1 | t2 | Method |
171171
| Test.kt:96:10:96:10 | 2 | IntegerLiteral | Test.kt:96:3:96:10 | return ... | ReturnStmt |
172+
| Test.kt:100:1:110:1 | fn | Method | file://:0:0:0:0 | <none> | <none> |
173+
| Test.kt:100:8:100:13 | x | Parameter | file://:0:0:0:0 | <none> | <none> |
174+
| Test.kt:100:16:100:22 | y | Parameter | file://:0:0:0:0 | <none> | <none> |
175+
| Test.kt:100:25:110:1 | { ... } | BlockStmt | Test.kt:101:5:103:5 | <Expr>; | ExprStmt |
176+
| Test.kt:101:5:103:5 | ... -> ... | WhenBranch | Test.kt:101:9:101:30 | when ... | WhenExpr |
177+
| Test.kt:101:5:103:5 | <Expr>; | ExprStmt | Test.kt:101:5:103:5 | when ... | WhenExpr |
178+
| Test.kt:101:5:103:5 | when ... | WhenExpr | Test.kt:101:5:103:5 | ... -> ... | WhenBranch |
179+
| Test.kt:101:9:101:9 | x | VarAccess | Test.kt:101:14:101:17 | null | NullLiteral |
180+
| Test.kt:101:9:101:17 | ... (value equals) ... | ValueEQExpr | Test.kt:101:22:101:30 | ... -> ... | WhenBranch |
181+
| Test.kt:101:9:101:17 | ... (value equals) ... | ValueEQExpr | Test.kt:101:22:101:30 | <Expr>; | ExprStmt |
182+
| Test.kt:101:9:101:30 | ... -> ... | WhenBranch | Test.kt:101:9:101:9 | x | VarAccess |
183+
| Test.kt:101:9:101:30 | when ... | WhenExpr | Test.kt:101:9:101:30 | ... -> ... | WhenBranch |
184+
| Test.kt:101:14:101:17 | null | NullLiteral | Test.kt:101:9:101:17 | ... (value equals) ... | ValueEQExpr |
185+
| Test.kt:101:22:101:22 | y | VarAccess | Test.kt:101:27:101:30 | null | NullLiteral |
186+
| Test.kt:101:22:101:30 | ... (value equals) ... | ValueEQExpr | Test.kt:101:33:103:5 | { ... } | BlockStmt |
187+
| Test.kt:101:22:101:30 | ... (value equals) ... | ValueEQExpr | Test.kt:105:5:109:5 | <Expr>; | ExprStmt |
188+
| Test.kt:101:22:101:30 | ... -> ... | WhenBranch | Test.kt:101:22:101:30 | true | BooleanLiteral |
189+
| Test.kt:101:22:101:30 | <Expr>; | ExprStmt | Test.kt:101:22:101:22 | y | VarAccess |
190+
| Test.kt:101:22:101:30 | <Expr>; | ExprStmt | Test.kt:101:22:101:30 | false | BooleanLiteral |
191+
| Test.kt:101:22:101:30 | false | BooleanLiteral | file://:0:0:0:0 | <none> | <none> |
192+
| Test.kt:101:22:101:30 | true | BooleanLiteral | Test.kt:101:22:101:30 | <Expr>; | ExprStmt |
193+
| Test.kt:101:27:101:30 | null | NullLiteral | Test.kt:101:22:101:30 | ... (value equals) ... | ValueEQExpr |
194+
| Test.kt:101:33:103:5 | { ... } | BlockStmt | Test.kt:102:15:102:25 | new Exception(...) | ClassInstanceExpr |
195+
| Test.kt:102:9:102:25 | throw ... | ThrowStmt | Test.kt:100:1:110:1 | fn | Method |
196+
| Test.kt:102:15:102:25 | Exception | TypeAccess | file://:0:0:0:0 | <none> | <none> |
197+
| Test.kt:102:15:102:25 | new Exception(...) | ClassInstanceExpr | Test.kt:102:9:102:25 | throw ... | ThrowStmt |
198+
| Test.kt:105:5:109:5 | <Expr>; | ExprStmt | Test.kt:105:5:109:5 | when ... | WhenExpr |
199+
| Test.kt:105:5:109:5 | when ... | WhenExpr | Test.kt:105:9:107:5 | ... -> ... | WhenBranch |
200+
| Test.kt:105:9:105:9 | x | VarAccess | Test.kt:105:14:105:17 | null | NullLiteral |
201+
| Test.kt:105:9:105:17 | ... (value not-equals) ... | ValueNEExpr | Test.kt:105:20:107:5 | { ... } | BlockStmt |
202+
| Test.kt:105:9:105:17 | ... (value not-equals) ... | ValueNEExpr | Test.kt:107:16:109:5 | ... -> ... | WhenBranch |
203+
| Test.kt:105:9:107:5 | ... -> ... | WhenBranch | Test.kt:105:9:105:9 | x | VarAccess |
204+
| Test.kt:105:14:105:17 | null | NullLiteral | Test.kt:105:9:105:17 | ... (value not-equals) ... | ValueNEExpr |
205+
| Test.kt:105:20:107:5 | { ... } | BlockStmt | Test.kt:106:9:106:29 | <Expr>; | ExprStmt |
206+
| Test.kt:106:9:106:29 | <Expr>; | ExprStmt | Test.kt:106:18:106:27 | x not null | StringLiteral |
207+
| Test.kt:106:9:106:29 | ConsoleKt | TypeAccess | file://:0:0:0:0 | <none> | <none> |
208+
| Test.kt:106:9:106:29 | println(...) | MethodAccess | Test.kt:100:1:110:1 | fn | Method |
209+
| Test.kt:106:18:106:27 | x not null | StringLiteral | Test.kt:106:9:106:29 | println(...) | MethodAccess |
210+
| Test.kt:107:16:107:16 | y | VarAccess | Test.kt:107:21:107:24 | null | NullLiteral |
211+
| Test.kt:107:16:107:24 | ... (value not-equals) ... | ValueNEExpr | Test.kt:100:1:110:1 | fn | Method |
212+
| Test.kt:107:16:107:24 | ... (value not-equals) ... | ValueNEExpr | Test.kt:107:27:109:5 | { ... } | BlockStmt |
213+
| Test.kt:107:16:109:5 | ... -> ... | WhenBranch | Test.kt:107:16:107:16 | y | VarAccess |
214+
| Test.kt:107:21:107:24 | null | NullLiteral | Test.kt:107:16:107:24 | ... (value not-equals) ... | ValueNEExpr |
215+
| Test.kt:107:27:109:5 | { ... } | BlockStmt | Test.kt:108:9:108:29 | <Expr>; | ExprStmt |
216+
| Test.kt:108:9:108:29 | <Expr>; | ExprStmt | Test.kt:108:18:108:27 | y not null | StringLiteral |
217+
| Test.kt:108:9:108:29 | ConsoleKt | TypeAccess | file://:0:0:0:0 | <none> | <none> |
218+
| Test.kt:108:9:108:29 | println(...) | MethodAccess | Test.kt:100:1:110:1 | fn | Method |
219+
| Test.kt:108:18:108:27 | y not null | StringLiteral | Test.kt:108:9:108:29 | println(...) | MethodAccess |

java/ql/test/kotlin/library-tests/controlflow/basic/strictDominance.expected

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,83 @@
488488
| Test.kt:95:4:97:2 | catch (...) | Test.kt:95:36:97:2 | { ... } |
489489
| Test.kt:95:4:97:2 | catch (...) | Test.kt:96:3:96:10 | return ... |
490490
| Test.kt:95:36:97:2 | { ... } | Test.kt:96:3:96:10 | return ... |
491+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:5:103:5 | ... -> ... |
492+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:5:103:5 | <Expr>; |
493+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:9:101:30 | ... -> ... |
494+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | ... -> ... |
495+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | <Expr>; |
496+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:22:101:30 | <Expr>; |
497+
| Test.kt:100:25:110:1 | { ... } | Test.kt:101:33:103:5 | { ... } |
498+
| Test.kt:100:25:110:1 | { ... } | Test.kt:102:9:102:25 | throw ... |
499+
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:5:109:5 | <Expr>; |
500+
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:9:107:5 | ... -> ... |
501+
| Test.kt:100:25:110:1 | { ... } | Test.kt:105:20:107:5 | { ... } |
502+
| Test.kt:100:25:110:1 | { ... } | Test.kt:106:9:106:29 | <Expr>; |
503+
| Test.kt:100:25:110:1 | { ... } | Test.kt:107:16:109:5 | ... -> ... |
504+
| Test.kt:100:25:110:1 | { ... } | Test.kt:107:27:109:5 | { ... } |
505+
| Test.kt:100:25:110:1 | { ... } | Test.kt:108:9:108:29 | <Expr>; |
506+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:9:101:30 | ... -> ... |
507+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:22:101:30 | ... -> ... |
508+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:22:101:30 | <Expr>; |
509+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:22:101:30 | <Expr>; |
510+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:33:103:5 | { ... } |
511+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:102:9:102:25 | throw ... |
512+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:105:5:109:5 | <Expr>; |
513+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:105:9:107:5 | ... -> ... |
514+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:105:20:107:5 | { ... } |
515+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:106:9:106:29 | <Expr>; |
516+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:107:16:109:5 | ... -> ... |
517+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
518+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:108:9:108:29 | <Expr>; |
519+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:5:103:5 | ... -> ... |
520+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:9:101:30 | ... -> ... |
521+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:22:101:30 | ... -> ... |
522+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:22:101:30 | <Expr>; |
523+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:22:101:30 | <Expr>; |
524+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:101:33:103:5 | { ... } |
525+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:102:9:102:25 | throw ... |
526+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:105:5:109:5 | <Expr>; |
527+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:105:9:107:5 | ... -> ... |
528+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
529+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:106:9:106:29 | <Expr>; |
530+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
531+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
532+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:108:9:108:29 | <Expr>; |
533+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:22:101:30 | ... -> ... |
534+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:22:101:30 | <Expr>; |
535+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:22:101:30 | <Expr>; |
536+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:33:103:5 | { ... } |
537+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:102:9:102:25 | throw ... |
538+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:105:5:109:5 | <Expr>; |
539+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:105:9:107:5 | ... -> ... |
540+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:105:20:107:5 | { ... } |
541+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:106:9:106:29 | <Expr>; |
542+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:107:16:109:5 | ... -> ... |
543+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
544+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:108:9:108:29 | <Expr>; |
545+
| Test.kt:101:22:101:30 | ... -> ... | Test.kt:101:22:101:30 | <Expr>; |
546+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:33:103:5 | { ... } |
547+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:102:9:102:25 | throw ... |
548+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:5:109:5 | <Expr>; |
549+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:9:107:5 | ... -> ... |
550+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
551+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:106:9:106:29 | <Expr>; |
552+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
553+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
554+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:108:9:108:29 | <Expr>; |
555+
| Test.kt:101:33:103:5 | { ... } | Test.kt:102:9:102:25 | throw ... |
556+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:105:9:107:5 | ... -> ... |
557+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
558+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:106:9:106:29 | <Expr>; |
559+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:16:109:5 | ... -> ... |
560+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
561+
| Test.kt:105:5:109:5 | <Expr>; | Test.kt:108:9:108:29 | <Expr>; |
562+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:105:20:107:5 | { ... } |
563+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:106:9:106:29 | <Expr>; |
564+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:107:16:109:5 | ... -> ... |
565+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
566+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:108:9:108:29 | <Expr>; |
567+
| Test.kt:105:20:107:5 | { ... } | Test.kt:106:9:106:29 | <Expr>; |
568+
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:107:27:109:5 | { ... } |
569+
| Test.kt:107:16:109:5 | ... -> ... | Test.kt:108:9:108:29 | <Expr>; |
570+
| Test.kt:107:27:109:5 | { ... } | Test.kt:108:9:108:29 | <Expr>; |

java/ql/test/kotlin/library-tests/controlflow/basic/strictPostDominance.expected

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,18 @@
204204
| Test.kt:95:36:97:2 | { ... } | Test.kt:95:4:97:2 | catch (...) |
205205
| Test.kt:96:3:96:10 | return ... | Test.kt:95:4:97:2 | catch (...) |
206206
| Test.kt:96:3:96:10 | return ... | Test.kt:95:36:97:2 | { ... } |
207+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:100:25:110:1 | { ... } |
208+
| Test.kt:101:5:103:5 | ... -> ... | Test.kt:101:5:103:5 | <Expr>; |
209+
| Test.kt:101:5:103:5 | <Expr>; | Test.kt:100:25:110:1 | { ... } |
210+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:100:25:110:1 | { ... } |
211+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:5:103:5 | ... -> ... |
212+
| Test.kt:101:9:101:30 | ... -> ... | Test.kt:101:5:103:5 | <Expr>; |
213+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:100:25:110:1 | { ... } |
214+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:5:103:5 | ... -> ... |
215+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:5:103:5 | <Expr>; |
216+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:9:101:30 | ... -> ... |
217+
| Test.kt:101:22:101:30 | <Expr>; | Test.kt:101:22:101:30 | ... -> ... |
218+
| Test.kt:102:9:102:25 | throw ... | Test.kt:101:33:103:5 | { ... } |
219+
| Test.kt:105:9:107:5 | ... -> ... | Test.kt:105:5:109:5 | <Expr>; |
220+
| Test.kt:106:9:106:29 | <Expr>; | Test.kt:105:20:107:5 | { ... } |
221+
| Test.kt:108:9:108:29 | <Expr>; | Test.kt:107:27:109:5 | { ... } |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fun fn(x:Any?, y: Any?) {
2+
if (x == null && y == null) {
3+
throw Exception()
4+
}
5+
6+
if (x != null) {
7+
println("x not null")
8+
} else if (y != null) {
9+
println("y not null")
10+
}
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| Test.kt:8:16:8:24 | ... (value not-equals) ... | This check is useless, $@ cannot be null here, since it is guarded by $@. | Test.kt:8:16:8:16 | y | y | Test.kt:2:22:2:30 | ... (value equals) ... | ... (value equals) ... |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Language Abuse/UselessNullCheck.ql

0 commit comments

Comments
 (0)