@@ -409,13 +409,13 @@ object Implicits:
409409 }
410410
411411 object SearchFailure {
412- def apply (tpe : SearchFailureType )(using Context ): SearchFailure = {
412+ def apply (tpe : SearchFailureType , span : Span )(using Context ): SearchFailure = {
413413 val id = tpe match
414414 case tpe : AmbiguousImplicits =>
415415 untpd.SearchFailureIdent (nme.AMBIGUOUS , s " /* ambiguous: ${tpe.explanation} */ " )
416416 case _ =>
417417 untpd.SearchFailureIdent (nme.MISSING , " /* missing */" )
418- SearchFailure (id.withTypeUnchecked(tpe))
418+ SearchFailure (id.withTypeUnchecked(tpe).withSpan(span) )
419419 }
420420 }
421421
@@ -483,7 +483,7 @@ object Implicits:
483483 @ sharable object NoMatchingImplicits extends NoMatchingImplicits (NoType , EmptyTree , OrderingConstraint .empty)
484484
485485 @ sharable val NoMatchingImplicitsFailure : SearchFailure =
486- SearchFailure (NoMatchingImplicits )(using NoContext )
486+ SearchFailure (NoMatchingImplicits , NoSpan )(using NoContext )
487487
488488 /** An ambiguous implicits failure */
489489 class AmbiguousImplicits (val alt1 : SearchSuccess , val alt2 : SearchSuccess , val expectedType : Type , val argument : Tree ) extends SearchFailureType {
@@ -1022,7 +1022,7 @@ trait Implicits:
10221022 }
10231023 else result
10241024 case NoMatchingImplicitsFailure =>
1025- SearchFailure (new NoMatchingImplicits (pt, argument, ctx.typerState.constraint))
1025+ SearchFailure (new NoMatchingImplicits (pt, argument, ctx.typerState.constraint), span )
10261026 case _ =>
10271027 result0
10281028 }
@@ -1123,7 +1123,7 @@ trait Implicits:
11231123 */
11241124 def tryImplicit (cand : Candidate , contextual : Boolean ): SearchResult =
11251125 if checkDivergence(cand) then
1126- SearchFailure (new DivergingImplicit (cand.ref, wideProto, argument))
1126+ SearchFailure (new DivergingImplicit (cand.ref, wideProto, argument), span )
11271127 else {
11281128 val history = ctx.searchHistory.nest(cand, pt)
11291129 val result =
@@ -1174,7 +1174,7 @@ trait Implicits:
11741174
11751175 if diff < 0 then alt2
11761176 else if diff > 0 then alt1
1177- else SearchFailure (new AmbiguousImplicits (alt1, alt2, pt, argument))
1177+ else SearchFailure (new AmbiguousImplicits (alt1, alt2, pt, argument), span )
11781178 case _ : SearchFailure => alt2
11791179
11801180 /** Try to find a best matching implicit term among all the candidates in `pending`.
0 commit comments