From e6e47f195d5985b07934cdedb22680f767a6ecb5 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 4 Nov 2016 16:44:06 +0100 Subject: Better reporting of nested implicit failures Error messages of nested implicit failures are now reported with the top-level message if -explaintypes is set. --- compiler/src/dotty/tools/dotc/reporting/Reporter.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/reporting/Reporter.scala') diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 8477cfe28..26c1e5ebc 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -286,11 +286,16 @@ abstract class Reporter extends interfaces.ReporterResult { } /** Should this diagnostic not be reported at all? */ - def isHidden(m: MessageContainer)(implicit ctx: Context): Boolean = ctx.mode.is(Mode.Printing) + def isHidden(m: MessageContainer)(implicit ctx: Context): Boolean = + ctx.mode.is(Mode.Printing) /** Does this reporter contain not yet reported errors or warnings? */ def hasPending: Boolean = false + /** If this reporter buffers messages, remove and return all buffered messages. */ + def removeBufferedMessages(implicit ctx: Context): List[MessageContainer] = Nil + /** Issue all error messages in this reporter to next outer one, or make sure they are written. */ - def flush()(implicit ctx: Context): Unit = {} + def flush()(implicit ctx: Context): Unit = + removeBufferedMessages.foreach(ctx.reporter.report) } -- cgit v1.2.3