@@ -901,7 +901,7 @@ trait Implicits:
901
901
}
902
902
903
903
try
904
- val inferred = inferImplicit(adjust(to), from, from.span, ignored = Set .empty )
904
+ val inferred = inferImplicit(adjust(to), from, from.span)
905
905
906
906
inferred match {
907
907
case SearchSuccess (_, ref, _, false ) if isOldStyleFunctionConversion(ref.underlying) =>
@@ -928,7 +928,7 @@ trait Implicits:
928
928
/** Find an implicit argument for parameter `formal`.
929
929
* Return a failure as a SearchFailureType in the type of the returned tree.
930
930
*/
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 =
932
932
inferImplicit(formal, EmptyTree , span, ignored) match
933
933
case SearchSuccess (arg, _, _, _) => arg
934
934
case fail @ SearchFailure (failed) =>
@@ -944,7 +944,7 @@ trait Implicits:
944
944
945
945
/** Search an implicit argument and report error if not found */
946
946
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)
948
948
if (arg.tpe.isInstanceOf [SearchFailureType ])
949
949
report.error(missingArgMsg(arg, formal, where), ctx.source.atSpan(span))
950
950
arg
@@ -968,7 +968,7 @@ trait Implicits:
968
968
def ignoredInstanceNormalImport = arg.tpe match
969
969
case fail : SearchFailureType =>
970
970
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)(
972
972
using findHiddenImplicitsCtx(ctx)) match {
973
973
case s : SearchSuccess => Some (s)
974
974
case f : SearchFailure =>
@@ -1082,7 +1082,7 @@ trait Implicits:
1082
1082
* it should be applied, EmptyTree otherwise.
1083
1083
* @param span The position where errors should be reported.
1084
1084
*/
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):
1086
1086
trace(s " search implicit ${pt.show}, arg = ${argument.show}: ${argument.tpe.show}" , implicits, show = true ) {
1087
1087
record(" inferImplicit" )
1088
1088
assert(ctx.phase.allowsImplicitSearch,
@@ -1670,17 +1670,17 @@ trait Implicits:
1670
1670
SearchFailure (TooUnspecific (pt), span)
1671
1671
else
1672
1672
val contextual = ctxImplicits != null
1673
- val prePreEligible = // the eligible candidates, ignoring positions
1673
+ var preEligible = // the eligible candidates, ignoring positions
1674
1674
if ctxImplicits != null then
1675
1675
if ctx.gadt.isNarrowing then
1676
1676
withoutMode(Mode .ImplicitsEnabled ) {
1677
1677
ctxImplicits.uncachedEligible(wildProto)
1678
1678
}
1679
1679
else ctxImplicits.eligible(wildProto)
1680
1680
else implicitScope(wildProto).eligible
1681
-
1682
- val preEligible =
1683
- prePreEligible .filter(candidate => ! ignored.contains(candidate.implicitRef.underlyingRef.symbol))
1681
+ if ! ignored.isEmpty then
1682
+ preEligible =
1683
+ preEligible .filter(candidate => ! ignored.contains(candidate.implicitRef.underlyingRef.symbol))
1684
1684
/** Does candidate `cand` come too late for it to be considered as an
1685
1685
* eligible candidate? This is the case if `cand` appears in the same
1686
1686
* scope as a given definition of the form `given ... = ...` that
0 commit comments