Files
kotlin/compiler/testData/codegen/box/unit/nullableUnitInWhen3.kt
Alexander Udalov 0576851102 Fix codegen for closures returning 'Unit?'
Only do a checkcast when we need to coerce Object to Unit: the code was
hopefully type-checked so that it'll only be necessary when the value is either
Unit.VALUE or null
2013-12-12 21:38:20 +04:00

13 lines
168 B
Kotlin
Vendored

fun foo() {}
fun box(): String {
val x = when ("A") {
"B" -> foo()
else -> null
}
foo()
return if (x == null) "OK" else "Fail"
}