FIR2IR fix enum special methods generation
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: E.java
|
||||
public enum E {
|
||||
OK();
|
||||
public static String valueOf(E x) {
|
||||
return x.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
// check that both 'valueOf(String): E' and 'valueOf(E): String' are invoked correctly
|
||||
fun box() =
|
||||
E.valueOf(E.valueOf("OK"))
|
||||
@@ -1,8 +1,4 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FIR status: V
|
||||
// Caused by: java.util.NoSuchElementException: Sequence contains no element matching the predicate.
|
||||
// at org.jetbrains.kotlin.backend.jvm.lower.MappedEnumWhenLowering.visitClassNew(MappedEnumWhenLowering.kt:232)
|
||||
// FILE: E.java
|
||||
public enum E {
|
||||
A();
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: E.java
|
||||
public enum E {
|
||||
A();
|
||||
public static String values(String s) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun f(e: E) = when (e) {
|
||||
E.A -> E.values("OK")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return f(E.A)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: E.java
|
||||
public enum E {
|
||||
OK(), A();
|
||||
public static void values(boolean b) {}
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun f(e: E) = when (e) {
|
||||
E.A -> E.values()[0].toString()
|
||||
else -> "?"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return f(E.A)
|
||||
}
|
||||
Reference in New Issue
Block a user