aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/transform/TreeChecker.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-12-14 19:15:18 +0100
committerMartin Odersky <odersky@gmail.com>2014-12-15 16:36:53 +0100
commit332b1af33441b382b3e1efa68c5dab4fcda8b2bc (patch)
treeb04a52702b09d8423fc053f88e1883940e27b600 /src/dotty/tools/dotc/transform/TreeChecker.scala
parent0eec180a686a4425bd3f3089006eda530123fe2e (diff)
downloaddotty-332b1af33441b382b3e1efa68c5dab4fcda8b2bc.tar.gz
dotty-332b1af33441b382b3e1efa68c5dab4fcda8b2bc.tar.bz2
dotty-332b1af33441b382b3e1efa68c5dab4fcda8b2bc.zip
Replace Throwable catches with NonFatal
Previously, stackoverflows led to infinite loops because the catch immediately threw another stack overflow. Anyway, one should never catch Throwable.
Diffstat (limited to 'src/dotty/tools/dotc/transform/TreeChecker.scala')
-rw-r--r--src/dotty/tools/dotc/transform/TreeChecker.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala
index 652536011..1aa681f33 100644
--- a/src/dotty/tools/dotc/transform/TreeChecker.scala
+++ b/src/dotty/tools/dotc/transform/TreeChecker.scala
@@ -23,6 +23,7 @@ import util.SourcePosition
import collection.mutable
import ProtoTypes._
import java.lang.AssertionError
+import scala.util.control.NonFatal
/** Run by -Ycheck option after a given phase, this class retypes all syntax trees
* and verifies that the type of each tree node so obtained conforms to the type found in the tree node.
@@ -58,7 +59,7 @@ class TreeChecker {
val checker = new Checker(previousPhases(phasesToRun.toList)(ctx))
try checker.typedExpr(ctx.compilationUnit.tpdTree)(checkingCtx)
catch {
- case ex: Throwable =>
+ case NonFatal(ex) =>
implicit val ctx: Context = checkingCtx
println(i"*** error while checking after phase ${checkingCtx.phase.prev} ***")
throw ex