Skip to content

Commit ace332c

Browse files
committed
Specialize mapBufferedMessages
1 parent 61aeabf commit ace332c

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class ExploringReporter extends StoreReporter(null, fromTyperState = false):
1818
override def removeBufferedMessages(using Context): List[Diagnostic] =
1919
try infos.toList finally reset()
2020

21+
override def mapBufferedMessages(f: Diagnostic => Diagnostic)(using Context): Unit =
22+
infos.mapInPlace(f)
23+
2124
def reset(): Unit = infos.clear()
2225

23-
end ExploringReporter
26+
end ExploringReporter

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ abstract class Reporter extends interfaces.ReporterResult {
264264
def removeBufferedMessages(using Context): List[Diagnostic] = Nil
265265

266266
/** If this reporter buffers messages, apply `f` to all buffered messages. */
267-
def mapBufferedMessages(f: Diagnostic => Diagnostic)(using Context): Unit =
268-
val mappedDiagnostics = removeBufferedMessages.map(f)
269-
mappedDiagnostics.foreach(report)
267+
def mapBufferedMessages(f: Diagnostic => Diagnostic)(using Context): Unit = ()
270268

271269
/** Issue all messages in this reporter to next outer one, or make sure they are written. */
272270
def flush()(using Context): Unit =

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

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class StoreReporter(outer: Reporter | Null = Reporter.NoReporter, fromTyperState
3737
if (infos != null) try infos.uncheckedNN.toList finally infos = null
3838
else Nil
3939

40+
override def mapBufferedMessages(f: Diagnostic => Diagnostic)(using Context): Unit =
41+
if infos != null then infos.uncheckedNN.mapInPlace(f)
42+
4043
override def pendingMessages(using Context): List[Diagnostic] =
4144
if (infos != null) infos.uncheckedNN.toList else Nil
4245

compiler/src/dotty/tools/dotc/typer/Applications.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ trait Applications extends Compatibility {
10971097
case _ => dia
10981098
case msg => dia
10991099
case dia => dia
1100+
case _ => ()
11001101

11011102
// Try once with original prototype and once (if different) with tupled one.
11021103
// The reason we need to try both is that the decision whether to use tupled

0 commit comments

Comments
 (0)