Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 7d94bb78 by Alan Zimmerman at 2026-08-09T15:21:29-04:00 EPA: Remove LocatedE, replace with LocatedA This gets rid of one more LocatedXXX occurrence - - - - - 24 changed files: - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Expr.hs - compiler/GHC/Hs/Pat.hs - compiler/GHC/Hs/Utils.hs - compiler/GHC/Iface/Ext/Ast.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Rename/Pat.hs - compiler/GHC/Unit/Module/Warnings.hs - testsuite/tests/ghc-api/exactprint/T22919.stderr - testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr - testsuite/tests/module/mod185.stderr - testsuite/tests/parser/should_compile/DumpParsedAst.stderr - testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr - testsuite/tests/parser/should_compile/DumpRenamedAst.stderr - testsuite/tests/parser/should_compile/DumpSemis.stderr - testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr - testsuite/tests/parser/should_compile/KindSigs.stderr - testsuite/tests/parser/should_compile/T20718.stderr - testsuite/tests/parser/should_compile/T20846.stderr - testsuite/tests/printer/Test20297.stdout - testsuite/tests/printer/Test24533.stdout - utils/check-exact/ExactPrint.hs Changes: ===================================== compiler/GHC/Hs/Decls.hs ===================================== @@ -1354,10 +1354,10 @@ type instance XForeignExport GhcTc = Coercion type instance XXForeignDecl (GhcPass _) = DataConCantHappen -type instance XCImport (GhcPass _) = LocatedE SourceText -- original source text for the C entity +type instance XCImport (GhcPass _) = LocatedA SourceText -- original source text for the C entity type instance XXForeignImport (GhcPass _) = DataConCantHappen -type instance XCExport (GhcPass _) = LocatedE SourceText -- original source text for the C entity +type instance XCExport (GhcPass _) = LocatedA SourceText -- original source text for the C entity type instance XXForeignExport (GhcPass _) = DataConCantHappen @@ -1610,6 +1610,6 @@ type instance Anno (WarnDecl (GhcPass p)) = SrcSpanAnnA type instance Anno (AnnDecl (GhcPass p)) = SrcSpanAnnA type instance Anno (RoleAnnotDecl (GhcPass p)) = SrcSpanAnnA type instance Anno (Maybe Role) = EpAnnCO -type instance Anno CCallConv = EpaLocation -type instance Anno Safety = EpaLocation -type instance Anno CExportSpec = EpaLocation +type instance Anno CCallConv = SrcSpanAnnA +type instance Anno Safety = SrcSpanAnnA +type instance Anno CExportSpec = SrcSpanAnnA ===================================== compiler/GHC/Hs/Expr.hs ===================================== @@ -2662,7 +2662,7 @@ type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p))))] = SrcSpanAnnA type instance Anno (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = SrcSpanAnnA type instance Anno (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = SrcSpanAnnA -type instance Anno [LocatedA (Pat (GhcPass p))] = EpaLocation +type instance Anno [LocatedA (Pat (GhcPass p))] = SrcSpanAnnA type instance Anno (GRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = EpAnnCO type instance Anno (GRHS (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = EpAnnCO type instance Anno (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr)))) = SrcSpanAnnA ===================================== compiler/GHC/Hs/Pat.hs ===================================== @@ -353,7 +353,7 @@ hsRecFieldId = hsRecFieldSel ************************************************************************ -} -instance (Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedE RecFieldsDotDot) +instance (Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedA RecFieldsDotDot) => Outputable (HsRecFields p arg) where ppr (HsRecFields { rec_flds = flds, rec_dotdot = Nothing }) = braces (fsep (punctuate comma (map ppr flds))) @@ -1178,4 +1178,4 @@ type instance Anno (Pat (GhcPass p)) = SrcSpanAnnA type instance Anno (HsOverLit (GhcPass p)) = EpAnnCO type instance Anno ConLike = SrcSpanAnnN type instance Anno (HsFieldBind lhs rhs) = SrcSpanAnnA -type instance Anno RecFieldsDotDot = EpaLocation +type instance Anno RecFieldsDotDot = SrcSpanAnnA ===================================== compiler/GHC/Hs/Utils.hs ===================================== @@ -179,7 +179,7 @@ mkSimpleMatch :: (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p)))) Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p)))) ~ EpAnn NoEpAnns) => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) - -> LocatedE [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) + -> LocatedA [LPat (GhcPass p)] -> LocatedA (body (GhcPass p)) -> LMatch (GhcPass p) (LocatedA (body (GhcPass p))) mkSimpleMatch ctxt (L l pats) rhs = L loc $ @@ -264,7 +264,7 @@ mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn mkHsAppTypes = foldl' mkHsAppType mkHsLam :: (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ (Origin, MatchGroupAnn)) - => LocatedE [LPat (GhcPass p)] + => LocatedA [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> LHsExpr (GhcPass p) mkHsLam (L l pats) body = mkHsPar (L (getLoc body) (HsLam noAnn LamSingle matches)) @@ -904,7 +904,7 @@ get_bind_spans binds sigs ------------ -- | Convenience function using 'mkFunBind'. -- This is for generated bindings only, do not use for user-written code. -mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedE [LPat GhcPs] +mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedA [LPat GhcPs] -> LHsExpr GhcPs -> LHsBind GhcPs mkSimpleGeneratedFunBind loc fun pats expr = L (noAnnSrcSpan loc) $ mkFunBind (Generated OtherExpansion SkipPmc) (L (noAnnSrcSpan loc) fun) @@ -923,7 +923,7 @@ mkPrefixFunRhs n an = FunRhs { mc_fun = n ------------ mkMatch :: forall p. IsPass p => HsMatchContext (LIdP (NoGhcTc (GhcPass p))) - -> LocatedE [LPat (GhcPass p)] + -> LocatedA [LPat (GhcPass p)] -> LHsExpr (GhcPass p) -> HsLocalBinds (GhcPass p) -> LMatch (GhcPass p) (LHsExpr (GhcPass p)) ===================================== compiler/GHC/Iface/Ext/Ast.hs ===================================== @@ -2212,15 +2212,15 @@ instance ToHie (LocatedA (ForeignDecl GhcRn)) where instance ToHie (ForeignImport GhcRn) where toHie (CImport (L c _) (L a _) (L b _) _ _) = concatM $ - [ locOnlyE a - , locOnlyE b - , locOnlyE c + [ locOnlyE (entry a) + , locOnlyE (entry b) + , locOnlyE (entry c) ] instance ToHie (ForeignExport GhcRn) where toHie (CExport (L b _) (L a _)) = concatM $ - [ locOnlyE a - , locOnlyE b + [ locOnlyE (entry a) + , locOnlyE (entry b) ] instance ToHie (LocatedA (WarnDecls GhcRn)) where ===================================== compiler/GHC/Parser.y ===================================== @@ -2086,7 +2086,7 @@ maybe_warning_pragma :: { Maybe (LWarningTxt GhcPs) } $2 (snd $ unLoc $3))} | {- empty -} { Nothing } -warning_category :: { Maybe (LocatedE (InWarningCategory GhcPs)) } +warning_category :: { Maybe (LocatedA (InWarningCategory GhcPs)) } : 'in' STRING { Just (reLoc $ sLL $1 $> $ InWarningCategory (epTok $1, getSTRINGs $2) (reLoc $ sL1 $2 $ mkWarningCategory (getSTRING $2))) } | {- empty -} { Nothing } ===================================== compiler/GHC/Parser/Annotation.hs ===================================== @@ -28,7 +28,7 @@ module GHC.Parser.Annotation ( -- ** Annotations in 'GenLocated' LocatedA, LocatedN, LocatedAn, - LocatedE, LocatedBF, + LocatedBF, SrcSpanAnnA, SrcSpanAnnN, SrcSpanAnnBF, @@ -442,8 +442,6 @@ type SrcSpanAnnN = EpAnn NameAnn type SrcSpanAnnBF = EpAnn AnnBooleanFormula -type LocatedE = GenLocated EpaLocation - -- | General representation of a 'GenLocated' type carrying a -- parameterised annotation type. type LocatedAn an = GenLocated (EpAnn an) @@ -840,8 +838,8 @@ widenSpanT :: SrcSpan -> EpToken tok -> SrcSpan widenSpanT l (EpTok loc) = widenSpanL l [loc] widenSpanT l NoEpTok = l -listLocation :: [LocatedAn an a] -> EpaLocation -listLocation as = EpaSpan (go noSrcSpan as) +listLocation :: [LocatedAn an a] -> SrcSpanAnnA +listLocation as = EpAnn (EpaSpan (go noSrcSpan as)) noAnn emptyComments where combine l r = combineSrcSpans l r ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -1518,7 +1518,7 @@ checkFunBind :: SrcSpan -> AnnFunRhs -> LocatedN RdrName -> LexicalFixity - -> LocatedE [LocatedA (PatBuilder GhcPs)] + -> LocatedA [LocatedA (PatBuilder GhcPs)] -> Located (GRHSs GhcPs (LHsExpr GhcPs)) -> P (HsBind GhcPs) checkFunBind locF ann_fun (L lf fun) is_infix (L lp pats) (L _ grhss) @@ -3214,7 +3214,7 @@ mkImport cconv safety (L loc sLit, v, ty) (timport, td) = -- the string "foo" is ambiguous: either a header or a C identifier. The -- C identifier case comes first in the alternatives below, so we pick -- that one. -parseCImport :: LocatedE CCallConv -> LocatedE Safety -> HText -> String +parseCImport :: LocatedA CCallConv -> LocatedA Safety -> HText -> String -> Located SourceText -> Maybe (ForeignImport GhcPs) parseCImport cconv safety nm str sourceText = ===================================== compiler/GHC/Rename/Pat.hs ===================================== @@ -859,7 +859,7 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) , hfbRHS = arg' , hfbPun = pun } } - rn_dotdot :: Maybe (LocatedE RecFieldsDotDot) -- See Note [DotDot fields] in GHC.Hs.Pat + rn_dotdot :: Maybe (LocatedA RecFieldsDotDot) -- See Note [DotDot fields] in GHC.Hs.Pat -> Maybe (WithUserRdr Name) -- The constructor (Nothing for an out of scope constructor) -> [LHsRecField GhcRn (LocatedA arg)] -- Explicit fields ===================================== compiler/GHC/Unit/Module/Warnings.hs ===================================== @@ -165,8 +165,8 @@ type instance XInWarningCategory (GhcPass _) = (EpToken "in", SourceText) type instance XXInWarningCategory (GhcPass _) = DataConCantHappen type instance Anno (WithHsDocIdentifiers (StringLiteral pass) pass) = SrcSpanAnnA -type instance Anno (InWarningCategory (GhcPass pass)) = EpaLocation -type instance Anno (WarningCategory) = EpaLocation +type instance Anno (InWarningCategory (GhcPass pass)) = SrcSpanAnnA +type instance Anno (WarningCategory) = SrcSpanAnnA type instance Anno (WarningTxt (GhcPass pass)) = SrcSpanAnnA deriving stock instance Eq (WarningTxt GhcPs) ===================================== testsuite/tests/ghc-api/exactprint/T22919.stderr ===================================== @@ -105,7 +105,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr ===================================== @@ -117,7 +117,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/module/mod185.stderr ===================================== @@ -129,7 +129,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/DumpParsedAst.stderr ===================================== @@ -2157,7 +2157,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr ===================================== @@ -125,7 +125,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -245,7 +249,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -391,7 +399,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -65,7 +65,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -293,7 +293,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -583,7 +587,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -831,7 +839,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -1036,7 +1048,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -1138,7 +1154,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -1242,7 +1262,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -1730,7 +1754,11 @@ [] [])) (L - (EpaSpan { DumpSemis.hs:32:3 }) + (EpAnn + (EpaSpan { DumpSemis.hs:32:3 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:32:3 }) @@ -1853,7 +1881,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -1976,7 +2008,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -2086,7 +2122,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -2208,7 +2248,11 @@ [] [])) (L - (EpaSpan { DumpSemis.hs:36:5 }) + (EpAnn + (EpaSpan { DumpSemis.hs:36:5 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:36:5 }) @@ -2311,7 +2355,11 @@ (NoExtField) (CaseAlt) (L - (EpaSpan { DumpSemis.hs:39:6 }) + (EpAnn + (EpaSpan { DumpSemis.hs:39:6 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:39:6 }) @@ -2383,7 +2431,11 @@ (NoExtField) (CaseAlt) (L - (EpaSpan { DumpSemis.hs:40:6 }) + (EpAnn + (EpaSpan { DumpSemis.hs:40:6 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:40:6 }) @@ -2458,7 +2510,11 @@ (NoExtField) (CaseAlt) (L - (EpaSpan { DumpSemis.hs:41:6 }) + (EpAnn + (EpaSpan { DumpSemis.hs:41:6 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:41:6 }) @@ -2536,7 +2592,11 @@ (NoExtField) (CaseAlt) (L - (EpaSpan { DumpSemis.hs:42:6 }) + (EpAnn + (EpaSpan { DumpSemis.hs:42:6 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { DumpSemis.hs:42:6 }) ===================================== testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr ===================================== @@ -1731,7 +1731,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/KindSigs.stderr ===================================== @@ -998,7 +998,11 @@ [] [])) (L - (EpaSpan { KindSigs.hs:23:5-7 }) + (EpAnn + (EpaSpan { KindSigs.hs:23:5-7 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { KindSigs.hs:23:5 }) @@ -1694,7 +1698,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/T20718.stderr ===================================== @@ -139,7 +139,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/parser/should_compile/T20846.stderr ===================================== @@ -133,7 +133,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/printer/Test20297.stdout ===================================== @@ -105,7 +105,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -233,7 +237,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -353,7 +361,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -539,7 +551,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -655,7 +671,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments @@ -769,7 +789,11 @@ [] [])) (L - (EpaSpan { <no location info> }) + (EpAnn + (EpaSpan { <no location info> }) + [] + (EpaComments + [])) []) (GRHSs (EpaComments ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -555,7 +555,11 @@ [] [])) (L - (EpaSpan { Test24533.hs:16:3-12 }) + (EpAnn + (EpaSpan { Test24533.hs:16:3-12 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { Test24533.hs:16:3-5 }) @@ -1124,7 +1128,11 @@ [] [])) (L - (EpaSpan { Test24533.ppr.hs:6:3-12 }) + (EpAnn + (EpaSpan { Test24533.ppr.hs:6:3-12 }) + [] + (EpaComments + [])) [(L (EpAnn (EpaSpan { Test24533.ppr.hs:6:3-5 }) ===================================== utils/check-exact/ExactPrint.hs ===================================== @@ -723,6 +723,11 @@ printStringAtMLocL an l s = do printStringAdvanceA :: (Monad m, Monoid w) => String -> EP w m () printStringAdvanceA str = printStringAtAA (EpaDelta noSrcSpan (SameLine 0) []) str >> return () +printStringAtA :: (Monad m, Monoid w) => EpAnn a -> String -> EP w m (EpAnn a) +printStringAtA ann s = do + l' <- printStringAtAA (entry ann) s + return ann { entry = l' } + printStringAtAA :: (Monad m, Monoid w) => EpaLocation -> String -> EP w m EpaLocation printStringAtAA el str = printStringAtAAC CaptureComments el str @@ -747,9 +752,13 @@ printStringAtAAC capture (EpaDelta ss d cs) s = do -- --------------------------------------------------------------------- -markExternalSourceTextE :: (Monad m, Monoid w) => EpaLocation -> SourceText -> String -> EP w m EpaLocation -markExternalSourceTextE l NoSourceText txt = printStringAtAA l txt -markExternalSourceTextE l (SourceText txt) _ = printStringAtAA l (unpackFS txt) +markExternalSourceTextA :: (Monad m, Monoid w) => EpAnn a -> SourceText -> String -> EP w m (EpAnn a) +markExternalSourceTextA ann src txt = do + l' <- mark_source_text ann src txt + return (ann { entry = l'}) + where + mark_source_text l NoSourceText txt' = printStringAtAA (entry l) txt' + mark_source_text l (SourceText txt') _ = printStringAtAA (entry l) (unpackFS txt') -- --------------------------------------------------------------------- @@ -1415,15 +1424,6 @@ instance (ExactPrint a) => ExactPrint (Located a) where exact (L l a) = L l <$> markAnnotated a -instance (ExactPrint a) => ExactPrint (LocatedE a) where - getAnnotationEntry (L l _) = Entry l [] emptyComments NoFlushComments CanUpdateAnchorOnly - setAnnotationAnchor (L _ a) anc _ts _cs = L anc a - - exact (L la a) = do - debugM $ "LocatedE a:la loc=" ++ show (ss2range $ locA la) - a' <- markAnnotated a - return (L la a') - instance (ExactPrint a) => ExactPrint (LocatedA a) where getAnnotationEntry = entryFromLocatedA setAnnotationAnchor la anc ts cs = setAnchorAn la anc ts cs @@ -1865,11 +1865,11 @@ instance ExactPrint (ForeignImport GhcPs) where setAnnotationAnchor a _ _ _ = a exact (CImport (L ls src) cconv safety@(L l _) mh imp) = do cconv' <- markAnnotated cconv - safety' <- if notDodgyE l + safety' <- if notDodgyE (entry l) then markAnnotated safety else return safety - ls' <- if notDodgyE ls - then markExternalSourceTextE ls src "" + ls' <- if notDodgyE (entry ls) + then markExternalSourceTextA ls src "" else return ls return (CImport (L ls' src) cconv' safety' mh imp) @@ -1881,8 +1881,8 @@ instance ExactPrint (ForeignExport GhcPs) where exact (CExport (L ls src) spec) = do debugM $ "CExport starting" spec' <- markAnnotated spec - ls' <- if notDodgyE ls - then markExternalSourceTextE ls src "" + ls' <- if notDodgyE (entry ls) + then markExternalSourceTextA ls src "" else return ls return (CExport (L ls' src) spec') @@ -3212,7 +3212,7 @@ instance (ExactPrint body) => ExactPrint (HsRecFields GhcPs body) where mdot' <- case mdot of Nothing -> return Nothing Just (L ss d) -> do - ss' <- printStringAtAA ss ".." + ss' <- printStringAtA ss ".." return $ Just (L ss' d) -- Note: mdot contains the SrcSpan where the ".." appears, if present cc' <- markEpToken cc View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7d94bb78dc06ea7d6d70f3488a9f72b8... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7d94bb78dc06ea7d6d70f3488a9f72b8... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help