[IR] Add new test to check that nullable access to enum is not evaluated
Just a safety check. If an expression like `EnumClass.Value?.name` was evaluated, we would consider it as breaking change.
This commit is contained in:
+6
@@ -28873,6 +28873,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -28873,6 +28873,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JS_IR
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// WITH_STDLIB
|
||||
fun <T> T.id() = this
|
||||
|
||||
enum class EnumClass {
|
||||
OK
|
||||
}
|
||||
|
||||
val shouldNotBeEvaluated1 = EnumClass.OK?.name ?: ""
|
||||
val shouldNotBeEvaluated2 = EnumClass.OK?.name?.toString()
|
||||
val shouldNotBeEvaluated3 = EnumClass.OK?.name.toString()
|
||||
|
||||
fun box(): String {
|
||||
if (shouldNotBeEvaluated1 != "OK") return "Fail 1"
|
||||
if (shouldNotBeEvaluated2 != "OK") return "Fail 2"
|
||||
if (shouldNotBeEvaluated3 != "OK") return "Fail 3"
|
||||
return shouldNotBeEvaluated1.id()
|
||||
}
|
||||
+6
@@ -28873,6 +28873,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -28873,6 +28873,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+5
@@ -24375,6 +24375,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/serialization")
|
||||
|
||||
+6
@@ -21397,6 +21397,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -21397,6 +21397,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -21397,6 +21397,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24222,6 +24222,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24698,6 +24698,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -23985,6 +23985,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -24223,6 +24223,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
public void testKt58717() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullableEnumName.kt")
|
||||
public void testNullableEnumName() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/nullableEnumName.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user