[FIR] Refactor: extract function which returns single compatible expect
...symbol for actual symbol. It will be reused in next commit. ^KT-62036
This commit is contained in:
committed by
Space Team
parent
9943c7078c
commit
2d51bb233d
+1
-1
@@ -188,7 +188,7 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
// We want to report errors even if a candidate is incompatible, but it's single
|
// We want to report errors even if a candidate is incompatible, but it's single
|
||||||
val expectedSingleCandidate = compatibilityToMembersMap[Compatible]?.singleOrNull()
|
val expectedSingleCandidate = symbol.getSingleCompatibleExpectForActualOrNull()
|
||||||
?: symbol.getSingleExpectForActualOrNull()
|
?: symbol.getSingleExpectForActualOrNull()
|
||||||
if (expectedSingleCandidate != null) {
|
if (expectedSingleCandidate != null) {
|
||||||
checkIfExpectHasDefaultArgumentsAndActualizedWithTypealias(
|
checkIfExpectHasDefaultArgumentsAndActualizedWithTypealias(
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ fun FirBasedSymbol<*>.getSingleExpectForActualOrNull(): FirBasedSymbol<*>? {
|
|||||||
return expectForActual?.values?.singleOrNull()?.singleOrNull()
|
return expectForActual?.values?.singleOrNull()?.singleOrNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun FirBasedSymbol<*>.getSingleCompatibleExpectForActualOrNull(): FirBasedSymbol<*>? {
|
||||||
|
return expectForActual?.get(ExpectActualCompatibility.Compatible)?.singleOrNull()
|
||||||
|
}
|
||||||
|
|
||||||
fun FirBasedSymbol<*>.getSingleCompatibleOrWeaklyIncompatibleExpectForActualOrNull(): FirBasedSymbol<*>? {
|
fun FirBasedSymbol<*>.getSingleCompatibleOrWeaklyIncompatibleExpectForActualOrNull(): FirBasedSymbol<*>? {
|
||||||
val expectForActual = expectForActual ?: return null
|
val expectForActual = expectForActual ?: return null
|
||||||
val compatibleOrWeakCompatible: List<FirBasedSymbol<*>> =
|
val compatibleOrWeakCompatible: List<FirBasedSymbol<*>> =
|
||||||
|
|||||||
Reference in New Issue
Block a user