[FIR] Support for constructor calls of unsigned types in constants

This commit is contained in:
Andrey Zinovyev
2021-05-21 14:53:34 +03:00
committed by TeamCityServer
parent f9eba6e842
commit 7f2eaab02b
9 changed files with 43 additions and 12 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
// WITH_RUNTIME
// WITH_STDLIB
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT
// TARGET_BACKEND: JVM
@@ -7,21 +6,21 @@ annotation class AnnoUS(val us: UShortArray)
annotation class AnnoUI(val ui: UIntArray)
annotation class AnnoUL(val ul: ULongArray)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val ub0 = UByte(1)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val us0 = UShort(2)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val ul0 = ULong(3)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val ui0 = UInt(-1)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val ui1 = UInt(0)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
const val ui2 = UInt(40 + 2)
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
object Foo {
@AnnoUB([UByte(1), ub0])
fun f0() {}
@@ -41,7 +40,7 @@ fun <T> check(ann: Annotation, f: T.() -> Boolean) {
if (!result) throw RuntimeException("fail for $ann")
}
@Suppress("INVISIBLE_MEMBER")
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
fun box(): String {
if (ub0.toByte() != 1.toByte()) return "fail"
if (us0.toShort() != 2.toShort()) return "fail"
@@ -1,11 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT
// TARGET_BACKEND: JVM
// TODO: it's not clear why compilation fails for Android
// IGNORE_BACKEND: ANDROID
@file:Suppress("INVISIBLE_MEMBER")
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
annotation class AnnoUB(val ub0: UByte, val ub1: UByte)
annotation class AnnoUS(val us0: UShort, val us1: UShort)