diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-26 12:24:05 +0200 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-03-26 17:43:41 +0200 |
commit | 9c0442984fff7ea9fa7ded05c619d5c1273d85db (patch) | |
tree | 6b1b5a473ae69fb5c083646423f9b7eab9bcbc59 /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | |
parent | e0d1f15c244539ce7970c4a903eb49962eaa3569 (diff) | |
download | scala-9c0442984fff7ea9fa7ded05c619d5c1273d85db.tar.gz scala-9c0442984fff7ea9fa7ded05c619d5c1273d85db.tar.bz2 scala-9c0442984fff7ea9fa7ded05c619d5c1273d85db.zip |
[vpm] error message on missing parameter type
for selector-less matches that should yield a function
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index e37f5784c9..764823d786 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -376,21 +376,16 @@ trait ContextErrors { setError(tree) } - def MissingParameterTypeError(fun: Tree, vparam: ValDef, pt: Type) = { - def anonMessage = ( - "\nThe argument types of an anonymous function must be fully known. (SLS 8.5)" + - "\nExpected type was: " + pt.toLongString - ) - - val suffix = - if (!vparam.mods.isSynthetic) "" - else " for expanded function" + (fun match { - case Function(_, Match(_, _)) => anonMessage - case _ => " " + fun - }) - - issueNormalTypeError(vparam, "missing parameter type" + suffix) - } + def MissingParameterTypeError(fun: Tree, vparam: ValDef, pt: Type) = + if (vparam.mods.isSynthetic) fun match { + case Function(_, Match(_, _)) => MissingParameterTypeAnonMatchError(vparam, pt) + case _ => issueNormalTypeError(vparam, "missing parameter type for expanded function " + fun) + } else issueNormalTypeError(vparam, "missing parameter type") + + def MissingParameterTypeAnonMatchError(vparam: Tree, pt: Type) = + issueNormalTypeError(vparam, "missing parameter type for expanded function\n"+ + "The argument types of an anonymous function must be fully known. (SLS 8.5)\n"+ + "Expected type was: " + pt.toLongString) def ConstructorsOrderError(tree: Tree) = { issueNormalTypeError(tree, "called constructor's definition must precede calling constructor's definition") |