[Expect/Actual] Add ability to skip matching of constructors of expect enums

In terms of MPP there are no such thing as `expect constructor` for enums,
  but they are physically exist in FIR and IR, so we need a switch which
  skips matching for them

FE 1.0 implementation did not touch to avoid any hidden changes
This commit is contained in:
Dmitriy Novozhilov
2023-06-06 17:26:41 +03:00
committed by Space Team
parent ba41e8ec38
commit 8b9079d026
8 changed files with 22 additions and 59 deletions
@@ -256,6 +256,16 @@ object AbstractExpectActualCompatibilityChecker {
return Incompatible.CallableKind
}
if (
enumConstructorsAreAlwaysCompatible &&
expectContainingClass?.classKind == ClassKind.ENUM_CLASS &&
actualContainingClass?.classKind == ClassKind.ENUM_CLASS &&
expectDeclaration is ConstructorSymbolMarker &&
actualDeclaration is ConstructorSymbolMarker
) {
return ExpectActualCompatibility.Compatible
}
val expectedReceiverType = expectDeclaration.extensionReceiverType
val actualReceiverType = actualDeclaration.extensionReceiverType
if ((expectedReceiverType != null) != (actualReceiverType != null)) {
@@ -36,6 +36,9 @@ interface ExpectActualMatchingContext<T : DeclarationSymbolMarker> : TypeSystemC
val innerClassesCapturesOuterTypeParameters: Boolean
get() = true
val enumConstructorsAreAlwaysCompatible: Boolean
get() = false
val RegularClassSymbolMarker.classId: ClassId
val TypeAliasSymbolMarker.classId: ClassId
val CallableSymbolMarker.callableId: CallableId