WIP: compiler: introduce types for subsystem-specific errors
Commit message:
This is the first step towards implementing ghc-proposals#306 (1). This patch introduces
ParseError
andTcRnError
in the relevant subsystems as well as a toplevelGhcError
sum type which can be constructed with a value of one of the two aforementioned types, or just a rawErrMsg
.GhcError
however only exists at the driver-level and each subsystem gets to deal only with its corresponding error type.At the moment, we use
ParseError
both when parsing Haskell source code as well as Cmm, and similarly the desugarer just reusesTcRnError
as it shares a lot of infrastructure with the renamer+typechecker subsystem. This could be refined if deemed desirable.This change alone is enough to compel us to make some error-related infrastructure a bit more generic, which this patch attempts to do. It does not yet delay the rendering of errors, as
ParseError
andTcRnError
are mere wrappers forErrMsg
at this point. The addition of dedicated constructors for all the possible errors is delayed to a later patch, once the design for this one is consolidated (or changed a bit) and approved.
Note: this only tackles error messages and not warnings (yet?)