Files
kotlin/compiler/testData/codegen/box/nullCheckOptimization/trivialInstanceOf.kt
2018-06-14 19:54:30 +03: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"
}