[FE] Refactoring: Move check for "enumConstructorsAreAlwaysCompatible" higher than check for callable kind

Review: https://jetbrains.team/p/kt/reviews/11039/timeline

This is a preparation refactoring for the following KT-60902 fix and
type-safety refactoring.

This commit doesn't have observable side effects (and can be called pure refactoring) because the following conditions:
1. `expectDeclaration is ConstructorSymbolMarker && actualDeclaration is ConstructorSymbolMarker`
2. `expectDeclaration is FunctionSymbolMarker != actualDeclaration is FunctionSymbolMarker`

can't be both `true` at the same time
This commit is contained in:
Nikita Bobko
2023-08-02 18:59:54 +02:00
committed by teamcity
parent 529a1dd720
commit fd5e97ff23
@@ -288,10 +288,6 @@ object AbstractExpectActualCompatibilityChecker {
"This function should be invoked only for declarations in the same kind of container (both members or both top level): $expectDeclaration, $actualDeclaration"
}
if (expectDeclaration is FunctionSymbolMarker != actualDeclaration is FunctionSymbolMarker) {
return Incompatible.CallableKind
}
if (
enumConstructorsAreAlwaysCompatible &&
expectContainingClass?.classKind == ClassKind.ENUM_CLASS &&
@@ -302,6 +298,10 @@ object AbstractExpectActualCompatibilityChecker {
return ExpectActualCompatibility.Compatible
}
if (expectDeclaration is FunctionSymbolMarker != actualDeclaration is FunctionSymbolMarker) {
return Incompatible.CallableKind
}
val expectedReceiverType = expectDeclaration.extensionReceiverType
val actualReceiverType = actualDeclaration.extensionReceiverType
if ((expectedReceiverType != null) != (actualReceiverType != null)) {