Files
kotlin-fork/compiler/testData/codegen/box/checkcastOptimization/kt50215.kt
T
2021-12-13 20:34:57 +03:00

20 lines
258 B
Kotlin
Vendored

// WITH_RUNTIME
class A {
fun foo(x: Int = 32) = "OK"
}
var result = "failed"
fun whoops(x: Any) {
when (x) {
is A -> result = x.foo()
else -> throw AssertionError()
}
}
fun box(): String {
whoops(A())
return result
}