MessageClass split and partial refactoring of GHC.Tc.Errors
This MR builds on top of !4932 (closed) and further reaps the benefits of the new MessageClass/Severity
split. In particular, we try to construct virtually all the diagnostics with the correct Severity
set "at birth". We are not quite there yet, but very, very close. In particular, @rae will be pleased to know the calls to demoteError
are gone. We now have a set_severity
local function that does pretty much the same thing, ,but it's arguably cleaner and we can get rid of it, with a bit of work.
In particular, I have spent quite a bit of time refactoring mkHoleError
and its ancillary logic, and I think this is paying off.
The only obstacle now remaining is maybeReportError
and all the related logic, but hopefully the same reasoning can apply. Having said that, I think that here perfect is the enemy of good, so I suggest we tackle the maybeReportError
in another MR, and start enjoying the benefits of the MessageClass
split.
NOTA BENE for Richard: The new commits from !4932 (closed) are only from 75506b493425999b3e983aef19ff5f918aec21ee
upwards.