Support proper frame maps for enumValues
This commit is contained in:
@@ -14,7 +14,6 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
public class AsmTypes {
|
public class AsmTypes {
|
||||||
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();
|
private static final Map<Class<?>, Type> TYPES_MAP = new HashMap<>();
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ private fun createSpecialEnumMethodBody(
|
|||||||
} 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)
|
||||||
|
node.visitTypeInsn(Opcodes.CHECKCAST, AsmUtil.getArrayType(ENUM_TYPE).internalName)
|
||||||
}
|
}
|
||||||
node.visitInsn(Opcodes.ARETURN)
|
node.visitInsn(Opcodes.ARETURN)
|
||||||
node.visitMaxs(if (isValueOf) 3 else 2, if (isValueOf) 1 else 0)
|
node.visitMaxs(if (isValueOf) 3 else 2, if (isValueOf) 1 else 0)
|
||||||
|
|||||||
+5
@@ -3198,6 +3198,11 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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,46 @@
|
|||||||
|
// 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 foo(base: Array<out Enum<*>>) {
|
||||||
|
result = base[0].name
|
||||||
|
}
|
||||||
|
|
||||||
|
fun cond() = true
|
||||||
|
|
||||||
|
inline fun <reified T : Enum<T>, reified Y : Enum<Y>> process(a: String) {
|
||||||
|
val z = try {
|
||||||
|
enumValues<T>()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
enumValues<Y>()
|
||||||
|
}
|
||||||
|
|
||||||
|
foo(z)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
process<Base, Base2>("OK")
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
+5
@@ -3198,6 +3198,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -3198,6 +3198,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -3198,6 +3198,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -3198,6 +3198,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -3198,6 +3198,11 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -3198,6 +3198,11 @@ public class JvmOldAgainstIrBoxInlineTestGenerated extends AbstractJvmOldAgainst
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -2913,6 +2913,11 @@ public class IrJsCodegenInlineES6TestGenerated extends AbstractIrJsCodegenInline
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -2913,6 +2913,11 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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
@@ -2913,6 +2913,11 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest {
|
|||||||
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_valueOf.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35511_try_values.kt")
|
||||||
|
public void testKt35511_try_values() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/reified/kt35511_try_values.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