From 5f9e569926728e7f591a26729efa7700387aeb22 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 21 Feb 2017 09:28:22 +0100 Subject: Don't inline when errors are detected Inlining is only well-defined if the body to inline does not have any errors. We therefore check for errors before we perform any transformation of trees related to inlining. The error check is global, i.e. we stop on any error not just on errors in the code to be inlined. This is a safe approximation, of course. --- compiler/src/dotty/tools/dotc/reporting/Reporter.scala | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/reporting') diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 26c1e5ebc..b2c7abec9 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -171,22 +171,6 @@ trait Reporting { this: Context => throw ex } } - - /** Implements a fold that applies the function `f` to the result of `op` if - * there are no new errors in the reporter - * - * @param op operation checked for errors - * @param f function applied to result of op - * @return either the result of `op` if it had errors or the result of `f` - * applied to it - */ - def withNoError[A, B >: A](op: => A)(f: A => B): B = { - val before = reporter.errorCount - val op0 = op - - if (reporter.errorCount > before) op0 - else f(op0) - } } /** -- cgit v1.2.3