File tree 1 file changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1451,11 +1451,20 @@ trait Implicits:
1451
1451
def betterThanAll (newCand : RefAndLevel , disambiguate : Boolean ): Boolean =
1452
1452
ambiguousCands.forall(compareAlternatives(newCand, _, disambiguate) > 0 )
1453
1453
1454
+ inline def betterByCurrentScheme (newCand : RefAndLevel ): Boolean =
1455
+ if isWarnPriorityChangeVersion then
1456
+ // newCand may have only been kept in pending because it was better in the other priotization scheme.
1457
+ // If that candidate produces a SearchSuccess, disambiguate will return it as the found SearchResult.
1458
+ // We must now recheck it was really better than the ambigous candidates we are recovering from,
1459
+ // under the rules of the current scheme, which are applied when disambiguate = true.
1460
+ betterThanAll(newCand, disambiguate = true )
1461
+ else true
1462
+
1454
1463
val newPending = remaining.filter(betterThanAll(_, disambiguate = false ))
1455
1464
rank(newPending, fail, Nil ) match
1456
- case found : SearchSuccess
1457
- if ! isWarnPriorityChangeVersion || betterThanAll(found, disambiguate = true ) => found
1465
+ case found : SearchSuccess if betterByCurrentScheme(cand) => found
1458
1466
case _ => fail
1467
+ end healAmbiguous
1459
1468
1460
1469
negateIfNot(tryImplicit(cand, contextual)) match {
1461
1470
case fail : SearchFailure =>
You can’t perform that action at this time.
0 commit comments