From 9b9c51bc8dc275f3b9528a6c3e884181255dcc86 Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Tue, 28 Sep 2021 16:40:18 +0300 Subject: [PATCH] [FIR] Fix dispatch receivers on inner classes' constructors 1. Inner class constructor should have its outer class as a dispatch receiver, since it is necessary for the call. Before it was null 2. Substituted inner class constructor should have its original dispatch receiver type with the proper substitution. Before it was set to the class itself (since the class was usually passed as a new dispatch receiver) Also, modify FIR renderer, so it properly renders the dispatch receiver of the constructors --- .../constructorViaTypeAlias.txt | 2 +- .../testdata/onAirResolve/classInClass.txt | 2 +- .../OverridingDefaultQualifier.fir.txt | 4 +-- .../invokeWithReceiverAndArgument.fir.txt | 4 +-- .../diagnostics/conflictingProjection.fir.txt | 12 ++++---- .../diagnostics/incompatibleModifiers.fir.txt | 4 +-- .../expresssions/innerQualifier.fir.txt | 2 +- .../innerWithSuperCompanion.fir.txt | 2 +- .../expresssions/localInnerClass.fir.txt | 2 +- .../expresssions/nestedVisibility.fir.txt | 6 ++-- .../expresssions/outerMemberAccesses.fir.txt | 2 +- .../expresssions/privateVisibility.fir.txt | 4 +-- .../expresssions/protectedVisibility.fir.txt | 2 +- .../topExtensionVsOuterMember.fir.txt | 2 +- ...RedundantVisibilityModifierChecker.fir.txt | 2 +- .../resolve/fromBuilder/complexTypes.fir.txt | 2 +- .../inlineClassDeclaration.fir.txt | 4 +-- .../inlineClasses/inlineClassMembers.fir.txt | 2 +- .../resolve/innerClasses/inner.fir.txt | 2 +- .../innerTypeFromSuperClassInBody.fir.txt | 2 +- .../resolve/innerClasses/innerTypes.fir.txt | 2 +- .../implicitInLocalClasses.fir.txt | 2 +- .../testData/resolve/objectInnerClass.fir.txt | 10 +++---- .../problems/innerClassHierarchy.fir.txt | 18 ++++++------ .../objectDerivedFromInnerClass.fir.txt | 2 +- .../resolve/throwableSubclass.fir.txt | 4 +-- .../resolve/typeParameterVsNested.fir.txt | 2 +- .../capturedParametersOfInnerClasses.fir.txt | 4 +-- .../visibility/exposedSupertype.fir.txt | 2 +- .../visibility/exposedTypeAlias.fir.txt | 4 +-- .../j+k/KJKComplexHierarchyWithNested.fir.txt | 2 +- .../j+k/outerInnerClasses.fir.txt | 4 +-- .../FirUpperBoundViolatedExpressionChecker.kt | 28 ++++++++++--------- .../kotlin/fir/java/FirJavaFacade.kt | 6 +++- .../converter/DeclarationsConverter.kt | 6 +++- .../kotlin/fir/builder/RawFirBuilder.kt | 5 ++++ .../declarations/complexTypes.lazyBodies.txt | 2 +- .../rawBuilder/declarations/complexTypes.txt | 2 +- .../typeParameterVsNested.lazyBodies.txt | 2 +- .../declarations/typeParameterVsNested.txt | 2 +- .../kotlin/fir/builder/BaseFirBuilder.kt | 8 ++++++ .../resolve/calls/ConstructorProcessing.kt | 3 ++ .../scopes/impl/FirClassSubstitutionScope.kt | 16 +++++++++-- .../org/jetbrains/kotlin/fir/FirRenderer.kt | 10 ++++--- .../loadJava/compiledJava/InnerClass.fir.txt | 2 +- .../InnerClassReferencesOuterTP.fir.txt | 2 +- .../InnerClassTypeMultipleGeneric.fir.txt | 8 +++--- .../InnerClassesInGeneric.fir.txt | 4 +-- .../compiledJava/InnerOfGeneric.fir.txt | 10 +++---- .../MethodReferencesOuterClassTP.fir.txt | 2 +- .../compiledJava/OverrideMethod.fir.txt | 6 ++-- .../compiledJava/PrivateMembers.fir.txt | 2 +- .../compiledJava/RawOverrides.fir.txt | 6 ++-- ...edParameterInInnerClassConstructor.fir.txt | 4 +-- .../annotations/AnnotationRetentions.fir.txt | 8 +++--- .../compiledJava/rendering/Rendering.fir.txt | 10 +++---- .../TypeParameterOfOuterClass.fir.txt | 2 +- .../signaturePropagation/RawSuperType.fir.txt | 2 +- .../RawSuperTypeWithBound.fir.txt | 2 +- .../RawSuperTypeWithRecursiveBound.fir.txt | 2 +- ...thRecursiveBoundMultipleParameters.fir.txt | 2 +- .../ReturnInnerSubclassOfSupersInner.fir.txt | 4 +-- .../static/DeeplyInnerClass.fir.txt | 6 ++-- .../loadJava/compiledJava/static/Enum.fir.txt | 2 +- .../compiledJava/static/InnerClass.fir.txt | 2 +- 65 files changed, 169 insertions(+), 129 deletions(-) diff --git a/analysis/analysis-api/testData/symbols/symbolByReference/constructorViaTypeAlias.txt b/analysis/analysis-api/testData/symbols/symbolByReference/constructorViaTypeAlias.txt index f38c5b92291..443dd363322 100644 --- a/analysis/analysis-api/testData/symbols/symbolByReference/constructorViaTypeAlias.txt +++ b/analysis/analysis-api/testData/symbols/symbolByReference/constructorViaTypeAlias.txt @@ -4,7 +4,7 @@ KtFirConstructorSymbol: annotations: [] callableIdIfNonLocal: null containingClassIdIfNonLocal: java/util/ArrayList - dispatchType: java/util/ArrayList + dispatchType: null hasStableParameterNames: false isExtension: false isPrimary: false diff --git a/analysis/low-level-api-fir/testdata/onAirResolve/classInClass.txt b/analysis/low-level-api-fir/testdata/onAirResolve/classInClass.txt index 58848e01b02..572976b84c2 100644 --- a/analysis/low-level-api-fir/testdata/onAirResolve/classInClass.txt +++ b/analysis/low-level-api-fir/testdata/onAirResolve/classInClass.txt @@ -1,5 +1,5 @@ public final inner [BODY_RESOLVE] class ONAIR : R|X.BASE| { - public [BODY_RESOLVE] constructor(): R|X.ONAIR| { + public [BODY_RESOLVE] X.constructor(): R|X.ONAIR| { super() } diff --git a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt index 6c0453010f8..ab7e31d0786 100644 --- a/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt +++ b/compiler/fir/analysis-tests/testData/enhancement/jsr305/typeQualifierDefault/OverridingDefaultQualifier.fir.txt @@ -22,7 +22,7 @@ @R|javax/annotation/Nullable|() public open fun baz(): R|ft>?, kotlin/collections/List>?>| - public constructor(): R|A.B| + public A.constructor(): R|A.B| } @R|FieldsAreNullable|() public open inner class C : R|kotlin/Any| { @@ -36,7 +36,7 @@ @R|javax/annotation/Nullable|() public open fun baz(): R|ft>?, kotlin/collections/List>?>| - public constructor(): R|A.C| + public A.constructor(): R|A.C| } } diff --git a/compiler/fir/analysis-tests/testData/resolve/callResolution/invokeWithReceiverAndArgument.fir.txt b/compiler/fir/analysis-tests/testData/resolve/callResolution/invokeWithReceiverAndArgument.fir.txt index a5fe0f925bb..840c093867e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/callResolution/invokeWithReceiverAndArgument.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/callResolution/invokeWithReceiverAndArgument.fir.txt @@ -20,7 +20,7 @@ FILE: invokeWithReceiverAndArgument.kt } public final inner class LeafBuilderConfigurationContext : R|AbstractBuilderConfigurator.BuilderConfigurationContext| { - public constructor(): R|AbstractBuilderConfigurator.LeafBuilderConfigurationContext| { + public AbstractBuilderConfigurator.constructor(): R|AbstractBuilderConfigurator.LeafBuilderConfigurationContext| { super() } @@ -44,7 +44,7 @@ FILE: invokeWithReceiverAndArgument.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingProjection.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingProjection.fir.txt index 036ca920f8c..197d8b9c63e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingProjection.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingProjection.fir.txt @@ -68,12 +68,12 @@ FILE: conflictingProjection.kt } public final inner class Intermediate : R|kotlin/Any| { - public constructor(): R|Outer.Intermediate| { + public Outer.constructor(): R|Outer.Intermediate| { super() } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Intermediate.Inner| { + public Outer.Intermediate.constructor(): R|Outer.Intermediate.Inner| { super() } @@ -115,12 +115,12 @@ FILE: conflictingProjection.kt } public final inner class OutIntermediate : R|kotlin/Any| { - public constructor(): R|InOuter.OutIntermediate| { + public InOuter.constructor(): R|InOuter.OutIntermediate| { super() } public final inner class InInner : R|kotlin/Any| { - public constructor(): R|InOuter.OutIntermediate.InInner| { + public InOuter.OutIntermediate.constructor(): R|InOuter.OutIntermediate.InInner| { super() } @@ -162,12 +162,12 @@ FILE: conflictingProjection.kt } public final inner class TwoParametersIntermediate : R|kotlin/Any| { - public constructor(): R|TwoParametersOuter.TwoParametersIntermediate| { + public TwoParametersOuter.constructor(): R|TwoParametersOuter.TwoParametersIntermediate| { super() } public final inner class InInner : R|kotlin/Any| { - public constructor(): R|TwoParametersOuter.TwoParametersIntermediate.InInner| { + public TwoParametersOuter.TwoParametersIntermediate.constructor(): R|TwoParametersOuter.TwoParametersIntermediate.InInner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt index 55e220a6295..b90154d6a59 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/incompatibleModifiers.fir.txt @@ -106,7 +106,7 @@ FILE: incompatibleModifiers.kt } public final inner data class Y : R|kotlin/Any| { - public constructor(i: R|kotlin/Int|): R|X.Y| { + public X.constructor(i: R|kotlin/Int|): R|X.Y| { super() } @@ -120,7 +120,7 @@ FILE: incompatibleModifiers.kt } public sealed inner class Z : R|kotlin/Any| { - protected constructor(): R|X.Z| { + protected X.constructor(): R|X.Z| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/innerQualifier.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/innerQualifier.fir.txt index b01a138d56c..fae13d34b04 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/innerQualifier.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/innerQualifier.fir.txt @@ -5,7 +5,7 @@ FILE: innerQualifier.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/innerWithSuperCompanion.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/innerWithSuperCompanion.fir.txt index 84e38410f01..d395515c7af 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/innerWithSuperCompanion.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/innerWithSuperCompanion.fir.txt @@ -24,7 +24,7 @@ FILE: innerWithSuperCompanion.kt public get(): R|kotlin/String| public final inner class Inner : R|Base| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/localInnerClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/localInnerClass.fir.txt index f6aa7904c00..dacc7c6880c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/localInnerClass.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/localInnerClass.fir.txt @@ -12,7 +12,7 @@ FILE: localInnerClass.kt } local final inner class Derived : R|Foo| { - public constructor(x: R|kotlin/Int|): R|.Derived| { + public .constructor(x: R|kotlin/Int|): R|.Derived| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.fir.txt index ce6b20eb031..cb412c045e2 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/nestedVisibility.fir.txt @@ -12,7 +12,7 @@ FILE: nestedVisibility.kt } private final inner class PrivateInner : R|kotlin/Any| { - public constructor(): R|Outer.PrivateInner| { + public Outer.constructor(): R|Outer.PrivateInner| { super() } @@ -26,7 +26,7 @@ FILE: nestedVisibility.kt } protected final inner class ProtectedInner : R|kotlin/Any| { - public constructor(): R|Outer.ProtectedInner| { + public Outer.constructor(): R|Outer.ProtectedInner| { super() } @@ -40,7 +40,7 @@ FILE: nestedVisibility.kt } public final inner class PublicInner : R|kotlin/Any| { - public constructor(): R|Outer.PublicInner| { + public Outer.constructor(): R|Outer.PublicInner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/outerMemberAccesses.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/outerMemberAccesses.fir.txt index b8078b8094c..ca2b4c1c0f8 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/outerMemberAccesses.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/outerMemberAccesses.fir.txt @@ -22,7 +22,7 @@ FILE: O.kt private get(): R|kotlin/Int| private final inner class Some : R|kotlin/Any| { - public constructor(z: R|kotlin/Boolean|): R|O.Derived.Some| { + public O.Derived.constructor(z: R|kotlin/Boolean|): R|O.Derived.Some| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.fir.txt index a665777ef79..89613c4bc8a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/privateVisibility.fir.txt @@ -17,7 +17,7 @@ FILE: first.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Private.Inner| { + public Private.constructor(): R|Private.Inner| { super() } @@ -76,7 +76,7 @@ FILE: first.kt } local final inner class Inner : R|kotlin/Any| { - public constructor(): R|Local.Inner| { + public Local.constructor(): R|Local.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.fir.txt index f059cc30595..7afc84015d4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/protectedVisibility.fir.txt @@ -13,7 +13,7 @@ FILE: protectedVisibility.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Protected.Inner| { + public Protected.constructor(): R|Protected.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/topExtensionVsOuterMember.fir.txt b/compiler/fir/analysis-tests/testData/resolve/expresssions/topExtensionVsOuterMember.fir.txt index fb71c2bf620..a9387f49eb0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/topExtensionVsOuterMember.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/topExtensionVsOuterMember.fir.txt @@ -12,7 +12,7 @@ FILE: topExtensionVsOuterMember.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt index 2742e68027d..378b79200a7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierChecker.fir.txt @@ -45,7 +45,7 @@ FILE: RedundantVisibilityModifierChecker.kt } internal final inner class B : R|kotlin/Any| { - public constructor(): R|Foo2.B| { + public Foo2.constructor(): R|Foo2.B| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/complexTypes.fir.txt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/complexTypes.fir.txt index 51358c85764..56cf7d1c115 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/complexTypes.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/complexTypes.fir.txt @@ -5,7 +5,7 @@ FILE: complexTypes.kt } public final inner class D : R|kotlin/Any| { - public constructor(): R|a/b/C.D| { + public a/b/C.constructor(): R|a/b/C.D| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.fir.txt b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.fir.txt index 7b129707e5c..59e4dc918cc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.fir.txt @@ -5,7 +5,7 @@ FILE: inlineClassDeclaration.kt } public final inner inline class B : R|kotlin/Any| { - public constructor(x: R|kotlin/Int|): R|A.B| { + public A.constructor(x: R|kotlin/Int|): R|A.B| { super() } @@ -28,7 +28,7 @@ FILE: inlineClassDeclaration.kt } public final inner inline class D : R|kotlin/Any| { - public constructor(x: R|kotlin/Int|): R|A.D| { + public A.constructor(x: R|kotlin/Int|): R|A.D| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.fir.txt b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.fir.txt index 603f1d7c987..7e0ebef626e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.fir.txt @@ -91,7 +91,7 @@ FILE: inlineClassMembers.kt public get(): R|kotlin/String| public final inner class Inner : R|kotlin/Any| { - public constructor(): R|WithInner.Inner| { + public WithInner.constructor(): R|WithInner.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.fir.txt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.fir.txt index c97bebb206f..cc60118d59e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/inner.fir.txt @@ -18,7 +18,7 @@ FILE: inner.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Owner.Inner| { + public Owner.constructor(): R|Owner.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypeFromSuperClassInBody.fir.txt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypeFromSuperClassInBody.fir.txt index 972aca97d6d..596a06bff3f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypeFromSuperClassInBody.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypeFromSuperClassInBody.fir.txt @@ -5,7 +5,7 @@ FILE: innerTypeFromSuperClassInBody.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|A.Inner| { + public A.constructor(): R|A.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.fir.txt b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.fir.txt index 39cb646bd3f..1ea13151de6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/innerClasses/innerTypes.fir.txt @@ -5,7 +5,7 @@ FILE: innerTypes.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/localClasses/implicitInLocalClasses.fir.txt b/compiler/fir/analysis-tests/testData/resolve/localClasses/implicitInLocalClasses.fir.txt index d0db2e444f0..864350d4110 100644 --- a/compiler/fir/analysis-tests/testData/resolve/localClasses/implicitInLocalClasses.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/localClasses/implicitInLocalClasses.fir.txt @@ -49,7 +49,7 @@ FILE: implicitInLocalClasses.kt public get(): R|B.Inner| local final inner class Inner : R|kotlin/Any| { - public constructor(): R|B.Inner| { + public B.constructor(): R|B.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/objectInnerClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/objectInnerClass.fir.txt index cba01380f35..5a33ad11176 100644 --- a/compiler/fir/analysis-tests/testData/resolve/objectInnerClass.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/objectInnerClass.fir.txt @@ -5,7 +5,7 @@ FILE: objectInnerClass.kt } local final inner class Child : R|.Base| { - public constructor(property: R|B|): R|.Child| { + public .constructor(property: R|B|): R|.Child| { this@R|/|.super.Base|>(R|/property|) } @@ -31,7 +31,7 @@ FILE: objectInnerClass.kt } local open inner class Base : R|kotlin/Any| { - public constructor(property: R|B|): R|.Base| { + public .constructor(property: R|B|): R|.Base| { super() } @@ -92,7 +92,7 @@ FILE: objectInnerClass.kt } public open inner class Base : R|kotlin/Any| { - public constructor(property: R|B|): R|Case2.Base| { + public Case2.constructor(property: R|B|): R|Case2.Base| { super() } @@ -130,7 +130,7 @@ FILE: objectInnerClass.kt } local final inner class Child : R|Case3..Base| { - public constructor(property: R|B|): R|Case3..Child| { + public .constructor(property: R|B|): R|Case3..Child| { this@R|/|.super.Base|>(R|/property|) } @@ -156,7 +156,7 @@ FILE: objectInnerClass.kt } local open inner class Base : R|kotlin/Any| { - public constructor(property: R|B|): R|Case3..Base| { + public .constructor(property: R|B|): R|Case3..Base| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.fir.txt b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.fir.txt index 67021dccdf9..07009091488 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/innerClassHierarchy.fir.txt @@ -5,7 +5,7 @@ FILE: innerClassHierarchy.kt } public open inner class Inner : R|kotlin/Any| { - public constructor(): R|Base.Inner| { + public Base.constructor(): R|Base.Inner| { super() } @@ -18,17 +18,17 @@ FILE: innerClassHierarchy.kt } public final inner class InnerDerived : R|Base.Inner| { - public constructor(): R|Derived.InnerDerived| { + public Derived.constructor(): R|Derived.InnerDerived| { this@R|/Derived|.super() } public final inner class VeryInner : R|Base.Inner| { - public constructor(): R|Derived.InnerDerived.VeryInner| { + public Derived.InnerDerived.constructor(): R|Derived.InnerDerived.VeryInner| { this@R|/Derived|.super() } public final inner class VeryVeryInner : R|Base.Inner| { - public constructor(): R|Derived.InnerDerived.VeryInner.VeryVeryInner| { + public Derived.InnerDerived.VeryInner.constructor(): R|Derived.InnerDerived.VeryInner.VeryVeryInner| { this@R|/Derived|.super() } @@ -48,35 +48,35 @@ FILE: innerClassHierarchy.kt public get(): R|kotlin/String| public open inner class B : R|A| { - public constructor(s: R|kotlin/String|): R|A.B| { + public A.constructor(s: R|kotlin/String|): R|A.B| { super(R|/s|) } } public open inner class C : R|A.B| { - public constructor(s: R|kotlin/String|, additional: R|kotlin/Double|): R|A.C| { + public A.constructor(s: R|kotlin/String|, additional: R|kotlin/Double|): R|A.C| { this@R|/A|.super(R|/s|) } } public open inner class D : R|A.C| { - public constructor(other: R|kotlin/Int|, another: R|kotlin/Long|, s: R|kotlin/String|): R|A.D| { + public A.constructor(other: R|kotlin/Int|, another: R|kotlin/Long|, s: R|kotlin/String|): R|A.D| { this@R|/A|.super(R|/s|, R|/another|.R|kotlin/Long.toDouble|()) } } public open inner class E : R|A.D| { - public constructor(): R|A.E| { + public A.constructor(): R|A.E| { this@R|/A|.super(Int(0), Long(42), String(OK)) } } public final inner class F : R|A.E| { - public constructor(): R|A.F| { + public A.constructor(): R|A.F| { this@R|/A|.super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt index 55e079b8843..1f60d04a326 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/objectDerivedFromInnerClass.fir.txt @@ -5,7 +5,7 @@ FILE: objectDerivedFromInnerClass.kt } public final inner class Inner : R|kotlin/Any| { - public constructor(): R|Outer.Inner| { + public Outer.constructor(): R|Outer.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/throwableSubclass.fir.txt b/compiler/fir/analysis-tests/testData/resolve/throwableSubclass.fir.txt index d5df7c45fa8..e15a7fece5c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/throwableSubclass.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/throwableSubclass.fir.txt @@ -5,7 +5,7 @@ FILE: throwableSubclass.kt } public final inner class Test2 : R|kotlin/Throwable| { - public constructor(): R|Test1.Test2| { + public Test1.constructor(): R|Test1.Test2| { super() } @@ -32,7 +32,7 @@ FILE: throwableSubclass.kt } public final inner class Test6 : R|kotlin/Exception| { - public constructor(): R|Test5.Test6| { + public Test5.constructor(): R|Test5.Test6| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.fir.txt b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.fir.txt index 848d07d7874..a59735cea2e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/typeParameterVsNested.fir.txt @@ -7,7 +7,7 @@ FILE: typeParameterVsNested.kt } public final inner class T : R|kotlin/Any| { - public constructor(): R|test/My.T| { + public test/My.constructor(): R|test/My.T| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.fir.txt b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.fir.txt index 75eb3f942f9..4e860d75251 100644 --- a/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/types/capturedParametersOfInnerClasses.fir.txt @@ -5,12 +5,12 @@ FILE: capturedParametersOfInnerClasses.kt } public final inner class B : R|kotlin/Any| { - public constructor(): R|A.B| { + public A.constructor(): R|A.B| { super() } public final inner class C : R|kotlin/Any| { - public constructor(): R|A.B.C| { + public A.B.constructor(): R|A.B.C| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.fir.txt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.fir.txt index 2728e89207e..65502ac1513 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedSupertype.fir.txt @@ -24,7 +24,7 @@ FILE: exposedSupertype.kt } public final inner class BInner : R|kotlin/Any| { - public constructor(): R|B.BInner| { + public B.constructor(): R|B.BInner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.fir.txt b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.fir.txt index f59921d478f..9eb1e176cc0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/visibility/exposedTypeAlias.fir.txt @@ -5,7 +5,7 @@ FILE: exposedTypeAlias.kt } private final inner class Inner : R|kotlin/Any| { - public constructor(): R|A.Inner| { + public A.constructor(): R|A.Inner| { super() } @@ -20,7 +20,7 @@ FILE: exposedTypeAlias.kt public final typealias AInner = R|A.Inner| public final inner class Inner : R|kotlin/Any| { - public constructor(): R|B.Inner| { + public B.constructor(): R|B.Inner| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.fir.txt index db63047f8c3..e336e41e4bc 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.fir.txt @@ -25,7 +25,7 @@ FILE: K3.kt } public open inner class NestedInSuperClass : R|kotlin/Any| { - public constructor(): R|SuperClass.NestedInSuperClass| { + public SuperClass.constructor(): R|SuperClass.NestedInSuperClass| { super() } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/outerInnerClasses.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/outerInnerClasses.fir.txt index 0317b209b38..53f4495706d 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/outerInnerClasses.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/outerInnerClasses.fir.txt @@ -5,7 +5,7 @@ FILE: K1.kt } public open inner class KotlinInner : R|kotlin/Any| { - public constructor(): R|KotlinOuter.KotlinInner| { + public KotlinOuter.constructor(): R|KotlinOuter.KotlinInner| { super() } @@ -30,7 +30,7 @@ FILE: K2.kt } public final inner class K3 : R|J1.J2| { - public constructor(): R|K2.K3| { + public K2.constructor(): R|K2.K3| { this@R|/K2|.super() } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt index 8bf24153be8..e2c229885e7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirUpperBoundViolatedExpressionChecker.kt @@ -9,19 +9,17 @@ import org.jetbrains.kotlin.fir.analysis.checkers.FirTypeRefSource import org.jetbrains.kotlin.fir.analysis.checkers.checkUpperBoundViolated import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter -import org.jetbrains.kotlin.fir.declarations.FirConstructor import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.expressions.toResolvedCallableSymbol import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError +import org.jetbrains.kotlin.fir.resolve.calls.isTypeAliasedConstructor import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableWrongReceiver import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol +import org.jetbrains.kotlin.fir.symbols.impl.FirTypeParameterSymbol +import org.jetbrains.kotlin.fir.types.FirTypeProjection import org.jetbrains.kotlin.fir.types.FirTypeProjectionWithVariance -import org.jetbrains.kotlin.fir.types.toSymbol -import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability object FirUpperBoundViolatedExpressionChecker : FirQualifiedAccessExpressionChecker() { override fun check(expression: FirQualifiedAccessExpression, context: CheckerContext, reporter: DiagnosticReporter) { @@ -40,16 +38,20 @@ object FirUpperBoundViolatedExpressionChecker : FirQualifiedAccessExpressionChec calleeSymbol = calleReference.candidateSymbol as? FirCallableSymbol<*> } - var typeArguments: List? = null - var typeArgumentRefsAndSources: List? = null - val typeParameters = if (calleeSymbol is FirConstructorSymbol) { - typeArgumentRefsAndSources = - expression.typeArguments.map { FirTypeRefSource((it as? FirTypeProjectionWithVariance)?.typeRef, it.source) } - val prototypeClass = calleeSymbol.dispatchReceiverType?.toSymbol(context.session) as? FirRegularClassSymbol - prototypeClass?.typeParameterSymbols + val typeArguments: List? + val typeArgumentRefsAndSources: List? + val typeParameters: List? + + if (calleeSymbol is FirConstructorSymbol && calleeSymbol.isTypeAliasedConstructor) { + typeArguments = null + typeArgumentRefsAndSources = expression.typeArguments.map { + FirTypeRefSource((it as? FirTypeProjectionWithVariance)?.typeRef, it.source) + } + typeParameters = null } else { typeArguments = expression.typeArguments - calleeSymbol?.typeParameterSymbols + typeArgumentRefsAndSources = null + typeParameters = calleeSymbol?.typeParameterSymbols } checkUpperBoundViolated( diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaFacade.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaFacade.kt index 8169ca02cbc..3cfeadd53ae 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaFacade.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/FirJavaFacade.kt @@ -247,7 +247,8 @@ class FirJavaFacade( javaClass, ownerClassBuilder = this, classTypeParameters, - javaTypeParameterStack + javaTypeParameterStack, + parentClassSymbol, ) } for (javaConstructor in javaClassDeclaredConstructors) { @@ -258,6 +259,7 @@ class FirJavaFacade( ownerClassBuilder = this, classTypeParameters, javaTypeParameterStack, + parentClassSymbol, ) } @@ -440,6 +442,7 @@ class FirJavaFacade( ownerClassBuilder: FirJavaClassBuilder, classTypeParameters: List, javaTypeParameterStack: JavaTypeParameterStack, + outerClassSymbol: FirRegularClassSymbol?, ): FirJavaConstructor { val constructorSymbol = FirConstructorSymbol(constructorId) return buildJavaConstructor { @@ -464,6 +467,7 @@ class FirJavaFacade( returnTypeRef = buildResolvedTypeRef { type = ownerClassBuilder.buildSelfTypeRef() } + dispatchReceiverType = if (isThisInner) outerClassSymbol?.defaultType() else null typeParameters += classTypeParameters.map { buildConstructedClassTypeParameterRef { symbol = it.symbol } } if (javaConstructor != null) { diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index d39e7bde2fd..4e595ae2b8e 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -39,7 +39,6 @@ import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier import org.jetbrains.kotlin.fir.references.builder.buildExplicitSuperReference import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference -import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations import org.jetbrains.kotlin.fir.scopes.FirScopeProvider import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.* @@ -843,6 +842,7 @@ class DeclarationsConverter( moduleData = baseModuleData origin = FirDeclarationOrigin.Source returnTypeRef = classWrapper.delegatedSelfTypeRef + dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() this.status = status symbol = FirConstructorSymbol(callableIdForClassConstructor()) annotations += modifiers.annotations @@ -911,6 +911,7 @@ class DeclarationsConverter( moduleData = baseModuleData origin = FirDeclarationOrigin.Source returnTypeRef = delegatedSelfTypeRef + dispatchReceiverType = classWrapper.obtainDispatchReceiverForConstructor() this.status = status symbol = FirConstructorSymbol(callableIdForClassConstructor()) delegatedConstructor = constructorDelegationCall @@ -928,6 +929,9 @@ class DeclarationsConverter( } } + private fun ClassWrapper.obtainDispatchReceiverForConstructor(): ConeClassLikeType? = + if (isInner()) dispatchReceiverForInnerClassConstructor() else null + /** * @see org.jetbrains.kotlin.fir.builder.RawFirBuilder.Visitor.convert( * KtConstructorDelegationCall, FirTypeRef, Boolean) diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 6e8f598e026..2d494300c4e 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -847,6 +847,7 @@ open class RawFirBuilder( origin = FirDeclarationOrigin.Source returnTypeRef = delegatedSelfTypeRef this.status = status + dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() symbol = FirConstructorSymbol(callableIdForClassConstructor()) delegatedConstructor = firDelegatedCall typeParameters += constructorTypeParametersFromConstructedClass(ownerTypeParameters) @@ -858,6 +859,9 @@ open class RawFirBuilder( } } + private fun KtClassOrObject.obtainDispatchReceiverForConstructor(): ConeClassLikeType? = + if (hasModifier(INNER_KEYWORD)) dispatchReceiverForInnerClassConstructor() else null + override fun visitKtFile(file: KtFile, data: Unit): FirElement { context.packageFqName = if (psiMode == PsiHandlingMode.COMPILER) file.packageFqNameByTree else file.packageFqName return buildFile { @@ -1388,6 +1392,7 @@ open class RawFirBuilder( isFromSealedClass = owner.hasModifier(SEALED_KEYWORD) && explicitVisibility !== Visibilities.Private isFromEnumClass = owner.hasModifier(ENUM_KEYWORD) } + dispatchReceiverType = owner.obtainDispatchReceiverForConstructor() symbol = FirConstructorSymbol(callableIdForClassConstructor()) delegatedConstructor = getDelegationCall().convert( delegatedSuperTypeRef, diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.lazyBodies.txt index 421e8eb7b9c..352a2639829 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.lazyBodies.txt @@ -5,7 +5,7 @@ FILE: complexTypes.kt } public? final? inner class D : R|kotlin/Any| { - public? constructor(): R|a/b/C.D| { + public? a/b/C.constructor(): R|a/b/C.D| { super() } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.txt index 5b58c434dd3..ce0b1a941ec 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.txt @@ -5,7 +5,7 @@ FILE: complexTypes.kt } public? final? inner class D : R|kotlin/Any| { - public? [ContainingClassKey=D] constructor(): R|a/b/C.D| { + public? [ContainingClassKey=D] a/b/C.constructor(): R|a/b/C.D| { super() } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.lazyBodies.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.lazyBodies.txt index a44528deb24..b7517eb9e14 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.lazyBodies.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.lazyBodies.txt @@ -7,7 +7,7 @@ FILE: typeParameterVsNested.kt } public? final? inner class T : R|kotlin/Any| { - public? constructor(): R|test/My.T| { + public? test/My.constructor(): R|test/My.T| { super() } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.txt index 02883808ff4..2ae5fe4b5a0 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.txt @@ -7,7 +7,7 @@ FILE: typeParameterVsNested.kt } public? final? inner class T : R|kotlin/Any| { - public? [ContainingClassKey=T] constructor(): R|test/My.T| { + public? [ContainingClassKey=T] test/My.constructor(): R|test/My.T| { super() } diff --git a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index d39af63ecc3..46a50831fff 100644 --- a/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/raw-fir/raw-fir.common/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -131,6 +131,14 @@ abstract class BaseFirBuilder(val baseSession: FirSession, val context: Conte fun currentDispatchReceiverType(): ConeClassLikeType? = currentDispatchReceiverType(context) + /** + * @return second from the end dispatch receiver. For the inner class constructor it would be the outer class. + */ + protected fun dispatchReceiverForInnerClassConstructor(): ConeClassLikeType? { + val dispatchReceivers = context.dispatchReceiverTypesStack + return dispatchReceivers.getOrNull(dispatchReceivers.lastIndex - 1) + } + fun callableIdForClassConstructor() = if (context.className == FqName.ROOT) CallableId(context.packageFqName, Name.special("")) else CallableId(context.packageFqName, context.className, context.className.shortName()) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt index bd2480019c8..5c34b391bcc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ConstructorProcessing.kt @@ -260,3 +260,6 @@ private class TypeAliasConstructorsSubstitutingScope( private object TypeAliasConstructorKey : FirDeclarationDataKey() var FirConstructor.originalConstructorIfTypeAlias: FirConstructor? by FirDeclarationDataRegistry.data(TypeAliasConstructorKey) + +val FirConstructorSymbol.isTypeAliasedConstructor: Boolean + get() = fir.originalConstructorIfTypeAlias != null diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt index e8ee2feb020..9d4282605de 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassSubstitutionScope.kt @@ -175,6 +175,12 @@ class FirClassSubstitutionScope( val constructor = original.fir val (newTypeParameters, _, _, newReturnType, newSubstitutor, fakeOverrideSubstitution) = createSubstitutedData(constructor) + + // If constructor has a dispatch receiver, it should be an inner class' constructor. + // It means that we need to substitute its dispatcher as every other type, + // instead of using dispatchReceiverTypeForSubstitutedMembers + val newDispatchReceiverType = original.dispatchReceiverType?.substitute(substitutor) + val newParameterTypes = constructor.valueParameters.map { it.returnTypeRef.coneType.substitute(newSubstitutor) } @@ -185,8 +191,14 @@ class FirClassSubstitutionScope( return FirFakeOverrideGenerator.createSubstitutionOverrideConstructor( FirConstructorSymbol(original.callableId), - session, constructor, dispatchReceiverTypeForSubstitutedMembers, - newReturnType, newParameterTypes, newTypeParameters, makeExpect, fakeOverrideSubstitution + session, + constructor, + newDispatchReceiverType, + newReturnType, + newParameterTypes, + newTypeParameters, + makeExpect, + fakeOverrideSubstitution ).symbol } diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt index c3f9267cc49..beadd86f716 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/FirRenderer.kt @@ -20,10 +20,7 @@ import org.jetbrains.kotlin.fir.expressions.impl.* import org.jetbrains.kotlin.fir.references.* import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol +import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.visitors.FirVisitorVoid import org.jetbrains.kotlin.name.Name @@ -568,6 +565,11 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM print("actual ") } constructor.renderDeclarationData() + + constructor.dispatchReceiverType?.let { + print(it.render()) + print(".") + } print("constructor") constructor.typeParameters.renderTypeParameters() constructor.valueParameters.renderParameters() diff --git a/compiler/testData/loadJava/compiledJava/InnerClass.fir.txt b/compiler/testData/loadJava/compiledJava/InnerClass.fir.txt index af715732a90..f4ea2669a71 100644 --- a/compiler/testData/loadJava/compiledJava/InnerClass.fir.txt +++ b/compiler/testData/loadJava/compiledJava/InnerClass.fir.txt @@ -2,7 +2,7 @@ public open class InnerClass : R|kotlin/Any| { public constructor(): R|test/InnerClass| public open inner class Inner : R|kotlin/Any| { - public constructor(): R|test/InnerClass.Inner| + public test/InnerClass.constructor(): R|test/InnerClass.Inner| } } diff --git a/compiler/testData/loadJava/compiledJava/InnerClassReferencesOuterTP.fir.txt b/compiler/testData/loadJava/compiledJava/InnerClassReferencesOuterTP.fir.txt index 7a148f113a3..bb3a3ccf194 100644 --- a/compiler/testData/loadJava/compiledJava/InnerClassReferencesOuterTP.fir.txt +++ b/compiler/testData/loadJava/compiledJava/InnerClassReferencesOuterTP.fir.txt @@ -2,7 +2,7 @@ public open class InnerClassReferencesOuterTP

