Skip to content

Implement MessageClass and DiagnosticReason new Wiki design (Part 1)

Alfredo Di Napoli requested to merge wip/adinapoli-message-class-new-design into master

This MR implements the new MessageClass , DiagnosticReason and Severity hierarchy as described in the Wiki, in the "New API" section: it's the evolution of a previous iteration of a design which was affected by a duplication problem. It's the "moral successor" of !5024 (closed), which this MR supersedes.

As agreed with @rae, this MR delivers the first part of the "vision" described in the proposal. In particular:

  • We are still using default_reason_severity, which will be superseded in a follow-up MR by a proper diagnosticReasonSeverity :: DynFlags -> DiagnosticReason -> Severity which will take into account the DynFlags, as it should. For now, however, we go with this middle ground as trying to aim for the final design immediately will break the defer-type-errors machinery and fixing it requires care and attention;

  • We still do reclassification as part of printOrThrowWarning and GHC.Tc.Errors (see reclassify). Once again, fixing this is possible but it needs to be done carefully, so it will done in a separate MR;

This MR has still multiple commits. I will squash them into one after approval.

Edited by Alfredo Di Napoli

Merge request reports