Files
kotlin/compiler/testData/codegen/box/smartCasts/whenSmartCast.kt
2019-11-19 11:00:09 +03:00

11 lines
247 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
fun baz(s: String?): Int {
if (s == null) return 0
return when(s) {
"abc" -> s
else -> "xyz"
}.length
}
fun box() = if (baz("abc") == 3 && baz("") == 3 && baz(null) == 0) "OK" else "FAIL"