[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,
actualSymbols,
context,
checkClassScopesCompatibility = true
)
}
@@ -48,7 +48,8 @@ internal fun collectActualCallablesMatchingToSpecificExpect(
AbstractExpectActualCompatibilityChecker.matchSingleExpectTopLevelDeclarationAgainstPotentialActuals(
expectSymbol,
actualSymbols,
context
context,
checkClassScopesCompatibility = false
)
return matchingActuals
}
@@ -69,6 +69,7 @@ object AbstractExpectActualCompatibilityChecker {
expectDeclaration: DeclarationSymbolMarker,
actualDeclarations: List<DeclarationSymbolMarker>,
context: ExpectActualMatchingContext<T>,
checkClassScopesCompatibility: Boolean,
) {
with(context) {
matchSingleExpectAgainstPotentialActuals(
@@ -78,7 +79,7 @@ object AbstractExpectActualCompatibilityChecker {
expectClassSymbol = null,
actualClassSymbol = null,
unfulfilled = null,
checkClassScopesCompatibility = true,
checkClassScopesCompatibility = checkClassScopesCompatibility,
)
}
}