diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-09-03 14:20:07 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-09-03 14:20:07 +0000 |
commit | b3256eda6631fc0db5bb9440a6b77e2186053b3f (patch) | |
tree | 67de4c2d53b8c381bd8f04da77b305e7ce8256af /src/compiler | |
parent | 0d8ba6ca381227101367fce68ce8e250c4d91e33 (diff) | |
download | scala-b3256eda6631fc0db5bb9440a6b77e2186053b3f.tar.gz scala-b3256eda6631fc0db5bb9440a6b77e2186053b3f.tar.bz2 scala-b3256eda6631fc0db5bb9440a6b77e2186053b3f.zip |
better error message for default arguments.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index a003a4fd7e..7dc2f56197 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2371,6 +2371,9 @@ trait Typers { self: Analyzer => val funSym = fun1 match { case Block(_, expr) => expr.symbol } if (allArgs.length != args.length && callToCompanionConstr(context, funSym)) { errorTree(tree, "module extending its companion class cannot use default constructor arguments") + } else if (allArgs.length > formals.length) { + removeNames(Typer.this)(allArgs, params) // #3818 + setError(tree) } else if (allArgs.length == formals.length) { // useful when a default doesn't match parameter type, e.g. def f[T](x:T="a"); f[Int]() val note = "Error occurred in an application involving default arguments." |