Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInLoops.kt
T
2015-09-25 19:20:20 +03:00

21 lines
371 B
Kotlin
Vendored

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() = throw Exception()
fun bar() {}