@@ -2898,6 +2898,7 @@ class Typer extends Namer
2898
2898
def dummyArg (tp : Type ) = untpd.Ident (nme.??? ).withTypeUnchecked(tp)
2899
2899
2900
2900
def addImplicitArgs (using Context ) = {
2901
+ def hasDefaultParams = methPart(tree).symbol.hasDefaultParams
2901
2902
def implicitArgs (formals : List [Type ], argIndex : Int , pt : Type ): List [Tree ] = formals match {
2902
2903
case Nil => Nil
2903
2904
case formal :: formals1 =>
@@ -2907,7 +2908,7 @@ class Typer extends Namer
2907
2908
val pt1 = pt.deepenProto
2908
2909
if ((pt1 `ne` pt) && constrainResult(tree.symbol, wtp, pt1)) implicitArgs(formals, argIndex, pt1)
2909
2910
else arg :: implicitArgs(formals1, argIndex + 1 , pt1)
2910
- case failed : SearchFailureType if ! tree.symbol. hasDefaultParams =>
2911
+ case failed : SearchFailureType if ! hasDefaultParams =>
2911
2912
// no need to search further, the adapt fails in any case
2912
2913
// the reason why we continue inferring arguments in case of an AmbiguousImplicits
2913
2914
// is that we need to know whether there are further errors.
@@ -2963,7 +2964,7 @@ class Typer extends Namer
2963
2964
2964
2965
// If method has default params, fall back to regular application
2965
2966
// where all inferred implicits are passed as named args.
2966
- if (methPart(tree).symbol. hasDefaultParams && ! propFail.isInstanceOf [AmbiguousImplicits ]) {
2967
+ if hasDefaultParams && ! propFail.isInstanceOf [AmbiguousImplicits ] then
2967
2968
val namedArgs = wtp.paramNames.lazyZip(args).flatMap { (pname, arg) =>
2968
2969
if (arg.tpe.isError) Nil else untpd.NamedArg (pname, untpd.TypedSplice (arg)) :: Nil
2969
2970
}
@@ -2975,7 +2976,6 @@ class Typer extends Namer
2975
2976
} { (_, _) =>
2976
2977
issueErrors()
2977
2978
}
2978
- }
2979
2979
else issueErrors()
2980
2980
}
2981
2981
else tree match {
0 commit comments