diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt index bb4e366dc01..d50ce8548cc 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatchingContextImpl.kt @@ -49,12 +49,6 @@ class FirExpectActualMatchingContextImpl private constructor( override val shouldCheckDefaultParams: Boolean get() = true - override val allowClassActualizationWithWiderVisibility: Boolean - get() = true - - override val allowTransitiveSupertypesActualization: Boolean - get() = true - override val expectScopeSession: ScopeSession // todo KT-63773 design a way for managing scope sessions for common scopes during matching. // Right now we create a new session every time diff --git a/compiler/ir/ir.actualization/src/main/kotlin/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt b/compiler/ir/ir.actualization/src/main/kotlin/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt index 507853c5153..a9467147aae 100644 --- a/compiler/ir/ir.actualization/src/main/kotlin/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt +++ b/compiler/ir/ir.actualization/src/main/kotlin/org/jetbrains/kotlin/backend/common/actualizer/IrExpectActualMatchingContext.kt @@ -41,12 +41,6 @@ internal abstract class IrExpectActualMatchingContext( val typeContext: IrTypeSystemContext, val expectToActualClassMap: Map ) : ExpectActualMatchingContext, TypeSystemContext by typeContext { - override val allowClassActualizationWithWiderVisibility: Boolean - get() = true - - override val allowTransitiveSupertypesActualization: Boolean - get() = true - // This incompatibility is often suppressed in the source code (e.g. in kotlin-stdlib). // The backend must be able to do expect-actual matching to emit bytecode // That's why we disable the checker here. Probably, this checker can be enabled once KT-60426 is fixed diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualChecker.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualChecker.kt index c15f1ec1258..081a146a0b9 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualChecker.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/AbstractExpectActualChecker.kt @@ -161,36 +161,6 @@ object AbstractExpectActualChecker { expectClassSymbol: RegularClassSymbolMarker, actualClassSymbol: RegularClassSymbolMarker, substitutor: TypeSubstitutorMarker, - ): Boolean { - return when (allowTransitiveSupertypesActualization) { - false -> areCompatibleSupertypesOneByOne(expectClassSymbol, actualClassSymbol, substitutor) - true -> areCompatibleSupertypesTransitive(expectClassSymbol, actualClassSymbol, substitutor) - } - } - - context(ExpectActualMatchingContext<*>) - private fun areCompatibleSupertypesOneByOne( - expectClassSymbol: RegularClassSymbolMarker, - actualClassSymbol: RegularClassSymbolMarker, - substitutor: TypeSubstitutorMarker, - ): Boolean { - // Subtract kotlin.Any from supertypes because it's implicitly added if no explicit supertype is specified, - // and not added if an explicit supertype _is_ specified - val expectSupertypes = expectClassSymbol.superTypes.filterNot { it.typeConstructor().isAnyConstructor() } - val actualSupertypes = actualClassSymbol.superTypes.filterNot { it.typeConstructor().isAnyConstructor() } - return expectSupertypes.all { expectSupertype -> - val substitutedExpectType = substitutor.safeSubstitute(expectSupertype) - actualSupertypes.any { actualSupertype -> - areCompatibleExpectActualTypes(substitutedExpectType, actualSupertype, parameterOfAnnotationComparisonMode = false) - } - } - } - - context(ExpectActualMatchingContext<*>) - private fun areCompatibleSupertypesTransitive( - expectClassSymbol: RegularClassSymbolMarker, - actualClassSymbol: RegularClassSymbolMarker, - substitutor: TypeSubstitutorMarker, ): Boolean { val expectSupertypes = expectClassSymbol.superTypes.filterNot { it.typeConstructor().isAnyConstructor() } val actualType = actualClassSymbol.defaultType @@ -505,7 +475,6 @@ object AbstractExpectActualChecker { val expectVisibility = expectClassSymbol.visibility val actualVisibility = actualClassSymbol.visibility if (expectVisibility == actualVisibility) return true - if (!allowClassActualizationWithWiderVisibility) return false val result = Visibilities.compare(actualVisibility, expectVisibility) return result != null && result > 0 } diff --git a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt index eca3901e811..cb577b9e6ae 100644 --- a/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt +++ b/compiler/resolution.common/src/org/jetbrains/kotlin/resolve/calls/mpp/ExpectActualMatchingContext.kt @@ -42,25 +42,6 @@ interface ExpectActualMatchingContext : TypeSystemC // - coroutines val shouldCheckDefaultParams: Boolean - /** - * This flag determines, how visibilities for classes/typealiases will be matched - * - `false` means that visibilities should be identical - * - `true` means that visibility of actual class should be the same or wider comparing to expect visibility - * this means that following actualizations will be additionally allowed: - * - protected -> public - * - internal -> public - */ - val allowClassActualizationWithWiderVisibility: Boolean - get() = false - - /** - * This flag determines strategy for matching supertypes between expect and actual class - * - `false` means that expect and actual supertypes are matched one by one - * - `true` means that type of actual class should be subtype of each expect supertype of the expect class - */ - val allowTransitiveSupertypesActualization: Boolean - get() = false - val RegularClassSymbolMarker.classId: ClassId val TypeAliasSymbolMarker.classId: ClassId val CallableSymbolMarker.callableId: CallableId