From c0b15b1768eaade6d9181a48eee3613277996fe5 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 12 Mar 2020 11:32:57 +0300 Subject: [PATCH] KT-37448 'this' in delegating constructor call may refer to outer object --- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 + .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 + .../psi2ir/generators/StatementGenerator.kt | 5 +- ...RefToObjectInNestedClassConstructorCall.kt | 11 ++ ...ObjectInNestedClassConstructorCall.fir.txt | 103 ++++++++++++++++++ ...RefToObjectInNestedClassConstructorCall.kt | 6 + ...efToObjectInNestedClassConstructorCall.txt | 103 ++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 + .../LightAnalysisModeTestGenerated.java | 5 + .../ir/IrBlackBoxCodegenTestGenerated.java | 5 + .../kotlin/ir/IrTextTestCaseGenerated.java | 5 + .../IrJsCodegenBoxTestGenerated.java | 5 + .../semantics/JsCodegenBoxTestGenerated.java | 5 + 13 files changed, 266 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.txt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt create mode 100644 compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 476cac4a14e..7ba14deef6a 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -16850,6 +16850,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt"); 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 c10530d43ae..389d8fb73d7 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1247,6 +1247,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("thisReferenceBeforeClassDeclared.kt") public void testThisReferenceBeforeClassDeclared() throws Exception { runTest("compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt index 168a8b9e5fb..510944e0eca 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/StatementGenerator.kt @@ -368,10 +368,11 @@ class StatementGenerator( override fun visitSafeQualifiedExpression(expression: KtSafeQualifiedExpression, data: Nothing?): IrStatement = expression.selectorExpression!!.accept(this, data) - private fun isInsideClass(classDescriptor: ClassDescriptor): Boolean { + private fun isThisForClassPhysicallyAvailable(classDescriptor: ClassDescriptor): Boolean { var scopeDescriptor: DeclarationDescriptor? = scopeOwner while (scopeDescriptor != null) { if (scopeDescriptor == classDescriptor) return true + if (scopeDescriptor is ClassDescriptor && !scopeDescriptor.isInner) return false scopeDescriptor = scopeDescriptor.containingDeclaration } return false @@ -381,7 +382,7 @@ class StatementGenerator( val thisAsReceiverParameter = classDescriptor.thisAsReceiverParameter val thisType = kotlinType.toIrType() - return if (DescriptorUtils.isObject(classDescriptor) && !isInsideClass(classDescriptor)) { + return if (DescriptorUtils.isObject(classDescriptor) && !isThisForClassPhysicallyAvailable(classDescriptor)) { IrGetObjectValueImpl( startOffset, endOffset, thisType, diff --git a/compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt b/compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt new file mode 100644 index 00000000000..1ce188eb889 --- /dev/null +++ b/compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt @@ -0,0 +1,11 @@ +// IGNORE_BACKEND_FIR: JVM_IR + +open class Base(val s: String) + +object Host { + class Derived : Base(this.foo()) + + fun foo() = "OK" +} + +fun box() = Host.Derived().s \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.txt new file mode 100644 index 00000000000..e90717063a2 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.fir.txt @@ -0,0 +1,103 @@ +FILE fqName: fileName:/thisRefToObjectInNestedClassConstructorCall.kt + CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + CONSTRUCTOR visibility:public <> (x:kotlin.Any) returnType:.Base [primary] + VALUE_PARAMETER name:x index:0 type:kotlin.Any + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final] + EXPRESSION_BODY + GET_VAR 'x: kotlin.Any declared in .Base.' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.Any + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in .Base' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .Base declared in .Base.' type=.Base 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 + CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host + CONSTRUCTOR visibility:private <> () returnType:.Host [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host.Derived1 + CONSTRUCTOR visibility:public <> () returnType:.Host.Derived1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any) [primary] declared in .Base' + x: GET_VAR ': .Host.Derived1 declared in .Host.Derived1' type=.Host.Derived1 origin=null + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[.Base]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Host.Derived1) returnType:kotlin.Any [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Any declared in .Base + $this: VALUE_PARAMETER name: type:.Host.Derived1 + 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 + CLASS CLASS name:Derived2 modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host.Derived2 + CONSTRUCTOR visibility:public <> () returnType:.Host.Derived2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any) [primary] declared in .Base' + x: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived2 modality:FINAL visibility:public superTypes:[.Base]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Host.Derived2) returnType:kotlin.Any [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Any declared in .Base + $this: VALUE_PARAMETER name: type:.Host.Derived2 + 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 + 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/expressions/thisRefToObjectInNestedClassConstructorCall.kt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt new file mode 100644 index 00000000000..ad4a2c2e6fc --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt @@ -0,0 +1,6 @@ +open class Base(val x: Any) + +object Host { + class Derived1 : Base(this) + class Derived2 : Base(Host) +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.txt b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.txt new file mode 100644 index 00000000000..c050a6eeb5a --- /dev/null +++ b/compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.txt @@ -0,0 +1,103 @@ +FILE fqName: fileName:/thisRefToObjectInNestedClassConstructorCall.kt + CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base + CONSTRUCTOR visibility:public <> (x:kotlin.Any) returnType:.Base [primary] + VALUE_PARAMETER name:x index:0 type:kotlin.Any + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Base modality:OPEN visibility:public superTypes:[kotlin.Any]' + PROPERTY name:x visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final] + EXPRESSION_BODY + GET_VAR 'x: kotlin.Any declared in .Base.' type=kotlin.Any origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.Any + correspondingProperty: PROPERTY name:x visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Base + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Any declared in .Base' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null + receiver: GET_VAR ': .Base declared in .Base.' type=.Base 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 + CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host + CONSTRUCTOR visibility:private <> () returnType:.Host [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' + CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host.Derived1 + CONSTRUCTOR visibility:public <> () returnType:.Host.Derived1 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any) [primary] declared in .Base' + x: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived1 modality:FINAL visibility:public superTypes:[.Base]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.Any [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Any declared in .Base + $this: VALUE_PARAMETER name: type:.Base + 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 .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Derived2 modality:FINAL visibility:public superTypes:[.Base] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Host.Derived2 + CONSTRUCTOR visibility:public <> () returnType:.Host.Derived2 [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor (x: kotlin.Any) [primary] declared in .Base' + x: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived2 modality:FINAL visibility:public superTypes:[.Base]' + PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + FUN FAKE_OVERRIDE name: visibility:public modality:FINAL <> ($this:.Base) returnType:kotlin.Any [fake_override] + correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val] + overridden: + public final fun (): kotlin.Any declared in .Base + $this: VALUE_PARAMETER name: type:.Base + 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 .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any + 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/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 7850082e7ee..807e8d2ffe7 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -17995,6 +17995,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 4cf8729e1b3..13d9a68b064 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -17995,6 +17995,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 2861347d121..ffd5218921a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -16850,6 +16850,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 9b816b5c8a5..00b98f55481 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1246,6 +1246,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/expressions/thisOfGenericOuterClass.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/ir/irText/expressions/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("thisReferenceBeforeClassDeclared.kt") public void testThisReferenceBeforeClassDeclared() throws Exception { runTest("compiler/testData/ir/irText/expressions/thisReferenceBeforeClassDeclared.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 85400f4f597..52bac206c0e 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -13750,6 +13750,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 1a0de0464d4..225919dae18 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -13815,6 +13815,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/objects/thisInConstructor.kt"); } + @TestMetadata("thisRefToObjectInNestedClassConstructorCall.kt") + public void testThisRefToObjectInNestedClassConstructorCall() throws Exception { + runTest("compiler/testData/codegen/box/objects/thisRefToObjectInNestedClassConstructorCall.kt"); + } + @TestMetadata("useAnonymousObjectAsIterator.kt") public void testUseAnonymousObjectAsIterator() throws Exception { runTest("compiler/testData/codegen/box/objects/useAnonymousObjectAsIterator.kt");