KT-27948: Properly coerce values when generating areEqual call
#KT-27948
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: +InlineClasses
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
inline class Z(val x: Int)
|
||||
inline class NZ1(val nz: Z?)
|
||||
inline class NZ2(val nz: NZ1)
|
||||
|
||||
fun box(): String {
|
||||
if (NZ2(NZ1(null)) != NZ2(NZ1(null))) throw AssertionError()
|
||||
if (NZ2(NZ1(Z(1))) != NZ2(NZ1(Z(1)))) throw AssertionError()
|
||||
if (NZ2(NZ1(null)) == NZ2(NZ1(Z(1)))) throw AssertionError()
|
||||
if (NZ2(NZ1(Z(1))) == NZ2(NZ1(null))) throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// WITH_UNSIGNED
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun isZeroUInt(n: UInt?) = 0U == n
|
||||
fun isZeroULong(n: ULong?) = 0UL == n
|
||||
|
||||
fun box(): String {
|
||||
if (isZeroUInt(null)) throw AssertionError()
|
||||
if (isZeroUInt(1U)) throw AssertionError()
|
||||
if (!isZeroUInt(0U)) throw AssertionError()
|
||||
|
||||
if (isZeroULong(null)) throw AssertionError()
|
||||
if (isZeroULong(1UL)) throw AssertionError()
|
||||
if (!isZeroULong(0UL)) throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// WITH_UNSIGNED
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
fun isZeroUInt(n: UInt?) = n == 0U
|
||||
fun isZeroULong(n: ULong?) = n == 0UL
|
||||
|
||||
fun box(): String {
|
||||
if (isZeroUInt(null)) throw AssertionError()
|
||||
if (isZeroUInt(1U)) throw AssertionError()
|
||||
if (!isZeroUInt(0U)) throw AssertionError()
|
||||
|
||||
if (isZeroULong(null)) throw AssertionError()
|
||||
if (isZeroULong(1UL)) throw AssertionError()
|
||||
if (!isZeroULong(0UL)) throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user