Update bytecode text tests for JVM_IR
This commit is contained in:
+10
-16
@@ -1,23 +1,20 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36845 Generate enum-based TABLESWITCH/LOOKUPSWITCH on a value with smart cast to enum in JVM_IR
|
||||
|
||||
enum class En { A, B, С }
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var res1 = "fail"
|
||||
var res2 = "fail2"
|
||||
fun box() {
|
||||
var r = ""
|
||||
|
||||
val en: En = En.A
|
||||
when (en) {
|
||||
En.A -> {res1 = ""}
|
||||
En.A -> { r = "when-1" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
|
||||
when (en as En) {
|
||||
En.A -> {res1 += "O"}
|
||||
En.A -> { r = "when-2" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
@@ -27,13 +24,13 @@ fun box(): String {
|
||||
val en2: Any? = En.A
|
||||
if (en2 is En) {
|
||||
when (en2) {
|
||||
En.A -> {res1 += "K"}
|
||||
En.A -> { r = "when-3" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
|
||||
when (en2 as En) {
|
||||
En.A -> {res2 = ""}
|
||||
En.A -> { r = "when-4" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
@@ -44,20 +41,17 @@ fun box(): String {
|
||||
val en1: Any = En.A
|
||||
if (en1 is En) {
|
||||
when (en1) {
|
||||
En.A -> {res2 += "O"}
|
||||
En.A -> { r = "when-5" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
// Working without other examples
|
||||
when (en1 as En) {
|
||||
En.A -> {res2 += "K"}
|
||||
En.A -> { r = "when-6" }
|
||||
En.B -> {}
|
||||
En.С -> {}
|
||||
}
|
||||
}
|
||||
|
||||
if (res1 != res2) return "different results: $res1 != $res2"
|
||||
return res1
|
||||
}
|
||||
|
||||
// 6 TABLESWITCH
|
||||
@@ -1,4 +1,6 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36845 Generate enum-based TABLESWITCH/LOOKUPSWITCH on a value with smart cast to enum in JVM_IR
|
||||
|
||||
class EncapsulatedEnum<T : Enum<T>>(val value: T)
|
||||
|
||||
enum class MyEnum(val value: String) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TODO KT-36845 Generate enum-based TABLESWITCH/LOOKUPSWITCH on a value with smart cast to enum in JVM_IR
|
||||
|
||||
private fun Any?.doTheThing(): String {
|
||||
when (this) {
|
||||
|
||||
Reference in New Issue
Block a user