diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-03-25 21:38:13 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-31 11:13:28 -0400 |
commit | d03005e642710d0f1f78757292e0fe65287e5f0a (patch) | |
tree | 2bd2c11a00577649ac19ddc6aa9705efa19bc8e5 | |
parent | 0fe5175ac537c0ce2afe969ec82a0d1c73a4ae38 (diff) | |
download | haskell-d03005e642710d0f1f78757292e0fe65287e5f0a.tar.gz |
EPA : rename 'api annotations' to 'exact print annotations'
In comments, and notes.
Follow-up from !2418, see #19579
-rw-r--r-- | compiler/GHC.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Class.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/DataCon.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Hs.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Hs/ImpExp.hs | 16 | ||||
-rw-r--r-- | compiler/GHC/Hs/Type.hs | 4 | ||||
-rw-r--r-- | compiler/GHC/Parser.y | 2 | ||||
-rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 26 | ||||
-rw-r--r-- | compiler/GHC/Parser/Lexer.x | 2 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Types/Basic.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Types/ForeignCall.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Types/Name/Reader.hs | 2 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Binds.hs | 26 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Decls.hs | 59 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Expr.hs | 102 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Extension.hs | 7 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Pat.hs | 24 | ||||
-rw-r--r-- | compiler/Language/Haskell/Syntax/Type.hs | 50 | ||||
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 10 | ||||
-rw-r--r-- | utils/check-exact/Transform.hs | 10 | ||||
-rw-r--r-- | utils/check-ppr/Main.hs | 2 |
22 files changed, 182 insertions, 184 deletions
diff --git a/compiler/GHC.hs b/compiler/GHC.hs index da1f02bea5..ec9c473c26 100644 --- a/compiler/GHC.hs +++ b/compiler/GHC.hs @@ -1128,7 +1128,7 @@ parseModule ms = do let hsc_env_tmp = hsc_env { hsc_dflags = ms_hspp_opts ms } hpm <- liftIO $ hscParse hsc_env_tmp ms return (ParsedModule ms (hpm_module hpm) (hpm_src_files hpm)) - -- See Note [Api annotations] in GHC.Parser.Annotation + -- See Note [exact print annotations] in GHC.Parser.Annotation -- | Typecheck and rename a parsed module. -- diff --git a/compiler/GHC/Core/Class.hs b/compiler/GHC/Core/Class.hs index 57e6defca6..dfb651c279 100644 --- a/compiler/GHC/Core/Class.hs +++ b/compiler/GHC/Core/Class.hs @@ -80,7 +80,7 @@ data Class -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnRarrow'', --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation type FunDep a = ([a],[a]) type ClassOpItem = (Id, DefMethInfo) diff --git a/compiler/GHC/Core/DataCon.hs b/compiler/GHC/Core/DataCon.hs index 3239c80b2e..1c7b83b475 100644 --- a/compiler/GHC/Core/DataCon.hs +++ b/compiler/GHC/Core/DataCon.hs @@ -308,7 +308,7 @@ Note that (Foo a) might not be an instance of Ord. -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose','GHC.Parser.Annotation.AnnComma' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data DataCon = MkData { dcName :: Name, -- This is the name of the *source data con* diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs index 8b645ac5fc..17825119e7 100644 --- a/compiler/GHC/Hs.hs +++ b/compiler/GHC/Hs.hs @@ -89,7 +89,7 @@ data HsModule -- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnOpen' -- ,'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation hsmodImports :: [LImportDecl GhcPs], -- ^ We snaffle interesting stuff out of the imported interfaces early -- on, adding that info to TyDecls/etc; so this list is often empty, @@ -103,14 +103,14 @@ data HsModule -- ,'GHC.Parser.Annotation.AnnClose' -- - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation hsmodHaddockModHeader :: Maybe LHsDocString -- ^ Haddock module info and description, unparsed -- -- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnOpen' -- ,'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation } -- ^ 'GHC.Parser.Annotation.AnnKeywordId's -- @@ -120,7 +120,7 @@ data HsModule -- 'GHC.Parser.Annotation.AnnClose' for explicit braces and semi around -- hsmodImports,hsmodDecls if this style is used. - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation deriving instance Data HsModule diff --git a/compiler/GHC/Hs/ImpExp.hs b/compiler/GHC/Hs/ImpExp.hs index 309d0d8c62..2622f243ae 100644 --- a/compiler/GHC/Hs/ImpExp.hs +++ b/compiler/GHC/Hs/ImpExp.hs @@ -51,7 +51,7 @@ type LImportDecl pass = XRec pass (ImportDecl pass) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation type instance Anno (ImportDecl (GhcPass p)) = SrcSpanAnnA -- | If/how an import is 'qualified'. @@ -111,7 +111,7 @@ data ImportDecl pass -- 'GHC.Parser.Annotation.AnnClose' attached -- to location in ideclHiding - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation type instance XCImportDecl GhcPs = EpAnn' EpAnnImportDecl type instance XCImportDecl GhcRn = NoExtField @@ -217,7 +217,7 @@ data IEWrappedName name -- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnType', -- 'GHC.Parser.Annotation.AnnPattern' type LIEWrappedName name = LocatedA (IEWrappedName name) --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Located Import or Export @@ -226,7 +226,7 @@ type LIE pass = XRec pass (IE pass) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation type instance Anno (IE (GhcPass p)) = SrcSpanAnnA -- | Imported or exported entity. @@ -241,7 +241,7 @@ data IE pass -- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnPattern', -- 'GHC.Parser.Annotation.AnnType','GHC.Parser.Annotation.AnnVal' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- See Note [Located RdrNames] in GHC.Hs.Expr | IEThingAll (XIEThingAll pass) (LIEWrappedName (IdP pass)) -- ^ Imported or exported Thing with All imported or exported @@ -252,7 +252,7 @@ data IE pass -- 'GHC.Parser.Annotation.AnnDotdot','GHC.Parser.Annotation.AnnClose', -- 'GHC.Parser.Annotation.AnnType' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- See Note [Located RdrNames] in GHC.Hs.Expr | IEThingWith (XIEThingWith pass) @@ -268,7 +268,7 @@ data IE pass -- 'GHC.Parser.Annotation.AnnComma', -- 'GHC.Parser.Annotation.AnnType' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | IEModuleContents (XIEModuleContents pass) (XRec pass ModuleName) -- ^ Imported or exported module contents -- @@ -276,7 +276,7 @@ data IE pass -- -- - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnModule' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | IEGroup (XIEGroup pass) Int HsDocString -- ^ Doc section heading | IEDoc (XIEDoc pass) HsDocString -- ^ Some documentation | IEDocNamed (XIEDocNamed pass) String -- ^ Reference to named doc diff --git a/compiler/GHC/Hs/Type.hs b/compiler/GHC/Hs/Type.hs index ba07ad35b7..9c494d6aa7 100644 --- a/compiler/GHC/Hs/Type.hs +++ b/compiler/GHC/Hs/Type.hs @@ -483,12 +483,12 @@ splitHsFunType ty = go ty = let (anns, cs, args, res) = splitHsFunType ty anns' = anns ++ annParen2AddEpAnn an - cs' = cs S.<> apiAnnComments (ann l) S.<> apiAnnComments an + cs' = cs S.<> epAnnComments (ann l) S.<> epAnnComments an in (anns', cs', args, res) go (L ll (HsFunTy (EpAnn _ an cs) mult x y)) | (anns, csy, args, res) <- splitHsFunType y - = (anns, csy S.<> apiAnnComments (ann ll), HsScaled mult x':args, res) + = (anns, csy S.<> epAnnComments (ann ll), HsScaled mult x':args, res) where (L (SrcSpanAnn a l) t) = x an' = addTrailingAnnToA l an cs a diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 19b5642ff0..478e2d27d5 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -4140,7 +4140,7 @@ reportEmptyDoubleQuotes span = do %* * %************************************************************************ -For the general principles of the following routines, see Note [Api annotations] +For the general principles of the following routines, see Note [exact print annotations] in GHC.Parser.Annotation -} diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index 6acb712833..23b0864246 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -57,9 +57,9 @@ module GHC.Parser.Annotation ( -- ** Querying annotations getLocAnn, - apiAnnAnns, apiAnnAnnsL, + epAnnAnns, epAnnAnnsL, annParen2AddEpAnn, - apiAnnComments, + epAnnComments, -- ** Working with locations of annotations sortLocatedA, @@ -95,7 +95,7 @@ import GHC.Utils.Outputable hiding ( (<>) ) import GHC.Utils.Panic {- -Note [Api annotations] +Note [exact print annotations] ~~~~~~~~~~~~~~~~~~~~~~ Given a parse tree of a Haskell module, how can we reconstruct the original Haskell source code, retaining all whitespace and @@ -195,7 +195,7 @@ https://gitlab.haskell.org/ghc/ghc/wikis/api-annotations -- -- Note: in general the names of these are taken from the -- corresponding token, unless otherwise noted --- See note [Api annotations] above for details of the usage +-- See note [exact print annotations] above for details of the usage data AnnKeywordId = AnnAnyclass | AnnAs @@ -967,13 +967,13 @@ widenAnchorR (Anchor s op) r = Anchor (combineRealSrcSpans s r) op widenLocatedAn :: SrcSpanAnn' an -> [AddEpAnn] -> SrcSpanAnn' an widenLocatedAn (SrcSpanAnn a l) as = SrcSpanAnn a (widenSpan l as) -apiAnnAnnsL :: EpAnn' a -> [a] -apiAnnAnnsL EpAnnNotUsed = [] -apiAnnAnnsL (EpAnn _ anns _) = [anns] +epAnnAnnsL :: EpAnn' a -> [a] +epAnnAnnsL EpAnnNotUsed = [] +epAnnAnnsL (EpAnn _ anns _) = [anns] -apiAnnAnns :: EpAnn -> [AddEpAnn] -apiAnnAnns EpAnnNotUsed = [] -apiAnnAnns (EpAnn _ anns _) = anns +epAnnAnns :: EpAnn -> [AddEpAnn] +epAnnAnns EpAnnNotUsed = [] +epAnnAnns (EpAnn _ anns _) = anns annParen2AddEpAnn :: EpAnn' AnnParen -> [AddEpAnn] annParen2AddEpAnn EpAnnNotUsed = [] @@ -982,9 +982,9 @@ annParen2AddEpAnn (EpAnn _ (AnnParen pt o c) _) where (ai,ac) = parenTypeKws pt -apiAnnComments :: EpAnn' an -> EpAnnComments -apiAnnComments EpAnnNotUsed = AnnComments [] -apiAnnComments (EpAnn _ _ cs) = cs +epAnnComments :: EpAnn' an -> EpAnnComments +epAnnComments EpAnnNotUsed = AnnComments [] +epAnnComments (EpAnn _ _ cs) = cs -- --------------------------------------------------------------------- -- sortLocatedA :: [LocatedA a] -> [LocatedA a] diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 125e6aaaf6..be99757176 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -2346,7 +2346,7 @@ data PState = PState { -- The next three are used to implement Annotations giving the -- locations of 'noise' tokens in the source, so that users of -- the GHC API can do source to source conversions. - -- See note [Api annotations] in GHC.Parser.Annotation + -- See note [exact print annotations] in GHC.Parser.Annotation eof_pos :: Maybe (RealSrcSpan, RealSrcSpan), -- pos, gap to prior token header_comments :: Maybe [LAnnotationComment], comment_q :: [LAnnotationComment], diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index d6248bd107..18881dbe4c 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -713,7 +713,7 @@ mkGadtDecl loc names ty annsIn = do = let an' = addTrailingAnnToL (locA loc') (anns af) (comments af) an in ( RecConGADT (L (SrcSpanAnn an' (locA loc')) rf), res_ty - , [], apiAnnComments (ann ll)) + , [], epAnnComments (ann ll)) | otherwise = let (anns, cs, arg_types, res_type) = splitHsFunType body_ty in (PrefixConGADT arg_types, res_type, anns, cs) @@ -839,7 +839,7 @@ checkTyVars pp_what equals_or_where tc tparms chkParens :: [AddEpAnn] -> EpAnnComments -> LHsType GhcPs -> P (LHsTyVarBndr () GhcPs, [AddEpAnn]) chkParens acc cs (L l (HsParTy an ty)) - = chkParens (mkParensEpAnn (locA l) ++ acc) (cs Semi.<> apiAnnComments an) ty + = chkParens (mkParensEpAnn (locA l) ++ acc) (cs Semi.<> epAnnComments an) ty chkParens acc cs ty = do tv <- chk acc cs ty return (tv, reverse acc) @@ -1329,7 +1329,7 @@ addUnpackednessP (L lprag (UnpackednessPragma anns prag unpk)) ty = do -- Otherwise, wrap the type in a new HsBangTy constructor. addUnpackedness an (L _ (HsBangTy x bang t)) | HsSrcBang NoSourceText NoSrcUnpack strictness <- bang - = HsBangTy (addAnns an (apiAnnAnns x) (apiAnnComments x)) (HsSrcBang prag unpk strictness) t + = HsBangTy (addAnns an (epAnnAnns x) (epAnnComments x)) (HsSrcBang prag unpk strictness) t addUnpackedness an t = HsBangTy an (HsSrcBang prag unpk NoSrcStrict) t diff --git a/compiler/GHC/Types/Basic.hs b/compiler/GHC/Types/Basic.hs index c1947fab17..f8725bf8fc 100644 --- a/compiler/GHC/Types/Basic.hs +++ b/compiler/GHC/Types/Basic.hs @@ -580,7 +580,7 @@ instance Outputable Origin where -- @'\{-\# INCOHERENT'@, -- 'GHC.Parser.Annotation.AnnClose' @`\#-\}`@, --- For details on above see note [Api annotations] in "GHC.Parser.Annotation" +-- For details on above see note [exact print annotations] in "GHC.Parser.Annotation" data OverlapFlag = OverlapFlag { overlapMode :: OverlapMode , isSafeOverlap :: Bool diff --git a/compiler/GHC/Types/ForeignCall.hs b/compiler/GHC/Types/ForeignCall.hs index ac24d4ea4d..0c9032af91 100644 --- a/compiler/GHC/Types/ForeignCall.hs +++ b/compiler/GHC/Types/ForeignCall.hs @@ -241,7 +241,7 @@ instance Outputable Header where -- 'GHC.Parser.Annotation.AnnHeader','GHC.Parser.Annotation.AnnVal', -- 'GHC.Parser.Annotation.AnnClose' @'\#-}'@, --- For details on above see note [Api annotations] in "GHC.Parser.Annotation" +-- For details on above see note [exact print annotations] in "GHC.Parser.Annotation" data CType = CType SourceText -- Note [Pragma source text] in GHC.Types.SourceText (Maybe Header) -- header to include for this type (SourceText,FastString) -- the type itself diff --git a/compiler/GHC/Types/Name/Reader.hs b/compiler/GHC/Types/Name/Reader.hs index a4ec4bea8d..c14a0865ee 100644 --- a/compiler/GHC/Types/Name/Reader.hs +++ b/compiler/GHC/Types/Name/Reader.hs @@ -127,7 +127,7 @@ import Data.List( sortBy ) -- 'GHC.Parser.Annotation.AnnVal' -- 'GHC.Parser.Annotation.AnnTilde', --- For details on above see note [Api annotations] in "GHC.Parser.Annotation" +-- For details on above see note [exact print annotations] in "GHC.Parser.Annotation" data RdrName = Unqual OccName -- ^ Unqualified name diff --git a/compiler/Language/Haskell/Syntax/Binds.hs b/compiler/Language/Haskell/Syntax/Binds.hs index 2ad43e499c..8c69f10eb8 100644 --- a/compiler/Language/Haskell/Syntax/Binds.hs +++ b/compiler/Language/Haskell/Syntax/Binds.hs @@ -199,7 +199,7 @@ data HsBindLR idL idR -- - 'GHC.Parser.Annotation.AnnEqual','GHC.Parser.Annotation.AnnWhere', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation FunBind { fun_ext :: XFunBind idL idR, @@ -240,7 +240,7 @@ data HsBindLR idL idR -- 'GHC.Parser.Annotation.AnnEqual','GHC.Parser.Annotation.AnnWhere', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | PatBind { pat_ext :: XPatBind idL idR, -- ^ See Note [Bind free vars] pat_lhs :: LPat idL, @@ -291,7 +291,7 @@ data HsBindLR idL idR -- 'GHC.Parser.Annotation.AnnWhere' -- 'GHC.Parser.Annotation.AnnOpen' @'{'@,'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XHsBindsLR !(XXHsBindsLR idL idR) @@ -325,7 +325,7 @@ data ABExport p -- 'GHC.Parser.Annotation.AnnWhere','GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@, --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Pattern Synonym binding data PatSynBind idL idR @@ -595,7 +595,7 @@ type LIPBind id = XRec id (IPBind id) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a -- list --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Implicit parameter bindings. -- @@ -606,7 +606,7 @@ type LIPBind id = XRec id (IPBind id) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnEqual' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data IPBind id = IPBind (XCIPBind id) @@ -647,7 +647,7 @@ data Sig pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon', -- 'GHC.Parser.Annotation.AnnComma' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation TypeSig (XTypeSig pass) [LIdP pass] -- LHS of the signature; e.g. f,g,h :: blah @@ -661,7 +661,7 @@ data Sig pass -- 'GHC.Parser.Annotation.AnnDcolon','GHC.Parser.Annotation.AnnForall' -- 'GHC.Parser.Annotation.AnnDot','GHC.Parser.Annotation.AnnDarrow' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | PatSynSig (XPatSynSig pass) [LIdP pass] (LHsSigType pass) -- P :: forall a b. Req => Prov => ty @@ -692,7 +692,7 @@ data Sig pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnInfix', -- 'GHC.Parser.Annotation.AnnVal' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | FixSig (XFixSig pass) (FixitySig pass) -- | An inline pragma @@ -705,7 +705,7 @@ data Sig pass -- 'GHC.Parser.Annotation.AnnVal','GHC.Parser.Annotation.AnnTilde', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | InlineSig (XInlineSig pass) (LIdP pass) -- Function name InlinePragma -- Never defaultInlinePragma @@ -721,7 +721,7 @@ data Sig pass -- 'GHC.Parser.Annotation.AnnClose' @']'@ and @'\#-}'@, -- 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | SpecSig (XSpecSig pass) (LIdP pass) -- Specialise a function or datatype ... [LHsSigType pass] -- ... to these types @@ -739,7 +739,7 @@ data Sig pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnInstance','GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | SpecInstSig (XSpecInstSig pass) SourceText (LHsSigType pass) -- Note [Pragma source text] in GHC.Types.SourceText @@ -751,7 +751,7 @@ data Sig pass -- 'GHC.Parser.Annotation.AnnVbar','GHC.Parser.Annotation.AnnComma', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | MinimalSig (XMinimalSig pass) SourceText (LBooleanFormula (LIdP pass)) -- Note [Pragma source text] in GHC.Types.SourceText diff --git a/compiler/Language/Haskell/Syntax/Decls.hs b/compiler/Language/Haskell/Syntax/Decls.hs index 0b93e4b265..59ae54544a 100644 --- a/compiler/Language/Haskell/Syntax/Decls.hs +++ b/compiler/Language/Haskell/Syntax/Decls.hs @@ -132,7 +132,7 @@ type LHsDecl p = XRec p (HsDecl p) -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' -- --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | A Haskell Declaration data HsDecl p @@ -400,7 +400,7 @@ data TyClDecl pass -- 'GHC.Parser.Annotation.AnnEqual','GHC.Parser.Annotation.AnnRarrow', -- 'GHC.Parser.Annotation.AnnVbar' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation FamDecl { tcdFExt :: XFamDecl pass, tcdFam :: FamilyDecl pass } | -- | @type@ declaration @@ -408,7 +408,7 @@ data TyClDecl pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnType', -- 'GHC.Parser.Annotation.AnnEqual', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation SynDecl { tcdSExt :: XSynDecl pass -- ^ Post renameer, FVs , tcdLName :: LIdP pass -- ^ Type constructor , tcdTyVars :: LHsQTyVars pass -- ^ Type variables; for an @@ -425,7 +425,7 @@ data TyClDecl pass -- 'GHC.Parser.Annotation.AnnNewType','GHC.Parser.Annotation.AnnDcolon' -- 'GHC.Parser.Annotation.AnnWhere', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation DataDecl { tcdDExt :: XDataDecl pass -- ^ Post renamer, CUSK flag, FVs , tcdLName :: LIdP pass -- ^ Type constructor , tcdTyVars :: LHsQTyVars pass -- ^ Type variables @@ -452,7 +452,7 @@ data TyClDecl pass -- 'GHC.Parser.Annotation.AnnComma' -- 'GHC.Parser.Annotation.AnnRarrow' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XTyClDecl !(XXTyClDecl pass) data FunDep pass @@ -797,14 +797,14 @@ data FamilyResultSig pass = -- see Note [FamilyResultSig] NoSig (XNoSig pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | KindSig (XCKindSig pass) (LHsKind pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : -- 'GHC.Parser.Annotation.AnnOpenP','GHC.Parser.Annotation.AnnDcolon', -- 'GHC.Parser.Annotation.AnnCloseP' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | TyVarSig (XTyVarSig pass) (LHsTyVarBndr () pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : @@ -812,7 +812,7 @@ data FamilyResultSig pass = -- see Note [FamilyResultSig] -- 'GHC.Parser.Annotation.AnnCloseP', 'GHC.Parser.Annotation.AnnEqual' | XFamilyResultSig !(XXFamilyResultSig pass) - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Located type Family Declaration @@ -838,7 +838,7 @@ data FamilyDecl pass = FamilyDecl -- 'GHC.Parser.Annotation.AnnEqual', 'GHC.Parser.Annotation.AnnRarrow', -- 'GHC.Parser.Annotation.AnnVbar' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Located Injectivity Annotation @@ -858,7 +858,7 @@ data InjectivityAnn pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : -- 'GHC.Parser.Annotation.AnnRarrow', 'GHC.Parser.Annotation.AnnVbar' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XInjectivityAnn !(XXInjectivityAnn pass) data FamilyInfo pass @@ -918,7 +918,7 @@ data HsDataDefn pass -- The payload of a data type defn dd_derivs :: HsDeriving pass -- ^ Optional 'deriving' clause - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation } | XHsDataDefn !(XXHsDataDefn pass) @@ -938,7 +938,7 @@ type LHsDerivingClause pass = XRec pass (HsDerivingClause pass) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : -- 'GHC.Parser.Annotation.AnnDeriving', 'GHC.Parser.Annotation.AnnStock', --- 'GHC.Parser.Annotation.AnnAnyClass', 'Api.AnnNewtype', +-- 'GHC.Parser.Annotation.AnnAnyClass', 'GHC.Parser.Annotation.AnnNewtype', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose' data HsDerivingClause pass -- See Note [Deriving strategies] in GHC.Tc.Deriv @@ -1021,7 +1021,7 @@ type LConDecl pass = XRec pass (ConDecl pass) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when -- in a GADT constructor list - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | -- @@ -1045,7 +1045,7 @@ type LConDecl pass = XRec pass (ConDecl pass) -- 'GHC.Parser.Annotation.AnnDarrow','GHC.Parser.Annotation.AnnDarrow', -- 'GHC.Parser.Annotation.AnnForall','GHC.Parser.Annotation.AnnDot' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | data Constructor Declaration data ConDecl pass @@ -1056,8 +1056,9 @@ data ConDecl pass -- The following fields describe the type after the '::' -- See Note [GADT abstract syntax] , con_bndrs :: XRec pass (HsOuterSigTyVarBndrs pass) - -- ^ The outermost type variable binders, be they explicit or implicit. - -- The 'XRec' is used to anchor API annotations, AnnForall and AnnDot. + -- ^ The outermost type variable binders, be they explicit or + -- implicit. The 'XRec' is used to anchor exact print + -- annotations, AnnForall and AnnDot. , con_mb_cxt :: Maybe (LHsContext pass) -- ^ User-written context (if any) , con_g_args :: HsConDeclGADTDetails pass -- ^ Arguments; never infix , con_res_ty :: LHsType pass -- ^ Result type @@ -1256,7 +1257,7 @@ type LTyFamInstEqn pass = XRec pass (TyFamInstEqn pass) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' -- when in a list --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Haskell Type Patterns type HsTyPats pass = [LHsTypeArg pass] @@ -1316,7 +1317,7 @@ data TyFamInstDecl pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnType', -- 'GHC.Parser.Annotation.AnnInstance', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XTyFamInstDecl !(XXTyFamInstDecl pass) ----------------- Data family instances ------------- @@ -1334,7 +1335,7 @@ newtype DataFamInstDecl pass -- 'GHC.Parser.Annotation.AnnWhere','GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ----------------- Family instances (common types) ------------- @@ -1357,7 +1358,7 @@ data FamEqn pass rhs -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnEqual' | XFamEqn !(XXFamEqn pass rhs) - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ----------------- Class instances ------------- @@ -1379,14 +1380,14 @@ data ClsInstDecl pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation } -- ^ -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnInstance', -- 'GHC.Parser.Annotation.AnnWhere', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XClsInstDecl !(XXClsInstDecl pass) ----------------- Instances of all kinds ------------- @@ -1437,10 +1438,10 @@ data DerivDecl pass = DerivDecl , deriv_overlap_mode :: Maybe (XRec pass OverlapMode) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDeriving', -- 'GHC.Parser.Annotation.AnnInstance', 'GHC.Parser.Annotation.AnnStock', - -- 'GHC.Parser.Annotation.AnnAnyClass', 'Api.AnnNewtype', + -- 'GHC.Parser.Annotation.AnnAnyClass', 'GHC.Parser.Annotation.AnnNewtype', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation } | XDerivDecl !(XXDerivDecl pass) @@ -1499,7 +1500,7 @@ data DefaultDecl pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId's : 'GHC.Parser.Annotation.AnnDefault', -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XDefaultDecl !(XXDefaultDecl pass) {- @@ -1537,7 +1538,7 @@ data ForeignDecl pass -- 'GHC.Parser.Annotation.AnnImport','GHC.Parser.Annotation.AnnExport', -- 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XForeignDecl !(XXForeignDecl pass) {- @@ -1687,7 +1688,7 @@ data RuleBndr pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnDcolon','GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation collectRuleBndrSigTys :: [RuleBndr pass] -> [HsPatSigType pass] collectRuleBndrSigTys bndrs = [ty | RuleBndrSig _ _ ty <- bndrs] @@ -1773,7 +1774,7 @@ data AnnDecl pass = HsAnnotation -- 'GHC.Parser.Annotation.AnnModule' -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XAnnDecl !(XXAnnDecl pass) -- | Annotation Provenance @@ -1811,5 +1812,5 @@ data RoleAnnotDecl pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnType', -- 'GHC.Parser.Annotation.AnnRole' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XRoleAnnotDecl !(XXRoleAnnotDecl pass) diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs index 2362ea8373..e7756cc804 100644 --- a/compiler/Language/Haskell/Syntax/Expr.hs +++ b/compiler/Language/Haskell/Syntax/Expr.hs @@ -188,7 +188,7 @@ type LHsExpr p = XRec p (HsExpr p) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when -- in a list - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ------------------------- {- Note [NoSyntaxExpr] @@ -310,7 +310,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLam', -- 'GHC.Parser.Annotation.AnnRarrow', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsLamCase (XLamCase p) (MatchGroup p (LHsExpr p)) -- ^ Lambda-case -- @@ -318,7 +318,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnCase','GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsApp (XApp p) (LHsExpr p) (LHsExpr p) -- ^ Application @@ -347,7 +347,7 @@ data HsExpr p -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnMinus' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | NegApp (XNegApp p) (LHsExpr p) (SyntaxExpr p) @@ -355,7 +355,7 @@ data HsExpr p -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsPar (XPar p) (LHsExpr p) -- ^ Parenthesised expr; see Note [Parens in HsSyn] @@ -371,7 +371,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- Note [ExplicitTuple] | ExplicitTuple (XExplicitTuple p) @@ -395,7 +395,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnOf','GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCase (XCase p) (LHsExpr p) (MatchGroup p (LHsExpr p)) @@ -405,7 +405,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnThen','GHC.Parser.Annotation.AnnSemi', -- 'GHC.Parser.Annotation.AnnElse', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsIf (XIf p) -- GhcPs: this is a Bool; False <=> do not use -- rebindable syntax (LHsExpr p) -- predicate @@ -417,7 +417,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnIf' -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsMultiIf (XMultiIf p) [LGRHS p (LHsExpr p)] -- | let(rec) @@ -426,7 +426,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@,'GHC.Parser.Annotation.AnnIn' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsLet (XLet p) (HsLocalBinds p) (LHsExpr p) @@ -436,7 +436,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnVbar', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsDo (XDo p) -- Type of the whole expression (HsStmtContext (HsDoRn p)) -- The parameterisation of the above is unimportant @@ -449,7 +449,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'['@, -- 'GHC.Parser.Annotation.AnnClose' @']'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- See Note [Empty lists] | ExplicitList (XExplicitList p) -- Gives type of components of list @@ -460,7 +460,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnDotdot','GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | RecordCon { rcon_ext :: XRecordCon p , rcon_con :: XRec p (ConLikeP p) -- The constructor @@ -473,7 +473,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnComma, 'GHC.Parser.Annotation.AnnDot', -- 'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | RecordUpd { rupd_ext :: XRecordUpd p , rupd_expr :: LHsExpr p @@ -512,7 +512,7 @@ data HsExpr p -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | ExprWithTySig (XExprWithTySig p) @@ -525,14 +525,14 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnComma','GHC.Parser.Annotation.AnnDotdot', -- 'GHC.Parser.Annotation.AnnClose' @']'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | ArithSeq (XArithSeq p) (Maybe (SyntaxExpr p)) -- For OverloadedLists, the fromList witness (ArithSeqInfo p) - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ----------------------------------------------------------- -- MetaHaskell Extensions @@ -541,7 +541,7 @@ data HsExpr p -- 'GHC.Parser.Annotation.AnnOpenE','GHC.Parser.Annotation.AnnOpenEQ', -- 'GHC.Parser.Annotation.AnnClose','GHC.Parser.Annotation.AnnCloseQ' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsBracket (XBracket p) (HsBracket p) -- See Note [Pending Splices] @@ -563,7 +563,7 @@ data HsExpr p -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsSpliceE (XSpliceE p) (HsSplice p) ----------------------------------------------------------- @@ -574,7 +574,7 @@ data HsExpr p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnProc', -- 'GHC.Parser.Annotation.AnnRarrow' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsProc (XProc p) (LPat p) -- arrow abstraction, proc (LHsCmdTop p) -- body of the abstraction @@ -584,7 +584,7 @@ data HsExpr p -- static pointers extension -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnStatic', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsStatic (XStatic p) -- Free variables of the body (LHsExpr p) -- Body @@ -655,7 +655,7 @@ data HsPragE p type LHsTupArg id = XRec id (HsTupArg id) -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Haskell Tuple Argument data HsTupArg id @@ -730,14 +730,15 @@ the RHS so that we can build the expression. Note [Located RdrNames] ~~~~~~~~~~~~~~~~~~~~~~~ -A number of syntax elements have seemingly redundant locations attached to them. -This is deliberate, to allow transformations making use of the API Annotations -to easily correlate a Located Name in the RenamedSource with a Located RdrName -in the ParsedSource. +A number of syntax elements have seemingly redundant locations +attached to them. This is deliberate, to allow transformations making +use of the exact print annotations to easily correlate a Located Name +in the RenamedSource with a Located RdrName in the ParsedSource. -There are unfortunately enough differences between the ParsedSource and the -RenamedSource that the API Annotations cannot be used directly with -RenamedSource, so this allows a simple mapping to be used based on the location. +There are unfortunately enough differences between the ParsedSource +and the RenamedSource that the exact print annotations cannot be used +directly with RenamedSource, so this allows a simple mapping to be +used based on the location. Note [ExplicitTuple] ~~~~~~~~~~~~~~~~~~~~ @@ -842,7 +843,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.Annrarrowtail','GHC.Parser.Annotation.AnnLarrowtail', -- 'GHC.Parser.Annotation.AnnRarrowtail' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation = HsCmdArrApp -- Arrow tail, or arrow application (f -< arg) (XCmdArrApp id) -- type of the arrow expressions f, -- of the form a t t', where arg :: t @@ -855,7 +856,7 @@ data HsCmd id -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpenB' @'(|'@, -- 'GHC.Parser.Annotation.AnnCloseB' @'|)'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdArrForm -- Command formation, (| e cmd1 .. cmdn |) (XCmdArrForm id) (LHsExpr id) -- The operator. @@ -876,14 +877,14 @@ data HsCmd id -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLam', -- 'GHC.Parser.Annotation.AnnRarrow', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdPar (XCmdPar id) (LHsCmd id) -- parenthesised command -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdCase (XCmdCase id) (LHsExpr id) @@ -892,7 +893,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.AnnOf','GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdLamCase (XCmdLamCase id) (MatchGroup id (LHsCmd id)) -- bodies are HsCmd's @@ -900,7 +901,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.AnnCase','GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdIf (XCmdIf id) (SyntaxExpr id) -- cond function @@ -912,7 +913,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.AnnThen','GHC.Parser.Annotation.AnnSemi', -- 'GHC.Parser.Annotation.AnnElse', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdLet (XCmdLet id) (HsLocalBinds id) -- let(rec) @@ -921,7 +922,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@,'GHC.Parser.Annotation.AnnIn' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsCmdDo (XCmdDo id) -- Type of the whole expression (XRec id [CmdLStmt id]) @@ -930,7 +931,7 @@ data HsCmd id -- 'GHC.Parser.Annotation.AnnVbar', -- 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XCmd !(XXCmd id) -- Note [Trees that Grow] extension point @@ -1009,7 +1010,7 @@ type LMatch id body = XRec id (Match id body) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnSemi' when in a -- list --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data Match p body = Match { m_ext :: XCMatch p body, @@ -1030,8 +1031,8 @@ so on. In order to simplify tooling processing and pretty print output, the provenance is captured in an HsMatchContext. -This is particularly important for the API Annotations for a multi-equation -FunBind. +This is particularly important for the exact print annotations for a +multi-equation FunBind. The parser initially creates a FunBind with a single Match in it for every function definition it sees. @@ -1042,11 +1043,12 @@ where all the Matches are combined. In the process, all the original FunBind fun_id's bar one are discarded, including the locations. -This causes a problem for source to source conversions via API -Annotations, so the original fun_ids and infix flags are preserved in +This causes a problem for source to source conversions via exact print +annotations, so the original fun_ids and infix flags are preserved in the Match, when it originates from a FunBind. -Example infix function definition requiring individual API Annotations +Example infix function definition requiring individual exact print +annotations (&&& ) [] [] = [] xs &&& [] = xs @@ -1071,7 +1073,7 @@ isInfixMatch match = case m_ctxt match of -- 'GHC.Parser.Annotation.AnnOpen','GHC.Parser.Annotation.AnnClose' -- 'GHC.Parser.Annotation.AnnRarrow','GHC.Parser.Annotation.AnnSemi' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data GRHSs p body = GRHSs { grhssExt :: XCGRHSs p body, @@ -1134,13 +1136,13 @@ type GhciStmt id = Stmt id (LHsExpr id) -- The SyntaxExprs in here are used *only* for do-notation and monad -- comprehensions, which have rebindable syntax. Otherwise they are unused. --- | API Annotations when in qualifier lists or guards +-- | Exact print annotations when in qualifier lists or guards -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnVbar', -- 'GHC.Parser.Annotation.AnnComma','GHC.Parser.Annotation.AnnThen', -- 'GHC.Parser.Annotation.AnnBy','GHC.Parser.Annotation.AnnBy', -- 'GHC.Parser.Annotation.AnnGroup','GHC.Parser.Annotation.AnnUsing' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data StmtLR idL idR body -- body should always be (LHs**** idR) = LastStmt -- Always the last Stmt in ListComp, MonadComp, -- and (after the renamer, see GHC.Rename.Expr.checkLastStmt) DoExpr, MDoExpr @@ -1158,7 +1160,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR) -- See Note [Monad Comprehensions] -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLarrow' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | BindStmt (XBindStmt idL idR body) -- ^ Post renaming has optional fail and bind / (>>=) operator. -- Post typechecking, also has multiplicity of the argument @@ -1192,7 +1194,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR) -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnLet' -- 'GHC.Parser.Annotation.AnnOpen' @'{'@,'GHC.Parser.Annotation.AnnClose' @'}'@, - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | LetStmt (XLetStmt idL idR body) (HsLocalBindsLR idL idR) -- ParStmts only occur in a list/monad comprehension @@ -1230,7 +1232,7 @@ data StmtLR idL idR body -- body should always be (LHs**** idR) -- Recursive statement (see Note [How RecStmt works] below) -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnRec' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | RecStmt { recS_ext :: XRecStmt idL idR body , recS_stmts :: XRec idR [LStmtLR idL idR body] diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs index cd9804b7f9..892e93892d 100644 --- a/compiler/Language/Haskell/Syntax/Extension.hs +++ b/compiler/Language/Haskell/Syntax/Extension.hs @@ -117,9 +117,10 @@ SrcSpans everywhere. instead of `Located (HsExpr p)` or similar types, we will now have `XRec p (HsExpr p)` -XRec allows annotating certain points in the AST with extra information. This -maybe be source spans (for GHC), nothing (for TH), types (for HIE files), api -annotations (for exactprint) or anything else. +XRec allows annotating certain points in the AST with extra +information. This maybe be source spans (for GHC), nothing (for TH), +types (for HIE files), exact print annotations (for exactprint) or +anything else. This should hopefully bring us one step closer to sharing the AST between GHC and TH. diff --git a/compiler/Language/Haskell/Syntax/Pat.hs b/compiler/Language/Haskell/Syntax/Pat.hs index 86f56f7ad8..4417026478 100644 --- a/compiler/Language/Haskell/Syntax/Pat.hs +++ b/compiler/Language/Haskell/Syntax/Pat.hs @@ -49,7 +49,7 @@ type LPat p = XRec p (Pat p) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnBang' --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data Pat p = ------------ Simple patterns --------------- WildPat (XWildPat p) -- ^ Wildcard Pattern @@ -65,13 +65,13 @@ data Pat p (LPat p) -- ^ Lazy Pattern -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnTilde' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | AsPat (XAsPat p) (LIdP p) (LPat p) -- ^ As pattern -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnAt' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | ParPat (XParPat p) (LPat p) -- ^ Parenthesised pattern @@ -79,12 +79,12 @@ data Pat p -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | BangPat (XBangPat p) (LPat p) -- ^ Bang pattern -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnBang' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ------------ Lists, tuples, arrays --------------- | ListPat (XListPat p) @@ -98,7 +98,7 @@ data Pat p -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'['@, -- 'GHC.Parser.Annotation.AnnClose' @']'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | TuplePat (XTuplePat p) -- after typechecking, holds the types of the tuple components @@ -136,7 +136,7 @@ data Pat p -- 'GHC.Parser.Annotation.AnnOpen' @'(#'@, -- 'GHC.Parser.Annotation.AnnClose' @'#)'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation ------------ Constructor patterns --------------- | ConPat { @@ -149,7 +149,7 @@ data Pat p ------------ View patterns --------------- -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnRarrow' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | ViewPat (XViewPat p) -- The overall type of the pattern -- (= the argument type of the view function) -- for hsPatType. @@ -161,7 +161,7 @@ data Pat p -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'$('@ -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | SplicePat (XSplicePat p) (HsSplice p) -- ^ Splice Pattern (Includes quasi-quotes) @@ -187,7 +187,7 @@ data Pat p -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnVal' @'+'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | NPlusKPat (XNPlusKPat p) -- Type of overall pattern (LIdP p) -- n+k pattern (XRec p (HsOverLit p)) -- It'll always be an HsIntegral @@ -202,7 +202,7 @@ data Pat p ------------ Pattern type signatures --------------- -- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | SigPat (XSigPat p) -- After typechecker: Type (LPat p) -- Pattern with a type signature (HsPatSigType (NoGhcTc p)) -- Signature can bind both @@ -274,7 +274,7 @@ type HsRecUpdField p = HsRecField' (AmbiguousFieldOcc p) (LHsExpr p) -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnEqual', -- --- For details on above see note [Api annotations] in GHC.Parser.Annotation +-- For details on above see note [exact print annotations] in GHC.Parser.Annotation data HsRecField' id arg = HsRecField { hsRecFieldAnn :: XHsRecField id, hsRecFieldLbl :: Located id, diff --git a/compiler/Language/Haskell/Syntax/Type.hs b/compiler/Language/Haskell/Syntax/Type.hs index 4263f9548c..f23072c04a 100644 --- a/compiler/Language/Haskell/Syntax/Type.hs +++ b/compiler/Language/Haskell/Syntax/Type.hs @@ -277,7 +277,7 @@ quantified in left-to-right order in kind signatures is nice since: -- | Located Haskell Context type LHsContext pass = XRec pass (HsContext pass) -- ^ 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnUnit' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Haskell Context type HsContext pass = [LHsType pass] @@ -287,7 +287,7 @@ type LHsType pass = XRec pass (HsType pass) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when -- in a list - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Haskell Kind type HsKind pass = HsType pass @@ -296,7 +296,7 @@ type HsKind pass = HsType pass type LHsKind pass = XRec pass (HsKind pass) -- ^ 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -------------------------------------------------- -- LHsQTyVars @@ -709,7 +709,7 @@ data HsTyVarBndr flag pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen', -- 'GHC.Parser.Annotation.AnnDcolon', 'GHC.Parser.Annotation.AnnClose' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XTyVarBndr !(XXTyVarBndr pass) @@ -730,7 +730,7 @@ data HsType pass } -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnForall', -- 'GHC.Parser.Annotation.AnnDot','GHC.Parser.Annotation.AnnDarrow' - -- For details on above see note [Api annotations] in "GHC.Parser.Annotation" + -- For details on above see note [exact print annotations] in "GHC.Parser.Annotation" | HsQualTy -- See Note [HsType binders] { hst_xqual :: XQualTy pass @@ -746,14 +746,14 @@ data HsType pass -- See Note [Located RdrNames] in GHC.Hs.Expr -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsAppTy (XAppTy pass) (LHsType pass) (LHsType pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsAppKindTy (XAppKindTy pass) -- type level type app (LHsType pass) @@ -765,14 +765,14 @@ data HsType pass (LHsType pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnRarrow', - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsListTy (XListTy pass) (LHsType pass) -- Element type -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'['@, -- 'GHC.Parser.Annotation.AnnClose' @']'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsTupleTy (XTupleTy pass) HsTupleSort @@ -780,20 +780,20 @@ data HsType pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'(' or '(#'@, -- 'GHC.Parser.Annotation.AnnClose' @')' or '#)'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsSumTy (XSumTy pass) [LHsType pass] -- Element types (length gives arity) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'(#'@, -- 'GHC.Parser.Annotation.AnnClose' '#)'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsOpTy (XOpTy pass) (LHsType pass) (LIdP pass) (LHsType pass) -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsParTy (XParTy pass) (LHsType pass) -- See Note [Parens in HsSyn] in GHC.Hs.Expr @@ -803,7 +803,7 @@ data HsType pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsIParamTy (XIParamTy pass) (XRec pass HsIPName) -- (?x :: ty) @@ -814,7 +814,7 @@ data HsType pass -- -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsStarTy (XStarTy pass) Bool -- Is this the Unicode variant? @@ -830,20 +830,20 @@ data HsType pass -- - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'('@, -- 'GHC.Parser.Annotation.AnnDcolon','GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsSpliceTy (XSpliceTy pass) (HsSplice pass) -- Includes quasi-quotes -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'$('@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsDocTy (XDocTy pass) (LHsType pass) LHsDocString -- A documented type -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsBangTy (XBangTy pass) HsSrcBang (LHsType pass) -- Bang-style type annotations @@ -852,14 +852,14 @@ data HsType pass -- 'GHC.Parser.Annotation.AnnClose' @'#-}'@ -- 'GHC.Parser.Annotation.AnnBang' @\'!\'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsRecTy (XRecTy pass) [LConDeclField pass] -- Only in data type declarations -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @'{'@, -- 'GHC.Parser.Annotation.AnnClose' @'}'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsExplicitListTy -- A promoted explicit list (XExplicitListTy pass) @@ -868,7 +868,7 @@ data HsType pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @"'["@, -- 'GHC.Parser.Annotation.AnnClose' @']'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsExplicitTupleTy -- A promoted explicit tuple (XExplicitTupleTy pass) @@ -876,18 +876,18 @@ data HsType pass -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen' @"'("@, -- 'GHC.Parser.Annotation.AnnClose' @')'@ - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsTyLit (XTyLit pass) HsTyLit -- A promoted numeric literal. -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | HsWildCardTy (XWildCardTy pass) -- A type wildcard -- See Note [The wildcard story for types] -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : None - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- For adding new constructors via Trees that Grow | XHsType @@ -1043,7 +1043,7 @@ type LConDeclField pass = XRec pass (ConDeclField pass) -- ^ May have 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnComma' when -- in a list - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation -- | Constructor Declaration Field data ConDeclField pass -- Record fields have Haddock docs on them @@ -1054,7 +1054,7 @@ data ConDeclField pass -- Record fields have Haddock docs on them cd_fld_doc :: Maybe LHsDocString } -- ^ - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnDcolon' - -- For details on above see note [Api annotations] in GHC.Parser.Annotation + -- For details on above see note [exact print annotations] in GHC.Parser.Annotation | XConDeclField !(XXConDeclField pass) -- | Describes the arguments to a data constructor. This is a common diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 2415e73db9..e1fcc88219 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -2688,7 +2688,7 @@ instance ExactPrint (TyClDecl GhcPs) where markEpAnn an AnnCloseC where top_matter = do - annotationsToComments (apiAnnAnns an) [AnnOpenP, AnnCloseP] + annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP] markEpAnn an AnnClass exactVanillaDeclHead an lclas tyvars fixity context unless (null fds) $ do @@ -3282,7 +3282,7 @@ instance ExactPrint (ConDecl GhcPs) where mapM_ markAnnotated doc mapM_ markAnnotated cons markEpAnn an AnnDcolon - annotationsToComments (apiAnnAnns an) [AnnOpenP, AnnCloseP] + annotationsToComments (epAnnAnns an) [AnnOpenP, AnnCloseP] -- when has_forall $ markEpAnn an AnnForall markAnnotated bndrs -- mapM_ markAnnotated qvars @@ -4011,12 +4011,6 @@ setLayoutOffsetP c = do debugM $ "setLayoutOffsetP:" ++ show c modify (\s -> s { pLHS = c }) --- getEofPos :: (Monad m, Monoid w) => EP w m RealSrcSpan --- getEofPos = do --- as <- gets epEpAnns --- case apiAnnEofPos as of --- Nothing -> return placeholderRealSpan --- Just ss -> return ss -- --------------------------------------------------------------------- ------------------------------------------------------------------------- diff --git a/utils/check-exact/Transform.hs b/utils/check-exact/Transform.hs index 740591250c..60a059cb3c 100644 --- a/utils/check-exact/Transform.hs +++ b/utils/check-exact/Transform.hs @@ -663,7 +663,7 @@ balanceCommentsMatch (L l (Match am mctxt pats (GRHSs xg grhss binds))) = do where simpleBreak (r,_) = r /= 0 (SrcSpanAnn an1 _loc1) = l - anc1 = addCommentOrigDeltas $ apiAnnComments an1 + anc1 = addCommentOrigDeltas $ epAnnComments an1 cs1f = getFollowingComments anc1 -- (move',stay') = break simpleBreak (commentsDeltas (anchorFromLocatedA (L l ())) cs1f) (move',stay') = break simpleBreak (trailingCommentsDeltas (anchorFromLocatedA (L l ())) cs1f) @@ -734,8 +734,8 @@ balanceComments' la1 la2 = do simpleBreak n (r,_) = r > n L (SrcSpanAnn an1 loc1) f = la1 L (SrcSpanAnn an2 loc2) s = la2 - anc1 = addCommentOrigDeltas $ apiAnnComments an1 - anc2 = addCommentOrigDeltas $ apiAnnComments an2 + anc1 = addCommentOrigDeltas $ epAnnComments an1 + anc2 = addCommentOrigDeltas $ epAnnComments an2 cs1f = getFollowingComments anc1 cs2b = priorComments anc2 (stay'',move') = break (simpleBreak 1) (priorCommentsDeltas (anchorFromLocatedA la2) cs2b) @@ -854,7 +854,7 @@ balanceSameLineComments (L la (Match anm mctxt pats (GRHSs x grhss lb))) = do (L lg (GRHS ga gs rhs):grs) -> (la'',reverse $ (L lg (GRHS ga' gs rhs)):grs,[(gac,(csp,csf))]) where (SrcSpanAnn an1 _loc1) = la - anc1 = addCommentOrigDeltas $ apiAnnComments an1 + anc1 = addCommentOrigDeltas $ epAnnComments an1 (EpAnn anc an _) = ga :: EpAnn' GrhsAnn (csp,csf) = case anc1 of AnnComments cs -> ([],cs) @@ -864,7 +864,7 @@ balanceSameLineComments (L la (Match anm mctxt pats (GRHSs x grhss lb))) = do stay = map snd stay' cs1 = AnnCommentsBalanced csp stay - gac = addCommentOrigDeltas $ apiAnnComments ga + gac = addCommentOrigDeltas $ epAnnComments ga gfc = getFollowingComments gac gac' = setFollowingComments gac (sort $ gfc ++ move) ga' = (EpAnn anc an gac') diff --git a/utils/check-ppr/Main.hs b/utils/check-ppr/Main.hs index 7a36446807..c08f6e755d 100644 --- a/utils/check-ppr/Main.hs +++ b/utils/check-ppr/Main.hs @@ -106,7 +106,7 @@ getPragmas (L _ (HsModule { hsmodAnn = anns'})) = pragmaStr tokComment _ = "" cmp (L l1 _) (L l2 _) = compare (anchor l1) (anchor l2) - comments' = map tokComment $ sortBy cmp $ priorComments $ apiAnnComments anns' + comments' = map tokComment $ sortBy cmp $ priorComments $ epAnnComments anns' pragmas = filter (\c -> isPrefixOf "{-#" c ) comments' pragmaStr = intercalate "\n" pragmas |