mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
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
13 lines
168 B
Kotlin
Vendored
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"
|
|
}
|