Files
kotlin-fork/compiler/testData/codegen/bytecodeText/nullCheckOptimization/noNullCheckAfterCast.kt
T
Alexander Udalov 5480faf5c5 Add tests for issues fixed in JVM IR and other obsolete issues
#KT-6007
 #KT-16445
 #KT-17753
 #KT-22488
 #KT-23881
 #KT-24135
 #KT-26360
 #KT-27427
 #KT-27449
 #KT-27830
 #KT-28042
 #KT-29595
 #KT-30708
 #KT-32793
2021-02-01 18:29:59 +01:00

35 lines
387 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()
// JVM_TEMPLATES
// 1 IFNONNULL
// There should be no null checks in the bytecode.
// JVM_IR_TEMPLATES
// 0 IFNONNULL