diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt index bce143f297b..492ffbcd48d 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/JsLoweringPhases.kt @@ -26,6 +26,8 @@ import org.jetbrains.kotlin.ir.backend.js.lower.inline.* import org.jetbrains.kotlin.ir.backend.js.transformers.irToJs.JsGenerationGranularity import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.interpreter.IrInterpreterConfiguration +import org.jetbrains.kotlin.platform.js.JsPlatforms private fun DeclarationContainerLoweringPass.runOnFilesPostfix(files: Iterable) = files.forEach { runOnFilePostfix(it) } @@ -470,19 +472,6 @@ private val booleanPropertyInExternalLowering = makeBodyLoweringPhase( description = "Lowering which wrap boolean in external declarations with Boolean() call and add diagnostic for such cases" ) -private val foldConstantLoweringPhase = makeBodyLoweringPhase( - { FoldConstantLowering(it, true) }, - name = "FoldConstantLowering", - description = "[Optimization] Constant Folding", - prerequisite = setOf(propertyAccessorInlinerLoweringPhase) -) - -private val computeStringTrimPhase = makeJsModulePhase( - ::StringTrimLowering, - name = "StringTrimLowering", - description = "Compute trimIndent and trimMargin operations on constant strings" -).toModuleLowering() - private val localDelegatedPropertiesLoweringPhase = makeBodyLoweringPhase( { LocalDelegatedPropertiesLowering() }, name = "LocalDelegatedPropertiesLowering", @@ -846,6 +835,17 @@ private val jsSuspendArityStorePhase = makeDeclarationTransformerPhase( description = "Store arity for suspend functions to not remove it during DCE" ) +val constEvaluationPhase = makeJsModulePhase( + { + ConstEvaluationLowering( + it, + configuration = IrInterpreterConfiguration(printOnlyExceptionMessage = true, platform = JsPlatforms.defaultJsPlatform) + ) + }, + name = "ConstEvaluationLowering", + description = "Evaluate functions that are marked as `IntrinsicConstEvaluation`", +).toModuleLowering() + val loweringList = listOf( scriptRemoveReceiverLowering, validateIrBeforeLowering, @@ -868,6 +868,7 @@ val loweringList = listOf( wrapInlineDeclarationsWithReifiedTypeParametersLowering, saveInlineFunctionsBeforeInlining, functionInliningPhase, + constEvaluationPhase, copyInlineFunctionBodyLoweringPhase, removeInlineDeclarationsWithReifiedTypeParametersLoweringPhase, createScriptFunctionsPhase, @@ -917,8 +918,6 @@ val loweringList = listOf( propertyAccessorInlinerLoweringPhase, copyPropertyAccessorBodiesLoweringPass, booleanPropertyInExternalLowering, - foldConstantLoweringPhase, - computeStringTrimPhase, privateMembersLoweringPhase, privateMemberUsagesLoweringPhase, defaultArgumentStubGeneratorPhase, diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt index 632792a9b9f..11a474e5d36 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/CallInterceptor.kt @@ -172,10 +172,16 @@ internal class DefaultCallInterceptor(override val interpreter: IrInterpreter) : if (environment.configuration.platform.isJs()) { if (signature.name == "toString") return signature.args[0].value.specialToStringForJs() if (signature.name == "toFloat") signature.name = "toDouble" - signature.args.filter { it.type == "kotlin.Float" }.forEach { - it.type = "kotlin.Double" - it.value = it.value.toString().toDouble() - } + signature.args + .filter { it.value is Float || it.type == "kotlin.Float" || it.type == "kotlin.Float?" } + .forEach { + it.type = when (it.type) { + "kotlin.Float" -> "kotlin.Double" + "kotlin.Float?" -> "kotlin.Double?" + else -> it.type + } + it.value = it.value.toString().toDouble() + } } val name = signature.name diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt index 9e5938d1e7b..d7ce0faaa81 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/InstructionsUnfolder.kt @@ -234,6 +234,15 @@ private fun unfoldBody(body: IrBody, callStack: CallStack) { } private fun unfoldBlock(block: IrBlock, callStack: CallStack) { + if (block is IrReturnableBlock) { + val inlinedDeclaration = block.inlineFunction?.originalFunction?.let { it.property ?: it } + if (inlinedDeclaration != null && inlinedDeclaration.hasAnnotation(intrinsicConstEvaluationAnnotation)) { + val inlinedBlock = block.statements.single() as IrInlinedFunctionBlock + callStack.pushCompoundInstruction(inlinedBlock.inlineCall) + return + } + } + callStack.newSubFrame(block) callStack.pushSimpleInstruction(block) unfoldStatements(block.statements, callStack) diff --git a/compiler/testData/codegen/box/casts/asSafeForConstants.kt b/compiler/testData/codegen/box/casts/asSafeForConstants.kt index 33e0f25432f..be3fbff1dc4 100644 --- a/compiler/testData/codegen/box/casts/asSafeForConstants.kt +++ b/compiler/testData/codegen/box/casts/asSafeForConstants.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JS_IR_ES6 // TODO: muted automatically, investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/constants/doNotTriggerInit.kt b/compiler/testData/codegen/box/constants/doNotTriggerInit.kt index d66d11fb340..df4deed2f88 100644 --- a/compiler/testData/codegen/box/constants/doNotTriggerInit.kt +++ b/compiler/testData/codegen/box/constants/doNotTriggerInit.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND_K1: WASM -// IGNORE_BACKEND_K1: JS_IR, JS_IR_ES6 var initialized = 0 object O { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt index 2c3a92c2a6d..0dddf861da6 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_K1: JVM_IR +// TARGET_BACKEND: JS_IR +// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6 // WITH_STDLIB fun T.id() = this diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt index 218dddd8b9d..c44d7f3423e 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_K1: JVM_IR +// TARGET_BACKEND: JS_IR +// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6 // WITH_STDLIB fun T.id() = this diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt index 0e3536fb778..4ef7f5c2867 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumName.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_K1: JVM_IR +// TARGET_BACKEND: JS_IR +// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6 fun T.id() = this enum class EnumClass { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt index 70c333d1cc4..70efc56fd25 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/enumNameWithInit.kt @@ -1,5 +1,6 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR fun T.id() = this diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt index fb269d95cad..92a9b3b2989 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt @@ -1,5 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR + fun T.id() = this const val trueVal = true diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt index eed382697a7..121381aac00 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt @@ -1,6 +1,8 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_K1: JVM_IR +// TARGET_BACKEND: JS_IR +// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6 + fun T.id() = this class A(val OK: Int, val somePropertyWithLongName: String) { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt index f0abd4d85eb..803a3e0149e 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt @@ -1,15 +1,18 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR // WITH_STDLIB fun T.id() = this +fun someSideEffect(value: Any?) = {} + class A { val a = "" fun b() = "" init { - println("A init") + someSideEffect("A init") } fun test() { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt index 52fae4f83e8..31f5e490bbb 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt @@ -1,6 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR -// IGNORE_BACKEND_K1: JVM_IR +// TARGET_BACKEND: JS_IR +// IGNORE_BACKEND_K1: JVM_IR, JS_IR, JS_IR_ES6 // FILE: 1.kt diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt index 73a0094fa3d..8e840bed184 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt @@ -1,5 +1,7 @@ // !LANGUAGE: +IntrinsicConstEvaluation // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR + var result = "Fail" object O { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt b/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt index ec26544ced1..5de00032351 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/jsFloatDoubleToString.kt @@ -1,7 +1,6 @@ // TARGET_BACKEND: JS_IR // IGNORE_BACKEND_K1: JS_IR, JS_IR_ES6 -// IGNORE_BACKEND_K2: JS_IR, JS_IR_ES6 -// TODO enable for K2 when const lowering is applied for js + fun T.id() = this const val toStringDouble1 = 1.0.toString() diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt b/compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt index 0bd8db588f4..17bc87e1228 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR annotation class Key(val value: String) object Messanger { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt b/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt index 21646ace913..7c52b009a10 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM_IR -// TODO enable for JS, Native when const lowering is applied in corresponding backends +// TARGET_BACKEND: JS_IR // WITH_STDLIB object Test { diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt b/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt index 29a6d9e9590..63533c35d15 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM_IR -// TODO enable for JS, Native when const lowering is applied in corresponding backends +// TARGET_BACKEND: JS_IR object Test diff --git a/compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt b/compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt index e4e23c4559f..bf7b372275d 100644 --- a/compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt +++ b/compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt @@ -1,4 +1,5 @@ // TARGET_BACKEND: JVM_IR +// TARGET_BACKEND: JS_IR // This test is needed to check that IrCompileTimeChecker will not fail trying to find and analyze correct toString method object Obj { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 0746d7af861..5131772ef4b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -21123,6 +21123,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt"); } + @Test + @TestMetadata("objectConstValInAnnotationArgument.kt") + public void testObjectConstValInAnnotationArgument() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt"); + } + @Test @TestMetadata("shortOperations.kt") public void testShortOperations() throws Exception { @@ -21153,12 +21159,30 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt"); } + @Test + @TestMetadata("thisPlusString.kt") + public void testThisPlusString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt"); + } + + @Test + @TestMetadata("thisPlusStringWithObject.kt") + public void testThisPlusStringWithObject() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt"); + } + @Test @TestMetadata("unsignedConst.kt") public void testUnsignedConst() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt"); } + @Test + @TestMetadata("useCorrectToString.kt") + public void testUseCorrectToString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst") @TestDataPath("$PROJECT_ROOT") @@ -21168,11 +21192,65 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("constTrimIndent.kt") + public void testConstTrimIndent() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt"); + } + + @Test + @TestMetadata("constTrimMargin.kt") + public void testConstTrimMargin() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt"); + } + + @Test + @TestMetadata("enumName.kt") + public void testEnumName() throws Exception { + 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 { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt"); + } + @Test @TestMetadata("ifConstVal.kt") public void testIfConstVal() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt"); } + + @Test + @TestMetadata("kCallableName.kt") + public void testKCallableName() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt"); + } + + @Test + @TestMetadata("kCallableNameWithSideEffect.kt") + public void testKCallableNameWithSideEffect() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt"); + } + + @Test + @TestMetadata("kt53272.kt") + public void testKt53272() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt"); + } + + @Test + @TestMetadata("kt58717.kt") + public void testKt58717() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt"); + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index c51c5d9c388..a600594f9e8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -21123,6 +21123,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt"); } + @Test + @TestMetadata("objectConstValInAnnotationArgument.kt") + public void testObjectConstValInAnnotationArgument() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt"); + } + @Test @TestMetadata("shortOperations.kt") public void testShortOperations() throws Exception { @@ -21153,12 +21159,30 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt"); } + @Test + @TestMetadata("thisPlusString.kt") + public void testThisPlusString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt"); + } + + @Test + @TestMetadata("thisPlusStringWithObject.kt") + public void testThisPlusStringWithObject() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt"); + } + @Test @TestMetadata("unsignedConst.kt") public void testUnsignedConst() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt"); } + @Test + @TestMetadata("useCorrectToString.kt") + public void testUseCorrectToString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst") @TestDataPath("$PROJECT_ROOT") @@ -21168,11 +21192,65 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("constTrimIndent.kt") + public void testConstTrimIndent() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt"); + } + + @Test + @TestMetadata("constTrimMargin.kt") + public void testConstTrimMargin() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt"); + } + + @Test + @TestMetadata("enumName.kt") + public void testEnumName() throws Exception { + 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 { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt"); + } + @Test @TestMetadata("ifConstVal.kt") public void testIfConstVal() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt"); } + + @Test + @TestMetadata("kCallableName.kt") + public void testKCallableName() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt"); + } + + @Test + @TestMetadata("kCallableNameWithSideEffect.kt") + public void testKCallableNameWithSideEffect() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt"); + } + + @Test + @TestMetadata("kt53272.kt") + public void testKt53272() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt"); + } + + @Test + @TestMetadata("kt58717.kt") + public void testKt58717() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt"); + } } @Nested diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index f94ed3f549c..80c24c940e7 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -21123,6 +21123,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/involvesIrInterpreter/longOperations.kt"); } + @Test + @TestMetadata("objectConstValInAnnotationArgument.kt") + public void testObjectConstValInAnnotationArgument() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/objectConstValInAnnotationArgument.kt"); + } + @Test @TestMetadata("shortOperations.kt") public void testShortOperations() throws Exception { @@ -21153,12 +21159,30 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/involvesIrInterpreter/stringOperations.kt"); } + @Test + @TestMetadata("thisPlusString.kt") + public void testThisPlusString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusString.kt"); + } + + @Test + @TestMetadata("thisPlusStringWithObject.kt") + public void testThisPlusStringWithObject() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/thisPlusStringWithObject.kt"); + } + @Test @TestMetadata("unsignedConst.kt") public void testUnsignedConst() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/unsignedConst.kt"); } + @Test + @TestMetadata("useCorrectToString.kt") + public void testUseCorrectToString() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/useCorrectToString.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst") @TestDataPath("$PROJECT_ROOT") @@ -21168,11 +21192,65 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("constTrimIndent.kt") + public void testConstTrimIndent() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimIndent.kt"); + } + + @Test + @TestMetadata("constTrimMargin.kt") + public void testConstTrimMargin() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/constTrimMargin.kt"); + } + + @Test + @TestMetadata("enumName.kt") + public void testEnumName() throws Exception { + 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 { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/equals_after.kt"); + } + @Test @TestMetadata("ifConstVal.kt") public void testIfConstVal() throws Exception { runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/ifConstVal.kt"); } + + @Test + @TestMetadata("kCallableName.kt") + public void testKCallableName() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableName.kt"); + } + + @Test + @TestMetadata("kCallableNameWithSideEffect.kt") + public void testKCallableNameWithSideEffect() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kCallableNameWithSideEffect.kt"); + } + + @Test + @TestMetadata("kt53272.kt") + public void testKt53272() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt53272.kt"); + } + + @Test + @TestMetadata("kt58717.kt") + public void testKt58717() throws Exception { + runTest("compiler/testData/codegen/box/involvesIrInterpreter/intrinsicConst/kt58717.kt"); + } } @Nested