JVM_IR: Support init blocks in inline classes

Put their content to constructor-impl, so they are called during
constructor call, but they are not called during boxing, because
box-impl calls <init> and not constructor-impl.

 #KT-28055 In progress
This commit is contained in:
Ilmir Usmanov
2020-10-28 01:46:38 +01:00
parent 5804f73ebd
commit 999604541e
15 changed files with 323 additions and 24 deletions
@@ -14817,6 +14817,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/boundCallableReferencePassedToInlineFunction.kt");
}
@TestMetadata("boxImplDoesNotExecuteInitBlock.kt")
public void testBoxImplDoesNotExecuteInitBlock() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInitBlock.kt");
}
@TestMetadata("boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt")
public void testBoxNullableValueOfInlineClassWithNonNullUnderlyingType() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/boxNullableValueOfInlineClassWithNonNullUnderlyingType.kt");
@@ -15102,6 +15107,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/inlineClasses/genericVararg2ndConstructor.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/initBlock.kt");
}
@TestMetadata("inlineClassAsLastExpressionInInLambda.kt")
public void testInlineClassAsLastExpressionInInLambda() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassAsLastExpressionInInLambda.kt");