Files
kotlin/compiler/testData/codegen/bytecodeText/boxingOptimization/safeCallWithElvis.kt
Dmitry Petrov 9a95941ef3 JVM_IR: Rewrite '?.' and '?:' chains
This shortens code and avoids unnecessary boxing in some cases.
2020-03-26 12:19:25 +03:00

15 lines
202 B
Kotlin
Vendored

class A(val x : Int, val y : A?)
fun check(a : A?) : Int {
return a?.y?.x ?: (a?.x ?: 3)
}
// 0 valueOf
// 0 Value\s\(\)
// JVM_TEMPLATES:
// 0 ACONST_NULL
// JVM_IR_TEMPLATES:
// 1 ACONST_NULL