| public constructor

|>(): R|test/InnerClassReferencesOuterTP

| public open inner class Inner|, P : R|ft|> : R|kotlin/Any| { - public constructor|>(): R|test/InnerClassReferencesOuterTP.Inner| + public test/InnerClassReferencesOuterTP

.constructor|>(): R|test/InnerClassReferencesOuterTP.Inner| } } diff --git a/compiler/testData/loadJava/compiledJava/InnerClassTypeMultipleGeneric.fir.txt b/compiler/testData/loadJava/compiledJava/InnerClassTypeMultipleGeneric.fir.txt index 3dc72604bea..e3855274667 100644 --- a/compiler/testData/loadJava/compiledJava/InnerClassTypeMultipleGeneric.fir.txt +++ b/compiler/testData/loadJava/compiledJava/InnerClassTypeMultipleGeneric.fir.txt @@ -4,20 +4,20 @@ public open class InnerClassTypeMultipleGeneric : R|kotlin/Any| { public constructor(): R|test/InnerClassTypeMultipleGeneric| public open inner class BaseOuter

|, H2 : R|ft|> : R|kotlin/Any| { - public constructor

|, H2 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.BaseOuter| + public test/InnerClassTypeMultipleGeneric.constructor

|, H2 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.BaseOuter| public abstract inner class BaseInner

|, H4 : R|ft|, H1 : R|ft|, H2 : R|ft|> : R|kotlin/Any| { - public constructor

|, H4 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.BaseOuter.BaseInner| + public test/InnerClassTypeMultipleGeneric.BaseOuter.constructor

|, H4 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.BaseOuter.BaseInner| } } public open inner class Outer|, E2 : R|ft|> : R|test/InnerClassTypeMultipleGeneric.BaseOuter, ft>| { public open fun bar(): R|ft, java/lang/Class<*>?>, ft, ft, ft>, test/InnerClassTypeMultipleGeneric.BaseOuter.BaseInner, java/lang/Class<*>?>, ft, ft, ft>?>| - public constructor|, E2 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.Outer| + public test/InnerClassTypeMultipleGeneric.constructor|, E2 : R|ft|>(): R|test/InnerClassTypeMultipleGeneric.Outer| public open inner class Inner|, E1 : R|ft|, E2 : R|ft|> : R|test/InnerClassTypeMultipleGeneric.BaseOuter.BaseInner, ft, ft, ft>| { - public constructor|>(): R|test/InnerClassTypeMultipleGeneric.Outer.Inner| + public test/InnerClassTypeMultipleGeneric.Outer.constructor|>(): R|test/InnerClassTypeMultipleGeneric.Outer.Inner| } } diff --git a/compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.fir.txt b/compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.fir.txt index d85102e27b5..a27bbcb237b 100644 --- a/compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.fir.txt +++ b/compiler/testData/loadJava/compiledJava/InnerClassesInGeneric.fir.txt @@ -2,13 +2,13 @@ public open class InnerClassesInGeneric

|, Q : public constructor

|, Q : R|ft|>(): R|test/InnerClassesInGeneric| public open inner class Inner

|, Q : R|ft|> : R|kotlin/Any| { - public constructor(): R|test/InnerClassesInGeneric.Inner| + public test/InnerClassesInGeneric.constructor(): R|test/InnerClassesInGeneric.Inner| } public open inner class Inner2

|, Q : R|ft|> : R|test/InnerClassesInGeneric.Inner, ft>| { public open operator fun iterator(): R|ft>, kotlin/collections/Iterator>?>| - public constructor(): R|test/InnerClassesInGeneric.Inner2| + public test/InnerClassesInGeneric.constructor(): R|test/InnerClassesInGeneric.Inner2| } } diff --git a/compiler/testData/loadJava/compiledJava/InnerOfGeneric.fir.txt b/compiler/testData/loadJava/compiledJava/InnerOfGeneric.fir.txt index 77e441ae5b5..61863a44650 100644 --- a/compiler/testData/loadJava/compiledJava/InnerOfGeneric.fir.txt +++ b/compiler/testData/loadJava/compiledJava/InnerOfGeneric.fir.txt @@ -2,27 +2,27 @@ public open class InnerOfGeneric : R|kotlin/Any| { public constructor(): R|test/InnerOfGeneric| public abstract inner class A|> : R|kotlin/Any| { - public constructor|>(): R|test/InnerOfGeneric.A| + public test/InnerOfGeneric.constructor|>(): R|test/InnerOfGeneric.A| public abstract inner class Inner|> : R|test/InnerOfGeneric.S>| { - public constructor(): R|test/InnerOfGeneric.A.Inner| + public test/InnerOfGeneric.A.constructor(): R|test/InnerOfGeneric.A.Inner| } } public open inner class B|> : R|test/InnerOfGeneric.A>| { - public constructor|>(): R|test/InnerOfGeneric.B| + public test/InnerOfGeneric.constructor|>(): R|test/InnerOfGeneric.B| public open inner class SubInner|> : R|test/InnerOfGeneric.A.Inner>| { @R|java/lang/Override|() public open operator fun iterator(): R|ft>, kotlin/collections/Iterator>?>| - public constructor(): R|test/InnerOfGeneric.B.SubInner| + public test/InnerOfGeneric.B.constructor(): R|test/InnerOfGeneric.B.SubInner| } } public open inner class S|> : R|kotlin/Any| { public open operator fun iterator(): R|ft>, kotlin/collections/Iterator>?>| - public constructor|>(): R|test/InnerOfGeneric.S| + public test/InnerOfGeneric.constructor|>(): R|test/InnerOfGeneric.S| } } diff --git a/compiler/testData/loadJava/compiledJava/MethodReferencesOuterClassTP.fir.txt b/compiler/testData/loadJava/compiledJava/MethodReferencesOuterClassTP.fir.txt index 17e2aab9d28..6d5e54104fc 100644 --- a/compiler/testData/loadJava/compiledJava/MethodReferencesOuterClassTP.fir.txt +++ b/compiler/testData/loadJava/compiledJava/MethodReferencesOuterClassTP.fir.txt @@ -4,7 +4,7 @@ public final class MethodReferencesOuterClassTP

