@@ -901,7 +901,7 @@ trait Implicits:
901901 }
902902
903903 try
904- val inferred = inferImplicit(adjust(to), from, from.span, ignored = Set .empty )
904+ val inferred = inferImplicit(adjust(to), from, from.span)
905905
906906 inferred match {
907907 case SearchSuccess (_, ref, _, false ) if isOldStyleFunctionConversion(ref.underlying) =>
@@ -928,7 +928,7 @@ trait Implicits:
928928 /** Find an implicit argument for parameter `formal`.
929929 * Return a failure as a SearchFailureType in the type of the returned tree.
930930 */
931- def inferImplicitArg (formal : Type , span : Span , ignored : Set [Symbol ])(using Context ): Tree =
931+ def inferImplicitArg (formal : Type , span : Span , ignored : Set [Symbol ] = Set .empty )(using Context ): Tree =
932932 inferImplicit(formal, EmptyTree , span, ignored) match
933933 case SearchSuccess (arg, _, _, _) => arg
934934 case fail @ SearchFailure (failed) =>
@@ -944,7 +944,7 @@ trait Implicits:
944944
945945 /** Search an implicit argument and report error if not found */
946946 def implicitArgTree (formal : Type , span : Span , where : => String = " " )(using Context ): Tree = {
947- val arg = inferImplicitArg(formal, span, ignored = Set .empty )
947+ val arg = inferImplicitArg(formal, span)
948948 if (arg.tpe.isInstanceOf [SearchFailureType ])
949949 report.error(missingArgMsg(arg, formal, where), ctx.source.atSpan(span))
950950 arg
@@ -968,7 +968,7 @@ trait Implicits:
968968 def ignoredInstanceNormalImport = arg.tpe match
969969 case fail : SearchFailureType =>
970970 if (fail.expectedType eq pt) || isFullyDefined(fail.expectedType, ForceDegree .none) then
971- inferImplicit(fail.expectedType, fail.argument, arg.span, Set .empty )(
971+ inferImplicit(fail.expectedType, fail.argument, arg.span)(
972972 using findHiddenImplicitsCtx(ctx)) match {
973973 case s : SearchSuccess => Some (s)
974974 case f : SearchFailure =>
@@ -1082,7 +1082,7 @@ trait Implicits:
10821082 * it should be applied, EmptyTree otherwise.
10831083 * @param span The position where errors should be reported.
10841084 */
1085- def inferImplicit (pt : Type , argument : Tree , span : Span , ignored : Set [Symbol ])(using Context ): SearchResult = ctx.profiler.onImplicitSearch(pt):
1085+ def inferImplicit (pt : Type , argument : Tree , span : Span , ignored : Set [Symbol ] = Set .empty )(using Context ): SearchResult = ctx.profiler.onImplicitSearch(pt):
10861086 trace(s " search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}" , implicits, show = true ) {
10871087 record(" inferImplicit" )
10881088 assert(ctx.phase.allowsImplicitSearch,
@@ -1670,17 +1670,18 @@ trait Implicits:
16701670 SearchFailure (TooUnspecific (pt), span)
16711671 else
16721672 val contextual = ctxImplicits != null
1673- val prePreEligible = // the eligible candidates, ignoring positions
1673+ var preEligible = // the eligible candidates, ignoring positions
16741674 if ctxImplicits != null then
16751675 if ctx.gadt.isNarrowing then
16761676 withoutMode(Mode .ImplicitsEnabled ) {
16771677 ctxImplicits.uncachedEligible(wildProto)
16781678 }
16791679 else ctxImplicits.eligible(wildProto)
16801680 else implicitScope(wildProto).eligible
1681+ if ! ignored.isEmpty then
1682+ preEligible =
1683+ preEligible.filter(candidate => ! ignored.contains(candidate.implicitRef.underlyingRef.symbol))
16811684
1682- val preEligible =
1683- prePreEligible.filter(candidate => ! ignored.contains(candidate.implicitRef.underlyingRef.symbol))
16841685 /** Does candidate `cand` come too late for it to be considered as an
16851686 * eligible candidate? This is the case if `cand` appears in the same
16861687 * scope as a given definition of the form `given ... = ...` that
0 commit comments