Files
kotlin-fork/compiler/testData/codegen/bytecodeText/nullCheckOptimization/noNullCheckAfterCast.kt
T
Dmitry Petrov 4ad6cfcf53 JVM_IR fix cast to not-null type
We can't rely on argument type nullability here, because it still can
hold an uninitialized value on JVM.

KT-50577 KT-35272 KT-27427
2021-12-30 13:41:17 +03:00

30 lines
283 B
Kotlin
Vendored

// KT-27427
interface A {
fun foo()
}
class B : A {
override fun foo() {
}
}
fun test1() {
val b = B()
(b as A).foo()
}
fun test2() {
val b = getB()
(b as A).foo()
}
fun test3() {
val b = getB()
b.foo()
}
fun getB(): B = B()
// 1 IFNONNULL