Files
kotlin-fork/compiler/testData/cfg/deadCode/throwInLambda.kt
T
Mikhail Glukhikh a08b8f43b2 Control flow graph for safe calls corrected #KT-10913 Fixed
Also #KT-10186 Fixed
Also #KT-5198 Fixed
2016-02-10 12:29:45 +03:00

16 lines
346 B
Kotlin
Vendored

// See KT-10913 Bogus unreachable code warning
fun fn() : String? = null
inline fun <T, R> T.let(f: (T) -> R): R = f(this)
fun foo(): String {
val x = fn()?.let { throw Exception() } ?: "unreachable?"
return x
}
fun bar(): String {
val x = fn() ?: return ""
val y = x?.let { throw Exception() } ?: "unreachable"
return y
}