KT-43286 use JVM 1.8 intrinsics for coercible unsigned values only

This commit is contained in:
Dmitry Petrov
2020-11-25 12:56:47 +03:00
parent 498047e64e
commit f6abc5c3cf
11 changed files with 140 additions and 18 deletions
+26
View File
@@ -0,0 +1,26 @@
// JVM_TARGET: 1.8
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
class D(val x: UInt?)
class E(val x: Any)
fun f(d: D): String {
return d.x?.let { d.x.toString() } ?: ""
}
fun g(e: E): String {
if (e.x is UInt) return e.x.toString()
return ""
}
fun box(): String {
val test1 = f(D(42u))
if (test1 != "42") throw Exception(test1)
val test2 = g(E(42u))
if (test2 != "42") throw Exception(test2)
return "OK"
}
@@ -0,0 +1,8 @@
// JVM_TARGET: 1.8
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun box(): String {
val x = 3UL % 2U
return if (x == 1UL) "OK" else "Fail: $x"
}