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 a19621689c0..caac5b873ec 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt @@ -138,7 +138,12 @@ class ExpectedActualDeclarationChecker( } // Several compatible actuals on one path: report AMBIGUIOUS_ACTUALS here - val atLeastWeaklyCompatibleActuals = compatibility.filterKeys { it.isCompatibleOrWeakCompatible() }.values.flatten() + val atLeastWeaklyCompatibleActuals = compatibility + .filterKeys { it.isCompatibleOrWeakCompatible() } + .values + .flatten() + .distinct() + if (atLeastWeaklyCompatibleActuals.size > 1) { trace.report(Errors.AMBIGUOUS_ACTUALS.on( reportOn, diff --git a/idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/weaklyIncompatibleActualInIntermediateModule/top/top.kt b/idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/weaklyIncompatibleActualInIntermediateModule/top/top.kt index 54bf6400c61..f385c7d7ea1 100644 --- a/idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/weaklyIncompatibleActualInIntermediateModule/top/top.kt +++ b/idea/testData/multiModuleHighlighting/hierarchicalExpectActualMatching/weaklyIncompatibleActualInIntermediateModule/top/top.kt @@ -1,5 +1,5 @@ package sample -expect class A { +expect class A { fun f() } \ No newline at end of file