@@ -917,13 +917,13 @@ trait Implicits { self: Typer =>
917917 * - otherwise add the failure to `rfailures` and continue testing the other candidates.
918918 */
919919 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 {
921921 case fail : SearchFailure =>
922922 if (isNot)
923923 recur(
924924 SearchSuccess (ref(defn.Not_value ), defn.Not_value .termRef, 0 )(
925925 ctx.typerState.fresh().setCommittable(true )),
926- remaining)
926+ remaining, false )
927927 else if (fail.isAmbiguous)
928928 if (ctx.scala2Mode) {
929929 val result = rank(remaining, found, NoMatchingImplicitsFailure :: rfailures)
@@ -937,7 +937,7 @@ trait Implicits { self: Typer =>
937937 rank(remaining, found, fail :: rfailures)
938938 case best : SearchSuccess =>
939939 if (isNot)
940- recur(NoMatchingImplicitsFailure , remaining)
940+ recur(NoMatchingImplicitsFailure , remaining, false )
941941 else if (ctx.mode.is(Mode .ImplicitExploration ) || isCoherent)
942942 best
943943 else disambiguate(found, best) match {
@@ -953,7 +953,7 @@ trait Implicits { self: Typer =>
953953 }
954954 pending match {
955955 case cand :: pending1 =>
956- recur(tryImplicit(cand), pending1)
956+ recur(tryImplicit(cand), pending1, this .isNot )
957957 case nil =>
958958 if (rfailures.isEmpty) found
959959 else found.recoverWith(_ => rfailures.reverse.maxBy(_.tree.treeSize))
0 commit comments