diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index c462f751f70..f80cd4b6a59 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -197,6 +197,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt"); } + @TestMetadata("kt19306.kt") + public void testKt19306() throws Exception { + runTest("compiler/testData/ir/irText/classes/kt19306.kt"); + } + @TestMetadata("kt31649.kt") public void testKt31649() throws Exception { runTest("compiler/testData/ir/irText/classes/kt31649.kt"); diff --git a/compiler/testData/ir/irText/classes/kt19306.kt b/compiler/testData/ir/irText/classes/kt19306.kt new file mode 100644 index 00000000000..984402638ab --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt19306.kt @@ -0,0 +1,17 @@ +// SKIP_KT_DUMP +// FILE: kt19306_test1.kt +package test1 + +abstract class A { + protected var p = "" + private set +} + +// FILE: kt19306_test2.kt +package test2 + +import test1.A + +class B : A() { + fun test() = { -> p } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/classes/kt19306_test1.fir.txt b/compiler/testData/ir/irText/classes/kt19306_test1.fir.txt new file mode 100644 index 00000000000..4fa37d61152 --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt19306_test1.fir.txt @@ -0,0 +1,39 @@ +FILE fqName:test1 fileName:/kt19306_test1.kt + CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test1.A + CONSTRUCTOR visibility:public <> () returnType:test1.A [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:p visibility:protected modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String + correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var] + $this: VALUE_PARAMETER name: type:test1.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='protected final fun (): kotlin.String declared in test1.A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.String origin=null + receiver: GET_VAR ': test1.A declared in test1.A.' type=test1.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:test1.A, :kotlin.String) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var] + $this: VALUE_PARAMETER name: type:test1.A + VALUE_PARAMETER name: index:0 type:kotlin.String + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': test1.A declared in test1.A.' type=test1.A origin=null + value: GET_VAR ': kotlin.String declared in test1.A.' type=kotlin.String origin=null + 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/kt19306_test1.txt b/compiler/testData/ir/irText/classes/kt19306_test1.txt new file mode 100644 index 00000000000..4fa37d61152 --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt19306_test1.txt @@ -0,0 +1,39 @@ +FILE fqName:test1 fileName:/kt19306_test1.kt + CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test1.A + CONSTRUCTOR visibility:public <> () returnType:test1.A [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + PROPERTY name:p visibility:protected modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private + EXPRESSION_BODY + CONST String type=kotlin.String value="" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String + correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var] + $this: VALUE_PARAMETER name: type:test1.A + BLOCK_BODY + RETURN type=kotlin.Nothing from='protected final fun (): kotlin.String declared in test1.A' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.String origin=null + receiver: GET_VAR ': test1.A declared in test1.A.' type=test1.A origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:test1.A, :kotlin.String) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:p visibility:protected modality:FINAL [var] + $this: VALUE_PARAMETER name: type:test1.A + VALUE_PARAMETER name: index:0 type:kotlin.String + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:p type:kotlin.String visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': test1.A declared in test1.A.' type=test1.A origin=null + value: GET_VAR ': kotlin.String declared in test1.A.' type=kotlin.String origin=null + 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/kt19306_test2.fir.txt b/compiler/testData/ir/irText/classes/kt19306_test2.fir.txt new file mode 100644 index 00000000000..967a701cd4e --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt19306_test2.fir.txt @@ -0,0 +1,36 @@ +FILE fqName:test2 fileName:/kt19306_test2.kt + CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test2.B + CONSTRUCTOR visibility:public <> () returnType:test2.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in test1.A' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]' + FUN name:test visibility:public modality:FINAL <> ($this:test2.B) returnType:kotlin.Function0 + $this: VALUE_PARAMETER name: type:test2.B + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Function0 declared in test2.B' + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in test2.B.test' + CALL 'protected final fun (): kotlin.String declared in test1.A' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': test2.B declared in test2.B.test' type=test2.B origin=null + PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var] + FUN FAKE_OVERRIDE name: visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var] + overridden: + protected final fun (): kotlin.String declared in test1.A + $this: VALUE_PARAMETER name: type:test1.A + 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/kt19306_test2.txt b/compiler/testData/ir/irText/classes/kt19306_test2.txt new file mode 100644 index 00000000000..07b3e3b2e33 --- /dev/null +++ b/compiler/testData/ir/irText/classes/kt19306_test2.txt @@ -0,0 +1,36 @@ +FILE fqName:test2 fileName:/kt19306_test2.kt + CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:test2.B + CONSTRUCTOR visibility:public <> () returnType:test2.B [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in test1.A' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public superTypes:[test1.A]' + FUN name:test visibility:public modality:FINAL <> ($this:test2.B) returnType:kotlin.Function0 + $this: VALUE_PARAMETER name: type:test2.B + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Function0 declared in test2.B' + FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in test2.B.test' + CALL 'protected final fun (): kotlin.String [fake_override] declared in test2.B' type=kotlin.String origin=GET_PROPERTY + $this: GET_VAR ': test2.B declared in test2.B.test' type=test2.B origin=null + PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var] + FUN FAKE_OVERRIDE name: visibility:protected modality:FINAL <> ($this:test1.A) returnType:kotlin.String [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:p visibility:protected modality:FINAL [fake_override,var] + overridden: + protected final fun (): kotlin.String declared in test1.A + $this: VALUE_PARAMETER name: type:test1.A + 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 [fake_override,operator] declared in test1.A + $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 [fake_override] declared in test1.A + $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 [fake_override] declared in test1.A + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index f163f172535..f6a5f77c98d 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -119,15 +119,17 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { TestCase.assertEquals("IR dump mismatch after deep copy with symbols", actualTrees, copiedTrees) verify(irFileCopy) - val kotlinLikeDump = irFile.dumpKotlinLike( - KotlinLikeDumpOptions( - printFileName = false, - printFilePath = false, - printFakeOverridesStrategy = FakeOverridesStrategy.NONE + if (!testFile.directives.contains("SKIP_KT_DUMP")) { + val kotlinLikeDump = irFile.dumpKotlinLike( + KotlinLikeDumpOptions( + printFileName = false, + printFilePath = false, + printFakeOverridesStrategy = FakeOverridesStrategy.NONE + ) ) - ) - val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!! - KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump) + val kotlinLikeDumpExpectedFile = irTreeFileLabel.expectedTextFile.withReplacedExtensionOrNull(".txt", ".kt.txt")!! + KotlinTestUtils.assertEqualsToFile(kotlinLikeDumpExpectedFile, kotlinLikeDump) + } } try { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index c2ce58a2055..e65b5d91e72 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -196,6 +196,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/classes/innerClassWithDelegatingConstructor.kt"); } + @TestMetadata("kt19306.kt") + public void testKt19306() throws Exception { + runTest("compiler/testData/ir/irText/classes/kt19306.kt"); + } + @TestMetadata("kt31649.kt") public void testKt31649() throws Exception { runTest("compiler/testData/ir/irText/classes/kt31649.kt");