summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-02-21 22:39:58 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-02-22 09:44:39 +0100
commit17a3639adb5969e8381fd08655cc6fb2aea19c24 (patch)
tree5f8ba8ccbb26753bc89c819a5abac58ebd527a47 /src
parent00624a39ed84c3fd245dd9df7454d4cec4399e13 (diff)
downloadscala-17a3639adb5969e8381fd08655cc6fb2aea19c24.tar.gz
scala-17a3639adb5969e8381fd08655cc6fb2aea19c24.tar.bz2
scala-17a3639adb5969e8381fd08655cc6fb2aea19c24.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala3
1 files changed, 2 insertions, 1 deletions
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)
)
}