Skip to content

Commit 6847b83

Browse files
committed
Avoid reporting post check messages several times
1 parent d8c4652 commit 6847b83

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,4 +707,5 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
707707

708708
def postCheck()(using Context): Unit =
709709
for chk <- todoAtPostCheck do chk(ctx)
710+
todoAtPostCheck.clear()
710711
end Setup

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ trait UniqueMessagePositions extends Reporter {
2525
||
2626
dia.pos.exists
2727
&& !ctx.settings.YshowSuppressedErrors.value
28-
&& (dia.pos.start to dia.pos.end).exists(pos =>
29-
positions.get((ctx.source, pos)).exists(_.hides(dia)))
28+
&& (dia.pos.start to dia.pos.end).exists: offset =>
29+
positions.get((ctx.source, offset)).exists(_.hides(dia))
3030

3131
override def markReported(dia: Diagnostic)(using Context): Unit =
3232
if dia.pos.exists then
33-
for (pos <- dia.pos.start to dia.pos.end)
34-
positions.get(ctx.source, pos) match
33+
for offset <- dia.pos.start to dia.pos.end do
34+
positions.get((ctx.source, offset)) match
3535
case Some(dia1) if dia1.hides(dia) =>
36-
case _ => positions((ctx.source, pos)) = dia
36+
case _ => positions((ctx.source, offset)) = dia
3737
super.markReported(dia)
3838
}

0 commit comments

Comments
 (0)