mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 15:53:46 +00:00
comparisons. Having those conversions leads to unnecesary boxing and null checks. This change does it only for JVM in the optimization lowering. It is unclear to me if the other backends can get away with something similar.
26 lines
650 B
Kotlin
Vendored
26 lines
650 B
Kotlin
Vendored
fun testBoolean1(a: Boolean, b: Boolean?) = a == b
|
|
fun testBoolean2(a: Boolean, b: Boolean?) = a != b
|
|
|
|
fun testChar1(a: Char, b: Char?) = a == b
|
|
fun testChar2(a: Char, b: Char?) = a != b
|
|
|
|
fun testByte1(a: Byte, b: Byte?) = a == b
|
|
fun testByte2(a: Byte, b: Byte?) = a != b
|
|
|
|
fun testShort1(a: Short, b: Short?) = a == b
|
|
fun testShort2(a: Short, b: Short?) = a != b
|
|
|
|
fun testInt1(a: Int, b: Int?) = a == b
|
|
fun testInt2(a: Int, b: Int?) = a != b
|
|
|
|
fun testLong1(a: Long, b: Long?) = a == b
|
|
fun testLong2(a: Long, b: Long?) = a != b
|
|
|
|
// 2 charValue
|
|
// 2 byteValue
|
|
// 2 shortValue
|
|
// 2 intValue
|
|
// 2 longValue
|
|
// 2 valueOf
|
|
// 2 Boolean.valueOf
|
|
// 2 areEqual |