diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-04-15 20:57:54 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-04-19 15:41:00 -0400 |
commit | 0619fb0fb14a98f04aac5f031f6566419fd27495 (patch) | |
tree | 912a13457224565a3e5d98ccb2fce33eacdec0b7 /compiler/GHC/Hs | |
parent | 8b5e5b0524f614679a20ffaebab731c54dc6dee9 (diff) | |
download | haskell-0619fb0fb14a98f04aac5f031f6566419fd27495.tar.gz |
EPA: cleanups after the merge
Remove EpaAnn type synonym, rename EpaAnn' to EpaAnn.
Closes #19705
Updates haddock submodule
--
Change
data EpaAnchor = AR RealSrcSpan
| AD DeltaPos
To instead be
data EpaAnchor = AnchorReal RealSrcSpan
| AnchorDelta DeltaPos
Closes #19699
--
Change
data DeltaPos =
DP
{ deltaLine :: !Int,
deltaColumn :: !Int
}
To instead be
data DeltaPos
= SameLine { deltaColumn :: !Int }
| DifferentLine { deltaLine :: !Int, startColumn :: !Int }
Closes #19698
--
Also some clean-ups of unused parts of check-exact.
Diffstat (limited to 'compiler/GHC/Hs')
-rw-r--r-- | compiler/GHC/Hs/Binds.hs | 30 | ||||
-rw-r--r-- | compiler/GHC/Hs/Decls.hs | 62 | ||||
-rw-r--r-- | compiler/GHC/Hs/Dump.hs | 61 | ||||
-rw-r--r-- | compiler/GHC/Hs/Expr.hs | 112 | ||||
-rw-r--r-- | compiler/GHC/Hs/Extension.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Hs/ImpExp.hs | 34 | ||||
-rw-r--r-- | compiler/GHC/Hs/Pat.hs | 32 | ||||
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 36 | ||||
-rw-r--r-- | compiler/GHC/Hs/Utils.hs | 40 |
9 files changed, 205 insertions, 204 deletions
diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index 72f54828ee..6c2ed3c167 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -69,8 +69,8 @@ Global bindings (where clauses) -- the ...LR datatypes are parametrized by two id types, -- one for the left and one for the right. -type instance XHsValBinds (GhcPass pL) (GhcPass pR) = EpAnn' AnnList -type instance XHsIPBinds (GhcPass pL) (GhcPass pR) = EpAnn' AnnList +type instance XHsValBinds (GhcPass pL) (GhcPass pR) = EpAnn AnnList +type instance XHsIPBinds (GhcPass pL) (GhcPass pR) = EpAnn AnnList type instance XEmptyLocalBinds (GhcPass pL) (GhcPass pR) = NoExtField type instance XXHsLocalBindsLR (GhcPass pL) (GhcPass pR) = NoExtCon @@ -93,7 +93,7 @@ type instance XFunBind (GhcPass pL) GhcPs = NoExtField type instance XFunBind (GhcPass pL) GhcRn = NameSet -- Free variables type instance XFunBind (GhcPass pL) GhcTc = HsWrapper -- See comments on FunBind.fun_ext -type instance XPatBind GhcPs (GhcPass pR) = EpAnn +type instance XPatBind GhcPs (GhcPass pR) = EpAnn [AddEpAnn] type instance XPatBind GhcRn (GhcPass pR) = NameSet -- Free variables type instance XPatBind GhcTc (GhcPass pR) = Type -- Type of the GRHSs @@ -105,7 +105,7 @@ type instance XXHsBindsLR (GhcPass pL) (GhcPass pR) = NoExtCon type instance XABE (GhcPass p) = NoExtField type instance XXABExport (GhcPass p) = NoExtCon -type instance XPSB (GhcPass idL) GhcPs = EpAnn +type instance XPSB (GhcPass idL) GhcPs = EpAnn [AddEpAnn] type instance XPSB (GhcPass idL) GhcRn = NameSet type instance XPSB (GhcPass idL) GhcTc = NameSet @@ -552,7 +552,7 @@ isEmptyIPBindsPR (IPBinds _ is) = null is isEmptyIPBindsTc :: HsIPBinds GhcTc -> Bool isEmptyIPBindsTc (IPBinds ds is) = null is && isEmptyTcEvBinds ds -type instance XCIPBind (GhcPass p) = EpAnn +type instance XCIPBind (GhcPass p) = EpAnn [AddEpAnn] type instance XXIPBind (GhcPass p) = NoExtCon instance OutputableBndrId p @@ -574,17 +574,17 @@ instance OutputableBndrId p => Outputable (IPBind (GhcPass p)) where ************************************************************************ -} -type instance XTypeSig (GhcPass p) = EpAnn' AnnSig -type instance XPatSynSig (GhcPass p) = EpAnn' AnnSig -type instance XClassOpSig (GhcPass p) = EpAnn' AnnSig +type instance XTypeSig (GhcPass p) = EpAnn AnnSig +type instance XPatSynSig (GhcPass p) = EpAnn AnnSig +type instance XClassOpSig (GhcPass p) = EpAnn AnnSig type instance XIdSig (GhcPass p) = NoExtField -- No anns, generated -type instance XFixSig (GhcPass p) = EpAnn -type instance XInlineSig (GhcPass p) = EpAnn -type instance XSpecSig (GhcPass p) = EpAnn -type instance XSpecInstSig (GhcPass p) = EpAnn -type instance XMinimalSig (GhcPass p) = EpAnn -type instance XSCCFunSig (GhcPass p) = EpAnn -type instance XCompleteMatchSig (GhcPass p) = EpAnn +type instance XFixSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XInlineSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XSpecSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XSpecInstSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XMinimalSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XSCCFunSig (GhcPass p) = EpAnn [AddEpAnn] +type instance XCompleteMatchSig (GhcPass p) = EpAnn [AddEpAnn] type instance XXSig (GhcPass p) = NoExtCon diff --git a/compiler/GHC/Hs/Decls.hs b/compiler/GHC/Hs/Decls.hs index b3eac48499..9f3f6469e5 100644 --- a/compiler/GHC/Hs/Decls.hs +++ b/compiler/GHC/Hs/Decls.hs @@ -325,22 +325,22 @@ instance OutputableBndrId p type instance XFamDecl (GhcPass _) = NoExtField -type instance XSynDecl GhcPs = EpAnn +type instance XSynDecl GhcPs = EpAnn [AddEpAnn] type instance XSynDecl GhcRn = NameSet -- FVs type instance XSynDecl GhcTc = NameSet -- FVs -type instance XDataDecl GhcPs = EpAnn -- AZ: used? +type instance XDataDecl GhcPs = EpAnn [AddEpAnn] -- AZ: used? type instance XDataDecl GhcRn = DataDeclRn type instance XDataDecl GhcTc = DataDeclRn -type instance XClassDecl GhcPs = (EpAnn, AnnSortKey, LayoutInfo) -- See Note [Class LayoutInfo] +type instance XClassDecl GhcPs = (EpAnn [AddEpAnn], AnnSortKey, LayoutInfo) -- See Note [Class LayoutInfo] -- TODO:AZ:tidy up AnnSortKey above type instance XClassDecl GhcRn = NameSet -- FVs type instance XClassDecl GhcTc = NameSet -- FVs type instance XXTyClDecl (GhcPass _) = NoExtCon -type instance XCTyFamInstDecl (GhcPass _) = EpAnn +type instance XCTyFamInstDecl (GhcPass _) = EpAnn [AddEpAnn] type instance XXTyFamInstDecl (GhcPass _) = NoExtCon -- Dealing with names @@ -463,7 +463,7 @@ pprTyClDeclFlavour (DataDecl { tcdDataDefn = HsDataDefn { dd_ND = nd } }) instance OutputableBndrId p => Outputable (FunDep (GhcPass p)) where ppr = pprFunDep -type instance XCFunDep (GhcPass _) = EpAnn +type instance XCFunDep (GhcPass _) = EpAnn [AddEpAnn] type instance XXFunDep (GhcPass _) = NoExtCon pprFundeps :: OutputableBndrId p => [FunDep (GhcPass p)] -> SDoc @@ -497,7 +497,7 @@ type instance XCKindSig (GhcPass _) = NoExtField type instance XTyVarSig (GhcPass _) = NoExtField type instance XXFamilyResultSig (GhcPass _) = NoExtCon -type instance XCFamilyDecl (GhcPass _) = EpAnn +type instance XCFamilyDecl (GhcPass _) = EpAnn [AddEpAnn] type instance XXFamilyDecl (GhcPass _) = NoExtCon @@ -524,7 +524,7 @@ resultVariableName _ = Nothing ------------- Pretty printing FamilyDecls ----------- -type instance XCInjectivityAnn (GhcPass _) = EpAnn +type instance XCInjectivityAnn (GhcPass _) = EpAnn [AddEpAnn] type instance XXInjectivityAnn (GhcPass _) = NoExtCon instance OutputableBndrId p @@ -568,10 +568,10 @@ instance OutputableBndrId p * * ********************************************************************* -} -type instance XCHsDataDefn (GhcPass _) = EpAnn +type instance XCHsDataDefn (GhcPass _) = EpAnn [AddEpAnn] type instance XXHsDataDefn (GhcPass _) = NoExtCon -type instance XCHsDerivingClause (GhcPass _) = EpAnn +type instance XCHsDerivingClause (GhcPass _) = EpAnn [AddEpAnn] type instance XXHsDerivingClause (GhcPass _) = NoExtCon instance OutputableBndrId p @@ -598,7 +598,7 @@ instance OutputableBndrId p => Outputable (DerivClauseTys (GhcPass p)) where ppr (DctSingle _ ty) = ppr ty ppr (DctMulti _ tys) = parens (interpp'SP tys) -type instance XStandaloneKindSig GhcPs = EpAnn +type instance XStandaloneKindSig GhcPs = EpAnn [AddEpAnn] type instance XStandaloneKindSig GhcRn = NoExtField type instance XStandaloneKindSig GhcTc = NoExtField @@ -607,8 +607,8 @@ type instance XXStandaloneKindSig (GhcPass p) = NoExtCon standaloneKindSigName :: StandaloneKindSig (GhcPass p) -> IdP (GhcPass p) standaloneKindSigName (StandaloneKindSig _ lname _) = unLoc lname -type instance XConDeclGADT (GhcPass _) = EpAnn -type instance XConDeclH98 (GhcPass _) = EpAnn +type instance XConDeclGADT (GhcPass _) = EpAnn [AddEpAnn] +type instance XConDeclH98 (GhcPass _) = EpAnn [AddEpAnn] type instance XXConDecl (GhcPass _) = NoExtCon @@ -724,14 +724,14 @@ ppr_con_names = pprWithCommas (pprPrefixOcc . unLoc) ************************************************************************ -} -type instance XCFamEqn (GhcPass _) r = EpAnn +type instance XCFamEqn (GhcPass _) r = EpAnn [AddEpAnn] type instance XXFamEqn (GhcPass _) r = NoExtCon type instance Anno (FamEqn (GhcPass p) _) = SrcSpanAnnA ----------------- Class instances ------------- -type instance XCClsInstDecl GhcPs = (EpAnn, AnnSortKey) -- TODO:AZ:tidy up +type instance XCClsInstDecl GhcPs = (EpAnn [AddEpAnn], AnnSortKey) -- TODO:AZ:tidy up type instance XCClsInstDecl GhcRn = NoExtField type instance XCClsInstDecl GhcTc = NoExtField @@ -741,7 +741,7 @@ type instance XXClsInstDecl (GhcPass _) = NoExtCon type instance XClsInstD (GhcPass _) = NoExtField -type instance XDataFamInstD GhcPs = EpAnn +type instance XDataFamInstD GhcPs = EpAnn [AddEpAnn] type instance XDataFamInstD GhcRn = NoExtField type instance XDataFamInstD GhcTc = NoExtField @@ -887,7 +887,7 @@ instDeclDataFamInsts inst_decls ************************************************************************ -} -type instance XCDerivDecl (GhcPass _) = EpAnn +type instance XCDerivDecl (GhcPass _) = EpAnn [AddEpAnn] type instance XXDerivDecl (GhcPass _) = NoExtCon type instance Anno OverlapMode = SrcSpanAnnP @@ -911,15 +911,15 @@ instance OutputableBndrId p ************************************************************************ -} -type instance XStockStrategy GhcPs = EpAnn +type instance XStockStrategy GhcPs = EpAnn [AddEpAnn] type instance XStockStrategy GhcRn = NoExtField type instance XStockStrategy GhcTc = NoExtField -type instance XAnyClassStrategy GhcPs = EpAnn +type instance XAnyClassStrategy GhcPs = EpAnn [AddEpAnn] type instance XAnyClassStrategy GhcRn = NoExtField type instance XAnyClassStrategy GhcTc = NoExtField -type instance XNewtypeStrategy GhcPs = EpAnn +type instance XNewtypeStrategy GhcPs = EpAnn [AddEpAnn] type instance XNewtypeStrategy GhcRn = NoExtField type instance XNewtypeStrategy GhcTc = NoExtField @@ -927,7 +927,7 @@ type instance XViaStrategy GhcPs = XViaStrategyPs type instance XViaStrategy GhcRn = LHsSigType GhcRn type instance XViaStrategy GhcTc = Type -data XViaStrategyPs = XViaStrategyPs EpAnn (LHsSigType GhcPs) +data XViaStrategyPs = XViaStrategyPs (EpAnn [AddEpAnn]) (LHsSigType GhcPs) instance OutputableBndrId p => Outputable (DerivStrategy (GhcPass p)) where @@ -966,7 +966,7 @@ mapDerivStrategy f ds = foldDerivStrategy ds (ViaStrategy . f) ds ************************************************************************ -} -type instance XCDefaultDecl GhcPs = EpAnn +type instance XCDefaultDecl GhcPs = EpAnn [AddEpAnn] type instance XCDefaultDecl GhcRn = NoExtField type instance XCDefaultDecl GhcTc = NoExtField @@ -985,11 +985,11 @@ instance OutputableBndrId p ************************************************************************ -} -type instance XForeignImport GhcPs = EpAnn +type instance XForeignImport GhcPs = EpAnn [AddEpAnn] type instance XForeignImport GhcRn = NoExtField type instance XForeignImport GhcTc = Coercion -type instance XForeignExport GhcPs = EpAnn +type instance XForeignExport GhcPs = EpAnn [AddEpAnn] type instance XForeignExport GhcRn = NoExtField type instance XForeignExport GhcTc = Coercion @@ -1012,13 +1012,13 @@ instance OutputableBndrId p ************************************************************************ -} -type instance XCRuleDecls GhcPs = EpAnn +type instance XCRuleDecls GhcPs = EpAnn [AddEpAnn] type instance XCRuleDecls GhcRn = NoExtField type instance XCRuleDecls GhcTc = NoExtField type instance XXRuleDecls (GhcPass _) = NoExtCon -type instance XHsRule GhcPs = EpAnn' HsRuleAnn +type instance XHsRule GhcPs = EpAnn HsRuleAnn type instance XHsRule GhcRn = HsRuleRn type instance XHsRule GhcTc = HsRuleRn @@ -1040,8 +1040,8 @@ data HsRuleAnn flattenRuleDecls :: [LRuleDecls (GhcPass p)] -> [LRuleDecl (GhcPass p)] flattenRuleDecls decls = concatMap (rds_rules . unLoc) decls -type instance XCRuleBndr (GhcPass _) = EpAnn -type instance XRuleBndrSig (GhcPass _) = EpAnn +type instance XCRuleBndr (GhcPass _) = EpAnn [AddEpAnn] +type instance XRuleBndrSig (GhcPass _) = EpAnn [AddEpAnn] type instance XXRuleBndr (GhcPass _) = NoExtCon instance (OutputableBndrId p) => Outputable (RuleDecls (GhcPass p)) where @@ -1079,13 +1079,13 @@ instance (OutputableBndrId p) => Outputable (RuleBndr (GhcPass p)) where ************************************************************************ -} -type instance XWarnings GhcPs = EpAnn +type instance XWarnings GhcPs = EpAnn [AddEpAnn] type instance XWarnings GhcRn = NoExtField type instance XWarnings GhcTc = NoExtField type instance XXWarnDecls (GhcPass _) = NoExtCon -type instance XWarning (GhcPass _) = EpAnn +type instance XWarning (GhcPass _) = EpAnn [AddEpAnn] type instance XXWarnDecl (GhcPass _) = NoExtCon @@ -1109,7 +1109,7 @@ instance OutputableBndrId p ************************************************************************ -} -type instance XHsAnnotation (GhcPass _) = EpAnn' AnnPragma +type instance XHsAnnotation (GhcPass _) = EpAnn AnnPragma type instance XXAnnDecl (GhcPass _) = NoExtCon instance (OutputableBndrId p) => Outputable (AnnDecl (GhcPass p)) where @@ -1131,7 +1131,7 @@ pprAnnProvenance (TypeAnnProvenance (L _ name)) ************************************************************************ -} -type instance XCRoleAnnotDecl GhcPs = EpAnn +type instance XCRoleAnnotDecl GhcPs = EpAnn [AddEpAnn] type instance XCRoleAnnotDecl GhcRn = NoExtField type instance XCRoleAnnotDecl GhcTc = NoExtField diff --git a/compiler/GHC/Hs/Dump.hs b/compiler/GHC/Hs/Dump.hs index 8a69ad0c60..9be0f96640 100644 --- a/compiler/GHC/Hs/Dump.hs +++ b/compiler/GHC/Hs/Dump.hs @@ -136,12 +136,13 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 BlankSrcSpanFile -> parens $ text "SourceText" <+> text src _ -> parens $ text "SourceText" <+> text "blanked" - epaAnchor :: EpaAnchor -> SDoc - epaAnchor (AR r) = parens $ text "AR" <+> realSrcSpan r - epaAnchor (AD d) = parens $ text "AD" <+> deltaPos d + epaAnchor :: EpaLocation -> SDoc + epaAnchor (EpaSpan r) = parens $ text "EpaSpan" <+> realSrcSpan r + epaAnchor (EpaDelta d) = parens $ text "EpaDelta" <+> deltaPos d deltaPos :: DeltaPos -> SDoc - deltaPos (DP l c) = parens $ text "DP" <+> ppr l <+> ppr c + deltaPos (SameLine c) = parens $ text "SameLine" <+> ppr c + deltaPos (DifferentLine l c) = parens $ text "DifferentLine" <+> ppr l <+> ppr c name :: Name -> SDoc name nm = braces $ text "Name:" <+> ppr nm @@ -223,38 +224,38 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 -- ------------------------- - annotation :: EpAnn -> SDoc - annotation = annotation' (text "EpAnn") + annotation :: EpAnn [AddEpAnn] -> SDoc + annotation = annotation' (text "EpAnn [AddEpAnn]") - annotationModule :: EpAnn' AnnsModule -> SDoc - annotationModule = annotation' (text "EpAnn' AnnsModule") + annotationModule :: EpAnn AnnsModule -> SDoc + annotationModule = annotation' (text "EpAnn AnnsModule") - annotationAddEpAnn :: EpAnn' AddEpAnn -> SDoc - annotationAddEpAnn = annotation' (text "EpAnn' AddEpAnn") + annotationAddEpAnn :: EpAnn AddEpAnn -> SDoc + annotationAddEpAnn = annotation' (text "EpAnn AddEpAnn") - annotationGrhsAnn :: EpAnn' GrhsAnn -> SDoc - annotationGrhsAnn = annotation' (text "EpAnn' GrhsAnn") + annotationGrhsAnn :: EpAnn GrhsAnn -> SDoc + annotationGrhsAnn = annotation' (text "EpAnn GrhsAnn") - annotationEpAnnHsCase :: EpAnn' EpAnnHsCase -> SDoc - annotationEpAnnHsCase = annotation' (text "EpAnn' EpAnnHsCase") + annotationEpAnnHsCase :: EpAnn EpAnnHsCase -> SDoc + annotationEpAnnHsCase = annotation' (text "EpAnn EpAnnHsCase") - annotationEpAnnHsLet :: EpAnn' AnnsLet -> SDoc - annotationEpAnnHsLet = annotation' (text "EpAnn' AnnsLet") + annotationEpAnnHsLet :: EpAnn AnnsLet -> SDoc + annotationEpAnnHsLet = annotation' (text "EpAnn AnnsLet") - annotationAnnList :: EpAnn' AnnList -> SDoc - annotationAnnList = annotation' (text "EpAnn' AnnList") + annotationAnnList :: EpAnn AnnList -> SDoc + annotationAnnList = annotation' (text "EpAnn AnnList") - annotationEpAnnImportDecl :: EpAnn' EpAnnImportDecl -> SDoc - annotationEpAnnImportDecl = annotation' (text "EpAnn' EpAnnImportDecl") + annotationEpAnnImportDecl :: EpAnn EpAnnImportDecl -> SDoc + annotationEpAnnImportDecl = annotation' (text "EpAnn EpAnnImportDecl") - annotationAnnParen :: EpAnn' AnnParen -> SDoc - annotationAnnParen = annotation' (text "EpAnn' AnnParen") + annotationAnnParen :: EpAnn AnnParen -> SDoc + annotationAnnParen = annotation' (text "EpAnn AnnParen") - annotationTrailingAnn :: EpAnn' TrailingAnn -> SDoc - annotationTrailingAnn = annotation' (text "EpAnn' TrailingAnn") + annotationTrailingAnn :: EpAnn TrailingAnn -> SDoc + annotationTrailingAnn = annotation' (text "EpAnn TrailingAnn") annotation' :: forall a .(Data a, Typeable a) - => SDoc -> EpAnn' a -> SDoc + => SDoc -> EpAnn a -> SDoc annotation' tag anns = case ba of BlankEpAnnotations -> parens (text "blanked:" <+> tag) NoBlankEpAnnotations -> parens $ text (showConstr (toConstr anns)) @@ -262,19 +263,19 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 -- ------------------------- - srcSpanAnnA :: SrcSpanAnn' (EpAnn' AnnListItem) -> SDoc + srcSpanAnnA :: SrcSpanAnn' (EpAnn AnnListItem) -> SDoc srcSpanAnnA = locatedAnn'' (text "SrcSpanAnnA") - srcSpanAnnL :: SrcSpanAnn' (EpAnn' AnnList) -> SDoc + srcSpanAnnL :: SrcSpanAnn' (EpAnn AnnList) -> SDoc srcSpanAnnL = locatedAnn'' (text "SrcSpanAnnL") - srcSpanAnnP :: SrcSpanAnn' (EpAnn' AnnPragma) -> SDoc + srcSpanAnnP :: SrcSpanAnn' (EpAnn AnnPragma) -> SDoc srcSpanAnnP = locatedAnn'' (text "SrcSpanAnnP") - srcSpanAnnC :: SrcSpanAnn' (EpAnn' AnnContext) -> SDoc + srcSpanAnnC :: SrcSpanAnn' (EpAnn AnnContext) -> SDoc srcSpanAnnC = locatedAnn'' (text "SrcSpanAnnC") - srcSpanAnnN :: SrcSpanAnn' (EpAnn' NameAnn) -> SDoc + srcSpanAnnN :: SrcSpanAnn' (EpAnn NameAnn) -> SDoc srcSpanAnnN = locatedAnn'' (text "SrcSpanAnnN") locatedAnn'' :: forall a. (Typeable a, Data a) diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index 436da995a7..bf415f7264 100644 --- a/compiler/GHC/Hs/Expr.hs +++ b/compiler/GHC/Hs/Expr.hs @@ -207,14 +207,14 @@ could only do that if the extension field was strict (#18764) -- API Annotations types data EpAnnHsCase = EpAnnHsCase - { hsCaseAnnCase :: EpaAnchor - , hsCaseAnnOf :: EpaAnchor + { hsCaseAnnCase :: EpaLocation + , hsCaseAnnOf :: EpaLocation , hsCaseAnnsRest :: [AddEpAnn] } deriving Data data EpAnnUnboundVar = EpAnnUnboundVar - { hsUnboundBackquotes :: (EpaAnchor, EpaAnchor) - , hsUnboundHole :: EpaAnchor + { hsUnboundBackquotes :: (EpaLocation, EpaLocation) + , hsUnboundHole :: EpaLocation } deriving Data type instance XVar (GhcPass _) = NoExtField @@ -232,7 +232,7 @@ type instance XOverLabel GhcTc = Void -- See Note [Constructor cannot occur type instance XVar (GhcPass _) = NoExtField -type instance XUnboundVar GhcPs = EpAnn' EpAnnUnboundVar +type instance XUnboundVar GhcPs = EpAnn EpAnnUnboundVar type instance XUnboundVar GhcRn = NoExtField type instance XUnboundVar GhcTc = HoleExprRef -- We really don't need the whole HoleExprRef; just the IORef EvTerm @@ -248,7 +248,7 @@ type instance XLitE (GhcPass _) = EpAnnCO type instance XLam (GhcPass _) = NoExtField -type instance XLamCase (GhcPass _) = EpAnn +type instance XLamCase (GhcPass _) = EpAnn [AddEpAnn] type instance XApp (GhcPass _) = EpAnnCO type instance XAppTypeE GhcPs = SrcSpan -- Where the `@` lives @@ -257,7 +257,7 @@ type instance XAppTypeE GhcTc = Type -- OpApp not present in GhcTc pass; see GHC.Rename.Expr -- Note [Handling overloaded and rebindable constructs] -type instance XOpApp GhcPs = EpAnn +type instance XOpApp GhcPs = EpAnn [AddEpAnn] type instance XOpApp GhcRn = Fixity type instance XOpApp GhcTc = Void -- See Note [Constructor cannot occur] @@ -271,41 +271,41 @@ type instance XSectionL GhcTc = Void -- See Note [Constructor cannot occur type instance XSectionR GhcTc = Void -- See Note [Constructor cannot occur] -type instance XNegApp GhcPs = EpAnn +type instance XNegApp GhcPs = EpAnn [AddEpAnn] type instance XNegApp GhcRn = NoExtField type instance XNegApp GhcTc = NoExtField -type instance XPar (GhcPass _) = EpAnn' AnnParen +type instance XPar (GhcPass _) = EpAnn AnnParen -type instance XExplicitTuple GhcPs = EpAnn +type instance XExplicitTuple GhcPs = EpAnn [AddEpAnn] type instance XExplicitTuple GhcRn = NoExtField type instance XExplicitTuple GhcTc = NoExtField -type instance XExplicitSum GhcPs = EpAnn' AnnExplicitSum +type instance XExplicitSum GhcPs = EpAnn AnnExplicitSum type instance XExplicitSum GhcRn = NoExtField type instance XExplicitSum GhcTc = [Type] -type instance XCase GhcPs = EpAnn' EpAnnHsCase +type instance XCase GhcPs = EpAnn EpAnnHsCase type instance XCase GhcRn = NoExtField type instance XCase GhcTc = NoExtField -type instance XIf GhcPs = EpAnn +type instance XIf GhcPs = EpAnn [AddEpAnn] type instance XIf GhcRn = NoExtField type instance XIf GhcTc = NoExtField -type instance XMultiIf GhcPs = EpAnn +type instance XMultiIf GhcPs = EpAnn [AddEpAnn] type instance XMultiIf GhcRn = NoExtField type instance XMultiIf GhcTc = Type -type instance XLet GhcPs = EpAnn' AnnsLet +type instance XLet GhcPs = EpAnn AnnsLet type instance XLet GhcRn = NoExtField type instance XLet GhcTc = NoExtField -type instance XDo GhcPs = EpAnn' AnnList +type instance XDo GhcPs = EpAnn AnnList type instance XDo GhcRn = NoExtField type instance XDo GhcTc = Type -type instance XExplicitList GhcPs = EpAnn' AnnList +type instance XExplicitList GhcPs = EpAnn AnnList type instance XExplicitList GhcRn = NoExtField type instance XExplicitList GhcTc = Type -- GhcPs: ExplicitList includes all source-level @@ -316,11 +316,11 @@ type instance XExplicitList GhcTc = Type -- See Note [Handling overloaded and rebindable constructs] -- in GHC.Rename.Expr -type instance XRecordCon GhcPs = EpAnn +type instance XRecordCon GhcPs = EpAnn [AddEpAnn] type instance XRecordCon GhcRn = NoExtField type instance XRecordCon GhcTc = PostTcExpr -- Instantiated constructor function -type instance XRecordUpd GhcPs = EpAnn +type instance XRecordUpd GhcPs = EpAnn [AddEpAnn] type instance XRecordUpd GhcRn = NoExtField type instance XRecordUpd GhcTc = RecordUpdTc @@ -330,29 +330,29 @@ type instance XGetField GhcTc = Void -- HsGetField is eliminated by the renamer. See [Handling overloaded -- and rebindable constructs]. -type instance XProjection GhcPs = EpAnn' AnnProjection +type instance XProjection GhcPs = EpAnn AnnProjection type instance XProjection GhcRn = NoExtField type instance XProjection GhcTc = Void -- HsProjection is eliminated by the renamer. See [Handling overloaded -- and rebindable constructs]. -type instance XExprWithTySig GhcPs = EpAnn +type instance XExprWithTySig GhcPs = EpAnn [AddEpAnn] type instance XExprWithTySig GhcRn = NoExtField type instance XExprWithTySig GhcTc = NoExtField -type instance XArithSeq GhcPs = EpAnn +type instance XArithSeq GhcPs = EpAnn [AddEpAnn] type instance XArithSeq GhcRn = NoExtField type instance XArithSeq GhcTc = PostTcExpr -type instance XBracket (GhcPass _) = EpAnn +type instance XBracket (GhcPass _) = EpAnn [AddEpAnn] type instance XRnBracketOut (GhcPass _) = NoExtField type instance XTcBracketOut (GhcPass _) = NoExtField type instance XSpliceE (GhcPass _) = EpAnnCO -type instance XProc (GhcPass _) = EpAnn +type instance XProc (GhcPass _) = EpAnn [AddEpAnn] -type instance XStatic GhcPs = EpAnn +type instance XStatic GhcPs = EpAnn [AddEpAnn] type instance XStatic GhcRn = NameSet type instance XStatic GhcTc = NameSet @@ -378,40 +378,40 @@ data XXExprGhcTc data AnnExplicitSum = AnnExplicitSum { - aesOpen :: EpaAnchor, - aesBarsBefore :: [EpaAnchor], - aesBarsAfter :: [EpaAnchor], - aesClose :: EpaAnchor + aesOpen :: EpaLocation, + aesBarsBefore :: [EpaLocation], + aesBarsAfter :: [EpaLocation], + aesClose :: EpaLocation } deriving Data data AnnsLet = AnnsLet { - alLet :: EpaAnchor, - alIn :: EpaAnchor + alLet :: EpaLocation, + alIn :: EpaLocation } deriving Data data AnnFieldLabel = AnnFieldLabel { - afDot :: Maybe EpaAnchor + afDot :: Maybe EpaLocation } deriving Data data AnnProjection = AnnProjection { - apOpen :: EpaAnchor, -- ^ '(' - apClose :: EpaAnchor -- ^ ')' + apOpen :: EpaLocation, -- ^ '(' + apClose :: EpaLocation -- ^ ')' } deriving Data -- --------------------------------------------------------------------- -type instance XSCC (GhcPass _) = EpAnn' AnnPragma +type instance XSCC (GhcPass _) = EpAnn AnnPragma type instance XXPragE (GhcPass _) = NoExtCon -type instance XCHsFieldLabel (GhcPass _) = EpAnn' AnnFieldLabel +type instance XCHsFieldLabel (GhcPass _) = EpAnn AnnFieldLabel type instance XXHsFieldLabel (GhcPass _) = NoExtCon -type instance XPresent (GhcPass _) = EpAnn +type instance XPresent (GhcPass _) = EpAnn [AddEpAnn] -type instance XMissing GhcPs = EpAnn' EpaAnchor +type instance XMissing GhcPs = EpAnn EpaLocation type instance XMissing GhcRn = NoExtField type instance XMissing GhcTc = Scaled Type @@ -981,33 +981,33 @@ instance (Outputable a, Outputable b) => Outputable (HsExpansion a b) where ************************************************************************ -} -type instance XCmdArrApp GhcPs = EpAnn' AddEpAnn +type instance XCmdArrApp GhcPs = EpAnn AddEpAnn type instance XCmdArrApp GhcRn = NoExtField type instance XCmdArrApp GhcTc = Type -type instance XCmdArrForm GhcPs = EpAnn' AnnList +type instance XCmdArrForm GhcPs = EpAnn AnnList type instance XCmdArrForm GhcRn = NoExtField type instance XCmdArrForm GhcTc = NoExtField type instance XCmdApp (GhcPass _) = EpAnnCO type instance XCmdLam (GhcPass _) = NoExtField -type instance XCmdPar (GhcPass _) = EpAnn' AnnParen +type instance XCmdPar (GhcPass _) = EpAnn AnnParen -type instance XCmdCase GhcPs = EpAnn' EpAnnHsCase +type instance XCmdCase GhcPs = EpAnn EpAnnHsCase type instance XCmdCase GhcRn = NoExtField type instance XCmdCase GhcTc = NoExtField -type instance XCmdLamCase (GhcPass _) = EpAnn +type instance XCmdLamCase (GhcPass _) = EpAnn [AddEpAnn] -type instance XCmdIf GhcPs = EpAnn +type instance XCmdIf GhcPs = EpAnn [AddEpAnn] type instance XCmdIf GhcRn = NoExtField type instance XCmdIf GhcTc = NoExtField -type instance XCmdLet GhcPs = EpAnn' AnnsLet +type instance XCmdLet GhcPs = EpAnn AnnsLet type instance XCmdLet GhcRn = NoExtField type instance XCmdLet GhcTc = NoExtField -type instance XCmdDo GhcPs = EpAnn' AnnList +type instance XCmdDo GhcPs = EpAnn AnnList type instance XCmdDo GhcRn = NoExtField type instance XCmdDo GhcTc = Type @@ -1152,7 +1152,7 @@ type instance XMG GhcTc b = MatchGroupTc type instance XXMatchGroup (GhcPass _) b = NoExtCon -type instance XCMatch (GhcPass _) b = EpAnn +type instance XCMatch (GhcPass _) b = EpAnn [AddEpAnn] type instance XXMatch (GhcPass _) b = NoExtCon instance (OutputableBndrId pr, Outputable body) @@ -1186,11 +1186,11 @@ type instance XXGRHSs (GhcPass _) _ = NoExtCon data GrhsAnn = GrhsAnn { - ga_vbar :: Maybe EpaAnchor, -- TODO:AZ do we need this? + ga_vbar :: Maybe EpaLocation, -- TODO:AZ do we need this? ga_sep :: AddEpAnn -- ^ Match separator location } deriving (Data) -type instance XCGRHS (GhcPass _) _ = EpAnn' GrhsAnn +type instance XCGRHS (GhcPass _) _ = EpAnn GrhsAnn -- Location of matchSeparator -- TODO:AZ does this belong on the GRHS, or GRHSs? @@ -1304,7 +1304,7 @@ data RecStmtTc = type instance XLastStmt (GhcPass _) (GhcPass _) b = NoExtField -type instance XBindStmt (GhcPass _) GhcPs b = EpAnn +type instance XBindStmt (GhcPass _) GhcPs b = EpAnn [AddEpAnn] type instance XBindStmt (GhcPass _) GhcRn b = XBindStmtRn type instance XBindStmt (GhcPass _) GhcTc b = XBindStmtTc @@ -1328,17 +1328,17 @@ type instance XBodyStmt (GhcPass _) GhcPs b = NoExtField type instance XBodyStmt (GhcPass _) GhcRn b = NoExtField type instance XBodyStmt (GhcPass _) GhcTc b = Type -type instance XLetStmt (GhcPass _) (GhcPass _) b = EpAnn +type instance XLetStmt (GhcPass _) (GhcPass _) b = EpAnn [AddEpAnn] type instance XParStmt (GhcPass _) GhcPs b = NoExtField type instance XParStmt (GhcPass _) GhcRn b = NoExtField type instance XParStmt (GhcPass _) GhcTc b = Type -type instance XTransStmt (GhcPass _) GhcPs b = EpAnn +type instance XTransStmt (GhcPass _) GhcPs b = EpAnn [AddEpAnn] type instance XTransStmt (GhcPass _) GhcRn b = NoExtField type instance XTransStmt (GhcPass _) GhcTc b = Type -type instance XRecStmt (GhcPass _) GhcPs b = EpAnn' AnnList +type instance XRecStmt (GhcPass _) GhcPs b = EpAnn AnnList type instance XRecStmt (GhcPass _) GhcRn b = NoExtField type instance XRecStmt (GhcPass _) GhcTc b = RecStmtTc @@ -1523,8 +1523,8 @@ pprQuals quals = interpp'SP quals newtype HsSplicedT = HsSplicedT DelayedSplice deriving (Data) -type instance XTypedSplice (GhcPass _) = EpAnn -type instance XUntypedSplice (GhcPass _) = EpAnn +type instance XTypedSplice (GhcPass _) = EpAnn [AddEpAnn] +type instance XUntypedSplice (GhcPass _) = EpAnn [AddEpAnn] type instance XQuasiQuote (GhcPass _) = NoExtField type instance XSpliced (GhcPass _) = NoExtField type instance XXSplice GhcPs = NoExtCon @@ -1838,6 +1838,6 @@ type instance Anno (HsSplice (GhcPass p)) = SrcSpanAnnA type instance Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsExpr (GhcPass pr))))] = SrcSpanAnnL type instance Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))] = SrcSpanAnnL -instance (Anno a ~ SrcSpanAnn' (EpAnn' an)) +instance (Anno a ~ SrcSpanAnn' (EpAnn an)) => WrapXRec (GhcPass p) a where wrapXRec = noLocA diff --git a/compiler/GHC/Hs/Extension.hs b/compiler/GHC/Hs/Extension.hs index 1134e2520a..e28bcddbf1 100644 --- a/compiler/GHC/Hs/Extension.hs +++ b/compiler/GHC/Hs/Extension.hs @@ -101,7 +101,7 @@ type instance Anno RdrName = SrcSpanAnnN type instance Anno Name = SrcSpanAnnN type instance Anno Id = SrcSpanAnnN -type IsSrcSpanAnn p a = ( Anno (IdGhcP p) ~ SrcSpanAnn' (EpAnn' a), +type IsSrcSpanAnn p a = ( Anno (IdGhcP p) ~ SrcSpanAnn' (EpAnn a), IsPass p) instance UnXRec (GhcPass p) where diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 103359281b..55b5af7bc9 100644 --- a/compiler/GHC/Hs/ImpExp.hs +++ b/compiler/GHC/Hs/ImpExp.hs @@ -64,9 +64,9 @@ data ImportDeclQualifiedStyle -- | Given two possible located 'qualified' tokens, compute a style -- (in a conforming Haskell program only one of the two can be not -- 'Nothing'). This is called from "GHC.Parser". -importDeclQualifiedStyle :: Maybe EpaAnchor - -> Maybe EpaAnchor - -> (Maybe EpaAnchor, ImportDeclQualifiedStyle) +importDeclQualifiedStyle :: Maybe EpaLocation + -> Maybe EpaLocation + -> (Maybe EpaLocation, ImportDeclQualifiedStyle) importDeclQualifiedStyle mPre mPost = if isJust mPre then (mPre, QualifiedPre) else if isJust mPost then (mPost,QualifiedPost) else (Nothing, NotQualified) @@ -113,7 +113,7 @@ data ImportDecl pass -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -type instance XCImportDecl GhcPs = EpAnn' EpAnnImportDecl +type instance XCImportDecl GhcPs = EpAnn EpAnnImportDecl type instance XCImportDecl GhcRn = NoExtField type instance XCImportDecl GhcTc = NoExtField @@ -127,12 +127,12 @@ type instance Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnL -- API Annotations types data EpAnnImportDecl = EpAnnImportDecl - { importDeclAnnImport :: EpaAnchor - , importDeclAnnPragma :: Maybe (EpaAnchor, EpaAnchor) - , importDeclAnnSafe :: Maybe EpaAnchor - , importDeclAnnQualified :: Maybe EpaAnchor - , importDeclAnnPackage :: Maybe EpaAnchor - , importDeclAnnAs :: Maybe EpaAnchor + { importDeclAnnImport :: EpaLocation + , importDeclAnnPragma :: Maybe (EpaLocation, EpaLocation) + , importDeclAnnSafe :: Maybe EpaLocation + , importDeclAnnQualified :: Maybe EpaLocation + , importDeclAnnPackage :: Maybe EpaLocation + , importDeclAnnAs :: Maybe EpaLocation } deriving (Data) -- --------------------------------------------------------------------- @@ -208,9 +208,9 @@ instance (OutputableBndrId p -- 'GHC.Parser.Annotation' is the location of the adornment in -- the original source. data IEWrappedName name - = IEName (LocatedN name) -- ^ no extra - | IEPattern EpaAnchor (LocatedN name) -- ^ pattern X - | IEType EpaAnchor (LocatedN name) -- ^ type (:+:) + = IEName (LocatedN name) -- ^ no extra + | IEPattern EpaLocation (LocatedN name) -- ^ pattern X + | IEType EpaLocation (LocatedN name) -- ^ type (:+:) deriving (Eq,Data) -- | Located name with possible adornment @@ -286,15 +286,15 @@ type instance XIEVar GhcPs = NoExtField type instance XIEVar GhcRn = NoExtField type instance XIEVar GhcTc = NoExtField -type instance XIEThingAbs (GhcPass _) = EpAnn -type instance XIEThingAll (GhcPass _) = EpAnn +type instance XIEThingAbs (GhcPass _) = EpAnn [AddEpAnn] +type instance XIEThingAll (GhcPass _) = EpAnn [AddEpAnn] -- See Note [IEThingWith] -type instance XIEThingWith (GhcPass 'Parsed) = EpAnn +type instance XIEThingWith (GhcPass 'Parsed) = EpAnn [AddEpAnn] type instance XIEThingWith (GhcPass 'Renamed) = [Located FieldLabel] type instance XIEThingWith (GhcPass 'Typechecked) = NoExtField -type instance XIEModuleContents GhcPs = EpAnn +type instance XIEModuleContents GhcPs = EpAnn [AddEpAnn] type instance XIEModuleContents GhcRn = NoExtField type instance XIEModuleContents GhcTc = NoExtField diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs index 6efbfb860e..577321ea0a 100644 --- a/compiler/GHC/Hs/Pat.hs +++ b/compiler/GHC/Hs/Pat.hs @@ -95,55 +95,55 @@ type instance XWildPat GhcTc = Type type instance XVarPat (GhcPass _) = NoExtField -type instance XLazyPat GhcPs = EpAnn -- For '~' +type instance XLazyPat GhcPs = EpAnn [AddEpAnn] -- For '~' type instance XLazyPat GhcRn = NoExtField type instance XLazyPat GhcTc = NoExtField -type instance XAsPat GhcPs = EpAnn -- For '@' +type instance XAsPat GhcPs = EpAnn [AddEpAnn] -- For '@' type instance XAsPat GhcRn = NoExtField type instance XAsPat GhcTc = NoExtField -type instance XParPat (GhcPass _) = EpAnn' AnnParen +type instance XParPat (GhcPass _) = EpAnn AnnParen -type instance XBangPat GhcPs = EpAnn -- For '!' +type instance XBangPat GhcPs = EpAnn [AddEpAnn] -- For '!' type instance XBangPat GhcRn = NoExtField type instance XBangPat GhcTc = NoExtField -- Note: XListPat cannot be extended when using GHC 8.0.2 as the bootstrap -- compiler, as it triggers https://gitlab.haskell.org/ghc/ghc/issues/14396 for -- `SyntaxExpr` -type instance XListPat GhcPs = EpAnn' AnnList +type instance XListPat GhcPs = EpAnn AnnList type instance XListPat GhcRn = Maybe (SyntaxExpr GhcRn) type instance XListPat GhcTc = ListPatTc -type instance XTuplePat GhcPs = EpAnn +type instance XTuplePat GhcPs = EpAnn [AddEpAnn] type instance XTuplePat GhcRn = NoExtField type instance XTuplePat GhcTc = [Type] -type instance XSumPat GhcPs = EpAnn' EpAnnSumPat +type instance XSumPat GhcPs = EpAnn EpAnnSumPat type instance XSumPat GhcRn = NoExtField type instance XSumPat GhcTc = [Type] -type instance XConPat GhcPs = EpAnn +type instance XConPat GhcPs = EpAnn [AddEpAnn] type instance XConPat GhcRn = NoExtField type instance XConPat GhcTc = ConPatTc -type instance XViewPat GhcPs = EpAnn +type instance XViewPat GhcPs = EpAnn [AddEpAnn] type instance XViewPat GhcRn = NoExtField type instance XViewPat GhcTc = Type type instance XSplicePat (GhcPass _) = NoExtField type instance XLitPat (GhcPass _) = NoExtField -type instance XNPat GhcPs = EpAnn -type instance XNPat GhcRn = EpAnn +type instance XNPat GhcPs = EpAnn [AddEpAnn] +type instance XNPat GhcRn = EpAnn [AddEpAnn] type instance XNPat GhcTc = Type -type instance XNPlusKPat GhcPs = EpAnn +type instance XNPlusKPat GhcPs = EpAnn [AddEpAnn] type instance XNPlusKPat GhcRn = NoExtField type instance XNPlusKPat GhcTc = Type -type instance XSigPat GhcPs = EpAnn +type instance XSigPat GhcPs = EpAnn [AddEpAnn] type instance XSigPat GhcRn = NoExtField type instance XSigPat GhcTc = Type @@ -156,7 +156,7 @@ type instance ConLikeP GhcPs = RdrName -- IdP GhcPs type instance ConLikeP GhcRn = Name -- IdP GhcRn type instance ConLikeP GhcTc = ConLike -type instance XHsRecField _ = EpAnn +type instance XHsRecField _ = EpAnn [AddEpAnn] -- --------------------------------------------------------------------- @@ -164,8 +164,8 @@ type instance XHsRecField _ = EpAnn data EpAnnSumPat = EpAnnSumPat { sumPatParens :: [AddEpAnn] - , sumPatVbarsBefore :: [EpaAnchor] - , sumPatVbarsAfter :: [EpaAnchor] + , sumPatVbarsBefore :: [EpaLocation] + , sumPatVbarsAfter :: [EpaLocation] } deriving Data -- --------------------------------------------------------------------- diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index 9c494d6aa7..a666a87519 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -151,7 +151,7 @@ type instance XHsForAllInvis (GhcPass _) = EpAnnForallTy type instance XXHsForAllTelescope (GhcPass _) = NoExtCon -type EpAnnForallTy = EpAnn' (AddEpAnn, AddEpAnn) +type EpAnnForallTy = EpAnn (AddEpAnn, AddEpAnn) -- ^ Location of 'forall' and '->' for HsForAllVis -- Location of 'forall' and '.' for HsForAllInvis @@ -259,8 +259,8 @@ mkEmptyWildCardBndrs x = HsWC { hswc_body = x -------------------------------------------------- -type instance XUserTyVar (GhcPass _) = EpAnn -type instance XKindedTyVar (GhcPass _) = EpAnn +type instance XUserTyVar (GhcPass _) = EpAnn [AddEpAnn] +type instance XKindedTyVar (GhcPass _) = EpAnn [AddEpAnn] type instance XXTyVarBndr (GhcPass _) = NoExtCon @@ -285,17 +285,17 @@ instance NamedThing (HsTyVarBndr flag GhcRn) where type instance XForAllTy (GhcPass _) = NoExtField type instance XQualTy (GhcPass _) = NoExtField -type instance XTyVar (GhcPass _) = EpAnn +type instance XTyVar (GhcPass _) = EpAnn [AddEpAnn] type instance XAppTy (GhcPass _) = NoExtField -type instance XFunTy (GhcPass _) = EpAnn' TrailingAnn -- For the AnnRarrow or AnnLolly -type instance XListTy (GhcPass _) = EpAnn' AnnParen -type instance XTupleTy (GhcPass _) = EpAnn' AnnParen -type instance XSumTy (GhcPass _) = EpAnn' AnnParen +type instance XFunTy (GhcPass _) = EpAnn TrailingAnn -- For the AnnRarrow or AnnLolly +type instance XListTy (GhcPass _) = EpAnn AnnParen +type instance XTupleTy (GhcPass _) = EpAnn AnnParen +type instance XSumTy (GhcPass _) = EpAnn AnnParen type instance XOpTy (GhcPass _) = NoExtField -type instance XParTy (GhcPass _) = EpAnn' AnnParen -type instance XIParamTy (GhcPass _) = EpAnn +type instance XParTy (GhcPass _) = EpAnn AnnParen +type instance XIParamTy (GhcPass _) = EpAnn [AddEpAnn] type instance XStarTy (GhcPass _) = NoExtField -type instance XKindSig (GhcPass _) = EpAnn +type instance XKindSig (GhcPass _) = EpAnn [AddEpAnn] type instance XAppKindTy (GhcPass _) = SrcSpan -- Where the `@` lives @@ -303,18 +303,18 @@ type instance XSpliceTy GhcPs = NoExtField type instance XSpliceTy GhcRn = NoExtField type instance XSpliceTy GhcTc = Kind -type instance XDocTy (GhcPass _) = EpAnn -type instance XBangTy (GhcPass _) = EpAnn +type instance XDocTy (GhcPass _) = EpAnn [AddEpAnn] +type instance XBangTy (GhcPass _) = EpAnn [AddEpAnn] -type instance XRecTy GhcPs = EpAnn' AnnList +type instance XRecTy GhcPs = EpAnn AnnList type instance XRecTy GhcRn = NoExtField type instance XRecTy GhcTc = NoExtField -type instance XExplicitListTy GhcPs = EpAnn +type instance XExplicitListTy GhcPs = EpAnn [AddEpAnn] type instance XExplicitListTy GhcRn = NoExtField type instance XExplicitListTy GhcTc = Kind -type instance XExplicitTupleTy GhcPs = EpAnn +type instance XExplicitTupleTy GhcPs = EpAnn [AddEpAnn] type instance XExplicitTupleTy GhcRn = NoExtField type instance XExplicitTupleTy GhcTc = [Kind] @@ -354,7 +354,7 @@ pprHsArrow (HsUnrestrictedArrow _) = arrow pprHsArrow (HsLinearArrow _ _) = lollipop pprHsArrow (HsExplicitMult _ _ p) = (mulArrow (ppr p)) -type instance XConDeclField (GhcPass _) = EpAnn +type instance XConDeclField (GhcPass _) = EpAnn [AddEpAnn] type instance XXConDeclField (GhcPass _) = NoExtCon instance OutputableBndrId p @@ -494,7 +494,7 @@ splitHsFunType ty = go ty an' = addTrailingAnnToA l an cs a x' = L (SrcSpanAnn an' l) t - go other = ([], noCom, [], other) + go other = ([], emptyComments, [], other) -- | Retrieve the name of the \"head\" of a nested type application. -- This is somewhat like @GHC.Tc.Gen.HsType.splitHsAppTys@, but a little more diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index a23c1a1868..bf37398347 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -190,14 +190,14 @@ mkSimpleMatch ctxt pats rhs unguardedGRHSs :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan - => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn' GrhsAnn + => SrcSpan -> LocatedA (body (GhcPass p)) -> EpAnn GrhsAnn -> GRHSs (GhcPass p) (LocatedA (body (GhcPass p))) unguardedGRHSs loc rhs an = GRHSs noExtField (unguardedRHS an loc rhs) emptyLocalBinds unguardedRHS :: Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ SrcSpan - => EpAnn' GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) + => EpAnn GrhsAnn -> SrcSpan -> LocatedA (body (GhcPass p)) -> [LGRHS (GhcPass p) (LocatedA (body (GhcPass p)))] unguardedRHS an loc rhs = [L loc (GRHS an [] rhs)] @@ -305,16 +305,16 @@ mkHsIntegral :: IntegralLit -> HsOverLit GhcPs mkHsFractional :: FractionalLit -> HsOverLit GhcPs mkHsIsString :: SourceText -> FastString -> HsOverLit GhcPs mkHsDo :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs -mkHsDoAnns :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> EpAnn' AnnList -> HsExpr GhcPs +mkHsDoAnns :: HsStmtContext GhcRn -> LocatedL [ExprLStmt GhcPs] -> EpAnn AnnList -> HsExpr GhcPs mkHsComp :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> HsExpr GhcPs mkHsCompAnns :: HsStmtContext GhcRn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs - -> EpAnn' AnnList + -> EpAnn AnnList -> HsExpr GhcPs -mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn +mkNPat :: Located (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn [AddEpAnn] -> Pat GhcPs -mkNPlusKPat :: LocatedN RdrName -> Located (HsOverLit GhcPs) -> EpAnn +mkNPlusKPat :: LocatedN RdrName -> Located (HsOverLit GhcPs) -> EpAnn [AddEpAnn] -> Pat GhcPs -- NB: The following functions all use noSyntaxExpr: the generated expressions @@ -323,7 +323,7 @@ mkLastStmt :: IsPass idR => LocatedA (bodyR (GhcPass idR)) -> StmtLR (GhcPass idL) (GhcPass idR) (LocatedA (bodyR (GhcPass idR))) mkBodyStmt :: LocatedA (bodyR GhcPs) -> StmtLR (GhcPass idL) GhcPs (LocatedA (bodyR GhcPs)) -mkPsBindStmt :: EpAnn -> LPat GhcPs -> LocatedA (bodyR GhcPs) +mkPsBindStmt :: EpAnn [AddEpAnn] -> LPat GhcPs -> LocatedA (bodyR GhcPs) -> StmtLR GhcPs GhcPs (LocatedA (bodyR GhcPs)) mkRnBindStmt :: LPat GhcRn -> LocatedA (bodyR GhcRn) -> StmtLR GhcRn GhcRn (LocatedA (bodyR GhcRn)) @@ -345,7 +345,7 @@ mkRecStmt :: (Anno [GenLocated (Anno (StmtLR (GhcPass idL) GhcPs bodyR)) (StmtLR (GhcPass idL) GhcPs bodyR)] ~ SrcSpanAnnL) - => EpAnn' AnnList + => EpAnn AnnList -> LocatedL [LStmtLR (GhcPass idL) GhcPs bodyR] -> StmtLR (GhcPass idL) GhcPs bodyR @@ -363,12 +363,12 @@ mkHsCompAnns ctxt stmts expr anns = mkHsDoAnns ctxt (mkLocatedList (stmts ++ [la last_stmt = L (noAnnSrcSpan $ getLocA expr) $ mkLastStmt expr -- restricted to GhcPs because other phases might need a SyntaxExpr -mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> EpAnn +mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> EpAnn [AddEpAnn] -> HsExpr GhcPs mkHsIf c a b anns = HsIf anns c a b -- restricted to GhcPs because other phases might need a SyntaxExpr -mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> EpAnn +mkHsCmdIf :: LHsExpr GhcPs -> LHsCmd GhcPs -> LHsCmd GhcPs -> EpAnn [AddEpAnn] -> HsCmd GhcPs mkHsCmdIf c a b anns = HsCmdIf anns noSyntaxExpr c a b @@ -376,17 +376,17 @@ mkNPat lit neg anns = NPat anns lit neg noSyntaxExpr mkNPlusKPat id lit anns = NPlusKPat anns id lit (unLoc lit) noSyntaxExpr noSyntaxExpr -mkTransformStmt :: EpAnn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs +mkTransformStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) -mkTransformByStmt :: EpAnn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs +mkTransformByStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) -mkGroupUsingStmt :: EpAnn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs +mkGroupUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) -mkGroupByUsingStmt :: EpAnn -> [ExprLStmt GhcPs] -> LHsExpr GhcPs +mkGroupByUsingStmt :: EpAnn [AddEpAnn] -> [ExprLStmt GhcPs] -> LHsExpr GhcPs -> LHsExpr GhcPs -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) -emptyTransStmt :: EpAnn -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) +emptyTransStmt :: EpAnn [AddEpAnn] -> StmtLR GhcPs GhcPs (LHsExpr GhcPs) emptyTransStmt anns = TransStmt { trS_ext = anns , trS_form = panic "emptyTransStmt: form" , trS_stmts = [], trS_bndrs = [] @@ -436,7 +436,7 @@ emptyRecStmtId = emptyRecStmt' unitRecStmtTc -- a panic might trigger during zonking mkRecStmt anns stmts = (emptyRecStmt' anns) { recS_stmts = stmts } -mkLetStmt :: EpAnn -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b) +mkLetStmt :: EpAnn [AddEpAnn] -> HsLocalBinds GhcPs -> StmtLR GhcPs GhcPs (LocatedA b) mkLetStmt anns binds = LetStmt anns binds ------------------------------- @@ -448,10 +448,10 @@ mkHsOpApp e1 op e2 = OpApp noAnn e1 (noLocA (HsVar noExtField (noLocA op))) e2 unqualSplice :: RdrName unqualSplice = mkRdrUnqual (mkVarOccFS (fsLit "splice")) -mkUntypedSplice :: EpAnn -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs +mkUntypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs mkUntypedSplice ann hasParen e = HsUntypedSplice ann hasParen unqualSplice e -mkTypedSplice :: EpAnn -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs +mkTypedSplice :: EpAnn [AddEpAnn] -> SpliceDecoration -> LHsExpr GhcPs -> HsSplice GhcPs mkTypedSplice ann hasParen e = HsTypedSplice ann hasParen unqualSplice e mkHsQuasiQuote :: RdrName -> SrcSpan -> FastString -> HsSplice GhcPs @@ -657,7 +657,7 @@ mkLHsVarTuple ids ext = mkLHsTupleExpr (map nlHsVar ids) ext nlTuplePat :: [LPat GhcPs] -> Boxity -> LPat GhcPs nlTuplePat pats box = noLocA (TuplePat noAnn pats box) -missingTupArg :: EpAnn' EpaAnchor -> HsTupArg GhcPs +missingTupArg :: EpAnn EpaLocation -> HsTupArg GhcPs missingTupArg ann = Missing ann mkLHsPatTup :: [LPat GhcRn] -> LPat GhcRn @@ -862,7 +862,7 @@ mkVarBind var rhs = L (getLoc rhs) $ var_id = var, var_rhs = rhs } mkPatSynBind :: LocatedN RdrName -> HsPatSynDetails GhcPs - -> LPat GhcPs -> HsPatSynDir GhcPs -> EpAnn -> HsBind GhcPs + -> LPat GhcPs -> HsPatSynDir GhcPs -> EpAnn [AddEpAnn] -> HsBind GhcPs mkPatSynBind name details lpat dir anns = PatSynBind noExtField psb where psb = PSB{ psb_ext = anns |