JVM_IR: Fix null-constant comparison with primitive types.

This commit is contained in:
Kristoffer Andersen
2019-09-05 11:25:17 +02:00
committed by max-kammerer
parent e21da3a61a
commit e7d0909979
10 changed files with 122 additions and 44 deletions
@@ -0,0 +1,20 @@
fun f(): Boolean = "non-primitive" == null
fun g(): Boolean = null == "non-primitive"
fun h(): Boolean = "non-primitive".equals(null)
//fun i(): Boolean = null.equals("non-primitive")
//See KT-33757
// JVM does not optimize h() to constant false
// 0 IF
// JVM_TEMPLATES
// 2 ICONST_0
// 1 ACONST_NULL
// 1 INVOKEVIRTUAL
// JVM_IR_TEMPLATES
// 0 ACONST_NULL
// 0 INVOKESTATIC
// 0 INVOKEVIRTUAL
// 3 ICONST_0