JS: support unsigned constants inside string templates

This commit is contained in:
Anton Bannykh
2018-08-17 14:25:23 +03:00
committed by Ilya Gorbunov
parent 6103df0b31
commit 2663d9751a
3 changed files with 24 additions and 2 deletions
@@ -1,13 +1,18 @@
// WITH_UNSIGNED
// IGNORE_BACKEND: JVM_IR, JS_IR, JS
// IGNORE_BACKEND: JVM_IR, JS_IR
const val MAX_BYTE: UByte = 0xFFu
const val HUNDRED: UByte = 100u
const val MAX_LONG: ULong = ULong.MAX_VALUE
fun box(): String {
val maxByteStringSingle = "$MAX_BYTE"
if (maxByteStringSingle != MAX_BYTE.toString() || maxByteStringSingle != "255") return "Fail 1: $maxByteStringSingle"
val maxLongStringSingle = "$MAX_LONG"
if (maxLongStringSingle != MAX_LONG.toString() || maxLongStringSingle != "18446744073709551615") return "Fail 1.5: $maxLongStringSingle"
val twoHundredUByte = "${(HUNDRED * 2u).toUByte()}"
if (twoHundredUByte != "200") return "Fail 2: $twoHundredUByte"