Files
kotlin/compiler/testData/codegen/box/nullCheckOptimization/trivialInstanceOf.kt
2019-11-29 13:49:13 +01:00

17 lines
258 B
Kotlin
Vendored

sealed class A {
class B : A()
class C : A()
}
inline fun foo(): A = A.B()
fun box(): String {
val a: A = foo()
val b: Boolean
when (a) {
is A.B -> b = true
is A.C -> b = false
}
return if (b) "OK" else "FAIL"
}