summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-01-05 00:48:01 +0300
committerEugene Burmako <xeno.by@gmail.com>2013-01-09 08:10:48 +0100
commit3d397aa5e6381fa7514f3b5e160d170dad9d8f1c (patch)
treef6ff89d900a17ad9d1a0c2ba30aa0c4b03b3cf4a /src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
parent055b07e4db30742e8282772d08f1c42811bab4fa (diff)
downloadscala-3d397aa5e6381fa7514f3b5e160d170dad9d8f1c.tar.gz
scala-3d397aa5e6381fa7514f3b5e160d170dad9d8f1c.tar.bz2
scala-3d397aa5e6381fa7514f3b5e160d170dad9d8f1c.zip
more precise errors for macros
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index ea03aca8c4..df78f8a05d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -562,11 +562,13 @@ trait ContextErrors {
//adapt
def MissingArgsForMethodTpeError(tree: Tree, meth: Symbol) = {
- issueNormalTypeError(tree,
- "missing arguments for " + meth.fullLocationString + (
+ val message =
+ if (meth.isMacro) MacroPartialApplicationErrorMessage
+ else "missing arguments for " + meth.fullLocationString + (
if (meth.isConstructor) ""
else ";\nfollow this method with `_' if you want to treat it as a partially applied function"
- ))
+ )
+ issueNormalTypeError(tree, message)
setError(tree)
}
@@ -670,6 +672,10 @@ trait ContextErrors {
setError(tree)
}
+ def MacroTooManyArgumentListsError(expandee: Tree, fun: Symbol) = {
+ NormalTypeError(expandee, "too many argument lists for " + fun)
+ }
+
// same reason as for MacroBodyTypecheckException
case object MacroExpansionException extends Exception with scala.util.control.ControlThrowable
@@ -681,10 +687,11 @@ trait ContextErrors {
throw MacroExpansionException
}
+ def MacroPartialApplicationErrorMessage = "macros cannot be partially applied"
def MacroPartialApplicationError(expandee: Tree) = {
// macroExpansionError won't work => swallows positions, hence needed to do issueTypeError
// kinda contradictory to the comment in `macroExpansionError`, but this is how it works
- issueNormalTypeError(expandee, "macros cannot be partially applied")
+ issueNormalTypeError(expandee, MacroPartialApplicationErrorMessage)
setError(expandee)
throw MacroExpansionException
}