Skip to content

Use ADT for Parser errors/warnings

Sylvain Henry requested to merge hsyl20/ghc:hsyl20/dynflags/parser3 into master

Use ADTs for parser errors/warnings

Haskell and Cmm parsers/lexers now report errors and warnings using ADTs defined in GHC.Parser.Errors. They can be printed using functions in GHC.Parser.Errors.Ppr.

Some of the errors provide hints with a separate ADT (e.g. to suggest to turn on some extension). For now, however, hints are not consistent across all messages. For example some errors contain the hints in the main message. I didn't want to change any message with this patch. I expect these changes to be discussed and implemented later.

Surprisingly, this patch enhances performance. On CI (x86_64/deb9/hadrian, ghc/alloc):

   parsing001         -11.5%
   T13719             -2.7%
   MultiLayerModules  -3.5%
   Naperian           -3.1%
Edited by Sylvain Henry

Merge request reports