[IR] Don't check class scopes compatibility in collectActualCallablesMatchingToSpecificExpect

This is a minor optimization.
This commit is a step forward for KT-62590

Conceptually, `checkClassScopesCompatibility` belongs to the
"expect-actual checker". It doesn't belong to the "expect-actual
matcher".

- `checkClassScopesCompatibility` should be set to `true` when you want
  to do the "checking"
- `checkClassScopesCompatibility` should be set to `false` when you want
  to do the "matching"

`collectActualCallablesMatchingToSpecificExpect` only needs the
"matching"

No tests changed their behaviour

Review: https://jetbrains.team/p/kt/reviews/12750/timeline
This commit is contained in:
Nikita Bobko
2023-10-16 12:56:01 +02:00
committed by teamcity
parent a3401b2f9e
commit 4ef8595a4b
3 changed files with 5 additions and 2 deletions
@@ -223,6 +223,7 @@ private class ExpectActualLinkCollector : IrElementVisitor<Unit, ExpectActualLin
expectSymbol, expectSymbol,
actualSymbols, actualSymbols,
context, context,
checkClassScopesCompatibility = true
) )
} }
@@ -48,7 +48,8 @@ internal fun collectActualCallablesMatchingToSpecificExpect(
AbstractExpectActualCompatibilityChecker.matchSingleExpectTopLevelDeclarationAgainstPotentialActuals( AbstractExpectActualCompatibilityChecker.matchSingleExpectTopLevelDeclarationAgainstPotentialActuals(
expectSymbol, expectSymbol,
actualSymbols, actualSymbols,
context context,
checkClassScopesCompatibility = false
) )
return matchingActuals return matchingActuals
} }
@@ -69,6 +69,7 @@ object AbstractExpectActualCompatibilityChecker {
expectDeclaration: DeclarationSymbolMarker, expectDeclaration: DeclarationSymbolMarker,
actualDeclarations: List<DeclarationSymbolMarker>, actualDeclarations: List<DeclarationSymbolMarker>,
context: ExpectActualMatchingContext<T>, context: ExpectActualMatchingContext<T>,
checkClassScopesCompatibility: Boolean,
) { ) {
with(context) { with(context) {
matchSingleExpectAgainstPotentialActuals( matchSingleExpectAgainstPotentialActuals(
@@ -78,7 +79,7 @@ object AbstractExpectActualCompatibilityChecker {
expectClassSymbol = null, expectClassSymbol = null,
actualClassSymbol = null, actualClassSymbol = null,
unfulfilled = null, unfulfilled = null,
checkClassScopesCompatibility = true, checkClassScopesCompatibility = checkClassScopesCompatibility,
) )
} }
} }