mirror of
https://github.com/github/codeql.git
synced 2025-12-22 19:56:32 +01:00
Kotlin: Add FP test case for constant loop condition
This commit is contained in:
10
java/ql/test/kotlin/query-tests/ConstantLoopCondition/A.kt
Normal file
10
java/ql/test/kotlin/query-tests/ConstantLoopCondition/A.kt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
fun fn0(f: Function0<Unit>) = f()
|
||||||
|
|
||||||
|
fun fn1() {
|
||||||
|
var c = true
|
||||||
|
while (c) {
|
||||||
|
fn0 {
|
||||||
|
c = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 |
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Likely Bugs/Termination/ConstantLoopCondition.ql
|
||||||
Reference in New Issue
Block a user