Skip to content
  • sheaf's avatar
    Compute all emitted diagnostic codes · 0ef1d8ae
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This commit introduces in GHC.Types.Error.Codes 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
    
    We then make use of this functionality in the new "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).
    0ef1d8ae