Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInLoops.kt
T
Andrey Zinovyev ec4cbfef59 [FIR] UNREACHABLE_CODE diagnostic (wip)
Implementation for PSI only
2021-08-04 14:42:24 +03:00

23 lines
398 B
Kotlin
Vendored

// FIR_IDENTICAL
fun testFor() {
operator fun Nothing.iterator() = (0..1).iterator()
<!UNREACHABLE_CODE!>for (i in<!> todo()<!UNREACHABLE_CODE!>) {}<!>
}
fun testWhile() {
<!UNREACHABLE_CODE!>while (<!>todo()<!UNREACHABLE_CODE!>) {
}<!>
}
fun testDoWhile() {
do {
} while(todo())
<!UNREACHABLE_CODE!>bar()<!>
}
fun todo(): Nothing = throw Exception()
fun bar() {}