Compute all emitted diagnostic codes
The first change in this MR is the introduction, in GHC.Types.Error.Codes
, of the function
constructorCodes :: forall diag. (...) => Map DiagnosticCode String
which computes a collection of all the diagnostic codes that correspond to a particular type. In particular, we can compute the collection of all diagnostic codes emitted by GHC using the invocation
constructorCodes @GhcMessage
The second change is to add the lint-codes
test, which checks consistency and coverage of GHC diagnostic codes.
It performs three checks:
- check 1: all non-outdated
GhcDiagnosticCode
equations are statically used. - check 2: all outdated
GhcDiagnosticCode
equations are statically unused. - check 3: all statically used diagnostic codes are covered by the testsuite (modulo accepted exceptions).