diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-05-16 12:28:43 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-05-16 12:28:43 +0200 |
commit | 3c79caa1369a7c1794097b669859118a71ab015e (patch) | |
tree | f9e86b4baeb78434807abe271a09a5797ef24ca1 /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | |
parent | b48aa909cefc4811e208f491d22d664538d75bad (diff) | |
download | scala-3c79caa1369a7c1794097b669859118a71ab015e.tar.gz scala-3c79caa1369a7c1794097b669859118a71ab015e.tar.bz2 scala-3c79caa1369a7c1794097b669859118a71ab015e.zip |
Fix SI-4928
better error message when a parameter is first defined positionally, then with a named argument.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 0c1638b76f..df0258832c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -1040,8 +1040,12 @@ trait ContextErrors { setError(arg) } - def DoubleParamNamesDefaultError(arg: Tree, name: Name)(implicit context: Context) = { - issueNormalTypeError(arg, "parameter specified twice: "+ name) + def DoubleParamNamesDefaultError(arg: Tree, name: Name, pos: Int, otherName: Option[Name])(implicit context: Context) = { + val annex = otherName match { + case Some(oName) => "\nNote that that '"+ oName +"' is not a parameter name of the invoked method." + case None => "" + } + issueNormalTypeError(arg, "parameter '"+ name +"' is already specified at parameter position "+ pos + annex) setError(arg) } |