Split out DynFlags data-type into own module
The original problem is that *.Errors.Types
modules import GHC.Driver.Session
to get DynFlags
, xopt
etc.
However GHC.Driver.Session
also includes the parser for DynFlags
which generates diagnostics.
These diagnostics are however not using the new diagnostic framework (cannot assign error code etc new goodies), and cannot be made easily because of import cycle: GHC.Driver.Session -> GHC.Driver.Error.Types -> ...
See e.g. !10172 (diffs, comment 493735)
An alternative is to move (small) functions like checkBuildingCabalPackage
or negLiteralExtEnabled
out of GHC.Driver.Errors.Types
and GHC.HsToCore.Errors.Types
respectively. I think that splitting (huge) GHC.Driver.Session
into types and parser parts is a better choice.
cc @adamgundry