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

27 lines
512 B
Kotlin
Vendored

// FIR_IDENTICAL
//KT-5200 Mark unreachable code in lambdas
fun test1(): String {
doCall local@ {
throw NullPointerException()
<!UNREACHABLE_CODE!>"b3"<!> //unmarked
}
return "OK"
}
fun test2(nonLocal: String, b: Boolean): String {
doCall local@ {
if (b) {
return@local "b1"
} else {
return@local "b2"
}
<!UNREACHABLE_CODE!>"b3"<!> //unmarked
}
return nonLocal
}
inline fun doCall(block: ()-> String) = block()