Skip to content

Commit 0a4cb68

Browse files
committed
Avoid needless closure in Reporter.flush
1 parent eca1369 commit 0a4cb68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/reporting/Reporter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ abstract class Reporter extends interfaces.ReporterResult {
202202

203203
/** Issue all error messages in this reporter to next outer one, or make sure they are written. */
204204
def flush()(using Context): Unit =
205-
removeBufferedMessages.foreach(ctx.reporter.report)
205+
val msgs = removeBufferedMessages
206+
if msgs.nonEmpty then msgs.foreach(ctx.reporter.report)
206207

207208
/** If this reporter buffers messages, all buffered messages, otherwise Nil */
208209
def pendingMessages(using Context): List[Diagnostic] = Nil

0 commit comments

Comments
 (0)