Decoupling L.H.S from GHC.Types.SourceText

This MR addresses issue #26953 (closed), decoupling L.H.S from GHC.Types.SourceText.

The MR moves the following data-types to L.H.S.Lit:

  • IntegralLit
  • FractionalLit
  • StringLiteral

Additionally, TTG extension points to these three literal types. There were a few other types in L.H.S.Lit that required TTG extension points to remove dependency on SourceText.

Across all modules in the L.H.S namespace, references to 'SourceText' have been removed and moved to the appropriate modules in GHC.*. This includes [Note]s about SourceText. Each note regarding SourceText within L.H.S has been moved to the corresponding module within GHC.*.

The export list of GHC.Hs.Lit has been completely reorganized. Furthermore, some exported functions have been renamed for nomenclature consistency. The old function names are still exported for backwards comparability, but with a deprecation warning. Included in the new export list are a number of "renaming" and "typechecking" functions to advance the 'GhcPass' for data-types exposed by L.H.S.Lit

A major change of this MR regards the StringLiteral data-type. The trailing comma record field (sl_tc) has been removed from StringLiteral. This information is now stored in the XRec p (StringLiteral p) type family instance.

This necessitates adding the instance 'Anno (StringLiteral (GhcPass p)) = SrcSpanAnnN type family instance for the XRec's annotation. Consequently the construction of StringLiteral values from the parser was altered, specifically the addTrailingCommaS function.

Edited by recursion-ninja

Merge request reports

Loading