Support other kinds of translation for unsigned literals

This commit is contained in:
Mikhail Zarechenskiy
2018-07-20 17:28:00 +03:00
committed by Ilya Gorbunov
parent d1df5f5783
commit d94b47bcd3
10 changed files with 94 additions and 18 deletions
@@ -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"
}
@@ -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,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