Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/testNestedSpecialCalls.kt
T
Pavel Kirpichenkov 2d21b82501 [NI] Remove hack for special functions
Treating special functions for `if`, `when`, `try`, `?:` as not accepting `Nothing` result type is incorrect.
Making so leads to cases with uninferred `Nothing` result type for inner calls and lost data flow info.
2019-12-27 18:40:42 +03:00

12 lines
250 B
Kotlin
Vendored

// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE
fun test() {
val x: Int? = 20
if (x != null) {
} else {
if (true) return else return
}
<!DEBUG_INFO_SMARTCAST!>x<!>.and(1) // unsafe call
}