[IR] Add test to specify new logic of enum initialization with name call
#KT-58948 #KT-57538
This commit is contained in:
+6
@@ -28504,6 +28504,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumNameWithInit.kt")
|
||||
public void testEnumNameWithInit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("equals_after.kt")
|
||||
public void testEquals_after() throws Exception {
|
||||
|
||||
+6
@@ -28504,6 +28504,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumNameWithInit.kt")
|
||||
public void testEnumNameWithInit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("equals_after.kt")
|
||||
public void testEquals_after() throws Exception {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +IntrinsicConstEvaluation
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
fun <T> T.id() = this
|
||||
|
||||
var result = "OK"
|
||||
|
||||
enum class EnumClass {
|
||||
OK;
|
||||
|
||||
init {
|
||||
result = "Fail"
|
||||
}
|
||||
}
|
||||
|
||||
// STOP_EVALUATION_CHECKS
|
||||
fun box(): String {
|
||||
if (EnumClass.OK.name.id() != "OK") return "Fail 1"
|
||||
return result
|
||||
}
|
||||
+6
@@ -28504,6 +28504,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumNameWithInit.kt")
|
||||
public void testEnumNameWithInit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("equals_after.kt")
|
||||
public void testEquals_after() throws Exception {
|
||||
|
||||
+6
@@ -28504,6 +28504,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumNameWithInit.kt")
|
||||
public void testEnumNameWithInit() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("equals_after.kt")
|
||||
public void testEquals_after() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user