JVM_IR: Rewrite '?.' and '?:' chains

This shortens code and avoids unnecessary boxing in some cases.
This commit is contained in:
Dmitry Petrov
2020-03-24 19:55:42 +03:00
parent 1d305d56b9
commit 9a95941ef3
4 changed files with 333 additions and 4 deletions
@@ -1,6 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36651 Avoid boxing in safe call / elvis chains in JVM_IR
class A(val x : Int, val y : A?)
fun check(a : A?) : Int {
@@ -9,4 +6,9 @@ fun check(a : A?) : Int {
// 0 valueOf
// 0 Value\s\(\)
// JVM_TEMPLATES:
// 0 ACONST_NULL
// JVM_IR_TEMPLATES:
// 1 ACONST_NULL