Skip to content

Commit 9d1af76

Browse files
committed
Add more test cases
1 parent 7559d30 commit 9d1af76

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

java/ql/test/kotlin/query-tests/ConstantLoopCondition/A.kt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@ fun fn0(f: Function0<Unit>) = f()
22

33
fun fn1() {
44
var c = true
5-
while (c) {
5+
while (c) { // TODO: false positive
66
fn0 {
77
c = false
88
}
99
}
10+
11+
var d = true
12+
while (d) {
13+
fn0 {
14+
println(d)
15+
}
16+
}
17+
18+
val e = true
19+
while (e) {
20+
fn0 {
21+
println(e)
22+
}
23+
}
1024
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
| A.kt:5:12:5:12 | c | $@ might not terminate, as this loop condition is constant within the loop. | A.kt:5:5:9:5 | while (...) | Loop |
2+
| A.kt:12:12:12:12 | d | $@ might not terminate, as this loop condition is constant within the loop. | A.kt:12:5:16:5 | while (...) | Loop |
3+
| A.kt:19:12:19:12 | e | $@ might not terminate, as this loop condition is constant within the loop. | A.kt:19:5:23:5 | while (...) | Loop |

0 commit comments

Comments
 (0)