diff options
author | romes <rodrigo.m.mesquita@gmail.com> | 2022-06-14 00:14:16 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-07-06 13:50:27 -0400 |
commit | 371c5ecf6898294f4e5bf91784dc794e7e16b7cc (patch) | |
tree | 85ff46ffd1af9b075d3291780058791167d3f32e /compiler/GHC/Hs | |
parent | acc1816b9153f134a3308d13b90d67bfcb123d87 (diff) | |
download | haskell-371c5ecf6898294f4e5bf91784dc794e7e16b7cc.tar.gz |
TTG for HsTyLit
Add TTG parameter to `HsTyLit` to move the GHC-specific `SourceText`
fields to the extension point and out of the base AST.
Progress towards #21592
Diffstat (limited to 'compiler/GHC/Hs')
-rw-r--r-- | compiler/GHC/Hs/Instances.hs | 5 | ||||
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/compiler/GHC/Hs/Instances.hs b/compiler/GHC/Hs/Instances.hs index ef849a17bb..a0c588413b 100644 --- a/compiler/GHC/Hs/Instances.hs +++ b/compiler/GHC/Hs/Instances.hs @@ -494,6 +494,11 @@ deriving instance Data (HsType GhcPs) deriving instance Data (HsType GhcRn) deriving instance Data (HsType GhcTc) +-- deriving instance (DataIdLR p p) => Data (HsTyLit p) +deriving instance Data (HsTyLit GhcPs) +deriving instance Data (HsTyLit GhcRn) +deriving instance Data (HsTyLit GhcTc) + -- deriving instance Data (HsLinearArrowTokens p) deriving instance Data (HsLinearArrowTokens GhcPs) deriving instance Data (HsLinearArrowTokens GhcRn) diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 73709e2849..73c7652dec 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -339,6 +339,12 @@ type instance XWildCardTy (GhcPass _) = NoExtField type instance XXType (GhcPass _) = HsCoreTy +type instance XNumTy (GhcPass _) = SourceText +type instance XStrTy (GhcPass _) = SourceText +type instance XCharTy (GhcPass _) = SourceText +type instance XXTyLit (GhcPass _) = DataConCantHappen + + oneDataConHsTy :: HsType GhcRn oneDataConHsTy = HsTyVar noAnn NotPromoted (noLocA oneDataConName) @@ -991,7 +997,8 @@ instance (OutputableBndrId p) ppr (HsPS { hsps_body = ty }) = ppr ty -instance Outputable HsTyLit where +instance (OutputableBndrId p) + => Outputable (HsTyLit (GhcPass p)) where ppr = ppr_tylit instance Outputable HsIPName where @@ -1020,7 +1027,7 @@ instance (UnXRec pass, OutputableBndr (XRec pass RdrName)) => OutputableBndr (Ge pprPrefixOcc = pprPrefixOcc . unLoc -ppr_tylit :: HsTyLit -> SDoc +ppr_tylit :: (HsTyLit (GhcPass p)) -> SDoc ppr_tylit (HsNumTy source i) = pprWithSourceText source (integer i) ppr_tylit (HsStrTy source s) = pprWithSourceText source (text (show s)) ppr_tylit (HsCharTy source c) = pprWithSourceText source (text (show c)) |