@@ -1385,6 +1385,7 @@ trait Implicits:
1385
1385
def disambiguate (alt1 : SearchResult , alt2 : SearchSuccess ) = alt1 match
1386
1386
case alt1 : SearchSuccess =>
1387
1387
var diff = compareAlternatives(alt1, alt2, disambiguate = true )
1388
+ // diff > 0 candidates should already have been eliminated in `rank`
1388
1389
if diff == 0 && alt1.ref =:= alt2.ref then
1389
1390
diff = 1 // See i12951 for a test where this happens
1390
1391
else if diff == 0 && alt2.isExtension then
@@ -1636,21 +1637,7 @@ trait Implicits:
1636
1637
validateOrdering(ord)
1637
1638
throw ex
1638
1639
1639
- val sorted = sort(eligible)
1640
- val res = sorted match
1641
- case first :: rest =>
1642
- val firstIsImplicit = first.ref.symbol.is(Implicit )
1643
- if rest.exists(_.ref.symbol.is(Implicit ) != firstIsImplicit) then
1644
- // Mixture of implicits and givens
1645
- // Rank implicits first, then, if there is a given that it better than the best implicit(s)
1646
- // switch over to givens.
1647
- val (sortedImplicits, sortedGivens) = sorted.partition(_.ref.symbol.is(Implicit ))
1648
- val implicitResult = rank(sortedImplicits, NoMatchingImplicitsFailure , Nil )
1649
- rank(sortedGivens, implicitResult, Nil )
1650
- else
1651
- rank(sorted, NoMatchingImplicitsFailure , Nil )
1652
- case _ =>
1653
- NoMatchingImplicitsFailure
1640
+ val res = rank(sort(eligible), NoMatchingImplicitsFailure , Nil )
1654
1641
1655
1642
// Issue all priority change warnings that can affect the result
1656
1643
val shownWarnings = priorityChangeWarnings.toList.collect:
0 commit comments