summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-06-10 21:59:35 +0200
committerJason Zaugg <jzaugg@gmail.com>2012-06-10 22:17:19 +0200
commitfc6ea96f1946712a889b7db50a520be49ea2e208 (patch)
tree757d25fbdb055ba84170f75ca851a225bd8a57d6 /src
parent30ef129f322687cbc885d344ca73dd4877fbedd6 (diff)
downloadscala-fc6ea96f1946712a889b7db50a520be49ea2e208.tar.gz
scala-fc6ea96f1946712a889b7db50a520be49ea2e208.tar.bz2
scala-fc6ea96f1946712a889b7db50a520be49ea2e208.zip
SI-5696 Detect excess constructor argument lists.
An apply method fooled the usual mechanism.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index a2f0e053a8..bcf2ba6b71 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -224,6 +224,11 @@ trait ContextErrors {
def SuperConstrArgsThisReferenceError(tree: Tree) =
NormalTypeError(tree, "super constructor arguments cannot reference unconstructed `this`")
+ def TooManyArgumentListsForConstructor(tree: Tree) = {
+ issueNormalTypeError(tree, "too many argument lists for constructor invocation")
+ setError(tree)
+ }
+
// typedValDef
def VolatileValueError(vdef: Tree) =
issueNormalTypeError(vdef, "values cannot be volatile")
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index fec5063bd0..2bdae4164a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4950,6 +4950,8 @@ trait Typers extends Modes with Adaptations with Tags {
else new ApplyToImplicitArgs(Select(tag, nme.newArray), args)
}
typed(newArrayApp, mode, pt)
+ case Apply(Select(fun, nme.apply), _) if treeInfo.isSuperConstrCall(fun) => //SI-5696
+ TooManyArgumentListsForConstructor(tree)
case tree1 =>
tree1
}