summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-10-03 23:09:42 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-10-03 23:56:07 +0200
commit992d255e2fc1ca487a60e38196ec4aa952617b92 (patch)
treeb929ca03652a7e0fff1d4e02b3e28dc15a913887 /src/compiler
parent1b2415865984071036c5f61e82a4a7048d4d18ee (diff)
downloadscala-992d255e2fc1ca487a60e38196ec4aa952617b92.tar.gz
scala-992d255e2fc1ca487a60e38196ec4aa952617b92.tar.bz2
scala-992d255e2fc1ca487a60e38196ec4aa952617b92.zip
renames macros.TypeError to TypecheckException
Again, this is not a fatal error, so it should end with an Error, and it should subclass not Throwable, but Exception. Also moved the exception outside the cake to simplify error handling, along the same lines of what've been done for parsing and reification exceptions.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/macros/runtime/Typers.scala10
-rw-r--r--src/compiler/scala/reflect/reify/Taggers.scala6
2 files changed, 5 insertions, 11 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala
index 9fa8567ada..be70181126 100644
--- a/src/compiler/scala/reflect/macros/runtime/Typers.scala
+++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala
@@ -25,7 +25,7 @@ trait Typers {
result
case error @ universe.analyzer.SilentTypeError(_) =>
macroLogVerbose(error.err.errMsg)
- if (!silent) throw new universe.TypeError(error.err.errPos, error.err.errMsg)
+ if (!silent) throw new TypecheckException(error.err.errPos, error.err.errMsg)
universe.EmptyTree
})
}
@@ -49,19 +49,13 @@ trait Typers {
wrapper(universe.analyzer.inferImplicit(tree, pt, reportAmbiguous = true, isView = isView, context = context, saveAmbiguousDivergent = !silent, pos = pos)) match {
case failure if failure.tree.isEmpty =>
macroLogVerbose("implicit search has failed. to find out the reason, turn on -Xlog-implicits")
- if (context.hasErrors) throw new universe.TypeError(context.errBuffer.head.errPos, context.errBuffer.head.errMsg)
+ if (context.hasErrors) throw new TypecheckException(context.errBuffer.head.errPos, context.errBuffer.head.errMsg)
universe.EmptyTree
case success =>
success.tree
}
}
- type TypeError = universe.TypeError
-
- object TypeError extends TypeErrorExtractor {
- def unapply(error: TypeError): Option[(Position, String)] = Some((error.pos, error.msg))
- }
-
def resetAllAttrs(tree: Tree): Tree = universe.resetAllAttrs(tree)
def resetLocalAttrs(tree: Tree): Tree = universe.resetLocalAttrs(tree)
diff --git a/src/compiler/scala/reflect/reify/Taggers.scala b/src/compiler/scala/reflect/reify/Taggers.scala
index 7db6394734..513ce020cc 100644
--- a/src/compiler/scala/reflect/reify/Taggers.scala
+++ b/src/compiler/scala/reflect/reify/Taggers.scala
@@ -1,6 +1,6 @@
package scala.reflect.reify
-import scala.reflect.macros.{ReificationError, UnexpectedReificationError}
+import scala.reflect.macros.{ReificationError, UnexpectedReificationError, TypecheckException}
import scala.reflect.macros.runtime.Context
abstract class Taggers {
@@ -65,13 +65,13 @@ abstract class Taggers {
translatingReificationErrors(materializer)
}
try c.typeCheck(result)
- catch { case terr @ c.TypeError(pos, msg) => failTag(result, terr) }
+ catch { case terr @ TypecheckException(pos, msg) => failTag(result, terr) }
}
def materializeExpr(universe: Tree, mirror: Tree, expr: Tree): Tree = {
val result = translatingReificationErrors(c.reifyTree(universe, mirror, expr))
try c.typeCheck(result)
- catch { case terr @ c.TypeError(pos, msg) => failExpr(result, terr) }
+ catch { case terr @ TypecheckException(pos, msg) => failExpr(result, terr) }
}
private def translatingReificationErrors(materializer: => Tree): Tree = {