File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1451,11 +1451,20 @@ trait Implicits:
14511451 def betterThanAll (newCand : RefAndLevel , disambiguate : Boolean ): Boolean =
14521452 ambiguousCands.forall(compareAlternatives(newCand, _, disambiguate) > 0 )
14531453
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+
14541463 val newPending = remaining.filter(betterThanAll(_, disambiguate = false ))
14551464 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
14581466 case _ => fail
1467+ end healAmbiguous
14591468
14601469 negateIfNot(tryImplicit(cand, contextual)) match {
14611470 case fail : SearchFailure =>
You can’t perform that action at this time.
0 commit comments