[FIR] Fix evaluation of Java properties for Char and String types

#KT-57802
This commit is contained in:
Ivan Kylchik
2023-06-26 18:28:49 +02:00
committed by Space Team
parent bf6f241d4a
commit 8c7c44f9f5
24 changed files with 459 additions and 125 deletions
@@ -568,7 +568,14 @@ class Fir2IrConverter(
val irProperty = components.declarationStorage.getCachedIrProperty(this, fakeOverrideOwnerLookupTag = null) ?: return null
fun IrProperty.tryToGetConst(): IrConst<*>? = (backingField?.initializer?.expression as? IrConst<*>)
irProperty.tryToGetConst()?.let { return it.value.toString() }
fun IrConst<*>.asString(): String {
return when (val constVal = value) {
is Char -> constVal.code.toString()
is String -> "\"$constVal\""
else -> constVal.toString()
}
}
irProperty.tryToGetConst()?.let { return it.asString() }
val irFile = irProperty.fileOrNull ?: return null
// Note: can't evaluate all expressions in given file, because we can accidentally get recursive processing and
@@ -579,7 +586,7 @@ class Fir2IrConverter(
inlineConstTracker = components.configuration.inlineConstTracker,
)
return (evaluated as? IrProperty)?.tryToGetConst()?.value?.toString()
return (evaluated as? IrProperty)?.tryToGetConst()?.asString()
}
// TODO: drop this function in favor of using [IrModuleDescriptor::shouldSeeInternalsOf] in FakeOverrideBuilder KT-61384
@@ -29066,12 +29066,6 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -29173,18 +29167,6 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
@@ -29263,6 +29245,46 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessComplexConst.kt")
public void testAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -29066,12 +29066,6 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -29173,18 +29167,6 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
@@ -29263,6 +29245,46 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessComplexConst.kt")
public void testAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -29066,12 +29066,6 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -29173,18 +29167,6 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
@@ -29263,6 +29245,46 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessComplexConst.kt")
public void testAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -185,6 +185,8 @@ class FirJavaElementFinder(
override fun getType(): TypeInfo {
val coneClassLikeType = firProperty.returnTypeRef.coneTypeUnsafe<ConeClassLikeType>()
if (coneClassLikeType.isString) return TypeInfo.fromString(CommonClassNames.JAVA_LANG_STRING)
val classId = coneClassLikeType.lookupTag.classId
val typeInfo = classId.relativeClassName.asString().toLowerCaseAsciiOnly()
return TypeInfo.fromString(typeInfo)
@@ -0,0 +1,21 @@
// !LANGUAGE: +IntrinsicConstEvaluation
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K1: JVM_IR
// WITH_STDLIB
// FILE: Bar.java
package one.two;
public class Bar {
public static final String BAR = MainKt.FOO + " JavaString";
}
// FILE: Main.kt
package one.two
const val FOO = "123".<!EVALUATED("123")!>trimIndent()<!>
const val BAZ = <!EVALUATED("123 JavaString KotlinString")!>Bar.BAR + " KotlinString"<!>
fun box(): String {
return "OK"
}
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
// FILE: Bar.java
package one.two;
@@ -0,0 +1,39 @@
// TARGET_BACKEND: JVM
// FILE: Bar.java
public class Bar {
public static final char CHAR = MainKt.CHAR + 1;
public static final boolean BOOL = !MainKt.BOOL;
public static final byte BYTE = MainKt.BYTE + 1;
public static final short SHORT = MainKt.SHORT + 1;
public static final int INT = MainKt.INT + 1;
public static final long LONG = MainKt.LONG + 1L;
public static final float FLOAT = MainKt.FLOAT + 1.0f;
public static final double DOUBLE = MainKt.DOUBLE + 1.0;
public static final String STRING = MainKt.STRING + "3";
}
// FILE: Main.kt
const val CHAR: Char = <!EVALUATED("2")!>'1' + 1<!>
const val BOOL: Boolean = <!EVALUATED("true")!>true<!>
const val BYTE: Byte = (1.toByte() + 1).<!EVALUATED("2")!>toByte()<!>
const val SHORT: Short = (1.toShort() + 1).<!EVALUATED("2")!>toShort()<!>
const val INT: Int = <!EVALUATED("2")!>1 + 1<!>
const val LONG: Long = <!EVALUATED("2")!>1L + 1L<!>
const val FLOAT: Float = <!EVALUATED("2.0")!>1.5f + .5f<!>
const val DOUBLE: Double = <!EVALUATED("2.0")!>1.5 + 0.5<!>
const val STRING: String = <!EVALUATED("12")!>"1" + "2"<!>
// FILE: usages.kt
const val CHAR_JAVA: Char = <!EVALUATED("4")!>Bar.CHAR + 1<!>
const val BOOL_JAVA: Boolean = Bar.<!EVALUATED("false")!>BOOL<!>
const val BYTE_JAVA: Byte = (Bar.BYTE + 1).<!EVALUATED("4")!>toByte()<!>
const val SHORT_JAVA: Short = (Bar.SHORT + 1).<!EVALUATED("4")!>toShort()<!>
const val INT_JAVA: Int = <!EVALUATED("4")!>Bar.INT + 1<!>
const val LONG_JAVA: Long = <!EVALUATED("4")!>Bar.LONG + 1L<!>
const val FLOAT_JAVA: Float = <!EVALUATED("4.0")!>Bar.FLOAT + 1.0f<!>
const val DOUBLE_JAVA: Double = <!EVALUATED("4.0")!>Bar.DOUBLE + 1.0<!>
const val STRING_JAVA: String = <!EVALUATED("1234")!>Bar.STRING + "4"<!>
fun box(): String {
return "OK"
}
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
// FILE: Bar.java
package one.two;
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_LIGHT_ANALYSIS
// FILE: Bar.java
package one.two;
@@ -27794,12 +27794,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
@@ -27829,24 +27823,46 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57028.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt58005.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -29066,12 +29066,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -29173,18 +29167,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
@@ -29263,6 +29245,46 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessComplexConst.kt")
public void testAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -29066,12 +29066,6 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter")
@TestDataPath("$PROJECT_ROOT")
public class InvolvesIrInterpreter {
@Test
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
@Test
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
@@ -29173,18 +29167,6 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@Test
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
@@ -29263,6 +29245,46 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
@TestMetadata("accessComplexConst.kt")
public void testAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
@Test
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@Test
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@Test
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24546,11 +24546,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
@TestMetadata("accessTopLevelConstFromJava.kt")
public void testAccessTopLevelConstFromJava() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/accessTopLevelConstFromJava.kt");
}
public void testAllFilesPresentInInvolvesIrInterpreter() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@@ -24630,16 +24625,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57313.kt");
}
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_1.kt");
}
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt57802_2.kt");
}
@TestMetadata("kt58005.kt")
public void testKt58005() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt58005.kt");
@@ -24705,6 +24690,44 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ConstEvaluationFromJavaWorld extends AbstractLightAnalysisModeTest {
@TestMetadata("accessComplexConst.kt")
public void ignoreAccessComplexConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessComplexConst.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
@TestMetadata("accessTopLevelConst.kt")
public void testAccessTopLevelConst() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/accessTopLevelConst.kt");
}
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/differentTypes.kt");
}
@TestMetadata("kt57802_1.kt")
public void testKt57802_1() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_1.kt");
}
@TestMetadata("kt57802_2.kt")
public void testKt57802_2() throws Exception {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld/kt57802_2.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -21631,6 +21631,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -21631,6 +21631,16 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -21631,6 +21631,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -21631,6 +21631,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24459,6 +24459,19 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
@Tag("frontend-fir")
@FirPipeline()
@UseExtTestCaseGroupProvider()
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24937,6 +24937,21 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
@Tag("frontend-fir")
@FirPipeline()
@UseExtTestCaseGroupProvider()
@UsePartialLinkage(mode = Mode.DISABLED)
@Tag("no-partial-linkage-may-be-skipped")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24221,6 +24221,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
@UseExtTestCaseGroupProvider()
@DisabledTestsIfProperty(sourceLocations = { "compiler/testData/codegen/box/coroutines/featureIntersection/defaultExpect.kt", "compiler/testData/codegen/box/multiplatform/defaultArguments/*.kt", "compiler/testData/codegen/box/multiplatform/migratedOldTests/*.kt", "compiler/testData/codegen/boxInline/multiplatform/defaultArguments/receiversAndParametersInLambda.kt" }, property = ClassLevelProperty.TEST_MODE, propertyValue = "ONE_STAGE_MULTI_MODULE")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -24460,6 +24460,19 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
@UseExtTestCaseGroupProvider()
@UsePartialLinkage(mode = Mode.DISABLED)
@Tag("no-partial-linkage-may-be-skipped")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -21535,6 +21535,16 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt56215.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")
@@ -21535,6 +21535,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/involvesIrInterpreter/kt56215.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld")
@TestDataPath("$PROJECT_ROOT")
public class ConstEvaluationFromJavaWorld {
@Test
public void testAllFilesPresentInConstEvaluationFromJavaWorld() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/constEvaluationFromJavaWorld"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst")
@TestDataPath("$PROJECT_ROOT")