From 332b1af33441b382b3e1efa68c5dab4fcda8b2bc Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 14 Dec 2014 19:15:18 +0100 Subject: 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. --- src/dotty/tools/dotc/transform/TreeChecker.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/transform/TreeChecker.scala') 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 -- cgit v1.2.3