Support proper frame maps for enum valueOf

This commit is contained in:
Mikhael Bogdanov
2021-01-27 12:16:08 +01:00
parent 5b64ceceb3
commit 1a044e5af4
12 changed files with 93 additions and 0 deletions
@@ -0,0 +1,42 @@
// JVM_TARGET: 1.8
// FILE: 1.kt
// WITH_RUNTIME
package test
enum class Base(val value: String) {
OK("OK"),
B("FAIL");
}
enum class Base2(val value: String) {
A("OK2"),
B("FAIL2");
}
var result = "fail"
fun foo(base: Enum<*>) {
result = base.name
}
fun cond() = true
inline fun <reified T : Enum<T>, reified Y : Enum<Y>> process(name: String) {
val z = try {
enumValueOf<T>(name)
} catch (e: Exception) {
enumValueOf<Y>(name)
}
foo(z)
}
// FILE: 2.kt
import test.*
fun box(): String {
process<Base, Base2>("OK")
return result
}