Alan Zimmerman pushed to branch wip/az/epa-tidy-locatedxxx-25 at Glasgow Haskell Compiler / GHC Commits: 53eead15 by Wolfgang Jeltsch at 2026-09-24T20:12:03-04:00 Correct the documentation of `explicitUnits` Resolves #27787. - - - - - 35bf6f4b by Simon Jakobi at 2026-09-24T20:12:49-04:00 Remove stale specHeader bullet from Note [Don't make fillers for constraint types] The Note said that Specialise.specHeader also calls mkAbsentFiller. abfc224a27c removed that call: the specialiser no longer drops dead arguments at all, see Note [Do not drop dead args from specialisations] in GHC.Core.Opt.Specialise. Assisted-by: Claude Fable 5.1 - - - - - e80748e9 by Alan Zimmerman at 2026-09-25T13:19:51+01:00 EPA: Add specific layout field to AnnList Up to now AnnList has effectively served to represent lists of things having layout, regardless of whether they do or not. In Haskell, layout is optional in many places, as there is also an alternative syntax using braces and semi-colons, which is free-form. This commit introduces AnnListLayout, a data structure capturing this distinction. It is deliberately set up similarly to EpLayout, so that these two can be merged in time. The transition is done mechanically, where AnnListBraces is not used yet, the original Nothing case maps to AnnListNoLayout, and the Just case to AnnListLayout. Later commits will fine tune these against the actual parser layout. - - - - - 21 changed files: - compiler/GHC/Core/Opt/WorkWrap/Utils.hs - compiler/GHC/Parser.y - compiler/GHC/Parser/Annotation.hs - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Unit/State.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/KindSigs.stderr - testsuite/tests/parser/should_compile/T15279.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 - utils/check-exact/Main.hs - utils/check-exact/Transform.hs Changes: ===================================== compiler/GHC/Core/Opt/WorkWrap/Utils.hs ===================================== @@ -1367,13 +1367,8 @@ It's surprisingly subtle. application; see test `T27627f`. TL;DR: we play safe: we never make an absent filler for any /constraint-kinded/ type, -using `isPredTy` to decide. - - * `mkAbsentFiller` returns `Nothing` for any constraint type, so worker/wrapper - keeps the real argument. - - * `Specialise.specHeader` calls `mkAbsentFiller` too, so it likewise keeps the - dead dictionary argument rather than dropping it for a filler. +using `isPredTy` to decide: `mkAbsentFiller` returns `Nothing` for any constraint +type, so worker/wrapper keeps the real argument. Prior failed approaches ===================================== compiler/GHC/Parser.y ===================================== @@ -1796,10 +1796,10 @@ cvars1 :: { [RecordPatSynField GhcPs] } where_decls :: { LocatedA (OrdList (LHsDecl GhcPs), EpToken "where", AnnList) } : 'where' '{' decls '}' {% amsA' (sLL $1 $> (thdOf3 $ unLoc $3, epTok $1, - AnnList (Just (fstOf3 $ unLoc $3)) (ListBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) } + AnnList (AnnListLayout (fstOf3 $ unLoc $3)) (ListBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) } | 'where' vocurly decls close {% amsA' (sLL $1 $3 (thdOf3 $ unLoc $3, epTok $1, - AnnList (Just (fstOf3 $ unLoc $3)) ListNone (sndOf3 $ unLoc $3))) } + AnnList (AnnListLayout (fstOf3 $ unLoc $3)) ListNone (sndOf3 $ unLoc $3))) } pattern_synonym_sig :: { LSig GhcPs } : 'pattern' con_list '::' sigtype @@ -1935,9 +1935,9 @@ decls :: { Located (EpaLocation, [EpToken ";"], OrdList (LHsDecl GhcPs)) } | {- empty -} { noLoc (noAnn, [],nilOL) } decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) } - : '{' decls '}' { sLL $1 $> (AnnList (Just (fstOf3 $ unLoc $2)) (ListBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2) + : '{' decls '}' { sLL $1 $> (AnnList (AnnListLayout (fstOf3 $ unLoc $2)) (ListBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2) ,sL1 $2 $ thdOf3 $ unLoc $2) } - | vocurly decls close { sL1 $2 (AnnList (Just (fstOf3 $ unLoc $2)) ListNone (sndOf3 $ unLoc $2) + | vocurly decls close { sL1 $2 (AnnList (AnnListLayout (fstOf3 $ unLoc $2)) ListNone (sndOf3 $ unLoc $2) ,sL1 $2 $ thdOf3 $ unLoc $2) } -- Binding groups other than those of class and instance declarations @@ -1945,16 +1945,16 @@ decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) } binds :: { Located (HsLocalBinds GhcPs) } -- May have implicit parameters -- No type declarations - : decllist {% do { let { (AnnList anc p s, decls) = unLoc $1 } + : decllist {% do { let { (AnnList la p s, decls) = unLoc $1 } ; val_binds <- cvBindGroup (unLoc $ decls) ; !cs <- getCommentsFor (gl $1) - ; return (sL1 $1 $ HsValBinds (EpAnn (glR $1) (AnnList anc p s) cs, noEpTok) val_binds)} } + ; return (sL1 $1 $ HsValBinds (EpAnn (glR $1) (AnnList la p s) cs, noEpTok) val_binds)} } | '{' dbinds '}' {% acs (comb3 $1 $2 $3) (\loc cs -> (L loc - $ HsIPBinds (EpAnn (spanAsAnchor (comb3 $1 $2 $3)) (AnnList (Just$ glR $2) (ListBraces (epTok $1) (epTok $3)) []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) } + $ HsIPBinds (EpAnn (spanAsAnchor (comb3 $1 $2 $3)) (AnnList (AnnListLayout$ glR $2) (ListBraces (epTok $1) (epTok $3)) []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) } | vocurly dbinds close {% acs (gl $2) (\loc cs -> (L loc - $ HsIPBinds (EpAnn (glR $1) (AnnList (Just $ glR $2) ListNone []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) } + $ HsIPBinds (EpAnn (glR $1) (AnnList (AnnListLayout $ glR $2) ListNone []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) } wherebinds :: { Maybe (Located (HsLocalBinds GhcPs, Maybe EpAnnComments )) } @@ -3542,11 +3542,11 @@ guardquals1 :: { Located [LStmt GhcPs (LHsExpr GhcPs)] } altslist(PATS) :: { forall b. DisambECP b => PV (LocatedA ([LMatch GhcPs (LocatedA b)], AnnList)) } : '{' alts(PATS) '}' { $2 >>= \ $2 -> amsA' (sLL $1 $> (reverse (snd $ unLoc $2), - (AnnList (Just $ glR $2) (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) } + (AnnList (AnnListLayout $ glR $2) (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) } | vocurly alts(PATS) close { $2 >>= \ $2 -> amsA' (L (getLoc $2) (reverse (snd $ unLoc $2), - (AnnList (Just $ glR $2) ListNone (fst $ unLoc $2)))) } - | '{' '}' { amsA' (sLL $1 $> ([], (AnnList Nothing (ListBraces (epTok $1) (epTok $2)) []))) } + (AnnList (AnnListLayout $ glR $2) ListNone (fst $ unLoc $2)))) } + | '{' '}' { amsA' (sLL $1 $> ([], (AnnList AnnListNoLayout (ListBraces (epTok $1) (epTok $2)) []))) } | vocurly close { return $ noLocA ([], noAnn) } alts(PATS) :: { forall b. DisambECP b => PV (Located ([EpToken ";"],[LMatch GhcPs (LocatedA b)])) } @@ -3656,10 +3656,10 @@ apat : aexp {% (checkPattern <=< runPV) (unECP $1) } stmtlist :: { forall b. DisambECP b => PV (LocatedA (AnnList, Located [LocatedA (Stmt GhcPs (LocatedA b))])) } : '{' stmts '}' { $2 >>= \ $2 -> - amsA' (sLL $1 $> (AnnList (Just (spanAsAnchor $ stmtsLoc $2)) (ListBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2) + amsA' (sLL $1 $> (AnnList (AnnListLayout (spanAsAnchor $ stmtsLoc $2)) (ListBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2) , sL1 $2 $ reverse $ snd $ unLoc $2))} | vocurly stmts close { $2 >>= \ $2 -> - amsA' (L (stmtsLoc $2) (AnnList (Just (spanAsAnchor $ stmtsLoc $2)) ListNone (fromOL $ fst $ unLoc $2) + amsA' (L (stmtsLoc $2) (AnnList (AnnListLayout (spanAsAnchor $ stmtsLoc $2)) ListNone (fromOL $ fst $ unLoc $2) , sL1 $2 $ reverse $ snd $ unLoc $2))} -- do { ;; s ; s ; ; s ;; } @@ -4630,9 +4630,6 @@ glEEz !x !y = if isZeroWidthSpan (getHasLoc y) then spanAsAnchor (getHasLoc x) else spanAsAnchor $ comb2 x y -glRM :: Located a -> Maybe EpaLocation -glRM (L !l _) = Just $ spanAsAnchor l - n2l :: LocatedN a -> LocatedA a n2l (L !la !a) = L (l2l la) a ===================================== compiler/GHC/Parser/Annotation.hs ===================================== @@ -31,10 +31,6 @@ module GHC.Parser.Annotation ( SrcSpanAnnA, SrcSpanAnnN, -- ** Annotation data types used in 'GenLocated' - - AnnList(..), AnnListBrackets(..), - AnnParen(..), - AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..), NameAnn(..), NameAdornment(..), NoEpAnns(..), @@ -43,6 +39,12 @@ module GHC.Parser.Annotation ( addTrailingAnnToA, addTrailingCommaToN, noTrailingN, + -- ** Annotation data types used in TTG extension points + + AnnList(..), AnnListBrackets(..), AnnListLayout(..), + AnnParen(..), + AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..), + -- ** Utilities for converting between different 'GenLocated' when -- ** we do not care about the annotations. l2l, la2la, @@ -513,7 +515,7 @@ instance Outputable TrailingAnn where -- AZ: goal: only used when there is layout, so vertical alignment matters data AnnList = AnnList { - al_anchor :: !(Maybe EpaLocation), -- ^ start point of a list having layout + al_layout :: !AnnListLayout, al_brackets :: !AnnListBrackets, al_semis :: [EpToken ";"] -- decls } deriving (Data,Eq) @@ -523,6 +525,18 @@ data AnnListBrackets | ListNone deriving (Data,Eq) +-- | How the extent of a list was delimited in the source. +data AnnListLayout + = AnnListBraces -- ^ Explicit @{ ; }@ written by the user. The tokens + -- live in 'al_brackets' and 'al_semis'. + | AnnListLayout !EpaLocation + -- ^ The lexer opened an implicit layout context. + -- The 'EpaLocation' is the @vocurly@ token (or, for + -- MultiWayIf, the leading @|@), whose start column is + -- the layout column chosen by 'new_layout_context'. + | AnnListNoLayout -- ^ Neither: an Empty or compiler-generated list. + deriving (Data, Eq) + -- --------------------------------------------------------------------- -- Annotations for parenthesised elements, such as tuples, lists -- --------------------------------------------------------------------- @@ -993,7 +1007,10 @@ instance NoAnn NoEpAnns where noAnn = NoEpAnns instance NoAnn AnnList where - noAnn = AnnList Nothing ListNone noAnn + noAnn = AnnList noAnn ListNone noAnn + +instance NoAnn AnnListLayout where + noAnn = AnnListNoLayout instance NoAnn NameAnn where noAnn = NameAnnTrailing [] @@ -1094,6 +1111,11 @@ instance Outputable AnnListBrackets where ppr (ListBraces o c) = text "ListBraces" <+> ppr o <+> ppr c ppr ListNone = text "ListNone" +instance Outputable AnnListLayout where + ppr AnnListBraces = text "AnnListBraces" + ppr (AnnListLayout l) = text "AnnListLayout" <+> ppr l + ppr AnnListNoLayout = text "AnnListNoLayout" + instance Outputable AnnCType where ppr (AnnCType o c l ca) = text "AnnCType" <+> ppr o <+> ppr c <+> ppr l ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -466,7 +466,7 @@ add_where w@(EpTok (EpaSpan (RealSrcSpan rs _))) (EpAnn a al cs) cs2 = (EpAnn (widenAnchorT a w) al (cs Semi.<> cs2), w) | otherwise = (EpAnn (patch_anchor rs a) - (al { al_anchor = (fmap (patch_anchor rs) (al_anchor al))}) + (al { al_layout = patch_layout (al_layout al)}) (cs Semi.<> cs2), w) add_where _ _ _ = panic "add_where" -- EpaDelta should only be used for transformations @@ -484,6 +484,12 @@ patch_anchor r1 (EpaSpan (RealSrcSpan r0 mb)) = EpaSpan (RealSrcSpan r mb) r = if srcSpanStartLine r0 < 0 then r1 else r0 patch_anchor _ (EpaSpan ss) = EpaSpan ss +-- If the decl list for where binds is empty, the anchor ends up +-- invalid. Explicitly mark it as not having layout +patch_layout :: AnnListLayout -> AnnListLayout +patch_layout (AnnListLayout _) = AnnListNoLayout +patch_layout lo = lo + -- | The anchor for a stmtlist is based on either the location or -- the first semicolon annotion. stmtsAnchor :: Located (OrdList (EpToken tok),a) -> Maybe EpaLocation ===================================== compiler/GHC/Unit/State.hs ===================================== @@ -369,10 +369,15 @@ data UnitState = UnitState { -- is always mentioned before the units it depends on. preloadUnits :: [UnitId], - -- | Units which we explicitly depend on (from a command line flag). - -- We'll use this to generate version macros and the unused packages warning. The - -- original flag which was used to bring the unit into scope is recorded for the - -- -Wunused-packages warning. + -- | The units that can be used by the respective home unit. Despite the + -- identifier, this does not just cover units that are enabled explicitly + -- using flags but also units from the package database that are enabled + -- implicitly in case @-hide-all-packages@ is absent. The former are paired + -- with 'Just' applied to the respective flags, the latter are paired with + -- 'Nothing'. + -- + -- This field is used for generating version macros and “unused packages” + -- warnings. explicitUnits :: [(Unit, Maybe PackageArg)], homeUnitDepends :: Set UnitId, @@ -907,7 +912,7 @@ mkUnitState logger unit_index cfg = do let pkgname_map = listToUFM [ (unitPackageName p, unitInstanceOf p) | p <- pkgs2 ] - -- The explicitUnits accurately reflects the set of units we have turned + -- The explicitUnits accurately reflects the set of units that are turned -- on; as such, it also is the only way one can come up with requirements. -- The requirement context is directly based off of this: we simply -- look for nested unit IDs that are directly fed holes: the requirements ===================================== testsuite/tests/ghc-api/exactprint/T22919.stderr ===================================== @@ -70,7 +70,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr ===================================== @@ -82,7 +82,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/module/mod185.stderr ===================================== @@ -97,7 +97,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/DumpParsedAst.stderr ===================================== @@ -2223,7 +2223,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr ===================================== @@ -90,7 +90,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -213,7 +213,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -291,7 +291,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { DumpParsedAstComments.hs:16:3 })) (ListNone) [])) @@ -361,7 +361,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/DumpRenamedAst.stderr ===================================== @@ -30,7 +30,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/DumpSemis.stderr ===================================== @@ -261,7 +261,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -333,7 +333,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:(11,3)-(12,3) })) (ListNone) [])) @@ -364,7 +364,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:11:8-13 })) (ListBraces (EpTok (EpaSpan { DumpSemis.hs:11:6 })) @@ -555,7 +555,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -627,7 +627,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:(16,5)-(18,5) })) (ListBraces (EpTok (EpaSpan { DumpSemis.hs:16:3 })) @@ -808,7 +808,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -880,7 +880,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:22:12-28 })) (ListBraces (EpTok (EpaSpan { DumpSemis.hs:22:10 })) @@ -1017,7 +1017,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1122,7 +1122,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1229,7 +1229,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1731,7 +1731,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1857,7 +1857,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1936,7 +1936,7 @@ (EpAnn (EpaSpan { DumpSemis.hs:34:13-31 }) (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:34:18-30 })) (ListBraces (EpTok (EpaSpan { DumpSemis.hs:34:13 })) @@ -1984,7 +1984,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -2097,7 +2097,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -2222,7 +2222,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -2333,7 +2333,7 @@ ((,) (FromSource) (AnnList - (Just + (AnnListLayout (EpaSpan { DumpSemis.hs:(38,6)-(43,13) })) (ListBraces (EpTok (EpaSpan { DumpSemis.hs:38:4 })) ===================================== testsuite/tests/parser/should_compile/KindSigs.stderr ===================================== @@ -1000,7 +1000,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1719,7 +1719,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/T15279.stderr ===================================== @@ -8,14 +8,15 @@ (EpAnn (EpaSpan { T15279.hs:1:1 }) (AnnsModule - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) (EpTok (EpaSpan { T15279.hs:3:1-6 })) (EpTok (EpaSpan { T15279.hs:3:15-19 })) ((,,) - (NoEpTok) - (NoEpTok) + (EpTok (EpaSpan { <no location info> })) + (EpTok (EpaSpan { <no location info> })) []) [] [] @@ -100,7 +101,8 @@ (EpaComments [])) (HsTyVar - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) (NotPromoted) (L (EpAnn @@ -118,7 +120,8 @@ (EpaComments [])) (HsTyVar - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) (NotPromoted) (L (EpAnn @@ -152,7 +155,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -182,7 +185,8 @@ (Prefix) (NoSrcStrict) (AnnFunRhs - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) [] [])) (L @@ -258,7 +262,8 @@ (Prefix) (NoSrcStrict) (AnnFunRhs - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) [] [])) (L @@ -334,7 +339,8 @@ (Prefix) (NoSrcStrict) (AnnFunRhs - (NoEpTok) + (EpTok + (EpaSpan { <no location info> })) [] [])) (L ===================================== testsuite/tests/parser/should_compile/T20718.stderr ===================================== @@ -104,7 +104,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/parser/should_compile/T20846.stderr ===================================== @@ -94,7 +94,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== testsuite/tests/printer/Test20297.stdout ===================================== @@ -70,7 +70,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -161,8 +161,7 @@ (EpAnn (EpaSpan { <no location info> }) (AnnList - (Just - (EpaSpan { Test20297.hs:7:3-7 })) + (AnnListNoLayout) (ListNone) []) (EpaComments @@ -201,7 +200,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -286,7 +285,7 @@ (EpAnn (EpaSpan { Test20297.hs:(10,3)-(11,26) }) (AnnList - (Just + (AnnListLayout (EpaSpan { Test20297.hs:11:9-26 })) (ListNone) []) @@ -324,7 +323,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -396,7 +395,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { Test20297.hs:11:22-26 })) (ListNone) [])) @@ -513,7 +512,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -598,8 +597,7 @@ (EpAnn (EpaSpan { <no location info> }) (AnnList - (Just - (EpaSpan { Test20297.ppr.hs:5:3-7 })) + (AnnListNoLayout) (ListNone) []) (EpaComments @@ -632,7 +630,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -717,7 +715,7 @@ (EpAnn (EpaSpan { Test20297.ppr.hs:(8,3)-(9,24) }) (AnnList - (Just + (AnnListLayout (EpaSpan { Test20297.ppr.hs:9:7-24 })) (ListNone) []) @@ -749,7 +747,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -821,7 +819,7 @@ ((,) (Right (AnnList - (Just + (AnnListLayout (EpaSpan { Test20297.ppr.hs:9:20-24 })) (ListNone) [])) ===================================== testsuite/tests/printer/Test24533.stdout ===================================== @@ -534,7 +534,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L @@ -1121,7 +1121,7 @@ ((,) (FromSource) (AnnList - (Nothing) + (AnnListNoLayout) (ListNone) [])) (L ===================================== utils/check-exact/ExactPrint.hs ===================================== @@ -231,7 +231,7 @@ setAnchorAn (L (EpAnn _ an _) a) anc ts cs = (L (EpAnn anc (setTrailing an ts) c -- `debug` ("setAnchorAn: anc=" ++ showAst anc) setAnchorEpaL :: EpAnn AnnList -> EpaLocation -> [TrailingAnn] -> EpAnnComments -> EpAnn AnnList -setAnchorEpaL (EpAnn _ an _) anc ts cs = EpAnn anc (setTrailing (an {al_anchor = Nothing}) ts) cs +setAnchorEpaL (EpAnn _ an _) anc ts cs = EpAnn anc (setTrailing (an {al_layout = AnnListNoLayout}) ts) cs -- --------------------------------------------------------------------- @@ -2672,8 +2672,8 @@ instance ExactPrint (HsLocalBinds GhcPs) where exact (HsValBinds (an0, w) valbinds) = do w' <- markEpToken w -- 'where' - case al_anchor $ anns an0 of - Just anc -> do + case al_layout $ anns an0 of + AnnListLayout anc -> do when (not $ isEmptyValBinds valbinds) $ setExtraDP (Just anc) _ -> return () @@ -2684,7 +2684,7 @@ instance ExactPrint (HsLocalBinds GhcPs) where Nothing -> return an1 Just (ss,dp) -> do setExtraDPReturn Nothing - return $ an1 { anns = (anns an1) { al_anchor = Just (EpaDelta ss dp []) }} + return $ an1 { anns = (anns an1) { al_layout = AnnListLayout (EpaDelta ss dp []) }} return (HsValBinds (an2, w') valbinds') exact (HsIPBinds (an,w) bs) = do ===================================== utils/check-exact/Main.hs ===================================== @@ -521,8 +521,8 @@ changeLocalDecls libdir (L l p) = do let oldDecls' = captureLineSpacing oldDecls let (VbSig o:oldBinds) = map wrapValBind oldDecls' o' = setEntryDP o (DifferentLine 2 0) - let (EpAnn anc (AnnList (Just _) a b) cs) = van - let van' = (EpAnn anc (AnnList (Just (EpaDelta noSrcSpan (DifferentLine 1 4) [])) a b) cs) + let (EpAnn anc (AnnList (AnnListLayout _) a b) cs) = van + let van' = (EpAnn anc (AnnList (AnnListLayout (EpaDelta noSrcSpan (DifferentLine 1 4) [])) a b) cs) let binds' = (HsValBinds (van',w) (ValBinds noExtField (VbSig sig':VbBind decl':VbSig o':oldBinds))) return (L lm (Match an mln pats (GRHSs emptyComments rhs binds'))) @@ -548,7 +548,7 @@ changeLocalDecls2 libdir (L l p) = do let anc = (EpaDelta noSrcSpan (DifferentLine 1 2) []) let anc2 = (EpaDelta noSrcSpan (DifferentLine 1 4) []) let an = (EpAnn anc - (AnnList (Just anc2) ListNone + (AnnList (AnnListLayout anc2) ListNone []) emptyComments, EpTok (EpaDelta noSrcSpan (SameLine 0) [])) let decls = [VbSig sig', VbBind decl'] ===================================== utils/check-exact/Transform.hs ===================================== @@ -1046,7 +1046,7 @@ newWhereAnnotation ww = (an, w) WithWhere -> EpTok (EpaDelta noSrcSpan (SameLine 0) []) WithoutWhere -> noEpTok an = EpAnn anc - (AnnList (Just anc2) ListNone []) + (AnnList (AnnListLayout anc2) ListNone []) emptyComments -- --------------------------------------------------------------------- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bd9b258a7d8c36002594c421b88d886... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/bd9b258a7d8c36002594c421b88d886... 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