Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/inference/kt6242.kt
T
Svetlana Isakova 5d0f004292 Fix for 'if' special construct type
If one branch has Nothing type (contains 'return', etc.),
return result type of corresponding resolved call (it may depend on smart casts)
 #KT-6242 Fixed
2014-11-21 14:02:42 +03:00

12 lines
254 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_VARIABLE
inline fun<T> foo(block: () -> T):T = block()
fun baz() {
val x: String = foo {
val task: String? = null
if (task == null) {
return
} else <!DEBUG_INFO_SMARTCAST!>task<!>
}
}