Files
kotlin/compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckBoolean.kt
2015-06-02 10:56:21 +03:00

13 lines
357 B
Kotlin
Vendored

// KT-7857: when exhaustiveness does not take previous nullability checks into account
fun foo(arg: Boolean?): Int {
if (arg != null) {
return when (<!DEBUG_INFO_SMARTCAST!>arg<!>) {
true -> 1
false -> 0
// else or null branch should not be required here!
}
}
else {
return -1
}
}