From 17a3639adb5969e8381fd08655cc6fb2aea19c24 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Fri, 21 Feb 2014 22:39:58 +0100 Subject: SI-8197 Only consider immediate params for defaults, overloading A recent commit fixed the behaviour of overloading with regards to discarding candiates that include default arguments. The old check was checking the wrong flag. But, the new code is actually checking all parameter lists for defaults, which led to a regression in scala-io, which is distilled in the enclosed test case. Applications are typechecked one parameter list at a time, so a holistic check for defaults doesn't seem to make sense; only defaults in the first parameter list ought to count. --- src/compiler/scala/tools/nsc/typechecker/Infer.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 50744f2d72..b42113c84f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -1328,7 +1328,8 @@ trait Infer extends Checkable { eligible else eligible filter (alt => - !mexists(alt.info.paramss)(_.hasDefault) && isApplicableBasedOnArity(alt.tpe, argtpes.length, varargsStar, tuplingAllowed = true) + !alt.info.params.exists(_.hasDefault) // run/t8197b first parameter list only! + && isApplicableBasedOnArity(alt.tpe, argtpes.length, varargsStar, tuplingAllowed = true) ) } -- cgit v1.2.3