Get rid of redundant boxing of unsigned operands of infix 'compareTo'

^KT-48759: Fixed
This commit is contained in:
Vladislav Grechko
2022-12-01 22:44:13 +01:00
committed by teamcity
parent 7423b35741
commit cb93e9d408
4 changed files with 48 additions and 13 deletions
@@ -0,0 +1,16 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM_IR
fun compareUInts(a: UInt, b: UInt) = a compareTo b
fun compareULongs(a: ULong, b: ULong) = a compareTo b
fun box(): String {
if (compareUInts(0u, 1u) != -1) return "Fail 1"
if (compareULongs(0u, 1u) != -1) return "Fail 2"
return "OK"
}
// CHECK_BYTECODE_TEXT
// 0 INVOKESTATIC kotlin/ULong.box-impl
// 0 INVOKESTATIC kotlin/UInt.box-impl