From b2378620c3374e528a8357c6cbbfe6c8cbfb3dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Tue, 11 May 2021 11:42:11 +0200 Subject: [PATCH] JVM IR: Fix handling of anonymous initializers in inline classes (#4372) Fixes KT-46554 --- .../FirBlackBoxCodegenTestGenerated.java | 30 ++++++++ .../jvm/lower/JvmInlineClassLowering.kt | 74 ++++++------------- ...mplDoesNotExecuteInSecondaryConstructor.kt | 21 ++++++ .../inlineClasses/classInInlineClassInit.kt | 17 +++++ .../inlineClasses/inlineClassFieldHandling.kt | 14 ++++ .../inlineClasses/inlineClassInInitBlock.kt | 16 ++++ .../codegen/box/inlineClasses/kt46554.kt | 14 ++++ .../codegen/BlackBoxCodegenTestGenerated.java | 30 ++++++++ .../IrBlackBoxCodegenTestGenerated.java | 30 ++++++++ .../LightAnalysisModeTestGenerated.java | 25 +++++++ .../IrJsCodegenBoxES6TestGenerated.java | 25 +++++++ .../IrJsCodegenBoxTestGenerated.java | 25 +++++++ .../semantics/JsCodegenBoxTestGenerated.java | 25 +++++++ .../IrCodegenBoxWasmTestGenerated.java | 25 +++++++ 14 files changed, 320 insertions(+), 51 deletions(-) create mode 100644 compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt create mode 100644 compiler/testData/codegen/box/inlineClasses/kt46554.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 2ee2a012e59..d74c4d4d3a0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -25,6 +25,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @@ -17744,6 +17750,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @Test + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @Test @TestMetadata("classLiteralOnInlineClass.kt") public void testClassLiteralOnInlineClass() throws Exception { @@ -17972,6 +17984,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @Test + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @Test @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { @@ -17984,6 +18002,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollection.kt"); } + @Test + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @Test @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { @@ -18374,6 +18398,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @Test + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @Test @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt index b031a8b409b..778480e1aa6 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmInlineClassLowering.kt @@ -186,7 +186,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F returnType = source.returnType }.apply { copyParameterDeclarationsFrom(source) - annotations += source.annotations + annotations = source.annotations parent = source.parent // We need to ensure that this bridge has the same attribute owner as its static inline class replacement, since this // is used in [CoroutineCodegen.isStaticInlineClassReplacementDelegatingCall] to identify the bridge and avoid generating @@ -391,13 +391,9 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F when { // Getting the underlying field of an inline class merely changes the IR type, // since the underlying representations are the same. - expression.symbol.owner.isInlineClassFieldGetter -> when (val ctor = findInitBlockOrConstructorImpl()) { - InitBlockOrConstructorImpl.InitBlock -> super.visitCall(expression) - is InitBlockOrConstructorImpl.ConstructorImpl -> getConstructorImplArgumentValue(ctor, expression.type) - else -> { - val arg = expression.dispatchReceiver!!.transform(this, null) - coerceInlineClasses(arg, expression.symbol.owner.dispatchReceiverParameter!!.type, expression.type) - } + expression.symbol.owner.isInlineClassFieldGetter -> { + val arg = expression.dispatchReceiver!!.transform(this, null) + coerceInlineClasses(arg, expression.symbol.owner.dispatchReceiverParameter!!.type, expression.type) } // Specialize calls to equals when the left argument is a value of inline class type. expression.isSpecializedInlineClassEqEq -> { @@ -410,24 +406,6 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F super.visitCall(expression) } - private fun getConstructorImplArgumentValue(ctor: InitBlockOrConstructorImpl.ConstructorImpl, expectedType: IrType): IrExpression { - val arg: IrValueParameter = ctor.irElement.valueParameters.single() - return coerceInlineClasses(IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, arg.symbol), arg.type, expectedType) - } - - @Suppress("UNCHECKED_CAST") - private fun findInitBlockOrConstructorImpl(): InitBlockOrConstructorImpl? { - for (scope in allScopes.reversed()) { - val irElement = scope.irElement - when { - irElement is IrAnonymousInitializer -> return InitBlockOrConstructorImpl.InitBlock - irElement is IrFunction && irElement.origin == JvmLoweredDeclarationOrigin.STATIC_INLINE_CLASS_CONSTRUCTOR -> - return InitBlockOrConstructorImpl.ConstructorImpl(irElement) - } - } - return null - } - private val IrCall.isSpecializedInlineClassEqEq: Boolean get() { // Note that reference equality (x === y) is not allowed on values of inline class type, @@ -490,13 +468,6 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F it.type, it.symbol, expression.origin ) } - val owner = expression.symbol.owner - if (owner is IrValueParameter && (owner.parent as? IrClass)?.isInline == true && owner.origin == IrDeclarationOrigin.INSTANCE_RECEIVER) { - val ctor = findInitBlockOrConstructorImpl() - if (ctor is InitBlockOrConstructorImpl.ConstructorImpl) { - return getConstructorImplArgumentValue(ctor, expression.type) - } - } return super.visitGetValue(expression) } @@ -512,6 +483,13 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F return super.visitSetValue(expression) } + // Anonymous initializers in inline classes are processed when building the primary constructor. + override fun visitAnonymousInitializerNew(declaration: IrAnonymousInitializer): IrStatement { + if (declaration.parent.safeAs()?.isInline == true) + return declaration + return super.visitAnonymousInitializerNew(declaration) + } + private fun buildPrimaryInlineClassConstructor(irClass: IrClass, irConstructor: IrConstructor) { // Add the default primary constructor irClass.addConstructor { @@ -523,7 +501,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F // Don't create a default argument stub for the primary constructor irConstructor.valueParameters.forEach { it.defaultValue = null } copyParameterDeclarationsFrom(irConstructor) - annotations += irConstructor.annotations + annotations = irConstructor.annotations body = context.createIrBuilder(this.symbol).irBlockBody(this) { +irDelegatingConstructorCall(context.irBuiltIns.anyClass.owner.constructors.single()) +irSetField( @@ -534,27 +512,26 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F } } - // Add a static bridge method to the primary constructor. - // This is a placeholder for null-checks and default arguments. + // Add a static bridge method to the primary constructor. This contains + // null-checks, default arguments, and anonymous initializers. val function = context.inlineClassReplacements.getReplacementFunction(irConstructor)!! val initBlocks = irClass.declarations.filterIsInstance() function.valueParameters.forEach { it.transformChildrenVoid() } - with(context.createIrBuilder(function.symbol)) { - val argument: IrValueParameter = function.valueParameters[0] - function.body = irBlockBody { - for (initBlock in initBlocks) { - for (stmt in initBlock.body.statements) { - +stmt - } + function.body = context.createIrBuilder(function.symbol).irBlockBody { + val argument = function.valueParameters[0] + val thisValue = irTemporary(coerceInlineClasses(irGet(argument), argument.type, function.returnType)) + valueMap[irClass.thisReceiver!!.symbol] = thisValue + for (initBlock in initBlocks) { + for (stmt in initBlock.body.statements) { + +stmt.transformStatement(this@JvmInlineClassLowering).patchDeclarationParents(function) } - +irReturn(coerceInlineClasses(irGet(argument), argument.type, function.returnType)) } + +irReturn(irGet(thisValue)) } - function.accept(this, null) - irClass.declarations.removeAll(initBlocks) + irClass.declarations.removeAll(initBlocks) irClass.declarations += function } @@ -601,8 +578,3 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F irClass.declarations += function } } - -private sealed class InitBlockOrConstructorImpl { - object InitBlock : InitBlockOrConstructorImpl() - class ConstructorImpl(val irElement: IrFunction) : InitBlockOrConstructorImpl() -} \ No newline at end of file diff --git a/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt b/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt new file mode 100644 index 00000000000..b611c6c83cc --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt @@ -0,0 +1,21 @@ +inline class IC private constructor(val i: Int) { + @Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS") + constructor() : this(0) { + counter += 1 + } +} + +var counter = 0 + +fun id(t: T) = t + +fun box(): String { + val ic = IC() + if (counter != 1) return "FAIL 1: $counter" + counter = 0 + + id(ic) + if (counter != 0) return "FAIL 2: $counter" + + return "OK" +} diff --git a/compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt b/compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt new file mode 100644 index 00000000000..525859afd02 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt @@ -0,0 +1,17 @@ +var result = "Fail" + +inline class A(val value: String) { + init { + class B { + init { + result = value + } + } + B() + } +} + +fun box(): String { + A("OK") + return result +} diff --git a/compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt b/compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt new file mode 100644 index 00000000000..304f184e48e --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt @@ -0,0 +1,14 @@ +var result = "Fail" + +inline class A(val value: String) + +inline class B(val a: A) { + init { + result = a.value + } +} + +fun box(): String { + B(A("OK")) + return result +} diff --git a/compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt b/compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt new file mode 100644 index 00000000000..39405454fd6 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt @@ -0,0 +1,16 @@ +var result = "Fail" + +inline class A(val value: String) { + fun f() = value + "K" +} + +class B(val a: A) { + val result: String + init { + result = a.f() + } +} + +fun box(): String { + return B(A("O")).result +} diff --git a/compiler/testData/codegen/box/inlineClasses/kt46554.kt b/compiler/testData/codegen/box/inlineClasses/kt46554.kt new file mode 100644 index 00000000000..6467c4c9f05 --- /dev/null +++ b/compiler/testData/codegen/box/inlineClasses/kt46554.kt @@ -0,0 +1,14 @@ +var result = "Fail" + +inline class A(val value: String) { + constructor() : this("OK") + + init { + result = value + } +} + +fun box(): String { + A() + return result +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index c04992ce7cc..b642f14fef9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -25,6 +25,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); } + @Test + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @@ -17720,6 +17726,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @Test + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @Test @TestMetadata("classLiteralOnInlineClass.kt") public void testClassLiteralOnInlineClass() throws Exception { @@ -17948,6 +17960,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @Test + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @Test @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { @@ -17960,6 +17978,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollection.kt"); } + @Test + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @Test @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { @@ -18350,6 +18374,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @Test + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @Test @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index b254a62fb27..56019366601 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -25,6 +25,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); } + @Test + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @@ -17744,6 +17750,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @Test + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @Test @TestMetadata("classLiteralOnInlineClass.kt") public void testClassLiteralOnInlineClass() throws Exception { @@ -17972,6 +17984,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @Test + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @Test @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { @@ -17984,6 +18002,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollection.kt"); } + @Test + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @Test @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { @@ -18374,6 +18398,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @Test + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @Test @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index ef1965d7806..93c53b8b424 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -30,6 +30,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true, "ranges/stepped", "compileKotlinAgainstKotlin"); } + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -14727,6 +14732,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @TestMetadata("classLiteralOnInlineClass.kt") public void testClassLiteralOnInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/classLiteralOnInlineClass.kt"); @@ -14912,6 +14922,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFunctionInvoke.kt"); @@ -14922,6 +14937,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollection.kt"); } + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInStringTemplate.kt"); @@ -15212,6 +15232,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt"); } + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index c8f849e3aea..a5a1192a96b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -30,6 +30,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -12861,6 +12866,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @TestMetadata("computablePropertyInsideInlineClass.kt") public void testComputablePropertyInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/computablePropertyInsideInlineClass.kt"); @@ -13041,11 +13051,21 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFunctionInvoke.kt"); } + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInStringTemplate.kt"); @@ -13311,6 +13331,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index a188ab75ab7..1650b5f8f44 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -30,6 +30,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true, "compileKotlinAgainstKotlin"); } + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -12267,6 +12272,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @TestMetadata("computablePropertyInsideInlineClass.kt") public void testComputablePropertyInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/computablePropertyInsideInlineClass.kt"); @@ -12447,11 +12457,21 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFunctionInvoke.kt"); } + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInStringTemplate.kt"); @@ -12717,6 +12737,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1bc79250435..7cabd68ddf0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -30,6 +30,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true, "compileKotlinAgainstKotlin"); } + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -12332,6 +12337,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @TestMetadata("computablePropertyInsideInlineClass.kt") public void testComputablePropertyInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/computablePropertyInsideInlineClass.kt"); @@ -12512,11 +12522,21 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFunctionInvoke.kt"); } + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInStringTemplate.kt"); @@ -12782,6 +12802,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 04ccdd6cbc1..c7f4cd0c2b9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -30,6 +30,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true, "toArray", "classLiteral", "reflection", "contracts", "platformTypes", "ranges/stepped/unsigned", "coroutines", "parametersMetadata", "finally", "deadCodeElimination", "controlStructures/tryCatchInExpressions", "delegatedProperty", "compileKotlinAgainstKotlin"); } + @TestMetadata("boxImplDoesNotExecuteInSecondaryConstructor.kt") + public void testBoxImplDoesNotExecuteInSecondaryConstructor() throws Exception { + runTest("compiler/testData/codegen/box/boxImplDoesNotExecuteInSecondaryConstructor.kt"); + } + @TestMetadata("compiler/testData/codegen/box/annotations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -6552,6 +6557,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/checkUnboxingResultFromTypeVariable.kt"); } + @TestMetadata("classInInlineClassInit.kt") + public void testClassInInlineClassInit() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/classInInlineClassInit.kt"); + } + @TestMetadata("computablePropertyInsideInlineClass.kt") public void testComputablePropertyInsideInlineClass() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/computablePropertyInsideInlineClass.kt"); @@ -6697,11 +6707,21 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/inlineClassEqualityShouldUseTotalOrderForFloatingPointData.kt"); } + @TestMetadata("inlineClassFieldHandling.kt") + public void testInlineClassFieldHandling() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFieldHandling.kt"); + } + @TestMetadata("inlineClassFunctionInvoke.kt") public void testInlineClassFunctionInvoke() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassFunctionInvoke.kt"); } + @TestMetadata("inlineClassInInitBlock.kt") + public void testInlineClassInInitBlock() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt"); + } + @TestMetadata("inlineClassInStringTemplate.kt") public void testInlineClassInStringTemplate() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInStringTemplate.kt"); @@ -6932,6 +6952,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt"); } + @TestMetadata("kt46554.kt") + public void testKt46554() throws Exception { + runTest("compiler/testData/codegen/box/inlineClasses/kt46554.kt"); + } + @TestMetadata("mangledDefaultParameterFunction.kt") public void testMangledDefaultParameterFunction() throws Exception { runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");