summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-11-20 21:02:23 +0000
committerMartin Odersky <odersky@gmail.com>2009-11-20 21:02:23 +0000
commitb408d0e98f694add637fc867433c627ca3191062 (patch)
treed13ca7c02e122ae53941c04523073a3ce7b1ea1e /src
parent937872a48956c11c278839622d5514a3ed65e25d (diff)
downloadscala-b408d0e98f694add637fc867433c627ca3191062.tar.gz
scala-b408d0e98f694add637fc867433c627ca3191062.tar.bz2
scala-b408d0e98f694add637fc867433c627ca3191062.zip
Closed #2642
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index a4b164edfe..3b2f917a05 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -1620,7 +1620,7 @@ trait Infer {
* assignment expression.
*/
def inferMethodAlternative(tree: Tree, undetparams: List[Symbol],
- argtpes: List[Type], pt0: Type): Unit = tree.tpe match {
+ argtpes: List[Type], pt0: Type, varArgsOnly: Boolean = false): Unit = tree.tpe match {
case OverloadedType(pre, alts) =>
val pt = if (pt0.typeSymbol == UnitClass) WildcardType else pt0
tryTwice {
@@ -1631,6 +1631,9 @@ trait Infer {
var allApplicable = alts filter (alt =>
isApplicable(undetparams, followApply(pre.memberType(alt)), argtpes, pt))
+ if (varArgsOnly)
+ allApplicable = allApplicable filter (alt => isVarArgs(alt.tpe.paramTypes))
+
// if there are multiple, drop those that use a default
// (keep those that use vararg / tupling conversion)
val applicable =
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ff57aabcb2..1a8db1f27d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2182,7 +2182,8 @@ trait Typers { self: Analyzer =>
arg1
}
context.undetparams = undetparams
- inferMethodAlternative(fun, undetparams, argtpes.toList, pt)
+ inferMethodAlternative(fun, undetparams, argtpes.toList, pt,
+ varArgsOnly = args.nonEmpty && treeInfo.isWildcardStarArg(args.last))
doTypedApply(tree, adapt(fun, funMode(mode), WildcardType), args1, mode, pt)
case mt @ MethodType(params, _) =>