Support other kinds of translation for unsigned literals
This commit is contained in:
committed by
Ilya Gorbunov
parent
d1df5f5783
commit
d94b47bcd3
@@ -1,15 +1,16 @@
|
||||
// WITH_UNSIGNED
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
|
||||
fun box(): String {
|
||||
val good = 42.toUInt()
|
||||
val u1 = 1u
|
||||
val u2 = 2u
|
||||
val u3 = u1 + u2
|
||||
// if (u3.toInt() != 3) return "fail"
|
||||
//
|
||||
// val max = 0u.dec().toLong()
|
||||
// val expected = Int.MAX_VALUE * 2L + 1
|
||||
// if (max != expected) return "fail"
|
||||
if (u3.toInt() != 3) return "fail"
|
||||
|
||||
val max = 0u.dec().toLong()
|
||||
val expected = Int.MAX_VALUE * 2L + 1
|
||||
if (max != expected) return "fail"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_UNSIGNED
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
|
||||
fun box(): String {
|
||||
val maxULong = 0xFFFF_FFFF_FFFF_FFFFuL
|
||||
val zero = 0uL
|
||||
if (zero >= maxULong) return "Fail"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_UNSIGNED
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
|
||||
fun box(): String {
|
||||
val u1: UByte = 255u
|
||||
|
||||
Reference in New Issue
Block a user