|> : R|kotlin/Any| { public final fun |> f(): R|kotlin/Unit| - public constructor(): R|test/MethodReferencesOuterClassTP.Inner

| + public test/MethodReferencesOuterClassTP

.constructor(): R|test/MethodReferencesOuterClassTP.Inner

| } } diff --git a/compiler/testData/loadJava/compiledJava/OverrideMethod.fir.txt b/compiler/testData/loadJava/compiledJava/OverrideMethod.fir.txt index 7cfab709a60..dbb0e12e861 100644 --- a/compiler/testData/loadJava/compiledJava/OverrideMethod.fir.txt +++ b/compiler/testData/loadJava/compiledJava/OverrideMethod.fir.txt @@ -6,7 +6,7 @@ public open class OverrideMethod : R|kotlin/Any| { public/*package*/ open fun bar(): R|kotlin/Unit| - public/*package*/ constructor(): R|test/OverrideMethod.Base| + public/*package*/ test/OverrideMethod.constructor(): R|test/OverrideMethod.Base| } public/*package*/ open inner class Derived : R|test/OverrideMethod.Base| { @@ -14,13 +14,13 @@ public open class OverrideMethod : R|kotlin/Any| { public/*package*/ open fun baz(): R|kotlin/Unit| - public/*package*/ constructor(): R|test/OverrideMethod.Derived| + public/*package*/ test/OverrideMethod.constructor(): R|test/OverrideMethod.Derived| } public/*package*/ open inner class SuperBase : R|kotlin/Any| { public/*package*/ open fun quux(x: R|kotlin/Int|): R|kotlin/Unit| - public/*package*/ constructor(): R|test/OverrideMethod.SuperBase| + public/*package*/ test/OverrideMethod.constructor(): R|test/OverrideMethod.SuperBase| } } diff --git a/compiler/testData/loadJava/compiledJava/PrivateMembers.fir.txt b/compiler/testData/loadJava/compiledJava/PrivateMembers.fir.txt index dec2608cfeb..da1f44d9003 100644 --- a/compiler/testData/loadJava/compiledJava/PrivateMembers.fir.txt +++ b/compiler/testData/loadJava/compiledJava/PrivateMembers.fir.txt @@ -10,7 +10,7 @@ public open class PrivateMembers : R|kotlin/Any| { private constructor(): R|test/PrivateMembers| private open inner class Inner : R|kotlin/Any| { - private constructor(): R|test/PrivateMembers.Inner| + private test/PrivateMembers.constructor(): R|test/PrivateMembers.Inner| } private open class Nested : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt b/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt index 11072a43f04..56b0be92532 100644 --- a/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt +++ b/compiler/testData/loadJava/compiledJava/RawOverrides.fir.txt @@ -8,13 +8,13 @@ public open class RawOverrides : R|kotlin/Any| { public open inner class B : R|kotlin/Any|, R|test/RawOverrides.A>| { @R|java/lang/Override|() public open fun foo(x: R|ft|, y: R|ft, kotlin/collections/List<*>?>|): R|ft| - public constructor(): R|test/RawOverrides.B| + public test/RawOverrides.constructor(): R|test/RawOverrides.B| } public open inner class C : R|kotlin/Any| { public/*package*/ open fun |, F : R|ft|> bar(x: R|ft|, y: R|ft, ft>, kotlin/collections/Map, ft>?>>, kotlin/collections/List, ft>, kotlin/collections/Map, ft>?>>?>|): R|ft| - public constructor(): R|test/RawOverrides.C| + public test/RawOverrides.constructor(): R|test/RawOverrides.C| } public open inner class D : R|test/RawOverrides.C| { @@ -22,7 +22,7 @@ public open class RawOverrides : R|kotlin/Any| { public/*package*/ open fun |, F : R|ft|> bar(x: R|ft|, y: R|ft, ft>, kotlin/collections/Map, ft>?>>, kotlin/collections/List, ft>, kotlin/collections/Map, ft>?>>?>|): R|ft| - public constructor(): R|test/RawOverrides.D| + public test/RawOverrides.constructor(): R|test/RawOverrides.D| } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/AnnotatedParameterInInnerClassConstructor.fir.txt b/compiler/testData/loadJava/compiledJava/annotations/AnnotatedParameterInInnerClassConstructor.fir.txt index c6156456ffe..155233ccc86 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/AnnotatedParameterInInnerClassConstructor.fir.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/AnnotatedParameterInInnerClassConstructor.fir.txt @@ -6,11 +6,11 @@ public/*package*/ open class AnnotatedParameterInInnerClassConstructor : R|kotli } public/*package*/ open inner class Inner : R|kotlin/Any| { - public/*package*/ constructor(@R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(a)) a: R|ft|, @R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(b)) b: R|ft|): R|test/AnnotatedParameterInInnerClassConstructor.Inner| + public/*package*/ test/AnnotatedParameterInInnerClassConstructor.constructor(@R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(a)) a: R|ft|, @R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(b)) b: R|ft|): R|test/AnnotatedParameterInInnerClassConstructor.Inner| } public/*package*/ open inner class InnerGeneric|> : R|kotlin/Any| { - public/*package*/ constructor|>(@R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(a)) a: R|ft|, @R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(b)) b: R|ft|): R|test/AnnotatedParameterInInnerClassConstructor.InnerGeneric| + public/*package*/ test/AnnotatedParameterInInnerClassConstructor.constructor|>(@R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(a)) a: R|ft|, @R|test/AnnotatedParameterInInnerClassConstructor.Anno|(value = String(b)) b: R|ft|): R|test/AnnotatedParameterInInnerClassConstructor.InnerGeneric| } } diff --git a/compiler/testData/loadJava/compiledJava/annotations/AnnotationRetentions.fir.txt b/compiler/testData/loadJava/compiledJava/annotations/AnnotationRetentions.fir.txt index 0dfda9afa75..1b318a1bee9 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/AnnotationRetentions.fir.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/AnnotationRetentions.fir.txt @@ -6,7 +6,7 @@ public open class AnnotationRetentions : R|kotlin/Any| { } @R|test/AnnotationRetentions.BaseAnnotation|() public/*package*/ open inner class BaseClass : R|kotlin/Any| { - public/*package*/ constructor(): R|test/AnnotationRetentions.BaseClass| + public/*package*/ test/AnnotationRetentions.constructor(): R|test/AnnotationRetentions.BaseClass| } @R|kotlin/annotation/Retention|(value = R|kotlin/annotation/AnnotationRetention.BINARY|()) public final annotation class BinaryAnnotation : R|kotlin/Annotation| { @@ -14,7 +14,7 @@ public open class AnnotationRetentions : R|kotlin/Any| { } @R|test/AnnotationRetentions.BinaryAnnotation|() public/*package*/ open inner class BinaryClass : R|kotlin/Any| { - public/*package*/ constructor(): R|test/AnnotationRetentions.BinaryClass| + public/*package*/ test/AnnotationRetentions.constructor(): R|test/AnnotationRetentions.BinaryClass| } @R|kotlin/annotation/Retention|(value = R|kotlin/annotation/AnnotationRetention.RUNTIME|()) public final annotation class RuntimeAnnotation : R|kotlin/Annotation| { @@ -22,7 +22,7 @@ public open class AnnotationRetentions : R|kotlin/Any| { } @R|test/AnnotationRetentions.RuntimeAnnotation|() public/*package*/ open inner class RuntimeClass : R|kotlin/Any| { - public/*package*/ constructor(): R|test/AnnotationRetentions.RuntimeClass| + public/*package*/ test/AnnotationRetentions.constructor(): R|test/AnnotationRetentions.RuntimeClass| } @R|kotlin/annotation/Retention|(value = R|kotlin/annotation/AnnotationRetention.SOURCE|()) public final annotation class SourceAnnotation : R|kotlin/Annotation| { @@ -30,7 +30,7 @@ public open class AnnotationRetentions : R|kotlin/Any| { } @R|test/AnnotationRetentions.SourceAnnotation|() public/*package*/ open inner class SourceClass : R|kotlin/Any| { - public/*package*/ constructor(): R|test/AnnotationRetentions.SourceClass| + public/*package*/ test/AnnotationRetentions.constructor(): R|test/AnnotationRetentions.SourceClass| } } diff --git a/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt b/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt index 7dcb59d0fbf..5fe8611109e 100644 --- a/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt +++ b/compiler/testData/loadJava/compiledJava/rendering/Rendering.fir.txt @@ -2,23 +2,23 @@ public open class Rendering : R|kotlin/Any| { public constructor(): R|test/Rendering| public/*package*/ open inner class A_Plain : R|kotlin/Any| { - public/*package*/ constructor(): R|test/Rendering.A_Plain| + public/*package*/ test/Rendering.constructor(): R|test/Rendering.A_Plain| } public/*package*/ open inner class B_Super : R|kotlin/Any| { - public/*package*/ constructor(): R|test/Rendering.B_Super| + public/*package*/ test/Rendering.constructor(): R|test/Rendering.B_Super| } public/*package*/ open inner class C_Sub : R|test/Rendering.B_Super| { - public/*package*/ constructor(): R|test/Rendering.C_Sub| + public/*package*/ test/Rendering.constructor(): R|test/Rendering.C_Sub| } public/*package*/ open inner class D_SuperG|> : R|kotlin/Any| { - public/*package*/ constructor|>(): R|test/Rendering.D_SuperG| + public/*package*/ test/Rendering.constructor|>(): R|test/Rendering.D_SuperG| } public/*package*/ open inner class E_SubG : R|test/Rendering.D_SuperG>| { - public/*package*/ constructor(): R|test/Rendering.E_SubG| + public/*package*/ test/Rendering.constructor(): R|test/Rendering.E_SubG| } public/*package*/ abstract interface F_Array : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.fir.txt b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.fir.txt index 4f358afbb66..9b094cfa2aa 100644 --- a/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.fir.txt +++ b/compiler/testData/loadJava/compiledJava/sam/adapters/TypeParameterOfOuterClass.fir.txt @@ -4,7 +4,7 @@ public open class TypeParameterOfOuterClass|> public open inner class Inner|> : R|kotlin/Any| { public open fun foo(comparator: R|ft>, java/util/Comparator>?>|): R|kotlin/Unit| - public constructor(): R|test/TypeParameterOfOuterClass.Inner| + public test/TypeParameterOfOuterClass.constructor(): R|test/TypeParameterOfOuterClass.Inner| } } diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt index c51b7551597..bf71c5bfd29 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperType.fir.txt @@ -6,7 +6,7 @@ public open class RawSuperType : R|kotlin/Any| { @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| - public constructor(): R|test/RawSuperType.Derived| + public test/RawSuperType.constructor(): R|test/RawSuperType.Derived| } public abstract interface Super|> : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt index da19a5fb783..4f296dcd35a 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithBound.fir.txt @@ -10,7 +10,7 @@ public open class RawSuperTypeWithBound : R|kotlin/Any| { @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| - public constructor(): R|test/RawSuperTypeWithBound.Derived| + public test/RawSuperTypeWithBound.constructor(): R|test/RawSuperTypeWithBound.Derived| } public abstract interface Super|> : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt index 8e962327240..2140cc5288b 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBound.fir.txt @@ -8,7 +8,7 @@ public open class RawSuperTypeWithRecursiveBound : R|kotlin/Any| { @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| - public constructor(): R|test/RawSuperTypeWithRecursiveBound.Derived| + public test/RawSuperTypeWithRecursiveBound.constructor(): R|test/RawSuperTypeWithRecursiveBound.Derived| } public abstract interface Super>, test/RawSuperTypeWithRecursiveBound.Super>?>|> : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt index e22ffce7396..8d42d18d2c6 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/RawSuperTypeWithRecursiveBoundMultipleParameters.fir.txt @@ -8,7 +8,7 @@ public open class RawSuperTypeWithRecursiveBoundMultipleParameters : R|kotlin/An @R|java/lang/Override|() public open fun dummy(): R|kotlin/Unit| - public constructor(): R|test/RawSuperTypeWithRecursiveBoundMultipleParameters.Derived| + public test/RawSuperTypeWithRecursiveBoundMultipleParameters.constructor(): R|test/RawSuperTypeWithRecursiveBoundMultipleParameters.Derived| } public abstract interface Super|, T : R|ft, ft>, test/RawSuperTypeWithRecursiveBoundMultipleParameters.Super, ft>?>|> : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.fir.txt b/compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.fir.txt index 0fa7d3f9db1..5a48a642848 100644 --- a/compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.fir.txt +++ b/compiler/testData/loadJava/compiledJava/signaturePropagation/ReturnInnerSubclassOfSupersInner.fir.txt @@ -5,7 +5,7 @@ public abstract interface ReturnInnerSubclassOfSupersInner : R|kotlin/Any| { public/*package*/ open inner class Inner|> : R|test/ReturnInnerSubclassOfSupersInner.Super.Inner>| { public/*package*/ open operator fun get(): R|ft>, test/ReturnInnerSubclassOfSupersInner.Sub>?>| - public/*package*/ constructor(): R|test/ReturnInnerSubclassOfSupersInner.Sub.Inner| + public/*package*/ test/ReturnInnerSubclassOfSupersInner.Sub.constructor(): R|test/ReturnInnerSubclassOfSupersInner.Sub.Inner| } } @@ -15,7 +15,7 @@ public abstract interface ReturnInnerSubclassOfSupersInner : R|kotlin/Any| { public/*package*/ open inner class Inner|> : R|kotlin/Any| { public/*package*/ open operator fun get(): R|ft>, test/ReturnInnerSubclassOfSupersInner.Super>?>| - public/*package*/ constructor(): R|test/ReturnInnerSubclassOfSupersInner.Super.Inner| + public/*package*/ test/ReturnInnerSubclassOfSupersInner.Super.constructor(): R|test/ReturnInnerSubclassOfSupersInner.Super.Inner| } } diff --git a/compiler/testData/loadJava/compiledJava/static/DeeplyInnerClass.fir.txt b/compiler/testData/loadJava/compiledJava/static/DeeplyInnerClass.fir.txt index 0cfb129efbd..9b63ddc1253 100644 --- a/compiler/testData/loadJava/compiledJava/static/DeeplyInnerClass.fir.txt +++ b/compiler/testData/loadJava/compiledJava/static/DeeplyInnerClass.fir.txt @@ -4,17 +4,17 @@ public open class DeeplyInnerClass : R|kotlin/Any| { public/*package*/ open inner class A : R|kotlin/Any| { public/*package*/ open fun a(): R|kotlin/Unit| - public/*package*/ constructor(): R|test/DeeplyInnerClass.A| + public/*package*/ test/DeeplyInnerClass.constructor(): R|test/DeeplyInnerClass.A| public/*package*/ open inner class B : R|kotlin/Any| { public/*package*/ open fun b(): R|kotlin/Unit| - public/*package*/ constructor(): R|test/DeeplyInnerClass.A.B| + public/*package*/ test/DeeplyInnerClass.A.constructor(): R|test/DeeplyInnerClass.A.B| public/*package*/ open inner class C : R|kotlin/Any| { public/*package*/ open fun c(): R|kotlin/Unit| - public/*package*/ constructor(): R|test/DeeplyInnerClass.A.B.C| + public/*package*/ test/DeeplyInnerClass.A.B.constructor(): R|test/DeeplyInnerClass.A.B.C| } } diff --git a/compiler/testData/loadJava/compiledJava/static/Enum.fir.txt b/compiler/testData/loadJava/compiledJava/static/Enum.fir.txt index a555ee14891..b15d6f71c8d 100644 --- a/compiler/testData/loadJava/compiledJava/static/Enum.fir.txt +++ b/compiler/testData/loadJava/compiledJava/static/Enum.fir.txt @@ -13,7 +13,7 @@ public final enum class Enum : R|kotlin/Enum>| { public/*package*/ open fun valueOf(s: R|ft|): R|kotlin/Unit| - public constructor(): R|test/Enum.Inner| + public test/Enum.constructor(): R|test/Enum.Inner| } public open class Nested : R|kotlin/Any| { diff --git a/compiler/testData/loadJava/compiledJava/static/InnerClass.fir.txt b/compiler/testData/loadJava/compiledJava/static/InnerClass.fir.txt index 019720cd6eb..0093ae44d26 100644 --- a/compiler/testData/loadJava/compiledJava/static/InnerClass.fir.txt +++ b/compiler/testData/loadJava/compiledJava/static/InnerClass.fir.txt @@ -4,7 +4,7 @@ public open class InnerClass : R|kotlin/Any| { public open inner class Inner : R|kotlin/Any| { public open fun foo(): R|kotlin/Unit| - public constructor(): R|test/InnerClass.Inner| + public test/InnerClass.constructor(): R|test/InnerClass.Inner| } public open class Nested : R|kotlin/Any| {