diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-03-25 21:46:56 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-31 11:13:28 -0400 |
commit | 49bc1e9ec854e571dfa78ac43565073586579f31 (patch) | |
tree | 4cf1ea1b7f53581ae57a493ba757cf1130585a03 /compiler | |
parent | d03005e642710d0f1f78757292e0fe65287e5f0a (diff) | |
download | haskell-49bc1e9ec854e571dfa78ac43565073586579f31.tar.gz |
EPA : rename AnnAnchor to EpaAnchor
Follow-up from !2418, see #19579
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/GHC/Hs/Binds.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Hs/Dump.hs | 10 | ||||
-rw-r--r-- | compiler/GHC/Hs/Expr.hs | 30 | ||||
-rw-r--r-- | compiler/GHC/Hs/ImpExp.hs | 22 | ||||
-rw-r--r-- | compiler/GHC/Hs/Pat.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Hs/Utils.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Parser.y | 28 | ||||
-rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 66 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 18 | ||||
-rw-r--r-- | compiler/GHC/Parser/Types.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Types/SourceText.hs | 2 |
11 files changed, 94 insertions, 94 deletions
diff --git a/compiler/GHC/Hs/Binds.hs b/compiler/GHC/Hs/Binds.hs index c89406a63e..72f54828ee 100644 --- a/compiler/GHC/Hs/Binds.hs +++ b/compiler/GHC/Hs/Binds.hs @@ -593,7 +593,7 @@ type instance XXFixitySig (GhcPass p) = NoExtCon data AnnSig = AnnSig { - asDcolon :: AddEpAnn, -- Not an AnnAnchor to capture unicode option + asDcolon :: AddEpAnn, -- Not an EpaAnchor to capture unicode option asRest :: [AddEpAnn] } deriving Data diff --git a/compiler/GHC/Hs/Dump.hs b/compiler/GHC/Hs/Dump.hs index 1e282a1ee3..8a69ad0c60 100644 --- a/compiler/GHC/Hs/Dump.hs +++ b/compiler/GHC/Hs/Dump.hs @@ -66,7 +66,7 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 `extQ` lit `extQ` litr `extQ` litt `extQ` sourceText `extQ` deltaPos - `extQ` annAnchor + `extQ` epaAnchor `extQ` bytestring `extQ` name `extQ` occName `extQ` moduleName `extQ` var `extQ` dataCon @@ -136,9 +136,9 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 BlankSrcSpanFile -> parens $ text "SourceText" <+> text src _ -> parens $ text "SourceText" <+> text "blanked" - annAnchor :: AnnAnchor -> SDoc - annAnchor (AR r) = parens $ text "AR" <+> realSrcSpan r - annAnchor (AD d) = parens $ text "AD" <+> deltaPos d + epaAnchor :: EpaAnchor -> SDoc + epaAnchor (AR r) = parens $ text "AR" <+> realSrcSpan r + epaAnchor (AD d) = parens $ text "AD" <+> deltaPos d deltaPos :: DeltaPos -> SDoc deltaPos (DP l c) = parens $ text "DP" <+> ppr l <+> ppr c @@ -183,7 +183,7 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0 BlankEpAnnotations -> parens $ text "blanked:" <+> text "AddEpAnn" NoBlankEpAnnotations -> - parens $ text "AddEpAnn" <+> ppr a <+> annAnchor s + parens $ text "AddEpAnn" <+> ppr a <+> epaAnchor s var :: Var -> SDoc var v = braces $ text "Var:" <+> ppr v diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs index f9782756bd..436da995a7 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 :: AnnAnchor - , hsCaseAnnOf :: AnnAnchor + { hsCaseAnnCase :: EpaAnchor + , hsCaseAnnOf :: EpaAnchor , hsCaseAnnsRest :: [AddEpAnn] } deriving Data data EpAnnUnboundVar = EpAnnUnboundVar - { hsUnboundBackquotes :: (AnnAnchor, AnnAnchor) - , hsUnboundHole :: AnnAnchor + { hsUnboundBackquotes :: (EpaAnchor, EpaAnchor) + , hsUnboundHole :: EpaAnchor } deriving Data type instance XVar (GhcPass _) = NoExtField @@ -378,27 +378,27 @@ data XXExprGhcTc data AnnExplicitSum = AnnExplicitSum { - aesOpen :: AnnAnchor, - aesBarsBefore :: [AnnAnchor], - aesBarsAfter :: [AnnAnchor], - aesClose :: AnnAnchor + aesOpen :: EpaAnchor, + aesBarsBefore :: [EpaAnchor], + aesBarsAfter :: [EpaAnchor], + aesClose :: EpaAnchor } deriving Data data AnnsLet = AnnsLet { - alLet :: AnnAnchor, - alIn :: AnnAnchor + alLet :: EpaAnchor, + alIn :: EpaAnchor } deriving Data data AnnFieldLabel = AnnFieldLabel { - afDot :: Maybe AnnAnchor + afDot :: Maybe EpaAnchor } deriving Data data AnnProjection = AnnProjection { - apOpen :: AnnAnchor, -- ^ '(' - apClose :: AnnAnchor -- ^ ')' + apOpen :: EpaAnchor, -- ^ '(' + apClose :: EpaAnchor -- ^ ')' } deriving Data -- --------------------------------------------------------------------- @@ -411,7 +411,7 @@ type instance XXHsFieldLabel (GhcPass _) = NoExtCon type instance XPresent (GhcPass _) = EpAnn -type instance XMissing GhcPs = EpAnn' AnnAnchor +type instance XMissing GhcPs = EpAnn' EpaAnchor type instance XMissing GhcRn = NoExtField type instance XMissing GhcTc = Scaled Type @@ -1186,7 +1186,7 @@ type instance XXGRHSs (GhcPass _) _ = NoExtCon data GrhsAnn = GrhsAnn { - ga_vbar :: Maybe AnnAnchor, -- TODO:AZ do we need this? + ga_vbar :: Maybe EpaAnchor, -- TODO:AZ do we need this? ga_sep :: AddEpAnn -- ^ Match separator location } deriving (Data) diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 2622f243ae..103359281b 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 AnnAnchor - -> Maybe AnnAnchor - -> (Maybe AnnAnchor, ImportDeclQualifiedStyle) +importDeclQualifiedStyle :: Maybe EpaAnchor + -> Maybe EpaAnchor + -> (Maybe EpaAnchor, ImportDeclQualifiedStyle) importDeclQualifiedStyle mPre mPost = if isJust mPre then (mPre, QualifiedPre) else if isJust mPost then (mPost,QualifiedPost) else (Nothing, NotQualified) @@ -127,12 +127,12 @@ type instance Anno [LocatedA (IE (GhcPass p))] = SrcSpanAnnL -- API Annotations types data EpAnnImportDecl = EpAnnImportDecl - { importDeclAnnImport :: AnnAnchor - , importDeclAnnPragma :: Maybe (AnnAnchor, AnnAnchor) - , importDeclAnnSafe :: Maybe AnnAnchor - , importDeclAnnQualified :: Maybe AnnAnchor - , importDeclAnnPackage :: Maybe AnnAnchor - , importDeclAnnAs :: Maybe AnnAnchor + { importDeclAnnImport :: EpaAnchor + , importDeclAnnPragma :: Maybe (EpaAnchor, EpaAnchor) + , importDeclAnnSafe :: Maybe EpaAnchor + , importDeclAnnQualified :: Maybe EpaAnchor + , importDeclAnnPackage :: Maybe EpaAnchor + , importDeclAnnAs :: Maybe EpaAnchor } deriving (Data) -- --------------------------------------------------------------------- @@ -209,8 +209,8 @@ instance (OutputableBndrId p -- the original source. data IEWrappedName name = IEName (LocatedN name) -- ^ no extra - | IEPattern AnnAnchor (LocatedN name) -- ^ pattern X - | IEType AnnAnchor (LocatedN name) -- ^ type (:+:) + | IEPattern EpaAnchor (LocatedN name) -- ^ pattern X + | IEType EpaAnchor (LocatedN name) -- ^ type (:+:) deriving (Eq,Data) -- | Located name with possible adornment diff --git a/compiler/GHC/Hs/Pat.hs b/compiler/GHC/Hs/Pat.hs index 36537728de..6efbfb860e 100644 --- a/compiler/GHC/Hs/Pat.hs +++ b/compiler/GHC/Hs/Pat.hs @@ -164,8 +164,8 @@ type instance XHsRecField _ = EpAnn data EpAnnSumPat = EpAnnSumPat { sumPatParens :: [AddEpAnn] - , sumPatVbarsBefore :: [AnnAnchor] - , sumPatVbarsAfter :: [AnnAnchor] + , sumPatVbarsBefore :: [EpaAnchor] + , sumPatVbarsAfter :: [EpaAnchor] } deriving Data -- --------------------------------------------------------------------- diff --git a/compiler/GHC/Hs/Utils.hs b/compiler/GHC/Hs/Utils.hs index 8151041996..a23c1a1868 100644 --- a/compiler/GHC/Hs/Utils.hs +++ b/compiler/GHC/Hs/Utils.hs @@ -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' AnnAnchor -> HsTupArg GhcPs +missingTupArg :: EpAnn' EpaAnchor -> HsTupArg GhcPs missingTupArg ann = Missing ann mkLHsPatTup :: [LPat GhcRn] -> LPat GhcRn diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 478e2d27d5..c30665837c 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -1112,27 +1112,27 @@ importdecl :: { LImportDecl GhcPs } } -maybe_src :: { ((Maybe (AnnAnchor,AnnAnchor),SourceText),IsBootInterface) } +maybe_src :: { ((Maybe (EpaAnchor,EpaAnchor),SourceText),IsBootInterface) } : '{-# SOURCE' '#-}' { ((Just (glAA $1,glAA $2),getSOURCE_PRAGs $1) , IsBoot) } | {- empty -} { ((Nothing,NoSourceText),NotBoot) } -maybe_safe :: { (Maybe AnnAnchor,Bool) } +maybe_safe :: { (Maybe EpaAnchor,Bool) } : 'safe' { (Just (glAA $1),True) } | {- empty -} { (Nothing, False) } -maybe_pkg :: { (Maybe AnnAnchor,Maybe StringLiteral) } +maybe_pkg :: { (Maybe EpaAnchor,Maybe StringLiteral) } : STRING {% do { let { pkgFS = getSTRING $1 } ; unless (looksLikePackageName (unpackFS pkgFS)) $ addError $ PsError (PsErrInvalidPackageName pkgFS) [] (getLoc $1) ; return (Just (glAA $1), Just (StringLiteral (getSTRINGs $1) pkgFS Nothing)) } } | {- empty -} { (Nothing,Nothing) } -optqualified :: { Located (Maybe AnnAnchor) } +optqualified :: { Located (Maybe EpaAnchor) } : 'qualified' { sL1 $1 (Just (glAA $1)) } | {- empty -} { noLoc Nothing } -maybeas :: { (Maybe AnnAnchor,Located (Maybe (Located ModuleName))) } +maybeas :: { (Maybe EpaAnchor,Located (Maybe (Located ModuleName))) } : 'as' modid { (Just (glAA $1) ,sLL $1 $> (Just $2)) } | {- empty -} { (Nothing,noLoc Nothing) } @@ -3035,14 +3035,14 @@ tup_exprs :: { forall b. DisambECP b => PV (SumOrTuple b) } (Sum (snd $1 + 1) (snd $1 + snd $3 + 1) $2 (fst $1) (fst $3)) } -- Always starts with commas; always follows an expr -commas_tup_tail :: { forall b. DisambECP b => PV (SrcSpan,[Either (EpAnn' AnnAnchor) (LocatedA b)]) } +commas_tup_tail :: { forall b. DisambECP b => PV (SrcSpan,[Either (EpAnn' EpaAnchor) (LocatedA b)]) } commas_tup_tail : commas tup_tail { $2 >>= \ $2 -> do { let {cos = map (\l -> (Left (EpAnn (anc $ rs l) (AR $ rs l) noCom))) (tail $ fst $1) } ; return ((head $ fst $1, cos ++ $2)) } } -- Always follows a comma -tup_tail :: { forall b. DisambECP b => PV [Either (EpAnn' AnnAnchor) (LocatedA b)] } +tup_tail :: { forall b. DisambECP b => PV [Either (EpAnn' EpaAnchor) (LocatedA b)] } : texp commas_tup_tail { unECP $1 >>= \ $1 -> $2 >>= \ $2 -> do { t <- amsA $1 [AddCommaAnn (AR $ rs $ fst $2)] @@ -3846,11 +3846,11 @@ commas :: { ([SrcSpan],Int) } -- One or more commas : commas ',' { ((fst $1)++[gl $2],snd $1 + 1) } | ',' { ([gl $1],1) } -bars0 :: { ([AnnAnchor],Int) } -- Zero or more bars +bars0 :: { ([EpaAnchor],Int) } -- Zero or more bars : bars { $1 } | { ([], 0) } -bars :: { ([AnnAnchor],Int) } -- One or more bars +bars :: { ([EpaAnchor],Int) } -- One or more bars : bars '|' { ((fst $1)++[glAA $2],snd $1 + 1) } | '|' { ([glAA $1],1) } @@ -4191,7 +4191,7 @@ glN = getLocA glR :: Located a -> Anchor glR la = Anchor (realSrcSpan $ getLoc la) UnchangedAnchor -glAA :: Located a -> AnnAnchor +glAA :: Located a -> EpaAnchor glAA = AR <$> realSrcSpan . getLoc glRR :: Located a -> RealSrcSpan @@ -4203,7 +4203,7 @@ glAR la = Anchor (realSrcSpan $ getLocA la) UnchangedAnchor glNR :: LocatedN a -> Anchor glNR ln = Anchor (realSrcSpan $ getLocA ln) UnchangedAnchor -glNRR :: LocatedN a -> AnnAnchor +glNRR :: LocatedN a -> EpaAnchor glNRR = AR <$> realSrcSpan . getLocA anc :: RealSrcSpan -> Anchor @@ -4349,7 +4349,7 @@ addTrailingSemiA la span = addTrailingAnnA la span AddSemiAnn addTrailingCommaA :: MonadP m => LocatedA a -> SrcSpan -> m (LocatedA a) addTrailingCommaA la span = addTrailingAnnA la span AddCommaAnn -addTrailingAnnA :: MonadP m => LocatedA a -> SrcSpan -> (AnnAnchor -> TrailingAnn) -> m (LocatedA a) +addTrailingAnnA :: MonadP m => LocatedA a -> SrcSpan -> (EpaAnchor -> TrailingAnn) -> m (LocatedA a) addTrailingAnnA (L (SrcSpanAnn anns l) a) ss ta = do -- cs <- getCommentsFor l let cs = noCom @@ -4387,8 +4387,8 @@ addTrailingCommaN (L (SrcSpanAnn anns l) a) span = do else addTrailingCommaToN l anns (AR $ rs span) return (L (SrcSpanAnn anns' l) a) -addTrailingCommaS :: Located StringLiteral -> AnnAnchor -> Located StringLiteral -addTrailingCommaS (L l sl) span = L l (sl { sl_tc = Just (annAnchorRealSrcSpan span) }) +addTrailingCommaS :: Located StringLiteral -> EpaAnchor -> Located StringLiteral +addTrailingCommaS (L l sl) span = L l (sl { sl_tc = Just (epaAnchorRealSrcSpan span) }) -- ------------------------------------- diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index 23b0864246..6fba7baa94 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -13,7 +13,7 @@ module GHC.Parser.Annotation ( -- * In-tree Exact Print Annotations AddEpAnn(..), - AnnAnchor(..), annAnchorRealSrcSpan, + EpaAnchor(..), epaAnchorRealSrcSpan, DeltaPos(..), EpAnn, EpAnn'(..), Anchor(..), AnchorOperation(..), @@ -378,15 +378,15 @@ data HasE = HasE | NoE -- --------------------------------------------------------------------- -- | Captures an annotation, storing the @'AnnKeywordId'@ and its --- location. The parser only ever inserts @'AnnAnchor'@ fields with a +-- location. The parser only ever inserts @'EpaAnchor'@ fields with a -- RealSrcSpan being the original location of the annotation in the -- source file. --- The @'AnnAnchor'@ can also store a delta position if the AST has been +-- The @'EpaAnchor'@ can also store a delta position if the AST has been -- modified and needs to be pretty printed again. -- The usual way an 'AddEpAnn' is created is using the 'mj' ("make -- jump") function, and then it can be inserted into the appropriate -- annotation. -data AddEpAnn = AddEpAnn AnnKeywordId AnnAnchor deriving (Data,Show,Eq,Ord) +data AddEpAnn = AddEpAnn AnnKeywordId EpaAnchor deriving (Data,Show,Eq,Ord) -- | The anchor for an @'AnnKeywordId'@. The Parser inserts the @'AR'@ -- variant, giving the exact location of the original item in the @@ -394,7 +394,7 @@ data AddEpAnn = AddEpAnn AnnKeywordId AnnAnchor deriving (Data,Show,Eq,Ord) -- provide a position for the item relative to the end of the previous -- item in the source. This is useful when editing an AST prior to -- exact printing the changed one. -data AnnAnchor = AR RealSrcSpan +data EpaAnchor = AR RealSrcSpan | AD DeltaPos deriving (Data,Show,Eq,Ord) @@ -411,11 +411,11 @@ data DeltaPos = } deriving (Show,Eq,Ord,Data) -annAnchorRealSrcSpan :: AnnAnchor -> RealSrcSpan -annAnchorRealSrcSpan (AR r) = r -annAnchorRealSrcSpan (AD _) = placeholderRealSpan +epaAnchorRealSrcSpan :: EpaAnchor -> RealSrcSpan +epaAnchorRealSrcSpan (AR r) = r +epaAnchorRealSrcSpan (AD _) = placeholderRealSpan -instance Outputable AnnAnchor where +instance Outputable EpaAnchor where ppr (AR r) = text "AR" <+> ppr r ppr (AD d) = text "AD" <+> ppr d @@ -476,8 +476,8 @@ See Note [XRec and Anno in the AST] for details of how this is done. -- type instance XLet GhcPs = EpAnn' AnnsLet -- data AnnsLet -- = AnnsLet { --- alLet :: AnnAnchor, --- alIn :: AnnAnchor +-- alLet :: EpaAnchor, +-- alIn :: EpaAnchor -- } deriving Data -- -- The spacing between the items under the scope of a given EpAnn' is @@ -637,11 +637,11 @@ meaning we can have type LocatedN RdrName -- | Captures the location of punctuation occuring between items, -- normally in a list. It is captured as a trailing annotation. data TrailingAnn - = AddSemiAnn AnnAnchor -- ^ Trailing ';' - | AddCommaAnn AnnAnchor -- ^ Trailing ',' - | AddVbarAnn AnnAnchor -- ^ Trailing '|' - | AddRarrowAnn AnnAnchor -- ^ Trailing '->' - | AddRarrowAnnU AnnAnchor -- ^ Trailing '->', unicode variant + = AddSemiAnn EpaAnchor -- ^ Trailing ';' + | AddCommaAnn EpaAnchor -- ^ Trailing ',' + | AddVbarAnn EpaAnchor -- ^ Trailing '|' + | AddRarrowAnn EpaAnchor -- ^ Trailing '->' + | AddRarrowAnnU EpaAnchor -- ^ Trailing '->', unicode variant deriving (Data,Show,Eq, Ord) instance Outputable TrailingAnn where @@ -686,8 +686,8 @@ data AnnList data AnnParen = AnnParen { ap_adornment :: ParenType, - ap_open :: AnnAnchor, - ap_close :: AnnAnchor + ap_open :: EpaAnchor, + ap_close :: EpaAnchor } deriving (Data) -- | Detail of the "brackets" used in an 'AnnParen' API Annotation. @@ -709,10 +709,10 @@ parenTypeKws AnnParensSquare = (AnnOpenS, AnnCloseS) -- | API Annotation for the 'Context' data type. data AnnContext = AnnContext { - ac_darrow :: Maybe (IsUnicodeSyntax, AnnAnchor), + ac_darrow :: Maybe (IsUnicodeSyntax, EpaAnchor), -- ^ location and encoding of the '=>', if present. - ac_open :: [AnnAnchor], -- ^ zero or more opening parentheses. - ac_close :: [AnnAnchor] -- ^ zero or more closing parentheses. + ac_open :: [EpaAnchor], -- ^ zero or more opening parentheses. + ac_close :: [EpaAnchor] -- ^ zero or more closing parentheses. } deriving (Data) @@ -727,35 +727,35 @@ data NameAnn -- | Used for a name with an adornment, so '`foo`', '(bar)' = NameAnn { nann_adornment :: NameAdornment, - nann_open :: AnnAnchor, - nann_name :: AnnAnchor, - nann_close :: AnnAnchor, + nann_open :: EpaAnchor, + nann_name :: EpaAnchor, + nann_close :: EpaAnchor, nann_trailing :: [TrailingAnn] } -- | Used for @(,,,)@, or @(#,,,#)# | NameAnnCommas { nann_adornment :: NameAdornment, - nann_open :: AnnAnchor, - nann_commas :: [AnnAnchor], - nann_close :: AnnAnchor, + nann_open :: EpaAnchor, + nann_commas :: [EpaAnchor], + nann_close :: EpaAnchor, nann_trailing :: [TrailingAnn] } -- | Used for @()@, @(##)@, @[]@ | NameAnnOnly { nann_adornment :: NameAdornment, - nann_open :: AnnAnchor, - nann_close :: AnnAnchor, + nann_open :: EpaAnchor, + nann_close :: EpaAnchor, nann_trailing :: [TrailingAnn] } -- | Used for @->@, as an identifier | NameAnnRArrow { - nann_name :: AnnAnchor, + nann_name :: EpaAnchor, nann_trailing :: [TrailingAnn] } -- | Used for an item with a leading @'@. The annotation for -- unquoted item is stored in 'nann_quoted'. | NameAnnQuote { - nann_quote :: AnnAnchor, + nann_quote :: EpaAnchor, nann_quoted :: SrcSpanAnnN, nann_trailing :: [TrailingAnn] } @@ -827,12 +827,12 @@ addTrailingAnnToA _ t cs n = n { anns = addTrailing (anns n) -- | Helper function used in the parser to add a comma location to an -- existing annotation. -addTrailingCommaToN :: SrcSpan -> EpAnn' NameAnn -> AnnAnchor -> EpAnn' NameAnn +addTrailingCommaToN :: SrcSpan -> EpAnn' NameAnn -> EpaAnchor -> EpAnn' NameAnn addTrailingCommaToN s EpAnnNotUsed l = EpAnn (spanAsAnchor s) (NameAnnTrailing [AddCommaAnn l]) noCom addTrailingCommaToN _ n l = n { anns = addTrailing (anns n) l } where - addTrailing :: NameAnn -> AnnAnchor -> NameAnn + addTrailing :: NameAnn -> EpaAnchor -> NameAnn addTrailing n l = n { nann_trailing = AddCommaAnn l : nann_trailing n } -- --------------------------------------------------------------------- diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 18881dbe4c..2a70119fcf 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -1019,7 +1019,7 @@ checkContext :: LHsType GhcPs -> P (LHsContext GhcPs) checkContext orig_t@(L (SrcSpanAnn _ l) _orig_t) = check ([],[],noCom) orig_t where - check :: ([AnnAnchor],[AnnAnchor],EpAnnComments) + check :: ([EpaAnchor],[EpaAnchor],EpAnnComments) -> LHsType GhcPs -> P (LHsContext GhcPs) check (oparens,cparens,cs) (L _l (HsTupleTy ann' HsBoxedOrConstraintTuple ts)) -- (Eq a, Ord b) shows up as a tuple type. Only boxed tuples can @@ -1044,8 +1044,8 @@ checkContext orig_t@(L (SrcSpanAnn _ l) _orig_t) = check (_opi,_cpi,_csi) _t = return (L (SrcSpanAnn (EpAnn (spanAsAnchor l) (AnnContext Nothing [] []) noCom) l) [orig_t]) -checkImportDecl :: Maybe AnnAnchor - -> Maybe AnnAnchor +checkImportDecl :: Maybe EpaAnchor + -> Maybe EpaAnchor -> P () checkImportDecl mPre mPost = do let whenJust mg f = maybe (pure ()) f mg @@ -1056,18 +1056,18 @@ checkImportDecl mPre mPost = do -- 'ImportQualifiedPost' is not in effect. whenJust mPost $ \post -> when (not importQualifiedPostEnabled) $ - failOpNotEnabledImportQualifiedPost (RealSrcSpan (annAnchorRealSrcSpan post) Nothing) + failOpNotEnabledImportQualifiedPost (RealSrcSpan (epaAnchorRealSrcSpan post) Nothing) -- Error if 'qualified' occurs in both pre and postpositive -- positions. whenJust mPost $ \post -> when (isJust mPre) $ - failOpImportQualifiedTwice (RealSrcSpan (annAnchorRealSrcSpan post) Nothing) + failOpImportQualifiedTwice (RealSrcSpan (epaAnchorRealSrcSpan post) Nothing) -- Warn if 'qualified' found in prepositive position and -- 'Opt_WarnPrepositiveQualifiedModule' is enabled. whenJust mPre $ \pre -> - warnPrepositiveQualifiedModule (RealSrcSpan (annAnchorRealSrcSpan pre) Nothing) + warnPrepositiveQualifiedModule (RealSrcSpan (epaAnchorRealSrcSpan pre) Nothing) -- ------------------------------------------------------------------------- -- Checking Patterns. @@ -2611,7 +2611,7 @@ data ImpExpSubSpec = ImpExpAbs | ImpExpAllWith [LocatedA ImpExpQcSpec] data ImpExpQcSpec = ImpExpQcName (LocatedN RdrName) - | ImpExpQcType AnnAnchor (LocatedN RdrName) + | ImpExpQcType EpaAnchor (LocatedN RdrName) | ImpExpQcWildcard mkModuleImpExp :: [AddEpAnn] -> LocatedA ImpExpQcSpec -> ImpExpSubSpec -> P (IE GhcPs) @@ -2885,7 +2885,7 @@ mkSumOrTupleExpr l boxity (Tuple es) anns = do cs <- getCommentsFor (locA l) return $ L l (ExplicitTuple (EpAnn (spanAsAnchor $ locA l) anns cs) (map toTupArg es) boxity) where - toTupArg :: Either (EpAnn' AnnAnchor) (LHsExpr GhcPs) -> HsTupArg GhcPs + toTupArg :: Either (EpAnn' EpaAnchor) (LHsExpr GhcPs) -> HsTupArg GhcPs toTupArg (Left ann) = missingTupArg ann toTupArg (Right a) = Present noAnn a @@ -2912,7 +2912,7 @@ mkSumOrTuplePat l boxity (Tuple ps) anns = do cs <- getCommentsFor (locA l) return $ L l (PatBuilderPat (TuplePat (EpAnn (spanAsAnchor $ locA l) anns cs) ps' boxity)) where - toTupPat :: Either (EpAnn' AnnAnchor) (LocatedA (PatBuilder GhcPs)) -> PV (LPat GhcPs) + toTupPat :: Either (EpAnn' EpaAnchor) (LocatedA (PatBuilder GhcPs)) -> PV (LPat GhcPs) -- Ignore the element location so that the error message refers to the -- entire tuple. See #19504 (and the discussion) for details. toTupPat p = case p of diff --git a/compiler/GHC/Parser/Types.hs b/compiler/GHC/Parser/Types.hs index 5c3ff72597..2f5f304009 100644 --- a/compiler/GHC/Parser/Types.hs +++ b/compiler/GHC/Parser/Types.hs @@ -26,9 +26,9 @@ import GHC.Parser.Annotation import Language.Haskell.Syntax data SumOrTuple b - = Sum ConTag Arity (LocatedA b) [AnnAnchor] [AnnAnchor] + = Sum ConTag Arity (LocatedA b) [EpaAnchor] [EpaAnchor] -- ^ Last two are the locations of the '|' before and after the payload - | Tuple [Either (EpAnn' AnnAnchor) (LocatedA b)] + | Tuple [Either (EpAnn' EpaAnchor) (LocatedA b)] pprSumOrTuple :: Outputable b => Boxity -> SumOrTuple b -> SDoc pprSumOrTuple boxity = \case diff --git a/compiler/GHC/Types/SourceText.hs b/compiler/GHC/Types/SourceText.hs index 720b64433c..59df5ddf9c 100644 --- a/compiler/GHC/Types/SourceText.hs +++ b/compiler/GHC/Types/SourceText.hs @@ -300,7 +300,7 @@ data StringLiteral = StringLiteral -- StringLiteral we would not need sl_tc, but -- that would cause import loops. - -- AZ:2: sl_tc should be an AnnAnchor, to allow + -- AZ:2: sl_tc should be an EpaAnchor, to allow -- editing and reprinting the AST. Need a more -- robust solution. |