From 1be33b91fa85e50f5048dc5a12604debfa3c19e8 Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Mon, 12 Mar 2018 15:58:14 +0300 Subject: [PATCH] MPP: Do not report ACTUAL_WITHOUT_EXPECT if compatibility is null for all modules This fixes diagnostic tests --- .../checkers/ExpectedActualDeclarationChecker.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt index edb96772dd7..1327a58ea57 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt @@ -117,13 +117,10 @@ object ExpectedActualDeclarationChecker : DeclarationChecker { // So yet we are using own module in compiler context and common module in IDE context. val commonOrOwnModules = descriptor.module.expectedByModules.ifEmpty { listOf(descriptor.module) } val compatibility = commonOrOwnModules - .asSequence() - .fold(LinkedHashMap>()) { resultMap, commonModule -> - val currentMap = ExpectedActualResolver.findExpectedForActual(descriptor, commonModule) - if (currentMap != null) { - resultMap.putAll(currentMap) - } - resultMap + .mapNotNull { ExpectedActualResolver.findExpectedForActual(descriptor, it) } + .ifEmpty { return } + .fold(LinkedHashMap>()) { resultMap, partialMap -> + resultMap.apply { putAll(partialMap) } } val hasActualModifier = descriptor.isActual && reportOn.hasActualModifier()