KT-15871 Unnecessary boxing for equality operator on inlined primitive values
Allow kotlin.jvm.internal.Intrinsics#areEqual for boxed values. Rewrite to primitive equality. NB we can't do that for Float and Double, because java.lang.Float#equals and java.lang.Double#equals behave differently from primitive equality comparisons.
This commit is contained in:
+6
-1
@@ -2,6 +2,9 @@
|
||||
fun box(): String {
|
||||
val plusZero: Double? = 0.0
|
||||
val minusZero: Double = -0.0
|
||||
|
||||
useBoxed(plusZero)
|
||||
|
||||
if (plusZero?.equals(minusZero) ?: null!!) {
|
||||
return "fail 1"
|
||||
}
|
||||
@@ -11,4 +14,6 @@ fun box(): String {
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun useBoxed(a: Any?) {}
|
||||
Reference in New Issue
Block a user