Skip to content

Remove errShortString, cleanup error-related functions

This is a stepping stone towards Structured errors, and part of the implementation plan as it can be found here.

In particular, this commit gets rid of the errShortString field from the ErrMsg, as it turns out we don't need it to pretty-print an ErrMsg. Furthermore, we also get rid of the Show instance for the ErrMsg, as the whole point of this strand of work is to render the errors via the pretty-printing infrastructure (not shipped as part of this PR). We still allow a showErrMsg top-level function for things like the Show instance for a SourceError.

Removing this field allows us to remove the input DynFlag argument to a lot of functions which morally belonged to GHC.Types.Error but that couldn't be moved there, so this MR does that, as well.

Last but not least, we move some driver-specific functions from the fairly overloaded GHC.Utils.Error into a separate GHC.Driver.Errors module, and we use it all the driver-related modules that needed error-reporting.

Merge request reports