Update bytecode text tests for JVM_IR
This commit is contained in:
+8
-9
@@ -1,13 +1,12 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
enum class A { V }
|
||||
enum class A { V1, V2, V3 }
|
||||
|
||||
fun box(): String {
|
||||
val a: A = A.V
|
||||
val b: Boolean
|
||||
when (a) {
|
||||
A.V -> b = true
|
||||
}
|
||||
return if (b) "OK" else "FAIL"
|
||||
fun test(a: A) {
|
||||
val x: Int
|
||||
when (a) {
|
||||
A.V1 -> x = 11
|
||||
A.V2 -> x = 22
|
||||
A.V3 -> x = 33
|
||||
}
|
||||
}
|
||||
|
||||
// 1 TABLESWITCH
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
enum class A { V }
|
||||
//- IGNORE_BACKEND: JVM_IR
|
||||
enum class A { V1, V2, V3 }
|
||||
|
||||
fun box(): String {
|
||||
val a: A = A.V
|
||||
fun box(a: A): String {
|
||||
when (a) {
|
||||
A.V -> return "OK"
|
||||
A.V1 -> return "V1"
|
||||
A.V2 -> return "V2"
|
||||
A.V3 -> return "V3"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36840 Don't generate 'throw' clause for statement 'when' in JVM_IR
|
||||
|
||||
enum class AccessMode { READ, WRITE, EXECUTE }
|
||||
|
||||
fun whenExpr(access: AccessMode) {
|
||||
@@ -9,11 +11,6 @@ fun whenExpr(access: AccessMode) {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
whenExpr(AccessMode.EXECUTE)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// 1 TABLESWITCH
|
||||
// 0 LOOKUPSWITCH
|
||||
// 0 ATHROW
|
||||
|
||||
+10
-2
@@ -1,6 +1,9 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun foo1(x: Int): Boolean {
|
||||
when(x) {
|
||||
0 -> return true
|
||||
1 -> return false
|
||||
2 -> return true
|
||||
3 -> return false
|
||||
2 + 2 -> return true
|
||||
else -> return false
|
||||
}
|
||||
@@ -8,9 +11,14 @@ fun foo1(x: Int): Boolean {
|
||||
|
||||
fun foo2(x: Int): Boolean {
|
||||
when(x) {
|
||||
0 -> return true
|
||||
1 -> return false
|
||||
2 -> return true
|
||||
3 -> return false
|
||||
Integer.MAX_VALUE -> return true
|
||||
else -> return false
|
||||
}
|
||||
}
|
||||
|
||||
// 2 TABLESWITCH
|
||||
// 1 TABLESWITCH
|
||||
// 1 LOOKUPSWITCH
|
||||
|
||||
+11
-18
@@ -1,27 +1,20 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: C.kt
|
||||
class CInt(val value: Int)
|
||||
val nCInt3: CInt? = CInt(3)
|
||||
// TODO KT-36646 Don't box primitive values in equality comparison with objects in JVM_IR
|
||||
|
||||
class CLong(val value: Long)
|
||||
val nCLong3: CLong? = CLong(3)
|
||||
|
||||
// FILE: test.kt
|
||||
fun testInt(i: Int?) =
|
||||
when (i) {
|
||||
0 -> "zero"
|
||||
42 -> "magic"
|
||||
else -> "other"
|
||||
}
|
||||
when (i) {
|
||||
0 -> "zero"
|
||||
42 -> "magic"
|
||||
else -> "other"
|
||||
}
|
||||
|
||||
fun testLong(i: Long?) =
|
||||
when (i) {
|
||||
0L -> "zero"
|
||||
42L -> "magic"
|
||||
else -> "other"
|
||||
}
|
||||
when (i) {
|
||||
0L -> "zero"
|
||||
42L -> "magic"
|
||||
else -> "other"
|
||||
}
|
||||
|
||||
// @TestKt.class:
|
||||
// 0 valueOf
|
||||
// 0 Integer.valueOf
|
||||
// 0 Long.valueOf
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36841 Generate integer comparison with 0 instructions (IFNE, etc) when comparing integers with 0 in JVM_IR
|
||||
|
||||
fun test(a: Int, b: Int, c: Int) {
|
||||
when (0) {
|
||||
a -> throw IllegalArgumentException("a is 0")
|
||||
|
||||
Reference in New Issue
Block a user