Files
kotlin/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInLoops.kt
Svetlana Isakova 79cec6411d Mark only unreachable parts of element if it has reachable parts
like for 'return todo()' mark only 'return'
2014-06-21 12:26:33 +04:00

21 lines
362 B
Kotlin

fun testFor() {
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() {}