Deduplicate incompatible actual descriptors

Otherwise, we might get false positive AMBIGUOUS_ACTUALS due to one and
the same descriptor appearing multiple times in a list
This commit is contained in:
Dmitry Savvinov
2019-10-17 14:30:33 +03:00
parent 9198b7a039
commit 3abfe59d75
2 changed files with 7 additions and 2 deletions
@@ -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,
@@ -1,5 +1,5 @@
package sample
expect class <!AMBIGUOUS_ACTUALS("Class 'A'", "middle, middle")!>A<!> {
expect class A {
fun f()
}