aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-12 02:27:41 +0200
committerMartin Odersky <odersky@gmail.com>2014-09-12 02:27:41 +0200
commitf05dafedf2c63bb4aa1830b600416f80c984dce6 (patch)
tree1f9a42885de0714d492605f3e2ec2a5ea1e04bd6 /src
parentedbe9edbbe4cf52ec6f885919253bf7ce4979b38 (diff)
downloaddotty-f05dafedf2c63bb4aa1830b600416f80c984dce6.tar.gz
dotty-f05dafedf2c63bb4aa1830b600416f80c984dce6.tar.bz2
dotty-f05dafedf2c63bb4aa1830b600416f80c984dce6.zip
Better failure diagnostic in TreeTransform
Include a backtrace of nested calls on error.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/transform/TreeTransform.scala26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/transform/TreeTransform.scala b/src/dotty/tools/dotc/transform/TreeTransform.scala
index 6f5956775..d06e1a0d9 100644
--- a/src/dotty/tools/dotc/transform/TreeTransform.scala
+++ b/src/dotty/tools/dotc/transform/TreeTransform.scala
@@ -1166,16 +1166,22 @@ object TreeTransforms {
}
def transform(tree: Tree, info: TransformerInfo, cur: Int)(implicit ctx: Context): Tree = ctx.traceIndented(s"transforming ${tree.show} at ${ctx.phase}", transforms, show = true) {
- if (cur < info.transformers.length) {
- // if cur > 0 then some of the symbols can be created by already performed transformations
- // this means that their denotations could not exists in previous period
- val pctx = ctx.withPhase(info.transformers(cur).treeTransformPhase)
- tree match {
- //split one big match into 2 smaller ones
- case tree: NameTree => transformNamed(tree, info, cur)(pctx)
- case tree => transformUnnamed(tree, info, cur)(pctx)
- }
- } else tree
+ try
+ if (cur < info.transformers.length) {
+ // if cur > 0 then some of the symbols can be created by already performed transformations
+ // this means that their denotations could not exists in previous period
+ val pctx = ctx.withPhase(info.transformers(cur).treeTransformPhase)
+ tree match {
+ //split one big match into 2 smaller ones
+ case tree: NameTree => transformNamed(tree, info, cur)(pctx)
+ case tree => transformUnnamed(tree, info, cur)(pctx)
+ }
+ } else tree
+ catch {
+ case ex: Throwable =>
+ println(i"exception while transforming $tree of class ${tree.getClass} # ${tree.uniqueId}")
+ throw ex
+ }
}
@tailrec