From 3b841dcb984580ac8bfc8e12daf7c7a7733fce80 Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Wed, 17 Jan 2024 09:59:17 +0100 Subject: [PATCH] [FIR] Don't remove subsumed members from intersection overrides's overriddens This fixes a bunch of missing overridden symbols in IR. This is also required for fixing KT-59921 in the following commit where we need to keep all overridden symbols of intersection overrides so that we can enhance them properly. #KT-57300 Fixed #KT-57299 Fixed #KT-59921 #KT-57300 #KT-62788 #KT-64271 #KT-64382 --- ...KtFirSymbolDeclarationOverridesProvider.kt | 47 ++++-- .../scopeProvider/memberScope/MutableList.txt | 80 ++-------- ...CompilerTestFE10TestdataTestGenerated.java | 42 +++++ ...sticCompilerFE10TestDataTestGenerated.java | 42 +++++ ...terOverrideAndKotlinProperty.overrides.txt | 18 +-- ...rsectionOverrideOfTwoMembers.overrides.txt | 34 ++-- ...ionOverrideOfTwoMembers_java.overrides.txt | 34 ++-- .../singleIntersectionOverride.overrides.txt | 18 +-- ...eeOldFrontendDiagnosticsTestGenerated.java | 42 +++++ ...siOldFrontendDiagnosticsTestGenerated.java | 42 +++++ .../FirJsNameClashClassMembersChecker.kt | 18 ++- .../fir/analysis/checkers/FirHelpers.kt | 13 +- .../FirImplementationMismatchChecker.kt | 33 ++-- ...eDefaultsInheritedFromSupertypesChecker.kt | 6 +- .../FirNotImplementedOverrideChecker.kt | 2 +- .../fir/declarations/declarationUtils.kt | 73 +++++++++ .../impl/FirTypeIntersectionScopeContext.kt | 39 +---- ...eritFromAbstractMutableListInt.jvm_abi.txt | 26 --- .../inheritFromAbstractMutableListInt.kt | 1 - .../box/collections/kt48945.jvm_abi.txt | 10 ++ .../codegen/box/collections/kt48945.kt | 3 +- .../box/collections/kt48945a.jvm_abi.txt | 10 ++ .../codegen/box/collections/kt48945a.kt | 4 +- .../box/collections/kt48945b.jvm_abi.txt | 10 ++ .../codegen/box/collections/kt48945b.kt | 3 +- .../box/collections/kt48945c.jvm_abi.txt | 10 ++ .../codegen/box/collections/kt48945c.kt | 3 +- .../removeAtIntOverrideInJava.jvm_abi.txt | 24 --- .../collections/removeAtIntOverrideInJava.kt | 2 +- ...ithMultipleOverriddens_generics.fir.ir.txt | 3 + ...ropertyWithMultipleOverriddens_generics.kt | 2 - ...hMultipleOverriddens_noGenerics.fir.ir.txt | 3 + ...pertyWithMultipleOverriddens_noGenerics.kt | 2 - .../jvm8/javaDefaults/kt40920_map.jvm_abi.txt | 13 -- .../box/jvm8/javaDefaults/kt40920_map.kt | 1 - .../extendingAbstractCollection.kt | 3 - .../inheritingFromAbstractCollections.kt | 3 - .../inheritingFromAbstractMap.kt | 4 - .../inheritingFromAbstractMutableList.kt | 3 - ...licateDefaultValuesSubsumedIntersection.kt | 13 ++ ...orderOfSupertypesAndFakeOverrides_1.fir.kt | 2 +- .../intersectionReturnTypeMismatchSubsumed.kt | 41 +++++ .../override/intersectionOfAbstractAndOpen.kt | 54 +++++++ .../intersectionOfSubstitutedProperties.kt | 16 ++ ...ectionOverrideWithSubsumedDifferentType.kt | 16 ++ .../intersectionOverridesIntersection.kt | 21 +++ ...ntersectionWithSubsumedWithSubstitution.kt | 18 +++ .../diagnostics/tests/rawTypes/kt57620.fir.kt | 29 ---- .../diagnostics/tests/rawTypes/kt57620.kt | 1 + .../customClassMutableList.fir.kt | 4 +- .../classes/enumClassModality.fir.ir.txt | 27 ++-- .../ir/irText/classes/enumClassModality.kt | 3 - .../ir/irText/classes/overriddenEquals.kt | 1 - .../firProblems/AbstractMutableMap.fir.ir.txt | 90 +++++------ .../AbstractMutableMap.fir.sig.kt.txt | 73 +++++---- .../irText/firProblems/MultiList.fir.ir.txt | 151 ++++++++++-------- .../firProblems/MultiList.fir.sig.kt.txt | 101 ++++++------ .../test/runners/DiagnosticTestGenerated.java | 42 +++++ 58 files changed, 899 insertions(+), 530 deletions(-) delete mode 100644 compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.jvm_abi.txt create mode 100644 compiler/testData/codegen/box/collections/kt48945.jvm_abi.txt create mode 100644 compiler/testData/codegen/box/collections/kt48945a.jvm_abi.txt create mode 100644 compiler/testData/codegen/box/collections/kt48945b.jvm_abi.txt create mode 100644 compiler/testData/codegen/box/collections/kt48945c.jvm_abi.txt delete mode 100644 compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.jvm_abi.txt create mode 100644 compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt create mode 100644 compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt create mode 100644 compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt create mode 100644 compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt create mode 100644 compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt create mode 100644 compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt create mode 100644 compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt delete mode 100644 compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSymbolDeclarationOverridesProvider.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSymbolDeclarationOverridesProvider.kt index 79486b6b5de..35aef0a8338 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSymbolDeclarationOverridesProvider.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/components/KtFirSymbolDeclarationOverridesProvider.kt @@ -17,14 +17,12 @@ import org.jetbrains.kotlin.analysis.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol import org.jetbrains.kotlin.analysis.api.symbols.KtSymbolOrigin import org.jetbrains.kotlin.analysis.api.symbols.KtValueParameterSymbol +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.superConeTypes import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirIntersectionOverrideFunctionSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirIntersectionOverridePropertySymbol +import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.toRegularClassSymbol import org.jetbrains.kotlin.fir.unwrapFakeOverrides @@ -36,15 +34,24 @@ internal class KtFirSymbolDeclarationOverridesProvider( override fun getAllOverriddenSymbols( callableSymbol: T, ): List { + require(callableSymbol is KtFirSymbol<*>) if (callableSymbol is KtFirBackingFieldSymbol) return emptyList() if (callableSymbol is KtValueParameterSymbol) { return callableSymbol.getAllOverriddenSymbols() } + (callableSymbol.firSymbol as? FirIntersectionCallableSymbol)?.let { intersectionSymbol -> + return intersectionSymbol.intersections.flatMap { + getAllOverriddenSymbols(analysisSession.firSymbolBuilder.callableBuilder.buildCallableSymbol(it)) + } + } val overriddenElement = mutableSetOf>() processOverrides(callableSymbol) { firTypeScope, firCallableDeclaration -> firTypeScope.processAllOverriddenDeclarations(firCallableDeclaration) { overriddenDeclaration -> - overriddenDeclaration.symbol.collectIntersectionOverridesSymbolsTo(overriddenElement) + overriddenDeclaration.symbol.collectIntersectionOverridesSymbolsTo( + overriddenElement, + callableSymbol.analysisSession.useSiteSession + ) } } @@ -52,15 +59,22 @@ internal class KtFirSymbolDeclarationOverridesProvider( } override fun getDirectlyOverriddenSymbols(callableSymbol: T): List { + require(callableSymbol is KtFirSymbol<*>) if (callableSymbol is KtFirBackingFieldSymbol) return emptyList() if (callableSymbol is KtValueParameterSymbol) { return callableSymbol.getDirectlyOverriddenSymbols() } + if (callableSymbol is KtCallableSymbol && callableSymbol.firSymbol is FirIntersectionCallableSymbol) { + return getIntersectionOverriddenSymbols(callableSymbol) + } val overriddenElement = mutableSetOf>() processOverrides(callableSymbol) { firTypeScope, firCallableDeclaration -> firTypeScope.processDirectOverriddenDeclarations(firCallableDeclaration) { overriddenDeclaration -> - overriddenDeclaration.symbol.collectIntersectionOverridesSymbolsTo(overriddenElement) + overriddenDeclaration.symbol.collectIntersectionOverridesSymbolsTo( + overriddenElement, + callableSymbol.analysisSession.useSiteSession + ) } } @@ -139,13 +153,13 @@ internal class KtFirSymbolDeclarationOverridesProvider( process(firTypeScope, firCallableDeclaration) } - private fun FirCallableSymbol<*>.collectIntersectionOverridesSymbolsTo(to: MutableCollection>) { + private fun FirCallableSymbol<*>.collectIntersectionOverridesSymbolsTo( + to: MutableCollection>, + useSiteSession: FirSession, + ) { when (this) { - is FirIntersectionOverrideFunctionSymbol -> { - intersections.forEach { it.collectIntersectionOverridesSymbolsTo(to) } - } - is FirIntersectionOverridePropertySymbol -> { - intersections.forEach { it.collectIntersectionOverridesSymbolsTo(to) } + is FirIntersectionCallableSymbol -> { + getIntersectionOverriddenSymbols(useSiteSession).forEach { it.collectIntersectionOverridesSymbolsTo(to, useSiteSession) } } else -> { to += this.fir.unwrapFakeOverrides().symbol @@ -187,22 +201,21 @@ internal class KtFirSymbolDeclarationOverridesProvider( return false } - override fun getIntersectionOverriddenSymbols(symbol: KtCallableSymbol): Collection { + override fun getIntersectionOverriddenSymbols(symbol: KtCallableSymbol): List { require(symbol is KtFirSymbol<*>) if (symbol.origin != KtSymbolOrigin.INTERSECTION_OVERRIDE) return emptyList() return symbol.firSymbol - .getIntersectionOverriddenSymbols() + .getIntersectionOverriddenSymbols(symbol.analysisSession.useSiteSession) .map { analysisSession.firSymbolBuilder.callableBuilder.buildCallableSymbol(it) } } - private fun FirBasedSymbol<*>.getIntersectionOverriddenSymbols(): Collection> { + private fun FirBasedSymbol<*>.getIntersectionOverriddenSymbols(useSiteSession: FirSession): Collection> { require(this is FirCallableSymbol<*>) { "Required FirCallableSymbol but ${this::class} found" } return when (this) { - is FirIntersectionOverrideFunctionSymbol -> intersections - is FirIntersectionOverridePropertySymbol -> intersections + is FirIntersectionCallableSymbol -> getNonSubsumedOverriddenSymbols(useSiteSession, analysisSession.getScopeSessionFor(useSiteSession)) else -> listOf(this) } } diff --git a/analysis/analysis-api/testData/components/scopeProvider/memberScope/MutableList.txt b/analysis/analysis-api/testData/components/scopeProvider/memberScope/MutableList.txt index bc14cb37e39..ad7fb7fc48f 100644 --- a/analysis/analysis-api/testData/components/scopeProvider/memberScope/MutableList.txt +++ b/analysis/analysis-api/testData/components/scopeProvider/memberScope/MutableList.txt @@ -939,62 +939,12 @@ KtFunctionSymbol: KtKotlinPropertySymbol: annotationsList: [] - backingFieldSymbol: KtBackingFieldSymbol: - annotationsList: [] - callableIdIfNonLocal: null - contextReceivers: [] - isExtension: false - name: field - origin: PROPERTY_BACKING_FIELD - owningProperty: KtKotlinPropertySymbol(kotlin/collections/List.size) - receiverParameter: null - returnType: KtUsualClassType: - annotationsList: [] - ownTypeArguments: [] - type: kotlin/Int - symbolKind: LOCAL - typeParameters: [] - getContainingFileSymbol: null - getContainingJvmClassName: kotlin.collections.List - getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" - deprecationStatus: null - callableIdIfNonLocal: kotlin/collections/List.size + backingFieldSymbol: null + callableIdIfNonLocal: kotlin/collections/MutableList.size contextReceivers: [] - getter: KtPropertyGetterSymbol: - annotationsList: [] - callableIdIfNonLocal: null - contextReceivers: [] - hasBody: false - hasStableParameterNames: true - isDefault: true - isExtension: false - isInline: false - isOverride: false - modality: ABSTRACT - origin: LIBRARY - receiverParameter: null - returnType: KtUsualClassType: - annotationsList: [] - ownTypeArguments: [] - type: kotlin/Int - symbolKind: ACCESSOR - typeParameters: [] - valueParameters: [] - visibility: Public - getDispatchReceiver(): KtUsualClassType: - annotationsList: [] - ownTypeArguments: [ - KtTypeParameterType: - annotationsList: [] - type: E - ] - type: kotlin/collections/List - getContainingFileSymbol: null - getContainingJvmClassName: kotlin.collections.List - getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" - deprecationStatus: null + getter: null hasBackingField: false - hasGetter: true + hasGetter: false hasSetter: false initializer: null isActual: false @@ -1009,7 +959,7 @@ KtKotlinPropertySymbol: isVal: true modality: ABSTRACT name: size - origin: LIBRARY + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtUsualClassType: annotationsList: [] @@ -1026,9 +976,9 @@ KtKotlinPropertySymbol: annotationsList: [] type: E ] - type: kotlin/collections/List + type: kotlin/collections/MutableList getContainingFileSymbol: null - getContainingJvmClassName: kotlin.collections.List + getContainingJvmClassName: kotlin.collections.MutableList getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" deprecationStatus: null getterDeprecationStatus: null @@ -1038,7 +988,7 @@ KtKotlinPropertySymbol: KtFunctionSymbol: annotationsList: [] - callableIdIfNonLocal: kotlin/collections/List.isEmpty + callableIdIfNonLocal: kotlin/collections/MutableList.isEmpty contextReceivers: [] contractEffects: [] hasStableParameterNames: true @@ -1055,7 +1005,7 @@ KtFunctionSymbol: isSuspend: false modality: ABSTRACT name: isEmpty - origin: LIBRARY + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtUsualClassType: annotationsList: [] @@ -1072,9 +1022,9 @@ KtFunctionSymbol: annotationsList: [] type: E ] - type: kotlin/collections/List + type: kotlin/collections/MutableList getContainingFileSymbol: null - getContainingJvmClassName: kotlin.collections.List + getContainingJvmClassName: kotlin.collections.MutableList getContainingModule: KtBinaryModule "Builtins for JVM (1.8)" deprecationStatus: null @@ -1097,7 +1047,7 @@ KtFunctionSymbol: isSuspend: false modality: ABSTRACT name: contains - origin: SUBSTITUTION_OVERRIDE + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtUsualClassType: annotationsList: [] @@ -1118,7 +1068,7 @@ KtFunctionSymbol: isNoinline: false isVararg: false name: element - origin: SUBSTITUTION_OVERRIDE + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtTypeParameterType: annotationsList: [] @@ -1209,7 +1159,7 @@ KtFunctionSymbol: isSuspend: false modality: ABSTRACT name: containsAll - origin: SUBSTITUTION_OVERRIDE + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtUsualClassType: annotationsList: [] @@ -1230,7 +1180,7 @@ KtFunctionSymbol: isNoinline: false isVararg: false name: elements - origin: SUBSTITUTION_OVERRIDE + origin: INTERSECTION_OVERRIDE receiverParameter: null returnType: KtUsualClassType: annotationsList: [] diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index c6a6a5ba302..0396a769c2c 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -345,6 +345,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/Dollar.kt"); } + @Test + @TestMetadata("duplicateDefaultValuesSubsumedIntersection.kt") + public void testDuplicateDefaultValuesSubsumedIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt"); + } + @Test @TestMetadata("duplicateDirrectOverriddenCallables.kt") public void testDuplicateDirrectOverriddenCallables() throws Exception { @@ -28698,6 +28704,36 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/override/InternalPotentialOverride.kt"); } + @Test + @TestMetadata("intersectionOfAbstractAndOpen.kt") + public void testIntersectionOfAbstractAndOpen() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt"); + } + + @Test + @TestMetadata("intersectionOfSubstitutedProperties.kt") + public void testIntersectionOfSubstitutedProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt"); + } + + @Test + @TestMetadata("intersectionOverrideWithSubsumedDifferentType.kt") + public void testIntersectionOverrideWithSubsumedDifferentType() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt"); + } + + @Test + @TestMetadata("intersectionOverridesIntersection.kt") + public void testIntersectionOverridesIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt"); + } + + @Test + @TestMetadata("intersectionWithSubsumedWithSubstitution.kt") + public void testIntersectionWithSubsumedWithSubstitution() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt"); + } + @Test @TestMetadata("InvisiblePotentialOverride.kt") public void testInvisiblePotentialOverride() throws Exception { @@ -28965,6 +29001,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/genericWithUpperBound.kt"); } + @Test + @TestMetadata("intersectionReturnTypeMismatchSubsumed.kt") + public void testIntersectionReturnTypeMismatchSubsumed() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt"); + } + @Test @TestMetadata("kt13355.kt") public void testKt13355() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 6eccd438407..97c850cfbce 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -345,6 +345,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/Dollar.kt"); } + @Test + @TestMetadata("duplicateDefaultValuesSubsumedIntersection.kt") + public void testDuplicateDefaultValuesSubsumedIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt"); + } + @Test @TestMetadata("duplicateDirrectOverriddenCallables.kt") public void testDuplicateDirrectOverriddenCallables() throws Exception { @@ -28698,6 +28704,36 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/override/InternalPotentialOverride.kt"); } + @Test + @TestMetadata("intersectionOfAbstractAndOpen.kt") + public void testIntersectionOfAbstractAndOpen() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt"); + } + + @Test + @TestMetadata("intersectionOfSubstitutedProperties.kt") + public void testIntersectionOfSubstitutedProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt"); + } + + @Test + @TestMetadata("intersectionOverrideWithSubsumedDifferentType.kt") + public void testIntersectionOverrideWithSubsumedDifferentType() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt"); + } + + @Test + @TestMetadata("intersectionOverridesIntersection.kt") + public void testIntersectionOverridesIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt"); + } + + @Test + @TestMetadata("intersectionWithSubsumedWithSubstitution.kt") + public void testIntersectionWithSubsumedWithSubstitution() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt"); + } + @Test @TestMetadata("InvisiblePotentialOverride.kt") public void testInvisiblePotentialOverride() throws Exception { @@ -28965,6 +29001,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/genericWithUpperBound.kt"); } + @Test + @TestMetadata("intersectionReturnTypeMismatchSubsumed.kt") + public void testIntersectionReturnTypeMismatchSubsumed() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt"); + } + @Test @TestMetadata("kt13355.kt") public void testKt13355() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolve/scopes/getterOverrideAndKotlinProperty.overrides.txt b/compiler/fir/analysis-tests/testData/resolve/scopes/getterOverrideAndKotlinProperty.overrides.txt index 9cf29e24c4a..1246aed73ff 100644 --- a/compiler/fir/analysis-tests/testData/resolve/scopes/getterOverrideAndKotlinProperty.overrides.txt +++ b/compiler/fir/analysis-tests/testData/resolve/scopes/getterOverrideAndKotlinProperty.overrides.txt @@ -6,15 +6,15 @@ B: [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1] C: - [Source]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0] - [Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 0] - [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1] - [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1] + [IntersectionOverride]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0] + [Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 1] + [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 2] + [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 2] D: - [Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /D [id: 0] - [Source]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0] - [Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 0] - [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1] - [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 1] + [IntersectionOverride]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /D [id: 0] + [IntersectionOverride]: public open override fun getFoo(): R|kotlin/String| from Java enhancement scope for /C [id: 0] + [Source]: public open override fun getFoo(): R|kotlin/String| from Use site scope of /B [id: 1] + [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 2] + [Enhancement]: public abstract fun getFoo(): R|kotlin/String!| from Java enhancement scope for /A [id: 2] diff --git a/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers.overrides.txt b/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers.overrides.txt index 130c86fdb69..613aab0f552 100644 --- a/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers.overrides.txt +++ b/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers.overrides.txt @@ -1,38 +1,38 @@ C: - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 0] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 2] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 0] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 0] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 2] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1] Explicit: [Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3] + [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 4] [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3] + [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 4] Implicit: [IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3] - [IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1] + [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 4] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3] + [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 4] diff --git a/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers_java.overrides.txt b/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers_java.overrides.txt index 130c86fdb69..613aab0f552 100644 --- a/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers_java.overrides.txt +++ b/compiler/fir/analysis-tests/testData/resolve/scopes/noIntersectionOverrideOfTwoMembers_java.overrides.txt @@ -1,38 +1,38 @@ C: - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 0] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 0] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 2] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 0] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 0] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 0] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 2] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 1] Explicit: [Source]: public abstract override fun foo(): R|kotlin/Int| from Use site scope of /Explicit [id: 0] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3] + [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 4] [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /Explicit [id: 0] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3] + [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 4] Implicit: [IntersectionOverride]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /Implicit [id: 0] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] + [IntersectionOverride]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override fun foo(): R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract fun foo(): R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 3] - [IntersectionOverride]: public abstract override val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /C [id: 1] + [Source]: public abstract fun foo(): R|kotlin/Int| from Use site scope of /D [id: 4] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /Implicit [id: 0] + [IntersectionOverride]: public abstract val x: R|kotlin/Any| from Use site scope of /C [id: 1] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 1] + [Source]: public abstract override val x: R|kotlin/Any| from Use site scope of /B [id: 3] [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /A [id: 2] - [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 3] + [Source]: public abstract val x: R|kotlin/Any| from Use site scope of /D [id: 4] diff --git a/compiler/fir/analysis-tests/testData/resolve/scopes/singleIntersectionOverride.overrides.txt b/compiler/fir/analysis-tests/testData/resolve/scopes/singleIntersectionOverride.overrides.txt index 916f0866883..58661fbc86e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/scopes/singleIntersectionOverride.overrides.txt +++ b/compiler/fir/analysis-tests/testData/resolve/scopes/singleIntersectionOverride.overrides.txt @@ -1,11 +1,11 @@ D: - [SubstitutionOverride(DeclarationSite)]: public abstract override fun foo(): R|E4| from Use site scope of /D [id: 0] - [SubstitutionOverride(DeclarationSite)]: public abstract override fun foo(): R|E4| from Substitution scope for [Use site scope of /B] for type D [id: 0] - [Source]: public abstract override fun foo(): R|E2| from Use site scope of /B [id: 1] - [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E2| from Substitution scope for [Use site scope of /A] for type B [id: 2] - [Source]: public abstract fun foo(): R|E1| from Use site scope of /A [id: 3] - [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E4| from Substitution scope for [Use site scope of /C] for type D [id: 4] - [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E3| from Use site scope of /C [id: 5] - [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E3| from Substitution scope for [Use site scope of /A] for type C [id: 5] - [Source]: public abstract fun foo(): R|E1| from Use site scope of /A [id: 3] + [IntersectionOverride]: public abstract override fun foo(): R|E4| from Use site scope of /D [id: 0] + [SubstitutionOverride(DeclarationSite)]: public abstract override fun foo(): R|E4| from Substitution scope for [Use site scope of /B] for type D [id: 1] + [Source]: public abstract override fun foo(): R|E2| from Use site scope of /B [id: 2] + [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E2| from Substitution scope for [Use site scope of /A] for type B [id: 3] + [Source]: public abstract fun foo(): R|E1| from Use site scope of /A [id: 4] + [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E4| from Substitution scope for [Use site scope of /C] for type D [id: 5] + [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E3| from Use site scope of /C [id: 6] + [SubstitutionOverride(DeclarationSite)]: public abstract fun foo(): R|E3| from Substitution scope for [Use site scope of /A] for type C [id: 6] + [Source]: public abstract fun foo(): R|E1| from Use site scope of /A [id: 4] diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 16a7705b270..f328df48dc2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -345,6 +345,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/Dollar.kt"); } + @Test + @TestMetadata("duplicateDefaultValuesSubsumedIntersection.kt") + public void testDuplicateDefaultValuesSubsumedIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt"); + } + @Test @TestMetadata("duplicateDirrectOverriddenCallables.kt") public void testDuplicateDirrectOverriddenCallables() throws Exception { @@ -26462,6 +26468,36 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/override/InternalPotentialOverride.kt"); } + @Test + @TestMetadata("intersectionOfAbstractAndOpen.kt") + public void testIntersectionOfAbstractAndOpen() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt"); + } + + @Test + @TestMetadata("intersectionOfSubstitutedProperties.kt") + public void testIntersectionOfSubstitutedProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt"); + } + + @Test + @TestMetadata("intersectionOverrideWithSubsumedDifferentType.kt") + public void testIntersectionOverrideWithSubsumedDifferentType() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt"); + } + + @Test + @TestMetadata("intersectionOverridesIntersection.kt") + public void testIntersectionOverridesIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt"); + } + + @Test + @TestMetadata("intersectionWithSubsumedWithSubstitution.kt") + public void testIntersectionWithSubsumedWithSubstitution() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt"); + } + @Test @TestMetadata("InvisiblePotentialOverride.kt") public void testInvisiblePotentialOverride() throws Exception { @@ -26729,6 +26765,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/genericWithUpperBound.kt"); } + @Test + @TestMetadata("intersectionReturnTypeMismatchSubsumed.kt") + public void testIntersectionReturnTypeMismatchSubsumed() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt"); + } + @Test @TestMetadata("kt13355.kt") public void testKt13355() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 51d175c703a..b728c1e6434 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -345,6 +345,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/Dollar.kt"); } + @Test + @TestMetadata("duplicateDefaultValuesSubsumedIntersection.kt") + public void testDuplicateDefaultValuesSubsumedIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt"); + } + @Test @TestMetadata("duplicateDirrectOverriddenCallables.kt") public void testDuplicateDirrectOverriddenCallables() throws Exception { @@ -26468,6 +26474,36 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/override/InternalPotentialOverride.kt"); } + @Test + @TestMetadata("intersectionOfAbstractAndOpen.kt") + public void testIntersectionOfAbstractAndOpen() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt"); + } + + @Test + @TestMetadata("intersectionOfSubstitutedProperties.kt") + public void testIntersectionOfSubstitutedProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt"); + } + + @Test + @TestMetadata("intersectionOverrideWithSubsumedDifferentType.kt") + public void testIntersectionOverrideWithSubsumedDifferentType() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt"); + } + + @Test + @TestMetadata("intersectionOverridesIntersection.kt") + public void testIntersectionOverridesIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt"); + } + + @Test + @TestMetadata("intersectionWithSubsumedWithSubstitution.kt") + public void testIntersectionWithSubsumedWithSubstitution() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt"); + } + @Test @TestMetadata("InvisiblePotentialOverride.kt") public void testInvisiblePotentialOverride() throws Exception { @@ -26735,6 +26771,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/genericWithUpperBound.kt"); } + @Test + @TestMetadata("intersectionReturnTypeMismatchSubsumed.kt") + public void testIntersectionReturnTypeMismatchSubsumed() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt"); + } + @Test @TestMetadata("kt13355.kt") public void testKt13355() throws Exception { diff --git a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt index f1767462593..6bfff83bf19 100644 --- a/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt +++ b/compiler/fir/checkers/checkers.js/src/org/jetbrains/kotlin/fir/analysis/js/checkers/declaration/FirJsNameClashClassMembersChecker.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.fir.declarations.FirClassLikeDeclaration import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin import org.jetbrains.kotlin.fir.declarations.constructors import org.jetbrains.kotlin.fir.declarations.utils.isExpect +import org.jetbrains.kotlin.fir.declarations.getNonSubsumedOverriddenSymbols import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol @@ -31,6 +32,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.fir.unwrapFakeOverridesOrDelegated import org.jetbrains.kotlin.utils.addIfNotNull import org.jetbrains.kotlin.utils.addToStdlib.popLast +import org.jetbrains.kotlin.fir.resolve.SessionHolder sealed class FirJsNameClashClassMembersChecker(mppKind: MppCheckerKind) : FirClassChecker(mppKind) { object Regular : FirJsNameClashClassMembersChecker(MppCheckerKind.Platform) { @@ -113,13 +115,17 @@ sealed class FirJsNameClashClassMembersChecker(mppKind: MppCheckerKind) : FirCla } } - fun addAllSymbolsFrom(symbols: Collection>) { + fun addAllSymbolsFrom(symbols: Collection>, sessionHolder: SessionHolder) { for (symbol in symbols) { when (symbol) { is FirIntersectionCallableSymbol -> { - addAllSymbolsFrom(symbol.intersections) - for (intersectedSymbol in symbol.intersections) { - overrideIntersections.getOrPut(intersectedSymbol) { hashSetOf() }.addAll(symbol.intersections) + val nonSubsumedOverriddenSymbols = symbol.getNonSubsumedOverriddenSymbols( + sessionHolder.session, + sessionHolder.scopeSession + ) + addAllSymbolsFrom(nonSubsumedOverriddenSymbols, sessionHolder) + for (intersectedSymbol in nonSubsumedOverriddenSymbols) { + overrideIntersections.getOrPut(intersectedSymbol) { hashSetOf() }.addAll(nonSubsumedOverriddenSymbols) } } else -> allSymbols.add(symbol) @@ -137,8 +143,8 @@ sealed class FirJsNameClashClassMembersChecker(mppKind: MppCheckerKind) : FirCla val scope = declaration.symbol.unsubstitutedScope(context) scope.processDeclaredConstructors(allSymbols::add) - addAllSymbolsFrom(scope.collectAllFunctions()) - addAllSymbolsFrom(scope.collectAllProperties()) + addAllSymbolsFrom(scope.collectAllFunctions(), context.sessionHolder) + addAllSymbolsFrom(scope.collectAllProperties(), context.sessionHolder) for (callableMemberSymbol in allSymbols) { val overriddenLeaves = scope.collectOverriddenLeaves(callableMemberSymbol) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt index 6c358059a6b..89becd5f89c 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirHelpers.kt @@ -34,7 +34,6 @@ import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.scopes.impl.declaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.multipleDelegatesWithTheSameSignature import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol -import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.name.ClassId @@ -335,7 +334,11 @@ fun FirCallableSymbol<*>.getImplementationStatus( } if (symbol is FirIntersectionCallableSymbol) { - if (containingClassSymbol === parentClassSymbol && symbol.subjectToManyNotImplemented(sessionHolder)) { + val dispatchReceiverScope = symbol.dispatchReceiverScope(sessionHolder.session, sessionHolder.scopeSession) + val memberWithBaseScope = MemberWithBaseScope(symbol, dispatchReceiverScope) + val nonSubsumed = memberWithBaseScope.getNonSubsumedOverriddenSymbols() + + if (containingClassSymbol === parentClassSymbol && !memberWithBaseScope.isTrivialIntersection() && nonSubsumed.subjectToManyNotImplemented(sessionHolder)) { return ImplementationStatus.AMBIGUOUSLY_INHERITED } @@ -345,7 +348,7 @@ fun FirCallableSymbol<*>.getImplementationStatus( var hasImplementation = false var hasImplementationVar = false - for (intersection in symbol.intersections) { + for (intersection in nonSubsumed) { val unwrapped = intersection.unwrapFakeOverrides() val isVar = unwrapped is FirPropertySymbol && unwrapped.isVar val isFromClass = unwrapped.getContainingClassSymbol(sessionHolder.session)?.classKind == ClassKind.CLASS @@ -403,11 +406,11 @@ fun FirCallableSymbol<*>.getImplementationStatus( } } -private fun FirIntersectionCallableSymbol.subjectToManyNotImplemented(sessionHolder: SessionHolder): Boolean { +private fun List>.subjectToManyNotImplemented(sessionHolder: SessionHolder): Boolean { var nonAbstractCountInClass = 0 var nonAbstractCountInInterface = 0 var abstractCountInInterface = 0 - for (intersectionSymbol in intersections) { + for (intersectionSymbol in this) { val containingClassSymbol = intersectionSymbol.getContainingClassSymbol(sessionHolder.session) as? FirRegularClassSymbol val hasInterfaceContainer = containingClassSymbol?.classKind == ClassKind.INTERFACE if (intersectionSymbol.modality != Modality.ABSTRACT) { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt index c34161999db..13fe51fa279 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirImplementationMismatchChecker.kt @@ -17,8 +17,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.isVisibleInClass import org.jetbrains.kotlin.fir.analysis.checkers.unsubstitutedScope import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.containingClassLookupTag -import org.jetbrains.kotlin.fir.declarations.FirClass -import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.declarations.utils.isAbstract import org.jetbrains.kotlin.fir.declarations.utils.isExpect @@ -26,15 +25,14 @@ import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.delegatedWrapperData import org.jetbrains.kotlin.fir.isSubstitutionOverride import org.jetbrains.kotlin.fir.resolve.substitution.substitutorByMap -import org.jetbrains.kotlin.fir.scopes.FirTypeScope -import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenMembers -import org.jetbrains.kotlin.fir.scopes.getDirectOverriddenProperties +import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.ConeErrorType import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.typeContext +import org.jetbrains.kotlin.fir.unwrapSubstitutionOverrides import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.types.AbstractTypeChecker import org.jetbrains.kotlin.types.TypeCheckerState @@ -121,6 +119,15 @@ sealed class FirImplementationMismatchChecker(mppKind: MppCheckerKind) : FirClas AbstractTypeChecker.isSubtypeOf(typeCheckerState, inheritedTypeSubstituted, baseType) } + /** + * An intersection override is trivial if one of the overridden symbols subsumes all others. + * + * @see org.jetbrains.kotlin.fir.scopes.impl.FirTypeIntersectionScopeContext.convertGroupedCallablesToIntersectionResults + */ + fun FirCallableSymbol<*>.isTrivialIntersectionOverride(): Boolean { + return callableId.classId != containingClass.classId || MemberWithBaseScope(this, classScope).isTrivialIntersection() + } + val intersectionSymbols = when { //substitution override means simple materialization of single method, so nothing to check symbol.isSubstitutionOverride -> return @@ -134,7 +141,9 @@ sealed class FirImplementationMismatchChecker(mppKind: MppCheckerKind) : FirClas //current symbol needs to be added, because basically it is the implementation cleared + symbol } - symbol is FirIntersectionCallableSymbol && symbol.callableId.classId == containingClass.classId -> + symbol is FirIntersectionCallableSymbol && !symbol.isTrivialIntersectionOverride() -> + // We intentionally don't use getNonSubsumedOverriddenSymbols here, otherwise we'll get lots of new errors (compared to K1) + // in cases where a Java superclass inherits multiple members with conflicting nullability annotations. symbol.intersections else -> return } @@ -203,12 +212,18 @@ sealed class FirImplementationMismatchChecker(mppKind: MppCheckerKind) : FirClas reporter.reportOn(containingClass.source, FirErrors.VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION, symbol, overriddenVar, context) } - private fun FirTypeScope.collectFunctionsNamed(name: Name, containingClass: FirClass): List { + private fun FirTypeScope.collectFunctionsNamed( + name: Name, + containingClass: FirClass, + context: CheckerContext, + ): List { val allFunctions = mutableListOf() processFunctionsByName(name) { sym -> when (sym) { - is FirIntersectionOverrideFunctionSymbol -> sym.intersections.mapNotNullTo(allFunctions) { it as? FirNamedFunctionSymbol } + is FirIntersectionOverrideFunctionSymbol -> sym + .getNonSubsumedOverriddenSymbols(context.session, context.scopeSession) + .mapNotNullTo(allFunctions) { it as? FirNamedFunctionSymbol } else -> allFunctions.add(sym) } } @@ -225,7 +240,7 @@ sealed class FirImplementationMismatchChecker(mppKind: MppCheckerKind) : FirClas scope: FirTypeScope, name: Name ) { - val allFunctions = scope.collectFunctionsNamed(name, containingClass) + val allFunctions = scope.collectFunctionsNamed(name, containingClass, context) val sameArgumentGroups = allFunctions.groupBy { function -> buildList { diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMultipleDefaultsInheritedFromSupertypesChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMultipleDefaultsInheritedFromSupertypesChecker.kt index be6ab080668..79f6f39f635 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMultipleDefaultsInheritedFromSupertypesChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirMultipleDefaultsInheritedFromSupertypesChecker.kt @@ -9,7 +9,6 @@ import org.jetbrains.kotlin.KtSourceElement import org.jetbrains.kotlin.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.diagnostics.reportOn import org.jetbrains.kotlin.fir.analysis.checkers.MppCheckerKind -import org.jetbrains.kotlin.fir.analysis.checkers.collectOverriddenFunctionsWhere import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.processOverriddenFunctions import org.jetbrains.kotlin.fir.analysis.checkers.unsubstitutedScope @@ -17,11 +16,10 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.containingClassLookupTag import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.getSingleMatchedExpectForActualOrNull import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.declarations.utils.superConeTypes -import org.jetbrains.kotlin.fir.isSubstitutionOverride +import org.jetbrains.kotlin.fir.isSubstitutionOrIntersectionOverride import org.jetbrains.kotlin.fir.scopes.processAllFunctions import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirValueParameterSymbol @@ -66,7 +64,7 @@ sealed class FirMultipleDefaultsInheritedFromSupertypesChecker(mppKind: MppCheck // default values of actual functions are located in corresponding expect functions val overriddenWithDefaults = overridden.getSingleMatchedExpectForActualOrNull() as? FirNamedFunctionSymbol ?: overridden // Substitution overrides copy default values from originals - if (!overriddenWithDefaults.isSubstitutionOverride && overriddenWithDefaults.valueParameterSymbols.any { it.hasDefaultValue }) { + if (!overriddenWithDefaults.isSubstitutionOrIntersectionOverride && overriddenWithDefaults.valueParameterSymbols.any { it.hasDefaultValue }) { overriddenFunctions += overriddenWithDefaults } } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirNotImplementedOverrideChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirNotImplementedOverrideChecker.kt index b82dd3df42c..ef91686b64e 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirNotImplementedOverrideChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirNotImplementedOverrideChecker.kt @@ -78,7 +78,7 @@ sealed class FirNotImplementedOverrideChecker(mppKind: MppCheckerKind) : FirClas fun collectSymbol(symbol: FirCallableSymbol<*>) { val delegatedWrapperData = symbol.delegatedWrapperData - if (delegatedWrapperData != null) { + if (delegatedWrapperData != null && symbol !is FirIntersectionCallableSymbol) { val directOverriddenMembersWithBaseScope = classScope .getDirectOverriddenMembersWithBaseScope(symbol) .filter { it.member != symbol } diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt index b7b5973f939..e9d4c267acb 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/declarations/declarationUtils.kt @@ -9,7 +9,10 @@ import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.util.PrivateForInline import org.jetbrains.kotlin.fir.declarations.utils.isInline +import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.fullyExpandedType +import org.jetbrains.kotlin.fir.resolve.scope +import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.scopes.impl.declaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.importedFromObjectOrStaticData import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol @@ -19,6 +22,7 @@ import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.fir.types.coneTypeSafe import org.jetbrains.kotlin.fir.types.isNullableAny import org.jetbrains.kotlin.fir.types.toSymbol +import org.jetbrains.kotlin.fir.unwrapSubstitutionOverrides import org.jetbrains.kotlin.util.OperatorNameConventions fun FirClass.constructors(session: FirSession): List { @@ -126,3 +130,72 @@ fun FirSimpleFunction.isEquals(session: FirSession): Boolean { val parameter = valueParameters.first() return parameter.returnTypeRef.coneType.fullyExpandedType(session).isNullableAny } + +/** + * An intersection override is trivial if one of the overridden symbols subsumes all others. + * + * @see org.jetbrains.kotlin.fir.scopes.impl.FirTypeIntersectionScopeContext.convertGroupedCallablesToIntersectionResults + */ +fun MemberWithBaseScope>.isTrivialIntersection(): Boolean { + return baseScope + .getDirectOverriddenMembersWithBaseScope(member) + .nonSubsumed() + .mapTo(mutableSetOf()) { it.member.unwrapSubstitutionOverrides() }.size == 1 +} + +fun FirIntersectionCallableSymbol.getNonSubsumedOverriddenSymbols( + session: FirSession, + scopeSession: ScopeSession, +): List> { + require(this is FirCallableSymbol<*>) + + val dispatchReceiverScope = dispatchReceiverScope(session, scopeSession) + return MemberWithBaseScope(this, dispatchReceiverScope).getNonSubsumedOverriddenSymbols() +} + +fun MemberWithBaseScope>.getNonSubsumedOverriddenSymbols(): List> { + return flattenIntersectionsRecursively() + .nonSubsumed() + .distinctBy { it.member.unwrapSubstitutionOverrides>() } + .map { it.member } +} + +fun FirCallableSymbol<*>.dispatchReceiverScope(session: FirSession, scopeSession: ScopeSession): FirTypeScope { + val dispatchReceiverType = requireNotNull(dispatchReceiverType) + return dispatchReceiverType.scope( + session, + scopeSession, + CallableCopyTypeCalculator.DoNothing, + FirResolvePhase.STATUS + ) ?: FirTypeScope.Empty +} + +fun MemberWithBaseScope>.flattenIntersectionsRecursively(): List>> { + if (member.origin != FirDeclarationOrigin.IntersectionOverride) return listOf(this) + + return baseScope.getDirectOverriddenMembersWithBaseScope(member).flatMap { it.flattenIntersectionsRecursively() } +} + +/** + * A callable declaration D [subsumes](https://kotlinlang.org/spec/inheritance.html#matching-and-subsumption-of-declarations) + * a callable declaration B if D overrides B. + */ +fun Collection>>.nonSubsumed(): List>> { + val baseMembers = mutableSetOf>() + for ((member, scope) in this) { + val unwrapped = member.unwrapSubstitutionOverrides>() + val addIfDifferent = { it: FirCallableSymbol<*> -> + val symbol = it.unwrapSubstitutionOverrides() + if (symbol != unwrapped) { + baseMembers += symbol + } + ProcessorAction.NEXT + } + if (member is FirNamedFunctionSymbol) { + scope.processOverriddenFunctions(member, addIfDifferent) + } else if (member is FirPropertySymbol) { + scope.processOverriddenProperties(member, addIfDifferent) + } + } + return filter { (member, _) -> member.unwrapSubstitutionOverrides>() !in baseMembers } +} \ No newline at end of file diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt index b2e3afb21ea..42f3e489b79 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/scopes/impl/FirTypeIntersectionScopeContext.kt @@ -10,9 +10,7 @@ import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.caches.* -import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin -import org.jetbrains.kotlin.fir.declarations.FirMemberDeclaration -import org.jetbrains.kotlin.fir.declarations.FirVariable +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.isExpect import org.jetbrains.kotlin.fir.declarations.utils.modality import org.jetbrains.kotlin.fir.declarations.utils.visibility @@ -159,8 +157,7 @@ class FirTypeIntersectionScopeContext( val groupWithInvisible = overrideService.extractBothWaysOverridable(allMembersWithScope.maxByVisibility(), allMembersWithScope, overrideChecker) val group = groupWithInvisible.filter { it.isVisible() }.ifEmpty { groupWithInvisible } - val nonSubsumed = if (forClassUseSiteScope) group.nonSubsumed() else group - val mostSpecific = overrideService.selectMostSpecificMembers(nonSubsumed, ReturnTypeCalculatorForFullBodyResolve.Default) + val mostSpecific = overrideService.selectMostSpecificMembers(group, ReturnTypeCalculatorForFullBodyResolve.Default) val nonTrivial = if (forClassUseSiteScope) { // Create a non-trivial intersection override when the base methods come from different scopes, // even if one of them is more specific than the others, i.e. when there is more than one method that is not subsumed. @@ -169,15 +166,15 @@ class FirTypeIntersectionScopeContext( // It is also possible to have the opposite case (> 1 most specific member, but all members are from // the same base scope), but this means there are different instantiations of the same base class, // which should generally result in INCONSISTENT_TYPE_PARAMETER_VALUES errors. - nonSubsumed.size > 1 && - nonSubsumed.mapTo(mutableSetOf()) { it.member.fir.unwrapSubstitutionOverrides().symbol }.size > 1 + group.size > 1 && + group.mapTo(mutableSetOf()) { it.member.fir.unwrapSubstitutionOverrides().symbol }.size > 1 } else { // Create a non-trivial intersection override when return types should be intersected. mostSpecific.size > 1 } if (nonTrivial) { // Only add non-subsumed members to list of overridden in intersection override. - result += ResultOfIntersection.NonTrivial(this, mostSpecific, overriddenMembers = nonSubsumed, containingScope = null) + result += ResultOfIntersection.NonTrivial(this, mostSpecific, overriddenMembers = group, containingScope = null) } else { val (member, containingScope) = mostSpecific.first() result += ResultOfIntersection.SingleMember(member, group, containingScope) @@ -207,7 +204,7 @@ class FirTypeIntersectionScopeContext( mostSpecific: List>, extractedOverrides: List>, ): MemberWithBaseScope> { - val newModality = chooseIntersectionOverrideModality(extractedOverrides) + val newModality = chooseIntersectionOverrideModality(extractedOverrides.flatMap { it.flattenIntersectionsRecursively() }.nonSubsumed()) val newVisibility = chooseIntersectionVisibility(extractedOverrides) val mostSpecificSymbols = mostSpecific.map { it.member } val extractedOverridesSymbols = extractedOverrides.map { it.member } @@ -228,30 +225,6 @@ class FirTypeIntersectionScopeContext( }.withScope(key.baseScope) } - /** - * A callable declaration D [subsumes](https://kotlinlang.org/spec/inheritance.html#matching-and-subsumption-of-declarations) - * a callable declaration B if D overrides B. - */ - private fun > List>.nonSubsumed(): List> { - val baseMembers = mutableSetOf>() - for ((member, scope) in this) { - val unwrapped = member.unwrapSubstitutionOverrides>() - val addIfDifferent = { it: FirCallableSymbol<*> -> - val symbol = it.unwrapSubstitutionOverrides() - if (symbol != unwrapped) { - baseMembers += symbol - } - ProcessorAction.NEXT - } - if (member is FirNamedFunctionSymbol) { - scope.processOverriddenFunctions(member, addIfDifferent) - } else if (member is FirPropertySymbol) { - scope.processOverriddenProperties(member, addIfDifferent) - } - } - return filter { it.member.unwrapSubstitutionOverrides>() !in baseMembers } - } - private fun > Collection>.maxByVisibility(): MemberWithBaseScope { var member: MemberWithBaseScope? = null for (candidate in this) { diff --git a/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.jvm_abi.txt b/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.jvm_abi.txt deleted file mode 100644 index e6e79bbfb77..00000000000 --- a/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.jvm_abi.txt +++ /dev/null @@ -1,26 +0,0 @@ -MODULE main - CLASS A.class - K1 - contains(I)Z [public, bridge] - K2 - --- - K1 - --- - K2 - contains(Ljava/lang/Integer;)Z [public, bridge] - K1 - indexOf(I)I [public, bridge] - K2 - --- - K1 - --- - K2 - indexOf(Ljava/lang/Integer;)I [public, bridge] - K1 - lastIndexOf(I)I [public, bridge] - K2 - --- - K1 - --- - K2 - lastIndexOf(Ljava/lang/Integer;)I [public, bridge] diff --git a/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt b/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt index 4c13509a2c7..8062bd55722 100644 --- a/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt +++ b/compiler/testData/codegen/box/collections/inheritFromAbstractMutableListInt.kt @@ -1,5 +1,4 @@ // WITH_STDLIB -// JVM_ABI_K1_K2_DIFF: KT-57300 abstract class A : AbstractMutableList() diff --git a/compiler/testData/codegen/box/collections/kt48945.jvm_abi.txt b/compiler/testData/codegen/box/collections/kt48945.jvm_abi.txt new file mode 100644 index 00000000000..11267717795 --- /dev/null +++ b/compiler/testData/codegen/box/collections/kt48945.jvm_abi.txt @@ -0,0 +1,10 @@ +MODULE main + CLASS Test.class + K1 + getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge] + K2 + --- + K1 + getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge] + K2 + --- diff --git a/compiler/testData/codegen/box/collections/kt48945.kt b/compiler/testData/codegen/box/collections/kt48945.kt index 5b03a92ac87..70730fd13df 100644 --- a/compiler/testData/codegen/box/collections/kt48945.kt +++ b/compiler/testData/codegen/box/collections/kt48945.kt @@ -1,10 +1,9 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 -// IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: different structure of fake overrides. Fixed in the IR fake override builder. // IGNORE_BACKEND: ANDROID // ^ NSME: java.util.AbstractMap.remove // FULL_JDK +// JVM_ABI_K1_K2_DIFF: KT-65095 class Test : Map, java.util.AbstractMap() { override val entries: MutableSet> diff --git a/compiler/testData/codegen/box/collections/kt48945a.jvm_abi.txt b/compiler/testData/codegen/box/collections/kt48945a.jvm_abi.txt new file mode 100644 index 00000000000..11267717795 --- /dev/null +++ b/compiler/testData/codegen/box/collections/kt48945a.jvm_abi.txt @@ -0,0 +1,10 @@ +MODULE main + CLASS Test.class + K1 + getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge] + K2 + --- + K1 + getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge] + K2 + --- diff --git a/compiler/testData/codegen/box/collections/kt48945a.kt b/compiler/testData/codegen/box/collections/kt48945a.kt index c40e43afe28..2824ccd3931 100644 --- a/compiler/testData/codegen/box/collections/kt48945a.kt +++ b/compiler/testData/codegen/box/collections/kt48945a.kt @@ -1,10 +1,10 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 -// IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: different structure of fake overrides. Fixed in the IR fake override builder. // IGNORE_BACKEND: ANDROID // ^ NSME: java.util.AbstractMap.remove // FULL_JDK +// JVM_ABI_K1_K2_DIFF: KT-65095 + interface MSS : Map class Test : MSS, java.util.AbstractMap() { diff --git a/compiler/testData/codegen/box/collections/kt48945b.jvm_abi.txt b/compiler/testData/codegen/box/collections/kt48945b.jvm_abi.txt new file mode 100644 index 00000000000..11267717795 --- /dev/null +++ b/compiler/testData/codegen/box/collections/kt48945b.jvm_abi.txt @@ -0,0 +1,10 @@ +MODULE main + CLASS Test.class + K1 + getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge] + K2 + --- + K1 + getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge] + K2 + --- diff --git a/compiler/testData/codegen/box/collections/kt48945b.kt b/compiler/testData/codegen/box/collections/kt48945b.kt index b4c6bf9f7ce..26780c50f69 100644 --- a/compiler/testData/codegen/box/collections/kt48945b.kt +++ b/compiler/testData/codegen/box/collections/kt48945b.kt @@ -1,10 +1,9 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 -// IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: different structure of fake overrides. Fixed in the IR fake override builder. // IGNORE_BACKEND: ANDROID // ^ NSME: java.util.AbstractMap.remove // FULL_JDK +// JVM_ABI_K1_K2_DIFF: KT-65095 // FILE: kt48945b.kt interface MSS : Map diff --git a/compiler/testData/codegen/box/collections/kt48945c.jvm_abi.txt b/compiler/testData/codegen/box/collections/kt48945c.jvm_abi.txt new file mode 100644 index 00000000000..11267717795 --- /dev/null +++ b/compiler/testData/codegen/box/collections/kt48945c.jvm_abi.txt @@ -0,0 +1,10 @@ +MODULE main + CLASS Test.class + K1 + getOrDefault(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; [public, final, bridge] + K2 + --- + K1 + getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; [public, bridge] + K2 + --- diff --git a/compiler/testData/codegen/box/collections/kt48945c.kt b/compiler/testData/codegen/box/collections/kt48945c.kt index 958c77a0df2..d9c25d4f9e0 100644 --- a/compiler/testData/codegen/box/collections/kt48945c.kt +++ b/compiler/testData/codegen/box/collections/kt48945c.kt @@ -1,10 +1,9 @@ // TARGET_BACKEND: JVM // JVM_TARGET: 1.8 -// IGNORE_BACKEND_K2: JVM_IR, JS_IR -// FIR status: different structure of fake overrides. Fixed in the IR fake override builder. // IGNORE_BACKEND: ANDROID // ^ NSME: java.util.AbstractMap.remove // FULL_JDK +// JVM_ABI_K1_K2_DIFF: KT-65095 // FILE: kt48945b.kt interface MSS : Map diff --git a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.jvm_abi.txt b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.jvm_abi.txt index 1433de84dc7..9176a90c4bc 100644 --- a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.jvm_abi.txt +++ b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.jvm_abi.txt @@ -7,30 +7,6 @@ MODULE main public open K2 public open operator - K1 - contains(I)Z [public, bridge] - K2 - --- - K1 - --- - K2 - contains(Ljava/lang/Integer;)Z [public, bridge] - K1 - indexOf(I)I [public, bridge] - K2 - --- - K1 - --- - K2 - indexOf(Ljava/lang/Integer;)I [public, bridge] - K1 - lastIndexOf(I)I [public, bridge] - K2 - --- - K1 - --- - K2 - lastIndexOf(Ljava/lang/Integer;)I [public, bridge] CLASS D.class CLASS METADATA FUNCTION removeAt(I)Ljava/lang/Integer; diff --git a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt index 88983dfd7a2..069b7a02ff9 100644 --- a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt +++ b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt @@ -1,5 +1,5 @@ // TARGET_BACKEND: JVM -// JVM_ABI_K1_K2_DIFF: KT-57300, KT-63857 +// JVM_ABI_K1_K2_DIFF: KT-63857 // FILE: A.java abstract public class A extends B { diff --git a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.fir.ir.txt b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.fir.ir.txt index d0efdef2ec2..9bc0cc6a290 100644 --- a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.fir.ir.txt +++ b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.fir.ir.txt @@ -83,14 +83,17 @@ FILE fqName: fileName:/delegatedPropertyWithMultipleOverriddens_generics.k FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:.MyList.MyMutableList>) returnType:E4 of .MyMutableList [fake_override] overridden: public abstract fun foo (): E2 of .MyList declared in .MyList + public abstract fun foo (): E3 of .MyMutableCollection declared in .MyMutableCollection $this: VALUE_PARAMETER name: type:.MyList.MyMutableList> PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val] overridden: public abstract bar: E2 of .MyList + public abstract bar: E3 of .MyMutableCollection FUN FAKE_OVERRIDE name: visibility:public modality:ABSTRACT <> ($this:.MyList.MyMutableList>) returnType:E4 of .MyMutableList [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val] overridden: public abstract fun (): E2 of .MyList declared in .MyList + public abstract fun (): E3 of .MyMutableCollection declared in .MyMutableCollection $this: VALUE_PARAMETER name: type:.MyList.MyMutableList> FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.kt b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.kt index fecdd0f8b39..84a189a00dd 100644 --- a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.kt +++ b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.kt @@ -1,7 +1,5 @@ // ISSUE: KT-55828 // DUMP_IR -// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: extra overridden symbols for declarations in MyMutableList. -// ^ This is most likely not a problem, and IR dump can be changed once IR fake override generation is enabled by default. // JVM_ABI_K1_K2_DIFF: KT-63828 diff --git a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.fir.ir.txt b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.fir.ir.txt index 2a7703bf383..079f0a6d314 100644 --- a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.fir.ir.txt +++ b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.fir.ir.txt @@ -79,14 +79,17 @@ FILE fqName: fileName:/delegatedPropertyWithMultipleOverriddens_noGenerics FUN FAKE_OVERRIDE name:foo visibility:public modality:ABSTRACT <> ($this:.MyList) returnType:kotlin.String [fake_override] overridden: public abstract fun foo (): kotlin.String declared in .MyList + public abstract fun foo (): kotlin.String declared in .MyMutableCollection $this: VALUE_PARAMETER name: type:.MyList PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val] overridden: public abstract bar: kotlin.String + public abstract bar: kotlin.String FUN FAKE_OVERRIDE name: visibility:public modality:ABSTRACT <> ($this:.MyList) returnType:kotlin.String [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:bar visibility:public modality:ABSTRACT [fake_override,val] overridden: public abstract fun (): kotlin.String declared in .MyList + public abstract fun (): kotlin.String declared in .MyMutableCollection $this: VALUE_PARAMETER name: type:.MyList FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.kt b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.kt index c09077d387b..f7c6bd0f6c1 100644 --- a/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.kt +++ b/compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_noGenerics.kt @@ -1,7 +1,5 @@ // ISSUE: KT-55828 // DUMP_IR -// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: extra overridden symbols for declarations in MyMutableList. -// ^ This is most likely not a problem, and IR dump can be changed once IR fake override generation is enabled by default. // JVM_ABI_K1_K2_DIFF: KT-63828 interface MyCollection { diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.jvm_abi.txt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.jvm_abi.txt deleted file mode 100644 index c7fdf96eb11..00000000000 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.jvm_abi.txt +++ /dev/null @@ -1,13 +0,0 @@ -MODULE main - CLASS MyMap.class - METHOD getOrDefault(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; - Annotation: method.invisibleAnnotations - K1 - @Lkotlin/SinceKotlin;( version: 1.1 ) - K2 - --- - Annotation: method.invisibleAnnotations - K1 - @Lkotlin/internal/PlatformDependent; - K2 - --- diff --git a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt index 42528c1914d..00fb4fddbd0 100644 --- a/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt +++ b/compiler/testData/codegen/box/jvm8/javaDefaults/kt40920_map.kt @@ -3,7 +3,6 @@ // TARGET_BACKEND: JVM // WITH_STDLIB // FULL_JDK -// JVM_ABI_K1_K2_DIFF: KT-62788 // FILE: main.kt var result = "" diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/extendingAbstractCollection.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/extendingAbstractCollection.kt index d4f378b66b6..11545e1014e 100644 --- a/compiler/testData/codegen/bytecodeListing/collectionStubs/extendingAbstractCollection.kt +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/extendingAbstractCollection.kt @@ -1,6 +1,3 @@ -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-57299 K2: VerifyError due to overriding final method `size` on a subclass of Collection and Set - abstract class AC : Collection abstract class ASet : AC(), Set diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractCollections.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractCollections.kt index 6c973b40aa0..dca362c5556 100644 --- a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractCollections.kt +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractCollections.kt @@ -1,8 +1,5 @@ // WITH_STDLIB -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type - abstract class AIterD : AbstractIterator() abstract class ACollD : AbstractCollection() diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMap.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMap.kt index b3a642a23d2..39572e06e52 100644 --- a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMap.kt +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMap.kt @@ -1,9 +1,5 @@ // WITH_STDLIB -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type -// (`containsValue(Ljava/lang/Double;)Z` instead of `containsValue(D)Z`) - abstract class AMapSD : AbstractMap() abstract class AMMapSD : AbstractMutableMap() diff --git a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt index b6ee90dadae..dec37d43de6 100644 --- a/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt +++ b/compiler/testData/codegen/bytecodeListing/collectionStubs/inheritingFromAbstractMutableList.kt @@ -1,8 +1,5 @@ // WITH_STDLIB -// IGNORE_BACKEND_K2: JVM_IR -// FIR status: KT-57300 K2: subclass of MutableCollection with primitive element type has methods with boxed type - abstract class AMListD : AbstractMutableList() abstract class AMListI : AbstractMutableList() diff --git a/compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt b/compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt new file mode 100644 index 00000000000..86b2821b022 --- /dev/null +++ b/compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt @@ -0,0 +1,13 @@ +// FIR_IDENTICAL + +interface SupervisorApiCallContextImpl : SupervisorApiCallDbContext, TxExecutor + +interface SupervisorApiCallDbContext : TxExecutor, DbContextOwner + +interface DbContextOwner : TxExecutor { + override fun foo(p: Int) {} +} + +interface TxExecutor { + fun foo(p: Int = 1) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/j+k/orderOfSupertypesAndFakeOverrides_1.fir.kt b/compiler/testData/diagnostics/tests/j+k/orderOfSupertypesAndFakeOverrides_1.fir.kt index 0e902c2a6c1..148bf3f4fca 100644 --- a/compiler/testData/diagnostics/tests/j+k/orderOfSupertypesAndFakeOverrides_1.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/orderOfSupertypesAndFakeOverrides_1.fir.kt @@ -12,7 +12,7 @@ abstract class Derived : Base { class InterfaceThenClass : Base, Derived() {} fun test_1(x: InterfaceThenClass, s: String?) { - x.delete(s) + x.delete(s) } class ClassThenInterface : Derived(), Base {} diff --git a/compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt b/compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt new file mode 100644 index 00000000000..ddec648eb17 --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt @@ -0,0 +1,41 @@ +// FIR_IDENTICAL + +// FILE: test.kt + +// We inherit getReturnType +// from CallableDescriptor with return type String? and +// from ClassConstructorDescriptorImpl with return type String +// but because ClassConstructorDescriptorImpl.getReturnType subsumes CallableDescriptor.getReturnType, we don't report RETURN_TYPE_MISMATCH_ON_INHERITANCE. +class DeserializedClassConstructorDescriptor : CallableDescriptor, ClassConstructorDescriptorImpl() + +// FILE: ClassConstructorDescriptorImpl.java + +// IJ reports an inspection warning +// "Non-annotated method 'getReturnType' from 'FunctionDescriptorImpl' implements non-null method from 'ConstructorDescriptor'" +// which is the underlying issue. +public class ClassConstructorDescriptorImpl extends FunctionDescriptorImpl implements ConstructorDescriptor {} + +// FILE: FunctionDescriptorImpl.java +public abstract class FunctionDescriptorImpl implements CallableDescriptor { + @Override + public String getReturnType() { + return null; + } +} + +// FILE: ConstructorDescriptor.java +import org.jetbrains.annotations.NotNull; + +public interface ConstructorDescriptor extends CallableDescriptor { + @NotNull + @Override + String getReturnType(); +} + +// FILE: CallableDescriptor.java +import org.jetbrains.annotations.Nullable; + +public interface CallableDescriptor { + @Nullable + String getReturnType(); +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt b/compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt new file mode 100644 index 00000000000..503e3218730 --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt @@ -0,0 +1,54 @@ +// FIR_IDENTICAL + +// FILE: VertLikeTable.java +public interface VertLikeTable extends BasicModMajorObject, BasicModTableOrView, BasicModIdentifiedElement +// FILE: BasicModMajorObject.java +public interface BasicModMajorObject extends BasicMajorObject, BasicModSchemaObject +// FILE: BasicMajorObject.java +public interface BasicMajorObject extends BasicSchemaObject, DasSchemaChild +// FILE: BasicSchemaObject.java +public interface BasicSchemaObject extends BasicNamedElement +// FILE: BasicNamedElement.java +public interface BasicNamedElement extends BasicElement { + @Override + void foo(); +} +// FILE: BasicElement.java +public interface BasicElement extends BasicMixinElement +// FILE: BasicMixinElement.java +public interface BasicMixinElement extends DasObject +// FILE: DasObject.java +public interface DasObject { + default void foo() {} +} +// FILE: DasSchemaChild.java +public interface DasSchemaChild extends DasObject +// FILE: BasicModSchemaObject.java +public interface BasicModSchemaObject extends BasicSchemaObject, BasicModNamedElement +// FILE: BasicModNamedElement.java +public interface BasicModNamedElement extends BasicNamedElement, BasicModElement +// FILE: BasicModElement.java +public interface BasicModElement extends BasicElement, BasicModMixinElement +// FILE: BasicModMixinElement.java +public interface BasicModMixinElement extends BasicMixinElement +// FILE: BasicModTableOrView.java +public interface BasicModTableOrView extends BasicTableOrView, BasicModLikeTable +// FILE: BasicTableOrView.java +public interface BasicTableOrView extends BasicLikeTable, BasicMixinTableOrView +// FILE: BasicLikeTable.java +public interface BasicLikeTable extends BasicNamedElement +// FILE: BasicMixinTableOrView.java +public interface BasicMixinTableOrView extends DasTable +// FILE: DasTable.java +public interface DasTable extends DasSchemaChild +// FILE: BasicModLikeTable.java +public interface BasicModLikeTable extends BasicLikeTable, BasicModNamedElement +// FILE: BasicModIdentifiedElement.java +public interface BasicModIdentifiedElement extends BasicIdentifiedElement, BasicModElement +// FILE: BasicIdentifiedElement.java +public interface BasicIdentifiedElement extends BasicElement + +// FILE: test.kt +fun foo(t: VertLikeTable) { + t.foo() +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt b/compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt new file mode 100644 index 00000000000..9583bbe958d --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt @@ -0,0 +1,16 @@ +// FIR_IDENTICAL + +abstract class C>() : + A(), + I> + +abstract class A, T> { + abstract val property: ModelPropertyT +} + +interface I { + val property: ModelPropertyCore +} + +interface ModelListPropertyCore : ModelPropertyCore> +interface ModelPropertyCore \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt b/compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt new file mode 100644 index 00000000000..22e4f8470d5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt @@ -0,0 +1,16 @@ +// FIR_IDENTICAL + +interface UAnnotationEx : UAnnotation, UAnchorOwner +interface UAnchorOwner : UElement +interface UElement { + val psi: PsiElement? + + val javaPsi: PsiElement? + get() = psi +} +interface UAnnotation : UElement { + override val javaPsi: PsiAnnotation? +} + +interface PsiElement +interface PsiAnnotation : PsiElement \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt b/compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt new file mode 100644 index 00000000000..80ef17f0644 --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt @@ -0,0 +1,21 @@ +// FIR_IDENTICAL + +// inherits accept from FirDeclarationStatusImpl and FirResolvedDeclarationStatus +class FirResolvedDeclarationStatusImpl : FirDeclarationStatusImpl(), FirResolvedDeclarationStatus + +// inherits accept from FirElement and FirDeclarationStatus +open class FirDeclarationStatusImpl : FirPureAbstractElement(), FirDeclarationStatus + +abstract class FirPureAbstractElement : FirElement + +interface FirResolvedDeclarationStatus : FirDeclarationStatus { + override fun accept() {} +} + +interface FirDeclarationStatus : FirElement { + override fun accept() {} +} + +interface FirElement { + fun accept() {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt b/compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt new file mode 100644 index 00000000000..2e3a36507aa --- /dev/null +++ b/compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt @@ -0,0 +1,18 @@ +// FIR_IDENTICAL + +class KtFirPsiJavaClassSymbol : KtFirNamedClassOrObjectSymbolBase(), KtFirPsiSymbol +open class KtFirNamedClassOrObjectSymbolBase : KtNamedClassOrObjectSymbol(), KtFirSymbol +abstract class KtNamedClassOrObjectSymbol : KtLifetimeOwner + +interface KtFirPsiSymbol : KtFirSymbol + +interface KtLifetimeOwner { + val token: String +} + +interface KtSymbol : KtLifetimeOwner + +interface KtFirSymbol : KtSymbol, KtLifetimeOwner { + override val token: String get() = "" +} + diff --git a/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt b/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt deleted file mode 100644 index 8df4ecc0a5e..00000000000 --- a/compiler/testData/diagnostics/tests/rawTypes/kt57620.fir.kt +++ /dev/null @@ -1,29 +0,0 @@ -// !CHECK_TYPE -// FILE: PythonRunParams.java -import java.util.Map; - -public interface PythonRunParams { - Map fetchEnvs(); -} - -// FILE: AbstractPythonRunConfiguration.java -import java.util.HashMap; -import java.util.Map; - -public class AbstractPythonRunConfiguration implements PythonRunParams { - public Map fetchEnvs() { - return null; - } -} - - -// FILE: PythonRunConfiguration.java -public class PythonRunConfiguration extends AbstractPythonRunConfiguration implements PythonRunParams {} - -// FILE: ProjectMain.kt - -fun getRunCommandLine(configuration: PythonRunConfiguration) { - fun foo(envs: Map) {} - checkSubtype>(configuration.fetchEnvs()) - checkSubtype>(configuration.fetchEnvs()) -} diff --git a/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt b/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt index 8613a018aeb..8a804c6f04c 100644 --- a/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt +++ b/compiler/testData/diagnostics/tests/rawTypes/kt57620.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // FILE: PythonRunParams.java import java.util.Map; diff --git a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.fir.kt index e5138150a0b..edb7211f022 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/purelyImplementedCollection/customClassMutableList.fir.kt @@ -27,8 +27,8 @@ fun foo() { x.add(bar()) x.add("") - x[0] = null - x[0] = bar() + x[0] = null + x[0] = bar() x[0] = "" val b1: MutableList = x diff --git a/compiler/testData/ir/irText/classes/enumClassModality.fir.ir.txt b/compiler/testData/ir/irText/classes/enumClassModality.fir.ir.txt index a4fbc6f1cdb..377c185d13e 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.fir.ir.txt @@ -527,19 +527,19 @@ FILE fqName: fileName:/enumClassModality.kt public abstract fun foo (): kotlin.Unit declared in .TestAbstractEnum2 $this: VALUE_PARAMETER name: type:.TestAbstractEnum2.X1 BLOCK_BODY - FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public final fun equals (other: kotlin.Any?): kotlin.Boolean declared in .TestAbstractEnum2 - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> + $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: public final fun hashCode (): kotlin.Int declared in .TestAbstractEnum2 - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum<.TestAbstractEnum2>) returnType:kotlin.String [fake_override] + $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 .TestAbstractEnum2 - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> + $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>, other:.TestAbstractEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: .TestAbstractEnum2): kotlin.Int declared in .TestAbstractEnum2 @@ -576,19 +576,22 @@ FILE fqName: fileName:/enumClassModality.kt overridden: public abstract fun foo (): kotlin.Unit declared in .IFoo $this: VALUE_PARAMETER name: type:.IFoo - FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + FUN FAKE_OVERRIDE name:equals visibility:public modality:FINAL <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IFoo public final fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> + $this: VALUE_PARAMETER name: type:kotlin.Any VALUE_PARAMETER name:other index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:FINAL <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] overridden: + public open fun hashCode (): kotlin.Int declared in .IFoo public final fun hashCode (): kotlin.Int declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Enum<.TestAbstractEnum2>) returnType:kotlin.String [fake_override] + $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 .IFoo public open fun toString (): kotlin.String declared in kotlin.Enum - $this: VALUE_PARAMETER name: type:kotlin.Enum<.TestAbstractEnum2> + $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:compareTo visibility:public modality:FINAL <> ($this:kotlin.Enum<.TestAbstractEnum2>, other:.TestAbstractEnum2) returnType:kotlin.Int [fake_override,operator] overridden: public final fun compareTo (other: E of kotlin.Enum): kotlin.Int declared in kotlin.Enum diff --git a/compiler/testData/ir/irText/classes/enumClassModality.kt b/compiler/testData/ir/irText/classes/enumClassModality.kt index 01227fd5025..7096f0638fd 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.kt +++ b/compiler/testData/ir/irText/classes/enumClassModality.kt @@ -1,6 +1,3 @@ -// KT-64271, KT-64382 -// IGNORE_BACKEND_K2: NATIVE, WASM, JS_IR, JS_IR_ES6 - enum class TestFinalEnum1 { X1 } diff --git a/compiler/testData/ir/irText/classes/overriddenEquals.kt b/compiler/testData/ir/irText/classes/overriddenEquals.kt index 897a54e2622..0db8905ae9e 100644 --- a/compiler/testData/ir/irText/classes/overriddenEquals.kt +++ b/compiler/testData/ir/irText/classes/overriddenEquals.kt @@ -1,6 +1,5 @@ // FIR_IDENTICAL // KT-64271 -// IGNORE_BACKEND_K2: JVM_IR open class Base { override fun equals(other: Any?): Boolean { diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.ir.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.ir.txt index ce29b2d7e04..21133fd5ff0 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.ir.txt @@ -20,30 +20,30 @@ FILE fqName: fileName:/AbstractMutableMap.kt CONST Null type=kotlin.Nothing? value=null PROPERTY name:entries visibility:public modality:OPEN [val] overridden: - public abstract entries: @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableSet<@[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableMap.MutableEntry<@[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?, @[FlexibleNullability] V of kotlin.collections.AbstractMutableMap?>?>? + public abstract entries: kotlin.collections.MutableSet> FUN name: visibility:public modality:OPEN <> ($this:.MyMap.MyMap, V of .MyMap>) returnType:kotlin.collections.MutableSet.MyMap, V of .MyMap>> correspondingProperty: PROPERTY name:entries visibility:public modality:OPEN [val] overridden: - public abstract fun (): @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableSet<@[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableMap.MutableEntry<@[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?, @[FlexibleNullability] V of kotlin.collections.AbstractMutableMap?>?>? declared in kotlin.collections.AbstractMutableMap + public abstract fun (): kotlin.collections.MutableSet> declared in kotlin.collections.AbstractMutableMap $this: VALUE_PARAMETER name: type:.MyMap.MyMap, V of .MyMap> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.collections.MutableSet.MyMap, V of .MyMap>> declared in .MyMap' CALL 'public final fun mutableSetOf (): kotlin.collections.MutableSet declared in kotlin.collections' type=kotlin.collections.MutableSet.MyMap, V of .MyMap>> origin=null : kotlin.collections.MutableMap.MutableEntry.MyMap, V of .MyMap> - FUN FAKE_OVERRIDE name:clear visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:kotlin.Unit [fake_override] + FUN FAKE_OVERRIDE name:clear visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>) returnType:kotlin.Unit [fake_override] overridden: public open fun clear (): kotlin.Unit declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - FUN FAKE_OVERRIDE name:putAll visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:@[EnhancedNullability] kotlin.collections.Map.MyMap?, @[FlexibleNullability] V of .MyMap?>) returnType:kotlin.Unit [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap.MyMap, V of .MyMap> + FUN FAKE_OVERRIDE name:putAll visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>, from:kotlin.collections.Map.MyMap, V of .MyMap>) returnType:kotlin.Unit [fake_override] overridden: - public open fun putAll (p0: @[EnhancedNullability] kotlin.collections.Map): kotlin.Unit declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] kotlin.collections.Map.MyMap?, @[FlexibleNullability] V of .MyMap?> - FUN FAKE_OVERRIDE name:remove visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:@[FlexibleNullability] K of .MyMap?) returnType:V of .MyMap? [fake_override] + public open fun putAll (from: kotlin.collections.Map): kotlin.Unit declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap.MyMap, V of .MyMap> + VALUE_PARAMETER name:from index:0 type:kotlin.collections.Map.MyMap, V of .MyMap> + FUN FAKE_OVERRIDE name:remove visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>, key:K of .MyMap) returnType:V of .MyMap? [fake_override] overridden: - public open fun remove (p0: @[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?): V of kotlin.collections.AbstractMutableMap? declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] K of .MyMap? + public open fun remove (key: K of kotlin.collections.AbstractMutableMap): V of kotlin.collections.AbstractMutableMap? declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap.MyMap, V of .MyMap> + VALUE_PARAMETER name:key index:0 type:K of .MyMap FUN FAKE_OVERRIDE name:remove visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>, key:K of .MyMap, value:V of .MyMap) returnType:kotlin.Boolean [fake_override] annotations: SinceKotlin(version = "1.1") @@ -55,47 +55,47 @@ FILE fqName: fileName:/AbstractMutableMap.kt VALUE_PARAMETER name:value index:1 type:V of .MyMap PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] overridden: - public open keys: @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableSet<@[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?>? - FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:@[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableSet<@[FlexibleNullability] K of .MyMap?>? [fake_override] + public open keys: kotlin.collections.MutableSet + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>) returnType:kotlin.collections.MutableSet.MyMap> [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:keys visibility:public modality:OPEN [fake_override,val] overridden: - public open fun (): @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableSet<@[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?>? declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> + public open fun (): kotlin.collections.MutableSet declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap.MyMap, V of .MyMap> PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] overridden: - public open values: @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableCollection<@[FlexibleNullability] V of kotlin.collections.AbstractMutableMap?>? - FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:@[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableCollection<@[FlexibleNullability] V of .MyMap?>? [fake_override] + public open values: kotlin.collections.MutableCollection + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:kotlin.collections.MutableMap.MyMap, V of .MyMap>) returnType:kotlin.collections.MutableCollection.MyMap> [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:values visibility:public modality:OPEN [fake_override,val] overridden: - public open fun (): @[FlexibleNullability] @[FlexibleMutability] kotlin.collections.MutableCollection<@[FlexibleNullability] V of kotlin.collections.AbstractMutableMap?>? declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> + public open fun (): kotlin.collections.MutableCollection declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.MutableMap.MyMap, V of .MyMap> PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: public open size: kotlin.Int - FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>) returnType:kotlin.Int [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: public open fun (): kotlin.Int declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:kotlin.Boolean [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.Map.MyMap, V of .MyMap> + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>) returnType:kotlin.Boolean [fake_override] overridden: public open fun isEmpty (): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:@[FlexibleNullability] K of .MyMap?) returnType:kotlin.Boolean [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.Map.MyMap, V of .MyMap> + FUN FAKE_OVERRIDE name:containsKey visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>, key:K of .MyMap) returnType:kotlin.Boolean [fake_override] overridden: - public open fun containsKey (p0: @[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] K of .MyMap? - FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:@[FlexibleNullability] V of .MyMap?) returnType:kotlin.Boolean [fake_override] + public open fun containsKey (key: K of kotlin.collections.AbstractMutableMap): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.Map.MyMap, V of .MyMap> + VALUE_PARAMETER name:key index:0 type:K of .MyMap + FUN FAKE_OVERRIDE name:containsValue visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>, value:V of .MyMap) returnType:kotlin.Boolean [fake_override] overridden: - public open fun containsValue (p0: @[FlexibleNullability] V of kotlin.collections.AbstractMutableMap?): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] V of .MyMap? - FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:@[FlexibleNullability] K of .MyMap?) returnType:V of .MyMap? [fake_override,operator] + public open fun containsValue (value: V of kotlin.collections.AbstractMutableMap): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.Map.MyMap, V of .MyMap> + VALUE_PARAMETER name:value index:0 type:V of .MyMap + FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>, key:K of .MyMap) returnType:V of .MyMap? [fake_override,operator] overridden: - public open fun get (p0: @[FlexibleNullability] K of kotlin.collections.AbstractMutableMap?): V of kotlin.collections.AbstractMutableMap? declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] K of .MyMap? + public open fun get (key: K of kotlin.collections.AbstractMutableMap): V of kotlin.collections.AbstractMutableMap? declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.collections.Map.MyMap, V of .MyMap> + VALUE_PARAMETER name:key index:0 type:K of .MyMap FUN FAKE_OVERRIDE name:getOrDefault visibility:public modality:OPEN <> ($this:kotlin.collections.Map.MyMap, V of .MyMap>, key:K of .MyMap, defaultValue:V of .MyMap) returnType:V of .MyMap [fake_override] annotations: SinceKotlin(version = "1.1") @@ -159,19 +159,19 @@ FILE fqName: fileName:/AbstractMutableMap.kt VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] K of .MyMap VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] {V of .MyMap & Any} VALUE_PARAMETER name:p2 index:2 type:@[EnhancedNullability] java.util.function.BiFunction.MyMap, in V of .MyMap, out V of .MyMap?> - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>, p0:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + 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 (p0: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - VALUE_PARAMETER name:p0 index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:kotlin.Int [fake_override] + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.collections.AbstractMutableMap + $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.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:@[EnhancedNullability] kotlin.String [fake_override] + $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 (): @[EnhancedNullability] kotlin.String declared in kotlin.collections.AbstractMutableMap - $this: VALUE_PARAMETER name: type:java.util.AbstractMap.MyMap, V of .MyMap> + public open fun toString (): kotlin.String declared in kotlin.collections.AbstractMutableMap + $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:clone visibility:protected/*protected and package*/ modality:OPEN <> ($this:java.util.AbstractMap.MyMap, V of .MyMap>) returnType:@[FlexibleNullability] kotlin.Any? [fake_override] overridden: protected/*protected and package*/ open fun clone (): @[FlexibleNullability] kotlin.Any? declared in kotlin.collections.AbstractMutableMap diff --git a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.sig.kt.txt b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.sig.kt.txt index 5b4e37d9d95..bc899f45a0a 100644 --- a/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.sig.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AbstractMutableMap.fir.sig.kt.txt @@ -41,22 +41,22 @@ class MyMap : AbstractMutableMap { /* fake */ override fun computeIfPresent(p0: @EnhancedNullability K, p1: @EnhancedNullability BiFunction): V? // CHECK JVM_IR: - // Mangled name: MyMap#containsKey(1:0?){}kotlin.Boolean - // Public signature: /MyMap.containsKey|5388260987070917879[0] - // Public signature debug description: containsKey(1:0?){}kotlin.Boolean - /* fake */ override fun containsKey(p0: K?): Boolean + // Mangled name: MyMap#containsKey(1:0){}kotlin.Boolean + // Public signature: /MyMap.containsKey|-2697616884574929105[0] + // Public signature debug description: containsKey(1:0){}kotlin.Boolean + /* fake */ override fun containsKey(key: K): Boolean // CHECK JVM_IR: - // Mangled name: MyMap#containsValue(1:1?){}kotlin.Boolean - // Public signature: /MyMap.containsValue|6075307672600079396[0] - // Public signature debug description: containsValue(1:1?){}kotlin.Boolean - /* fake */ override fun containsValue(p0: V?): Boolean + // Mangled name: MyMap#containsValue(1:1){}kotlin.Boolean + // Public signature: /MyMap.containsValue|4814293423579408279[0] + // Public signature debug description: containsValue(1:1){}kotlin.Boolean + /* fake */ override fun containsValue(value: V): Boolean // CHECK JVM_IR: // Mangled name: MyMap#equals(kotlin.Any?){}kotlin.Boolean // Public signature: /MyMap.equals|722809408929142791[0] // Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean - /* fake */ override operator fun equals(p0: Any?): Boolean + /* fake */ override operator fun equals(other: Any?): Boolean // CHECK: // Mangled name: MyMap#forEach(java.util.function.BiConsumer{EnhancedNullability}){} @@ -65,10 +65,10 @@ class MyMap : AbstractMutableMap { /* fake */ override fun forEach(p0: @EnhancedNullability BiConsumer): Unit // CHECK JVM_IR: - // Mangled name: MyMap#get(1:0?){}1:1? - // Public signature: /MyMap.get|-6772263552617817959[0] - // Public signature debug description: get(1:0?){}1:1? - /* fake */ override operator fun get(p0: K?): V? + // Mangled name: MyMap#get(1:0){}1:1? + // Public signature: /MyMap.get|-2177239518810968262[0] + // Public signature debug description: get(1:0){}1:1? + /* fake */ override operator fun get(key: K): V? // CHECK JVM_IR: // Mangled name: MyMap#hashCode(){}kotlin.Int @@ -91,12 +91,10 @@ class MyMap : AbstractMutableMap { /* fake */ override fun merge(p0: @EnhancedNullability K, p1: @EnhancedNullability (V & Any), p2: @EnhancedNullability BiFunction): V? // CHECK: - // Mangled name: MyMap#putAll(kotlin.collections.Map{EnhancedNullability}){} - // Mangled name for the signature by IR: putAll(kotlin.collections.Map{EnhancedNullability}){} - // Mangled name for the signature by Frontend: putAll(kotlin.collections.Map{EnhancedNullability}){} - // Public signature: /MyMap.putAll|8252374948943605914[0] - // Public signature debug description: putAll(kotlin.collections.Map{EnhancedNullability}){} - /* fake */ override fun putAll(p0: @EnhancedNullability Map): Unit + // Mangled name: MyMap#putAll(kotlin.collections.Map){} + // Public signature: /MyMap.putAll|3806055228188180795[0] + // Public signature debug description: putAll(kotlin.collections.Map){} + /* fake */ override fun putAll(from: Map): Unit // CHECK JVM_IR: // Mangled name: MyMap#putIfAbsent(1:0{EnhancedNullability};1:1{EnhancedNullability}){}1:1? @@ -105,10 +103,10 @@ class MyMap : AbstractMutableMap { /* fake */ override fun putIfAbsent(p0: @EnhancedNullability K, p1: @EnhancedNullability V): V? // CHECK JVM_IR: - // Mangled name: MyMap#remove(1:0?){}1:1? - // Public signature: /MyMap.remove|-6409265674850759324[0] - // Public signature debug description: remove(1:0?){}1:1? - /* fake */ override fun remove(p0: K?): V? + // Mangled name: MyMap#remove(1:0){}1:1? + // Public signature: /MyMap.remove|-2166109024517733367[0] + // Public signature debug description: remove(1:0){}1:1? + /* fake */ override fun remove(key: K): V? // CHECK JVM_IR: // Mangled name: MyMap#replace(1:0{EnhancedNullability};1:1{EnhancedNullability}){}1:1? @@ -129,10 +127,10 @@ class MyMap : AbstractMutableMap { /* fake */ override fun replaceAll(p0: @EnhancedNullability BiFunction): Unit // CHECK JVM_IR: - // Mangled name: MyMap#toString(){}kotlin.String{EnhancedNullability} - // Public signature: /MyMap.toString|7581629773206850948[0] - // Public signature debug description: toString(){}kotlin.String{EnhancedNullability} - /* fake */ override fun toString(): @EnhancedNullability String + // Mangled name: MyMap#toString(){}kotlin.String + // Public signature: /MyMap.toString|6958853723545266802[0] + // Public signature debug description: toString(){}kotlin.String + /* fake */ override fun toString(): String // CHECK JVM_IR: // Mangled name: MyMap#put(1:0;1:1){}1:1? @@ -144,12 +142,12 @@ class MyMap : AbstractMutableMap { // Mangled name: MyMap{}keys // Public signature: /MyMap.keys|-1539062068328255324[0] // Public signature debug description: {}keys - /* fake */ override val keys: MutableSet? + /* fake */ override val keys: MutableSet // CHECK JVM_IR: - // Mangled name: MyMap#(){}kotlin.collections.MutableSet<1:0?>? - // Public signature: /MyMap.keys.|-1655820107680360252[0] - // Public signature debug description: (){}kotlin.collections.MutableSet<1:0?>? - /* fake */ override get(): MutableSet? + // Mangled name: MyMap#(){}kotlin.collections.MutableSet<1:0> + // Public signature: /MyMap.keys.|7916886785914150473[0] + // Public signature debug description: (){}kotlin.collections.MutableSet<1:0> + /* fake */ override get(): MutableSet // CHECK: // Mangled name: MyMap{}size @@ -166,12 +164,12 @@ class MyMap : AbstractMutableMap { // Mangled name: MyMap{}values // Public signature: /MyMap.values|-764749005844117249[0] // Public signature debug description: {}values - /* fake */ override val values: MutableCollection? + /* fake */ override val values: MutableCollection // CHECK JVM_IR: - // Mangled name: MyMap#(){}kotlin.collections.MutableCollection<1:1?>? - // Public signature: /MyMap.values.|-600458440523652989[0] - // Public signature debug description: (){}kotlin.collections.MutableCollection<1:1?>? - /* fake */ override get(): MutableCollection? + // Mangled name: MyMap#(){}kotlin.collections.MutableCollection<1:1> + // Public signature: /MyMap.values.|2480674037943213638[0] + // Public signature debug description: (){}kotlin.collections.MutableCollection<1:1> + /* fake */ override get(): MutableCollection // CHECK: // Mangled name: MyMap{}entries @@ -185,3 +183,4 @@ class MyMap : AbstractMutableMap { override get(): MutableSet> } + diff --git a/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt b/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt index 7e2301a50fa..197ba42897d 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.fir.ir.txt @@ -196,62 +196,74 @@ FILE fqName: fileName:/MultiList.kt DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in java.util.ArrayList' : .Some.SomeList> INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SomeList modality:OPEN visibility:public superTypes:[.MyList.SomeList>; java.util.ArrayList<.Some.SomeList>>]' - FUN FAKE_OVERRIDE name:contains visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[EnhancedNullability] .Some.SomeList>) returnType:kotlin.Boolean [fake_override,operator] + FUN FAKE_OVERRIDE name:contains visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>, element:.Some.SomeList>) returnType:kotlin.Boolean [fake_override,operator] overridden: + public abstract fun contains (element: .Some.MyList>): kotlin.Boolean declared in .MyList public open fun contains (p0: @[EnhancedNullability] E of java.util.ArrayList): kotlin.Boolean declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some.SomeList> - FUN FAKE_OVERRIDE name:containsAll visibility:public modality:OPEN <> ($this:java.util.AbstractCollection<@[FlexibleNullability] .Some.SomeList>?>, p0:kotlin.collections.Collection<@[FlexibleNullability] .Some.SomeList>?>) returnType:kotlin.Boolean [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + VALUE_PARAMETER name:element index:0 type:.Some.SomeList> + FUN FAKE_OVERRIDE name:containsAll visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>, elements:kotlin.collections.Collection<.Some.SomeList>>) returnType:kotlin.Boolean [fake_override] overridden: + public abstract fun containsAll (elements: kotlin.collections.Collection<.Some.MyList>>): kotlin.Boolean declared in .MyList public open fun containsAll (p0: kotlin.collections.Collection<@[FlexibleNullability] E of java.util.ArrayList?>): kotlin.Boolean declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.AbstractCollection<@[FlexibleNullability] .Some.SomeList>?> - VALUE_PARAMETER name:p0 index:0 type:kotlin.collections.Collection<@[FlexibleNullability] .Some.SomeList>?> - FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:kotlin.Int) returnType:@[EnhancedNullability] .Some.SomeList> [fake_override,operator] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<.Some.SomeList>> + FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>, index:kotlin.Int) returnType:.Some.SomeList> [fake_override,operator] overridden: + public abstract fun get (index: kotlin.Int): .Some.MyList> declared in .MyList public open fun get (p0: kotlin.Int): @[EnhancedNullability] E of java.util.ArrayList declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - VALUE_PARAMETER name:p0 index:0 type:kotlin.Int - FUN FAKE_OVERRIDE name:indexOf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[EnhancedNullability] .Some.SomeList>) returnType:kotlin.Int [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + VALUE_PARAMETER name:index index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:indexOf visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>, element:.Some.SomeList>) returnType:kotlin.Int [fake_override] overridden: + public abstract fun indexOf (element: .Some.MyList>): kotlin.Int declared in .MyList public open fun indexOf (p0: @[EnhancedNullability] E of java.util.ArrayList): kotlin.Int declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some.SomeList> - FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:kotlin.Boolean [fake_override] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + VALUE_PARAMETER name:element index:0 type:.Some.SomeList> + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>) returnType:kotlin.Boolean [fake_override] overridden: + public abstract fun isEmpty (): kotlin.Boolean declared in .MyList public open fun isEmpty (): kotlin.Boolean declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> FUN FAKE_OVERRIDE name:iterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[EnhancedNullability] kotlin.collections.MutableIterator<@[EnhancedNullability] .Some.SomeList>> [fake_override,operator] overridden: + public abstract fun iterator (): kotlin.collections.Iterator<.Some.MyList>> declared in .MyList public open fun iterator (): @[EnhancedNullability] kotlin.collections.MutableIterator<@[EnhancedNullability] E of java.util.ArrayList> declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[EnhancedNullability] .Some.SomeList>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>, element:.Some.SomeList>) returnType:kotlin.Int [fake_override] overridden: + public abstract fun lastIndexOf (element: .Some.MyList>): kotlin.Int declared in .MyList public open fun lastIndexOf (p0: @[EnhancedNullability] E of java.util.ArrayList): kotlin.Int declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some.SomeList> + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + VALUE_PARAMETER name:element index:0 type:.Some.SomeList> FUN FAKE_OVERRIDE name:listIterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] .Some.SomeList>> [fake_override] overridden: + public abstract fun listIterator (): kotlin.collections.ListIterator<.Some.MyList>> declared in .MyList public open fun listIterator (): @[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] E of java.util.ArrayList> declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> FUN FAKE_OVERRIDE name:listIterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:kotlin.Int) returnType:@[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] .Some.SomeList>> [fake_override] overridden: + public abstract fun listIterator (index: kotlin.Int): kotlin.collections.ListIterator<.Some.MyList>> declared in .MyList public open fun listIterator (p0: kotlin.Int): @[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] E of java.util.ArrayList> declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> VALUE_PARAMETER name:p0 index:0 type:kotlin.Int FUN FAKE_OVERRIDE name:subList visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:kotlin.Int, p1:kotlin.Int) returnType:@[EnhancedNullability] kotlin.collections.MutableList<@[EnhancedNullability] .Some.SomeList>> [fake_override] overridden: + public abstract fun subList (fromIndex: kotlin.Int, toIndex: kotlin.Int): kotlin.collections.List<.Some.MyList>> declared in .MyList public open fun subList (p0: kotlin.Int, p1: kotlin.Int): @[EnhancedNullability] kotlin.collections.MutableList<@[EnhancedNullability] E of java.util.ArrayList> declared in java.util.ArrayList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> VALUE_PARAMETER name:p0 index:0 type:kotlin.Int VALUE_PARAMETER name:p1 index:1 type:kotlin.Int PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: + public abstract size: kotlin.Int public open size: kotlin.Int - FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>) returnType:kotlin.Int [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: + public abstract fun (): kotlin.Int declared in .MyList public open fun (): kotlin.Int declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in java.util.ArrayList @@ -319,23 +331,27 @@ FILE fqName: fileName:/MultiList.kt $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> VALUE_PARAMETER name:p0 index:0 type:kotlin.Int VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] .Some.SomeList> - FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:@[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some.SomeList>?> [fake_override] + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some.SomeList>>) returnType:@[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some.SomeList>?> [fake_override] overridden: + public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some.MyList>?> declared in .MyList public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] E of java.util.ArrayList?> declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:java.util.AbstractList<@[FlexibleNullability] .Some.SomeList>?>, p0:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some.SomeList>> + 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 declared in .MyList public open fun equals (p0: kotlin.Any?): kotlin.Boolean declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.AbstractList<@[FlexibleNullability] .Some.SomeList>?> - VALUE_PARAMETER name:p0 index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:java.util.AbstractList<@[FlexibleNullability] .Some.SomeList>?>) returnType:kotlin.Int [fake_override] + $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 .MyList public open fun hashCode (): kotlin.Int declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.AbstractList<@[FlexibleNullability] .Some.SomeList>?> - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:java.util.AbstractCollection<@[FlexibleNullability] .Some.SomeList>?>) returnType:@[EnhancedNullability] kotlin.String [fake_override] + $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 .MyList public open fun toString (): @[EnhancedNullability] kotlin.String declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.AbstractCollection<@[FlexibleNullability] .Some.SomeList>?> + $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:removeIf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[EnhancedNullability] java.util.function.Predicate.Some.SomeList>>) returnType:kotlin.Boolean [fake_override] overridden: public open fun removeIf (p0: @[EnhancedNullability] java.util.function.Predicate): kotlin.Boolean declared in java.util.ArrayList @@ -349,10 +365,11 @@ FILE fqName: fileName:/MultiList.kt overridden: public open fun parallelStream (): @[EnhancedNullability] java.util.stream.Stream<@[EnhancedNullability] .Some.MyList>> declared in .MyList $this: VALUE_PARAMETER name: type:kotlin.collections.Collection<.Some.SomeList>> - FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>, p0:@[FlexibleNullability] java.util.function.Consumer.Some.SomeList>?>?) returnType:kotlin.Unit [fake_override] + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.Some.SomeList>>, p0:@[FlexibleNullability] java.util.function.Consumer.Some.SomeList>?>?) returnType:kotlin.Unit [fake_override] overridden: + public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer.Some.MyList>?>?): kotlin.Unit declared in .MyList public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer?): kotlin.Unit declared in java.util.ArrayList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some.SomeList>> + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.Some.SomeList>> VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.Consumer.Some.SomeList>?>? FUN FAKE_OVERRIDE name:trimToSize visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some.SomeList>>) returnType:kotlin.Unit [fake_override] overridden: @@ -385,39 +402,39 @@ FILE fqName: fileName:/MultiList.kt DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .SomeList' : kotlin.String INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FinalList modality:FINAL visibility:public superTypes:[.SomeList]' - FUN FAKE_OVERRIDE name:contains visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[EnhancedNullability] .Some) returnType:kotlin.Boolean [fake_override,operator] + FUN FAKE_OVERRIDE name:contains visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>, element:.Some) returnType:kotlin.Boolean [fake_override,operator] overridden: - public open fun contains (p0: @[EnhancedNullability] .Some.SomeList>): kotlin.Boolean declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some - FUN FAKE_OVERRIDE name:containsAll visibility:public modality:OPEN <> ($this:java.util.AbstractCollection<@[FlexibleNullability] .Some?>, p0:kotlin.collections.Collection<@[FlexibleNullability] .Some?>) returnType:kotlin.Boolean [fake_override] + public open fun contains (element: .Some.SomeList>): kotlin.Boolean declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + VALUE_PARAMETER name:element index:0 type:.Some + FUN FAKE_OVERRIDE name:containsAll visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>, elements:kotlin.collections.Collection<.Some>) returnType:kotlin.Boolean [fake_override] overridden: - public open fun containsAll (p0: kotlin.collections.Collection<@[FlexibleNullability] .Some.SomeList>?>): kotlin.Boolean declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.AbstractCollection<@[FlexibleNullability] .Some?> - VALUE_PARAMETER name:p0 index:0 type:kotlin.collections.Collection<@[FlexibleNullability] .Some?> - FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:kotlin.Int) returnType:@[EnhancedNullability] .Some [fake_override,operator] + public open fun containsAll (elements: kotlin.collections.Collection<.Some.SomeList>>): kotlin.Boolean declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + VALUE_PARAMETER name:elements index:0 type:kotlin.collections.Collection<.Some> + FUN FAKE_OVERRIDE name:get visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>, index:kotlin.Int) returnType:.Some [fake_override,operator] overridden: - public open fun get (p0: kotlin.Int): @[EnhancedNullability] .Some.SomeList> declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - VALUE_PARAMETER name:p0 index:0 type:kotlin.Int - FUN FAKE_OVERRIDE name:indexOf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[EnhancedNullability] .Some) returnType:kotlin.Int [fake_override] + public open fun get (index: kotlin.Int): .Some.SomeList> declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + VALUE_PARAMETER name:index index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:indexOf visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>, element:.Some) returnType:kotlin.Int [fake_override] overridden: - public open fun indexOf (p0: @[EnhancedNullability] .Some.SomeList>): kotlin.Int declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some - FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:kotlin.Boolean [fake_override] + public open fun indexOf (element: .Some.SomeList>): kotlin.Int declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + VALUE_PARAMETER name:element index:0 type:.Some + FUN FAKE_OVERRIDE name:isEmpty visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>) returnType:kotlin.Boolean [fake_override] overridden: public open fun isEmpty (): kotlin.Boolean declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> FUN FAKE_OVERRIDE name:iterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[EnhancedNullability] kotlin.collections.MutableIterator<@[EnhancedNullability] .Some> [fake_override,operator] overridden: public open fun iterator (): @[EnhancedNullability] kotlin.collections.MutableIterator<@[EnhancedNullability] .Some.SomeList>> declared in .SomeList $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[EnhancedNullability] .Some) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name:lastIndexOf visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>, element:.Some) returnType:kotlin.Int [fake_override] overridden: - public open fun lastIndexOf (p0: @[EnhancedNullability] .Some.SomeList>): kotlin.Int declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - VALUE_PARAMETER name:p0 index:0 type:@[EnhancedNullability] .Some + public open fun lastIndexOf (element: .Some.SomeList>): kotlin.Int declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + VALUE_PARAMETER name:element index:0 type:.Some FUN FAKE_OVERRIDE name:listIterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] .Some> [fake_override] overridden: public open fun listIterator (): @[EnhancedNullability] kotlin.collections.MutableListIterator<@[EnhancedNullability] .Some.SomeList>> declared in .SomeList @@ -436,11 +453,11 @@ FILE fqName: fileName:/MultiList.kt PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: public open size: kotlin.Int - FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:kotlin.Int [fake_override] + FUN FAKE_OVERRIDE name: visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>) returnType:kotlin.Int [fake_override] correspondingProperty: PROPERTY FAKE_OVERRIDE name:size visibility:public modality:OPEN [fake_override,val] overridden: public open fun (): kotlin.Int declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> FUN FAKE_OVERRIDE name:toArray visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? [fake_override] overridden: public open fun toArray (): @[FlexibleNullability] @[FlexibleArrayElementVariance] kotlin.Array? declared in .SomeList @@ -508,23 +525,23 @@ FILE fqName: fileName:/MultiList.kt $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> VALUE_PARAMETER name:p0 index:0 type:kotlin.Int VALUE_PARAMETER name:p1 index:1 type:@[EnhancedNullability] .Some - FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:@[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some?> [fake_override] + FUN FAKE_OVERRIDE name:spliterator visibility:public modality:OPEN <> ($this:kotlin.collections.List<.Some>) returnType:@[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some?> [fake_override] overridden: public open fun spliterator (): @[EnhancedNullability] java.util.Spliterator<@[FlexibleNullability] .Some.SomeList>?> declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> - FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:java.util.AbstractList<@[FlexibleNullability] .Some?>, p0:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + $this: VALUE_PARAMETER name: type:kotlin.collections.List<.Some> + 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 (p0: kotlin.Any?): kotlin.Boolean declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.AbstractList<@[FlexibleNullability] .Some?> - VALUE_PARAMETER name:p0 index:0 type:kotlin.Any? - FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:java.util.AbstractList<@[FlexibleNullability] .Some?>) returnType:kotlin.Int [fake_override] + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .SomeList + $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 .SomeList - $this: VALUE_PARAMETER name: type:java.util.AbstractList<@[FlexibleNullability] .Some?> - FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:java.util.AbstractCollection<@[FlexibleNullability] .Some?>) returnType:@[EnhancedNullability] kotlin.String [fake_override] + $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 (): @[EnhancedNullability] kotlin.String declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.AbstractCollection<@[FlexibleNullability] .Some?> + public open fun toString (): kotlin.String declared in .SomeList + $this: VALUE_PARAMETER name: type:kotlin.Any FUN FAKE_OVERRIDE name:removeIf visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[EnhancedNullability] java.util.function.Predicate.Some>) returnType:kotlin.Boolean [fake_override] overridden: public open fun removeIf (p0: @[EnhancedNullability] java.util.function.Predicate.Some.SomeList>>): kotlin.Boolean declared in .SomeList @@ -538,10 +555,10 @@ FILE fqName: fileName:/MultiList.kt overridden: public open fun parallelStream (): @[EnhancedNullability] java.util.stream.Stream<@[EnhancedNullability] .Some.SomeList>> declared in .SomeList $this: VALUE_PARAMETER name: type:kotlin.collections.Collection<.Some> - FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>, p0:@[FlexibleNullability] java.util.function.Consumer.Some?>?) returnType:kotlin.Unit [fake_override] + FUN FAKE_OVERRIDE name:forEach visibility:public modality:OPEN <> ($this:kotlin.collections.Iterable<.Some>, p0:@[FlexibleNullability] java.util.function.Consumer.Some?>?) returnType:kotlin.Unit [fake_override] overridden: public open fun forEach (p0: @[FlexibleNullability] java.util.function.Consumer.Some.SomeList>?>?): kotlin.Unit declared in .SomeList - $this: VALUE_PARAMETER name: type:java.util.ArrayList<.Some> + $this: VALUE_PARAMETER name: type:kotlin.collections.Iterable<.Some> VALUE_PARAMETER name:p0 index:0 type:@[FlexibleNullability] java.util.function.Consumer.Some?>? FUN FAKE_OVERRIDE name:trimToSize visibility:public modality:OPEN <> ($this:java.util.ArrayList<.Some>) returnType:kotlin.Unit [fake_override] overridden: diff --git a/compiler/testData/ir/irText/firProblems/MultiList.fir.sig.kt.txt b/compiler/testData/ir/irText/firProblems/MultiList.fir.sig.kt.txt index 06b161e67d6..7394fdc4b04 100644 --- a/compiler/testData/ir/irText/firProblems/MultiList.fir.sig.kt.txt +++ b/compiler/testData/ir/irText/firProblems/MultiList.fir.sig.kt.txt @@ -45,16 +45,16 @@ class FinalList : SomeList { /* fake */ override fun clone(): @EnhancedNullability Any // CHECK JVM_IR: - // Mangled name: FinalList#contains(Some{EnhancedNullability}){}kotlin.Boolean - // Public signature: /FinalList.contains|3096303196508390878[0] - // Public signature debug description: contains(Some{EnhancedNullability}){}kotlin.Boolean - /* fake */ override operator fun contains(p0: @EnhancedNullability Some): Boolean + // Mangled name: FinalList#contains(Some){}kotlin.Boolean + // Public signature: /FinalList.contains|3306019531315598892[0] + // Public signature debug description: contains(Some){}kotlin.Boolean + /* fake */ override operator fun contains(element: Some): Boolean // CHECK JVM_IR: - // Mangled name: FinalList#containsAll(kotlin.collections.Collection?>){}kotlin.Boolean - // Public signature: /FinalList.containsAll|5422538213063988463[0] - // Public signature debug description: containsAll(kotlin.collections.Collection?>){}kotlin.Boolean - /* fake */ override fun containsAll(p0: Collection?>): Boolean + // Mangled name: FinalList#containsAll(kotlin.collections.Collection>){}kotlin.Boolean + // Public signature: /FinalList.containsAll|9064771870641374979[0] + // Public signature debug description: containsAll(kotlin.collections.Collection>){}kotlin.Boolean + /* fake */ override fun containsAll(elements: Collection>): Boolean // CHECK: // Mangled name: FinalList#ensureCapacity(kotlin.Int){} @@ -66,7 +66,7 @@ class FinalList : SomeList { // Mangled name: FinalList#equals(kotlin.Any?){}kotlin.Boolean // Public signature: /FinalList.equals|722809408929142791[0] // Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean - /* fake */ override operator fun equals(p0: Any?): Boolean + /* fake */ override operator fun equals(other: Any?): Boolean // CHECK: // Mangled name: FinalList#forEach(java.util.function.Consumer?>?){} @@ -75,10 +75,10 @@ class FinalList : SomeList { /* fake */ override fun forEach(p0: Consumer?>?): Unit // CHECK JVM_IR: - // Mangled name: FinalList#get(kotlin.Int){}Some{EnhancedNullability} - // Public signature: /FinalList.get|-1548509062534898774[0] - // Public signature debug description: get(kotlin.Int){}Some{EnhancedNullability} - /* fake */ override operator fun get(p0: Int): @EnhancedNullability Some + // Mangled name: FinalList#get(kotlin.Int){}Some + // Public signature: /FinalList.get|5550525129583729061[0] + // Public signature debug description: get(kotlin.Int){}Some + /* fake */ override operator fun get(index: Int): Some // CHECK JVM_IR: // Mangled name: FinalList#hashCode(){}kotlin.Int @@ -87,10 +87,10 @@ class FinalList : SomeList { /* fake */ override fun hashCode(): Int // CHECK JVM_IR: - // Mangled name: FinalList#indexOf(Some{EnhancedNullability}){}kotlin.Int - // Public signature: /FinalList.indexOf|7750638587776299509[0] - // Public signature debug description: indexOf(Some{EnhancedNullability}){}kotlin.Int - /* fake */ override fun indexOf(p0: @EnhancedNullability Some): Int + // Mangled name: FinalList#indexOf(Some){}kotlin.Int + // Public signature: /FinalList.indexOf|5440857764812757471[0] + // Public signature debug description: indexOf(Some){}kotlin.Int + /* fake */ override fun indexOf(element: Some): Int // CHECK JVM_IR: // Mangled name: FinalList#isEmpty(){}kotlin.Boolean @@ -105,10 +105,10 @@ class FinalList : SomeList { /* fake */ override operator fun iterator(): @EnhancedNullability MutableIterator<@EnhancedNullability Some> // CHECK JVM_IR: - // Mangled name: FinalList#lastIndexOf(Some{EnhancedNullability}){}kotlin.Int - // Public signature: /FinalList.lastIndexOf|5741372771241017733[0] - // Public signature debug description: lastIndexOf(Some{EnhancedNullability}){}kotlin.Int - /* fake */ override fun lastIndexOf(p0: @EnhancedNullability Some): Int + // Mangled name: FinalList#lastIndexOf(Some){}kotlin.Int + // Public signature: /FinalList.lastIndexOf|-46333449251229155[0] + // Public signature debug description: lastIndexOf(Some){}kotlin.Int + /* fake */ override fun lastIndexOf(element: Some): Int // CHECK JVM_IR: // Mangled name: FinalList#listIterator(){}kotlin.collections.MutableListIterator{EnhancedNullability}>{EnhancedNullability} @@ -213,10 +213,10 @@ class FinalList : SomeList { /* fake */ override fun toArray(p0: Array?): Array? // CHECK JVM_IR: - // Mangled name: FinalList#toString(){}kotlin.String{EnhancedNullability} - // Public signature: /FinalList.toString|7581629773206850948[0] - // Public signature debug description: toString(){}kotlin.String{EnhancedNullability} - /* fake */ override fun toString(): @EnhancedNullability String + // Mangled name: FinalList#toString(){}kotlin.String + // Public signature: /FinalList.toString|6958853723545266802[0] + // Public signature debug description: toString(){}kotlin.String + /* fake */ override fun toString(): String // CHECK: // Mangled name: FinalList#trimToSize(){} @@ -337,16 +337,16 @@ open class SomeList : ArrayList>, MyList { /* fake */ override fun clone(): @EnhancedNullability Any // CHECK JVM_IR: - // Mangled name: SomeList#contains(Some<1:0>{EnhancedNullability}){}kotlin.Boolean - // Public signature: /SomeList.contains|8295010842646223621[0] - // Public signature debug description: contains(Some<1:0>{EnhancedNullability}){}kotlin.Boolean - /* fake */ override operator fun contains(p0: @EnhancedNullability Some): Boolean + // Mangled name: SomeList#contains(Some<1:0>){}kotlin.Boolean + // Public signature: /SomeList.contains|-2920670572443692722[0] + // Public signature debug description: contains(Some<1:0>){}kotlin.Boolean + /* fake */ override operator fun contains(element: Some): Boolean // CHECK JVM_IR: - // Mangled name: SomeList#containsAll(kotlin.collections.Collection?>){}kotlin.Boolean - // Public signature: /SomeList.containsAll|5540597363096413063[0] - // Public signature debug description: containsAll(kotlin.collections.Collection?>){}kotlin.Boolean - /* fake */ override fun containsAll(p0: Collection?>): Boolean + // Mangled name: SomeList#containsAll(kotlin.collections.Collection>){}kotlin.Boolean + // Public signature: /SomeList.containsAll|4060484050930787658[0] + // Public signature debug description: containsAll(kotlin.collections.Collection>){}kotlin.Boolean + /* fake */ override fun containsAll(elements: Collection>): Boolean // CHECK: // Mangled name: SomeList#ensureCapacity(kotlin.Int){} @@ -358,7 +358,7 @@ open class SomeList : ArrayList>, MyList { // Mangled name: SomeList#equals(kotlin.Any?){}kotlin.Boolean // Public signature: /SomeList.equals|722809408929142791[0] // Public signature debug description: equals(kotlin.Any?){}kotlin.Boolean - /* fake */ override operator fun equals(p0: Any?): Boolean + /* fake */ override operator fun equals(other: Any?): Boolean // CHECK: // Mangled name: SomeList#forEach(java.util.function.Consumer?>?){} @@ -367,10 +367,10 @@ open class SomeList : ArrayList>, MyList { /* fake */ override fun forEach(p0: Consumer?>?): Unit // CHECK JVM_IR: - // Mangled name: SomeList#get(kotlin.Int){}Some<1:0>{EnhancedNullability} - // Public signature: /SomeList.get|-3046572306153092239[0] - // Public signature debug description: get(kotlin.Int){}Some<1:0>{EnhancedNullability} - /* fake */ override operator fun get(p0: Int): @EnhancedNullability Some + // Mangled name: SomeList#get(kotlin.Int){}Some<1:0> + // Public signature: /SomeList.get|7985278152358407752[0] + // Public signature debug description: get(kotlin.Int){}Some<1:0> + /* fake */ override operator fun get(index: Int): Some // CHECK JVM_IR: // Mangled name: SomeList#hashCode(){}kotlin.Int @@ -379,10 +379,10 @@ open class SomeList : ArrayList>, MyList { /* fake */ override fun hashCode(): Int // CHECK JVM_IR: - // Mangled name: SomeList#indexOf(Some<1:0>{EnhancedNullability}){}kotlin.Int - // Public signature: /SomeList.indexOf|-8100421064396203855[0] - // Public signature debug description: indexOf(Some<1:0>{EnhancedNullability}){}kotlin.Int - /* fake */ override fun indexOf(p0: @EnhancedNullability Some): Int + // Mangled name: SomeList#indexOf(Some<1:0>){}kotlin.Int + // Public signature: /SomeList.indexOf|4192413876446876489[0] + // Public signature debug description: indexOf(Some<1:0>){}kotlin.Int + /* fake */ override fun indexOf(element: Some): Int // CHECK JVM_IR: // Mangled name: SomeList#isEmpty(){}kotlin.Boolean @@ -397,10 +397,10 @@ open class SomeList : ArrayList>, MyList { /* fake */ override operator fun iterator(): @EnhancedNullability MutableIterator<@EnhancedNullability Some> // CHECK JVM_IR: - // Mangled name: SomeList#lastIndexOf(Some<1:0>{EnhancedNullability}){}kotlin.Int - // Public signature: /SomeList.lastIndexOf|1971452683190765047[0] - // Public signature debug description: lastIndexOf(Some<1:0>{EnhancedNullability}){}kotlin.Int - /* fake */ override fun lastIndexOf(p0: @EnhancedNullability Some): Int + // Mangled name: SomeList#lastIndexOf(Some<1:0>){}kotlin.Int + // Public signature: /SomeList.lastIndexOf|-4798028145670003218[0] + // Public signature debug description: lastIndexOf(Some<1:0>){}kotlin.Int + /* fake */ override fun lastIndexOf(element: Some): Int // CHECK JVM_IR: // Mangled name: SomeList#listIterator(){}kotlin.collections.MutableListIterator{EnhancedNullability}>{EnhancedNullability} @@ -505,10 +505,10 @@ open class SomeList : ArrayList>, MyList { /* fake */ override fun toArray(p0: Array?): Array? // CHECK JVM_IR: - // Mangled name: SomeList#toString(){}kotlin.String{EnhancedNullability} - // Public signature: /SomeList.toString|7581629773206850948[0] - // Public signature debug description: toString(){}kotlin.String{EnhancedNullability} - /* fake */ override fun toString(): @EnhancedNullability String + // Mangled name: SomeList#toString(){}kotlin.String + // Public signature: /SomeList.toString|6958853723545266802[0] + // Public signature debug description: toString(){}kotlin.String + /* fake */ override fun toString(): String // CHECK: // Mangled name: SomeList#trimToSize(){} @@ -629,3 +629,4 @@ interface MyList : List> { abstract /* fake */ override get(): Int } + diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index c4b13ce6bef..f91811db018 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -345,6 +345,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/Dollar.kt"); } + @Test + @TestMetadata("duplicateDefaultValuesSubsumedIntersection.kt") + public void testDuplicateDefaultValuesSubsumedIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/duplicateDefaultValuesSubsumedIntersection.kt"); + } + @Test @TestMetadata("duplicateDirrectOverriddenCallables.kt") public void testDuplicateDirrectOverriddenCallables() throws Exception { @@ -28698,6 +28704,36 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/override/InternalPotentialOverride.kt"); } + @Test + @TestMetadata("intersectionOfAbstractAndOpen.kt") + public void testIntersectionOfAbstractAndOpen() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfAbstractAndOpen.kt"); + } + + @Test + @TestMetadata("intersectionOfSubstitutedProperties.kt") + public void testIntersectionOfSubstitutedProperties() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOfSubstitutedProperties.kt"); + } + + @Test + @TestMetadata("intersectionOverrideWithSubsumedDifferentType.kt") + public void testIntersectionOverrideWithSubsumedDifferentType() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverrideWithSubsumedDifferentType.kt"); + } + + @Test + @TestMetadata("intersectionOverridesIntersection.kt") + public void testIntersectionOverridesIntersection() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionOverridesIntersection.kt"); + } + + @Test + @TestMetadata("intersectionWithSubsumedWithSubstitution.kt") + public void testIntersectionWithSubsumedWithSubstitution() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/intersectionWithSubsumedWithSubstitution.kt"); + } + @Test @TestMetadata("InvisiblePotentialOverride.kt") public void testInvisiblePotentialOverride() throws Exception { @@ -28965,6 +29001,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/genericWithUpperBound.kt"); } + @Test + @TestMetadata("intersectionReturnTypeMismatchSubsumed.kt") + public void testIntersectionReturnTypeMismatchSubsumed() throws Exception { + runTest("compiler/testData/diagnostics/tests/override/clashesOnInheritance/intersectionReturnTypeMismatchSubsumed.kt"); + } + @Test @TestMetadata("kt13355.kt") public void testKt13355() throws Exception {