Kotlin: Add FP test case for constant loop condition

This commit is contained in:
Tamas Vajk
2022-10-19 14:19:02 +02:00
parent 643cfced6a
commit 0bc57410a0
3 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
fun fn0(f: Function0<Unit>) = f()
fun fn1() {
var c = true
while (c) {
fn0 {
c = false
}
}
}

View File

@@ -0,0 +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 |

View File

@@ -0,0 +1 @@
Likely Bugs/Termination/ConstantLoopCondition.ql