From 4ef8595a4b542b47edcbc413528efea7c933e849 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Mon, 16 Oct 2023 12:56:01 +0200 Subject: [PATCH] [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 --- .../kotlin/backend/common/actualizer/ExpectActualCollector.kt | 1 + .../kotlin/backend/common/actualizer/IrActualizerUtils.kt | 3 ++- .../calls/mpp/AbstractExpectActualCompatibilityChecker.kt | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt index 8a3a88f9c84..2e4745f0ff0 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/actualizer/ExpectActualCollector.kt @@ -223,6 +223,7 @@ private class ExpectActualLinkCollector : IrElementVisitor, context: ExpectActualMatchingContext, + checkClassScopesCompatibility: Boolean, ) { with(context) { matchSingleExpectAgainstPotentialActuals( @@ -78,7 +79,7 @@ object AbstractExpectActualCompatibilityChecker { expectClassSymbol = null, actualClassSymbol = null, unfulfilled = null, - checkClassScopesCompatibility = true, + checkClassScopesCompatibility = checkClassScopesCompatibility, ) } }