Implement MessageClass and DiagnosticReason new Wiki design (Part 1)
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 properdiagnosticReasonSeverity :: DynFlags -> DiagnosticReason -> Severitywhich will take into account theDynFlags, 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
printOrThrowWarningandGHC.Tc.Errors(seereclassify). 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.