Support proper frame maps for enum valueOf
This commit is contained in:
@@ -84,6 +84,7 @@ private fun createSpecialEnumMethodBody(
|
|||||||
Opcodes.INVOKESTATIC, ENUM_TYPE.internalName, "valueOf",
|
Opcodes.INVOKESTATIC, ENUM_TYPE.internalName, "valueOf",
|
||||||
Type.getMethodDescriptor(ENUM_TYPE, JAVA_CLASS_TYPE, JAVA_STRING_TYPE), false
|
Type.getMethodDescriptor(ENUM_TYPE, JAVA_CLASS_TYPE, JAVA_STRING_TYPE), false
|
||||||
)
|
)
|
||||||
|
node.visitTypeInsn(Opcodes.CHECKCAST, ENUM_TYPE.internalName)
|
||||||
} else {
|
} else {
|
||||||
node.visitInsn(Opcodes.ICONST_0)
|
node.visitInsn(Opcodes.ICONST_0)
|
||||||
node.visitTypeInsn(Opcodes.ANEWARRAY, ENUM_TYPE.internalName)
|
node.visitTypeInsn(Opcodes.ANEWARRAY, ENUM_TYPE.internalName)
|
||||||
|
|||||||
+5
@@ -3193,6 +3193,11 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
+5
@@ -3193,6 +3193,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
Generated
+5
@@ -3193,6 +3193,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
Generated
+5
@@ -3193,6 +3193,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
+5
@@ -3193,6 +3193,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
Generated
+5
@@ -3193,6 +3193,11 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
Generated
+5
@@ -3193,6 +3193,11 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt6988.kt")
|
@TestMetadata("kt6988.kt")
|
||||||
public void testKt6988() throws Exception {
|
public void testKt6988() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt6988.kt");
|
||||||
|
|||||||
+5
@@ -2908,6 +2908,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt7017.kt")
|
@TestMetadata("kt7017.kt")
|
||||||
public void testKt7017() throws Exception {
|
public void testKt7017() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
||||||
|
|||||||
Generated
+5
@@ -2908,6 +2908,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt7017.kt")
|
@TestMetadata("kt7017.kt")
|
||||||
public void testKt7017() throws Exception {
|
public void testKt7017() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
||||||
|
|||||||
Generated
+5
@@ -2908,6 +2908,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_valueOf.kt")
|
||||||
|
public void testKt35511_try_valueOf() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt7017.kt")
|
@TestMetadata("kt7017.kt")
|
||||||
public void testKt7017() throws Exception {
|
public void testKt7017() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt7017.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user