@@ -917,13 +917,13 @@ trait Implicits { self: Typer =>
917
917
* - otherwise add the failure to `rfailures` and continue testing the other candidates.
918
918
*/
919
919
def rank (pending : List [Candidate ], found : SearchResult , rfailures : List [SearchFailure ]): SearchResult = {
920
- def recur (result : SearchResult , remaining : List [Candidate ]): SearchResult = result match {
920
+ def recur (result : SearchResult , remaining : List [Candidate ], isNot : Boolean ): SearchResult = result match {
921
921
case fail : SearchFailure =>
922
922
if (isNot)
923
923
recur(
924
924
SearchSuccess (ref(defn.Not_value ), defn.Not_value .termRef, 0 )(
925
925
ctx.typerState.fresh().setCommittable(true )),
926
- remaining)
926
+ remaining, false )
927
927
else if (fail.isAmbiguous)
928
928
if (ctx.scala2Mode) {
929
929
val result = rank(remaining, found, NoMatchingImplicitsFailure :: rfailures)
@@ -937,7 +937,7 @@ trait Implicits { self: Typer =>
937
937
rank(remaining, found, fail :: rfailures)
938
938
case best : SearchSuccess =>
939
939
if (isNot)
940
- recur(NoMatchingImplicitsFailure , remaining)
940
+ recur(NoMatchingImplicitsFailure , remaining, false )
941
941
else if (ctx.mode.is(Mode .ImplicitExploration ) || isCoherent)
942
942
best
943
943
else disambiguate(found, best) match {
@@ -953,7 +953,7 @@ trait Implicits { self: Typer =>
953
953
}
954
954
pending match {
955
955
case cand :: pending1 =>
956
- recur(tryImplicit(cand), pending1)
956
+ recur(tryImplicit(cand), pending1, this .isNot )
957
957
case nil =>
958
958
if (rfailures.isEmpty) found
959
959
else found.recoverWith(_ => rfailures.reverse.maxBy(_.tree.treeSize))
0 commit comments