Kotlin: Exclude captured variables from constant loop condition check

This commit is contained in:
Tamas Vajk
2022-10-19 15:01:17 +02:00
parent 0bc57410a0
commit 3e476f96bd
8 changed files with 83 additions and 3 deletions

View File

@@ -7,4 +7,18 @@ fun fn1() {
c = false
}
}
var d = true
while (d) { // FALSE NEGATIVE
fn0 {
println(d)
}
}
val e = true
while (e) {
fn0 {
println(e)
}
}
}

View File

@@ -1 +1 @@
| 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 |
| 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 |