#18516 (GHC Errors as Values) Implement "Design A" to suppress unwanted warnings
See #18516.
This MR was opened on top of wip/adinapoli-diag-reason-severity
for ease of review. It implements the Design A in the Wiki for suppressing warnings that user shouldn't see due to enabled WarningFlag
s. This is one of the two proposed designs by @rae that we are evaluating.
In particular, this introduces a new Severity
constructor called SevIgnore
, which is used to suppress WarningWithFlag
diagnostics for which the particular flag is not set. It also allowed us to simplify the GHC.Tc.Errors
further, in a quite nice way.
Under both designs, we don't need to check anymore if a particular warning flag is set before generating the relevant diagnostic: rather, we always generate and collect it, but we discard it at the end if it turns out the user is not supposed to see it. This was simple to code but it's potentially very performance taxing (thus the need to explore design B).
I have run only a selection of 125 tests locally (CI will give us proper perf results) but it seems like time performance is roughly the same. More interesting will be, of course, memory allocations.