@@ -477,6 +477,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
477477 | actualCaptures = ${args.map(arg => CaptureSet (captures(arg)))},
478478 | deps = ${deps.toList}""" )
479479 val parts = qual :: args
480+ var reported : SimpleIdentitySet [Tree ] = SimpleIdentitySet .empty
480481
481482 for arg <- args do
482483 val argPeaks = PeaksPair (
@@ -495,7 +496,9 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
495496 // 1. test argPeaks.actual against previously captured hidden sets
496497 if ! argPeaks.actual.sharedWith(currentPeaks.hidden).isEmpty then
497498 val clashing = clashingPart(argPeaks.actual, _.hidden)
498- if ! clashing.isEmpty then sepApplyError(fn, parts, clashing, arg)
499+ if ! clashing.isEmpty then
500+ sepApplyError(fn, parts, clashing, arg)
501+ reported += clashing
499502 else assert(! argDeps.isEmpty)
500503
501504 if arg.needsSepCheck then
@@ -505,9 +508,7 @@ class SepCheck(checker: CheckCaptures.CheckerAPI) extends tpd.TreeTraverser:
505508 if ! argPeaks.hidden.sharedWith(currentPeaks.actual).isEmpty then
506509 val clashing = clashingPart(argPeaks.hidden, _.actual)
507510 if ! clashing.isEmpty then
508- if ! clashing.needsSepCheck then
509- // if clashing needs a separation check then we already got an erro
510- // in (1) at position of clashing. No need to report it twice.
511+ if ! reported.contains(clashing) then
511512 // println(i"CLASH $arg / ${argPeaks.formal} vs $clashing / ${peaksOfTree(clashing).actual} / ${captures(clashing).peaks}")
512513 sepApplyError(fn, parts, arg, clashing)
513514 else assert(! argDeps.isEmpty)
0 commit comments