diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-04 08:46:04 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-09-04 08:46:14 +0200 |
commit | 431288d105c6fc581eb3cb32f8b9eb53b65a11c8 (patch) | |
tree | 8dc95891c3c9659020799eb668dedd022b117729 | |
parent | 225102627d37f16134bc682eb5b01270684a02e4 (diff) | |
download | dotty-431288d105c6fc581eb3cb32f8b9eb53b65a11c8.tar.gz dotty-431288d105c6fc581eb3cb32f8b9eb53b65a11c8.tar.bz2 dotty-431288d105c6fc581eb3cb32f8b9eb53b65a11c8.zip |
Move crash diagnostics from TreeChecker to ReTyper.
If there's a crash, we always want to see where the retyper was, not just for
tree checking.
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeChecker.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/ReTyper.scala | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala index c3e2278ad..5852eba9a 100644 --- a/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -42,7 +42,7 @@ class TreeChecker { } object Checker extends ReTyper { - override def typed(tree: untpd.Tree, pt: Type)(implicit ctx: Context) = try { + override def typed(tree: untpd.Tree, pt: Type)(implicit ctx: Context) = { val res = tree match { case _: untpd.UnApply => // can't recheck patterns @@ -69,10 +69,6 @@ class TreeChecker { } if (ctx.erasedTypes) assertErased(res) res - } catch { - case ex: Throwable => - println(i"exception while checking $tree of class ${tree.getClass} # ${tree.uniqueId}") - throw ex } override def typedIdent(tree: untpd.Ident, pt: Type)(implicit ctx: Context): Tree = { diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala index 0d98a3fe0..31a776fc9 100644 --- a/src/dotty/tools/dotc/typer/ReTyper.scala +++ b/src/dotty/tools/dotc/typer/ReTyper.scala @@ -81,5 +81,13 @@ class ReTyper extends Typer { super.handleUnexpectedFunType(tree, fun) } + override def typed(tree: untpd.Tree, pt: Type)(implicit ctx: Context) = + try super.typed(tree, pt) + catch { + case ex: Throwable => + println(i"exception while typing $tree of class ${tree.getClass} # ${tree.uniqueId}") + throw ex + } + override def checkVariance(tree: Tree)(implicit ctx: Context) = () }
\ No newline at end of file |