diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 4d8801bc000..0f6a88acd6f 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir; import com.intellij.testFramework.TestDataPath; import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; import org.jetbrains.kotlin.test.TestMetadata; import org.junit.runner.RunWith; @@ -21,11 +22,11 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInIrText() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("compiler/testData/ir/irText/classes") @@ -33,7 +34,7 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Classes extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } @TestMetadata("abstractMembers.kt") @@ -42,7 +43,7 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { } public void testAllFilesPresentInClasses() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/classes"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/classes"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("annotationClasses.kt") @@ -135,6 +136,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/classes/initVal.kt"); } + @TestMetadata("initValInLambda.kt") + public void testInitValInLambda() throws Exception { + runTest("compiler/testData/ir/irText/classes/initValInLambda.kt"); + } + @TestMetadata("initVar.kt") public void testInitVar() throws Exception { runTest("compiler/testData/ir/irText/classes/initVar.kt"); @@ -221,11 +227,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Declarations extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInDeclarations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("catchParameterInTopLevelProperty.kt") @@ -328,11 +334,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Annotations extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInAnnotations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/annotations"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("annotationsInAnnotationArguments.kt") @@ -491,11 +497,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Multiplatform extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInMultiplatform() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/multiplatform"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("expectClassInherited.kt") @@ -519,11 +525,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Parameters extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInParameters() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/parameters"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/parameters"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("class.kt") @@ -597,11 +603,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class ProvideDelegate extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInProvideDelegate() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/provideDelegate"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/declarations/provideDelegate"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("differentReceivers.kt") @@ -641,11 +647,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Errors extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInErrors() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/errors"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/errors"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("suppressedNonPublicCall.kt") @@ -664,11 +670,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Expressions extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInExpressions() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("argumentMappedWithError.kt") @@ -1326,11 +1332,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class FloatingPointComparisons extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInFloatingPointComparisons() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/floatingPointComparisons"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/floatingPointComparisons"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("comparableWithDoubleOrFloat.kt") @@ -1394,11 +1400,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Sam extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInSam() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/sam"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/expressions/sam"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("samByProjectedType.kt") @@ -1448,11 +1454,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Lambdas extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInLambdas() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/lambdas"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/lambdas"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("anonymousFunction.kt") @@ -1501,11 +1507,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Regressions extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInRegressions() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/regressions"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/regressions"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("coercionInLoop.kt") @@ -1533,11 +1539,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class NewInference extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInNewInference() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/regressions/newInference"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/regressions/newInference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("fixationOrder1.kt") @@ -1552,11 +1558,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Singletons extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInSingletons() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/singletons"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/singletons"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("companion.kt") @@ -1580,11 +1586,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Stubs extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } public void testAllFilesPresentInStubs() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/stubs"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/stubs"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("builtinMap.kt") @@ -1658,7 +1664,7 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { @RunWith(JUnit3RunnerWithInners.class) public static class Types extends AbstractFir2IrTextTest { private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY_FIR, testDataFilePath); } @TestMetadata("abbreviatedTypes.kt") @@ -1667,7 +1673,7 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { } public void testAllFilesPresentInTypes() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/types"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/ir/irText/types"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.ANY_FIR, true); } @TestMetadata("asOnPlatformType.kt") diff --git a/compiler/testData/ir/irText/classes/initVal.kt b/compiler/testData/ir/irText/classes/initVal.kt index f5b4b27a0c6..845e4f872c9 100644 --- a/compiler/testData/ir/irText/classes/initVal.kt +++ b/compiler/testData/ir/irText/classes/initVal.kt @@ -11,12 +11,3 @@ class TestInitValInInitBlock { x = 0 } } - -class TestInitValInLambdaCalledOnce { - val x: Int - init { - 1.run { - x = 0 - } - } -} diff --git a/compiler/testData/ir/irText/classes/initVal.txt b/compiler/testData/ir/irText/classes/initVal.txt index 39dbe3d6f62..688c1dcc903 100644 --- a/compiler/testData/ir/irText/classes/initVal.txt +++ b/compiler/testData/ir/irText/classes/initVal.txt @@ -93,44 +93,3 @@ FILE fqName: fileName:/initVal.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - CLASS CLASS name:TestInitValInLambdaCalledOnce modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestInitValInLambdaCalledOnce - CONSTRUCTOR visibility:public <> () returnType:.TestInitValInLambdaCalledOnce [primary] - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitValInLambdaCalledOnce modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:x visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.TestInitValInLambdaCalledOnce) returnType:kotlin.Int - correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.TestInitValInLambdaCalledOnce - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .TestInitValInLambdaCalledOnce' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null - receiver: GET_VAR ': .TestInitValInLambdaCalledOnce declared in .TestInitValInLambdaCalledOnce.' type=.TestInitValInLambdaCalledOnce origin=null - ANONYMOUS_INITIALIZER isStatic=false - BLOCK_BODY - CALL 'public final fun run (block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null - : kotlin.Int - : kotlin.Unit - $receiver: CONST Int type=kotlin.Int value=1 - block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit - $receiver: VALUE_PARAMETER name: type:kotlin.Int - BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Unit origin=null - receiver: GET_VAR ': .TestInitValInLambdaCalledOnce declared in .TestInitValInLambdaCalledOnce' type=.TestInitValInLambdaCalledOnce origin=null - value: CONST Int type=kotlin.Int value=0 - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] - overridden: - public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] - overridden: - public open fun hashCode (): kotlin.Int declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] - overridden: - public open fun toString (): kotlin.String declared in kotlin.Any - $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/classes/initValInLambda.kt b/compiler/testData/ir/irText/classes/initValInLambda.kt new file mode 100644 index 00000000000..5a82e8560f5 --- /dev/null +++ b/compiler/testData/ir/irText/classes/initValInLambda.kt @@ -0,0 +1,9 @@ +// IGNORE_BACKEND: ANY_FIR +class TestInitValInLambdaCalledOnce { + val x: Int + init { + 1.run { + x = 0 + } + } +} diff --git a/compiler/testData/ir/irText/classes/initValInLambda.txt b/compiler/testData/ir/irText/classes/initValInLambda.txt new file mode 100644 index 00000000000..9c0dbb3f3ea --- /dev/null +++ b/compiler/testData/ir/irText/classes/initValInLambda.txt @@ -0,0 +1,42 @@ +FILE fqName: fileName:/initValInLambda.kt + CLASS CLASS name:TestInitValInLambdaCalledOnce modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestInitValInLambdaCalledOnce + CONSTRUCTOR visibility:public <> () returnType:.TestInitValInLambdaCalledOnce [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitValInLambdaCalledOnce modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.TestInitValInLambdaCalledOnce) returnType:kotlin.Int + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.TestInitValInLambdaCalledOnce + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .TestInitValInLambdaCalledOnce' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null + receiver: GET_VAR ': .TestInitValInLambdaCalledOnce declared in .TestInitValInLambdaCalledOnce.' type=.TestInitValInLambdaCalledOnce origin=null + ANONYMOUS_INITIALIZER isStatic=false + BLOCK_BODY + CALL 'public final fun run (block: @[ExtensionFunctionType] kotlin.Function1): R of kotlin.run [inline] declared in kotlin' type=kotlin.Unit origin=null + : kotlin.Int + : kotlin.Unit + $receiver: CONST Int type=kotlin.Int value=1 + block: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.Int) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final]' type=kotlin.Unit origin=null + receiver: GET_VAR ': .TestInitValInLambdaCalledOnce declared in .TestInitValInLambdaCalledOnce' type=.TestInitValInLambdaCalledOnce origin=null + value: CONST Int type=kotlin.Int value=0 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TargetBackend.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TargetBackend.kt index 0b7c5c8903e..7d2c28eb80e 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/TargetBackend.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/TargetBackend.kt @@ -10,6 +10,7 @@ enum class TargetBackend( private val compatibleWithTargetBackend: TargetBackend? = null ) { ANY(false), + ANY_FIR(true, ANY), JVM(false), JVM_IR(true, JVM), JS(false), diff --git a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt index da215330227..4d0e8611a40 100644 --- a/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt +++ b/compiler/tests/org/jetbrains/kotlin/generators/tests/GenerateCompilerTests.kt @@ -589,7 +589,7 @@ fun main(args: Array) { testGroup("compiler/fir/fir2ir/tests", "compiler/testData") { testClass { - model("ir/irText") + model("ir/irText", targetBackend = TargetBackend.ANY_FIR) } } diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index ccc8c988a1c..d9b971d84a8 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -135,6 +135,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/classes/initVal.kt"); } + @TestMetadata("initValInLambda.kt") + public void testInitValInLambda() throws Exception { + runTest("compiler/testData/ir/irText/classes/initValInLambda.kt"); + } + @TestMetadata("initVar.kt") public void testInitVar() throws Exception { runTest("compiler/testData/ir/irText/classes/initVar.kt");