Skip to content

Commit

Permalink
Revert "Set errorsReported while running isHidden and forcing message"
Browse files Browse the repository at this point in the history
This reverts commit 6875465.
  • Loading branch information
nicolasstucki committed Dec 18, 2023
1 parent 6b8fbba commit 6bea557
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions compiler/src/dotty/tools/dotc/reporting/Reporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,7 @@ abstract class Reporter extends interfaces.ReporterResult {
val key = w.enablingOption.name
addUnreported(key, 1)
case _ =>
val hide = if !errorsReported && dia.isInstanceOf[Error] then
// We bump up errorCount so errorsReported is true while executing isHidden.
// We use errorsReported as a predicate for broken code.
// So now any code `isHidden` runs won't cause, for instance,
// assertion errors and thus compiler crashes.
// This normally amounts to forcing the message, which might run more code
// to generate useful hints for the user.
try
_errorCount += 1
isHidden(dia)
finally
_errorCount -= 1 // decrease rather than set back to `oldErrorCount` so we only ever decrease by 1
else isHidden(dia)
if !hide then // avoid isHidden test for summarized warnings so that message is not forced
if !isHidden(dia) then // avoid isHidden test for summarized warnings so that message is not forced
markReported(dia)
withMode(Mode.Printing)(doReport(dia))
dia match {
Expand Down

0 comments on commit 6bea557

Please sign in to comment.