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
-
35bf6f4b
by Simon Jakobi at 2026-09-24T20:12:49-04:00
-
e80748e9
by Alan Zimmerman at 2026-09-25T13:19:51+01:00
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:
| ... | ... | @@ -1367,13 +1367,8 @@ It's surprisingly subtle. |
| 1367 | 1367 | application; see test `T27627f`.
|
| 1368 | 1368 | |
| 1369 | 1369 | TL;DR: we play safe: we never make an absent filler for any /constraint-kinded/ type,
|
| 1370 | -using `isPredTy` to decide.
|
|
| 1371 | - |
|
| 1372 | - * `mkAbsentFiller` returns `Nothing` for any constraint type, so worker/wrapper
|
|
| 1373 | - keeps the real argument.
|
|
| 1374 | - |
|
| 1375 | - * `Specialise.specHeader` calls `mkAbsentFiller` too, so it likewise keeps the
|
|
| 1376 | - dead dictionary argument rather than dropping it for a filler.
|
|
| 1370 | +using `isPredTy` to decide: `mkAbsentFiller` returns `Nothing` for any constraint
|
|
| 1371 | +type, so worker/wrapper keeps the real argument.
|
|
| 1377 | 1372 | |
| 1378 | 1373 | Prior failed approaches
|
| 1379 | 1374 |
| ... | ... | @@ -1796,10 +1796,10 @@ cvars1 :: { [RecordPatSynField GhcPs] } |
| 1796 | 1796 | where_decls :: { LocatedA (OrdList (LHsDecl GhcPs), EpToken "where", AnnList) }
|
| 1797 | 1797 | : 'where' '{' decls '}' {% amsA' (sLL $1 $> (thdOf3 $ unLoc $3,
|
| 1798 | 1798 | epTok $1,
|
| 1799 | - AnnList (Just (fstOf3 $ unLoc $3)) (ListBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) }
|
|
| 1799 | + AnnList (AnnListLayout (fstOf3 $ unLoc $3)) (ListBraces (epTok $2) (epTok $4)) (sndOf3 $ unLoc $3))) }
|
|
| 1800 | 1800 | | 'where' vocurly decls close {% amsA' (sLL $1 $3 (thdOf3 $ unLoc $3,
|
| 1801 | 1801 | epTok $1,
|
| 1802 | - AnnList (Just (fstOf3 $ unLoc $3)) ListNone (sndOf3 $ unLoc $3))) }
|
|
| 1802 | + AnnList (AnnListLayout (fstOf3 $ unLoc $3)) ListNone (sndOf3 $ unLoc $3))) }
|
|
| 1803 | 1803 | |
| 1804 | 1804 | pattern_synonym_sig :: { LSig GhcPs }
|
| 1805 | 1805 | : 'pattern' con_list '::' sigtype
|
| ... | ... | @@ -1935,9 +1935,9 @@ decls :: { Located (EpaLocation, [EpToken ";"], OrdList (LHsDecl GhcPs)) } |
| 1935 | 1935 | | {- empty -} { noLoc (noAnn, [],nilOL) }
|
| 1936 | 1936 | |
| 1937 | 1937 | decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) }
|
| 1938 | - : '{' decls '}' { sLL $1 $> (AnnList (Just (fstOf3 $ unLoc $2)) (ListBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2)
|
|
| 1938 | + : '{' decls '}' { sLL $1 $> (AnnList (AnnListLayout (fstOf3 $ unLoc $2)) (ListBraces (epTok $1) (epTok $3)) (sndOf3 $ unLoc $2)
|
|
| 1939 | 1939 | ,sL1 $2 $ thdOf3 $ unLoc $2) }
|
| 1940 | - | vocurly decls close { sL1 $2 (AnnList (Just (fstOf3 $ unLoc $2)) ListNone (sndOf3 $ unLoc $2)
|
|
| 1940 | + | vocurly decls close { sL1 $2 (AnnList (AnnListLayout (fstOf3 $ unLoc $2)) ListNone (sndOf3 $ unLoc $2)
|
|
| 1941 | 1941 | ,sL1 $2 $ thdOf3 $ unLoc $2) }
|
| 1942 | 1942 | |
| 1943 | 1943 | -- Binding groups other than those of class and instance declarations
|
| ... | ... | @@ -1945,16 +1945,16 @@ decllist :: { Located (AnnList,Located (OrdList (LHsDecl GhcPs))) } |
| 1945 | 1945 | binds :: { Located (HsLocalBinds GhcPs) }
|
| 1946 | 1946 | -- May have implicit parameters
|
| 1947 | 1947 | -- No type declarations
|
| 1948 | - : decllist {% do { let { (AnnList anc p s, decls) = unLoc $1 }
|
|
| 1948 | + : decllist {% do { let { (AnnList la p s, decls) = unLoc $1 }
|
|
| 1949 | 1949 | ; val_binds <- cvBindGroup (unLoc $ decls)
|
| 1950 | 1950 | ; !cs <- getCommentsFor (gl $1)
|
| 1951 | - ; return (sL1 $1 $ HsValBinds (EpAnn (glR $1) (AnnList anc p s) cs, noEpTok) val_binds)} }
|
|
| 1951 | + ; return (sL1 $1 $ HsValBinds (EpAnn (glR $1) (AnnList la p s) cs, noEpTok) val_binds)} }
|
|
| 1952 | 1952 | |
| 1953 | 1953 | | '{' dbinds '}' {% acs (comb3 $1 $2 $3) (\loc cs -> (L loc
|
| 1954 | - $ HsIPBinds (EpAnn (spanAsAnchor (comb3 $1 $2 $3)) (AnnList (Just$ glR $2) (ListBraces (epTok $1) (epTok $3)) []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) }
|
|
| 1954 | + $ HsIPBinds (EpAnn (spanAsAnchor (comb3 $1 $2 $3)) (AnnList (AnnListLayout$ glR $2) (ListBraces (epTok $1) (epTok $3)) []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) }
|
|
| 1955 | 1955 | |
| 1956 | 1956 | | vocurly dbinds close {% acs (gl $2) (\loc cs -> (L loc
|
| 1957 | - $ HsIPBinds (EpAnn (glR $1) (AnnList (Just $ glR $2) ListNone []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) }
|
|
| 1957 | + $ HsIPBinds (EpAnn (glR $1) (AnnList (AnnListLayout $ glR $2) ListNone []) cs, noEpTok) (IPBinds noExtField (reverse $ unLoc $2)))) }
|
|
| 1958 | 1958 | |
| 1959 | 1959 | |
| 1960 | 1960 | wherebinds :: { Maybe (Located (HsLocalBinds GhcPs, Maybe EpAnnComments )) }
|
| ... | ... | @@ -3542,11 +3542,11 @@ guardquals1 :: { Located [LStmt GhcPs (LHsExpr GhcPs)] } |
| 3542 | 3542 | altslist(PATS) :: { forall b. DisambECP b => PV (LocatedA ([LMatch GhcPs (LocatedA b)], AnnList)) }
|
| 3543 | 3543 | : '{' alts(PATS) '}' { $2 >>= \ $2 -> amsA'
|
| 3544 | 3544 | (sLL $1 $> (reverse (snd $ unLoc $2),
|
| 3545 | - (AnnList (Just $ glR $2) (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) }
|
|
| 3545 | + (AnnList (AnnListLayout $ glR $2) (ListBraces (epTok $1) (epTok $3)) (fst $ unLoc $2)))) }
|
|
| 3546 | 3546 | | vocurly alts(PATS) close { $2 >>= \ $2 -> amsA'
|
| 3547 | 3547 | (L (getLoc $2) (reverse (snd $ unLoc $2),
|
| 3548 | - (AnnList (Just $ glR $2) ListNone (fst $ unLoc $2)))) }
|
|
| 3549 | - | '{' '}' { amsA' (sLL $1 $> ([], (AnnList Nothing (ListBraces (epTok $1) (epTok $2)) []))) }
|
|
| 3548 | + (AnnList (AnnListLayout $ glR $2) ListNone (fst $ unLoc $2)))) }
|
|
| 3549 | + | '{' '}' { amsA' (sLL $1 $> ([], (AnnList AnnListNoLayout (ListBraces (epTok $1) (epTok $2)) []))) }
|
|
| 3550 | 3550 | | vocurly close { return $ noLocA ([], noAnn) }
|
| 3551 | 3551 | |
| 3552 | 3552 | alts(PATS) :: { forall b. DisambECP b => PV (Located ([EpToken ";"],[LMatch GhcPs (LocatedA b)])) }
|
| ... | ... | @@ -3656,10 +3656,10 @@ apat : aexp {% (checkPattern <=< runPV) (unECP $1) } |
| 3656 | 3656 | |
| 3657 | 3657 | stmtlist :: { forall b. DisambECP b => PV (LocatedA (AnnList, Located [LocatedA (Stmt GhcPs (LocatedA b))])) }
|
| 3658 | 3658 | : '{' stmts '}' { $2 >>= \ $2 ->
|
| 3659 | - amsA' (sLL $1 $> (AnnList (Just (spanAsAnchor $ stmtsLoc $2)) (ListBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2)
|
|
| 3659 | + amsA' (sLL $1 $> (AnnList (AnnListLayout (spanAsAnchor $ stmtsLoc $2)) (ListBraces (epTok $1) (epTok $3)) (fromOL $ fst $ unLoc $2)
|
|
| 3660 | 3660 | , sL1 $2 $ reverse $ snd $ unLoc $2))}
|
| 3661 | 3661 | | vocurly stmts close { $2 >>= \ $2 ->
|
| 3662 | - amsA' (L (stmtsLoc $2) (AnnList (Just (spanAsAnchor $ stmtsLoc $2)) ListNone (fromOL $ fst $ unLoc $2)
|
|
| 3662 | + amsA' (L (stmtsLoc $2) (AnnList (AnnListLayout (spanAsAnchor $ stmtsLoc $2)) ListNone (fromOL $ fst $ unLoc $2)
|
|
| 3663 | 3663 | , sL1 $2 $ reverse $ snd $ unLoc $2))}
|
| 3664 | 3664 | |
| 3665 | 3665 | -- do { ;; s ; s ; ; s ;; }
|
| ... | ... | @@ -4630,9 +4630,6 @@ glEEz !x !y = if isZeroWidthSpan (getHasLoc y) |
| 4630 | 4630 | then spanAsAnchor (getHasLoc x)
|
| 4631 | 4631 | else spanAsAnchor $ comb2 x y
|
| 4632 | 4632 | |
| 4633 | -glRM :: Located a -> Maybe EpaLocation
|
|
| 4634 | -glRM (L !l _) = Just $ spanAsAnchor l
|
|
| 4635 | - |
|
| 4636 | 4633 | n2l :: LocatedN a -> LocatedA a
|
| 4637 | 4634 | n2l (L !la !a) = L (l2l la) a
|
| 4638 | 4635 |
| ... | ... | @@ -31,10 +31,6 @@ module GHC.Parser.Annotation ( |
| 31 | 31 | SrcSpanAnnA, SrcSpanAnnN,
|
| 32 | 32 | |
| 33 | 33 | -- ** Annotation data types used in 'GenLocated'
|
| 34 | - |
|
| 35 | - AnnList(..), AnnListBrackets(..),
|
|
| 36 | - AnnParen(..),
|
|
| 37 | - AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..),
|
|
| 38 | 34 | NameAnn(..), NameAdornment(..),
|
| 39 | 35 | NoEpAnns(..),
|
| 40 | 36 | |
| ... | ... | @@ -43,6 +39,12 @@ module GHC.Parser.Annotation ( |
| 43 | 39 | addTrailingAnnToA, addTrailingCommaToN,
|
| 44 | 40 | noTrailingN,
|
| 45 | 41 | |
| 42 | + -- ** Annotation data types used in TTG extension points
|
|
| 43 | + |
|
| 44 | + AnnList(..), AnnListBrackets(..), AnnListLayout(..),
|
|
| 45 | + AnnParen(..),
|
|
| 46 | + AnnCType(..),AnnWarningTxt(..),AnnOverlap(..),AnnAnnDecl(..),AnnPragSCC(..),
|
|
| 47 | + |
|
| 46 | 48 | -- ** Utilities for converting between different 'GenLocated' when
|
| 47 | 49 | -- ** we do not care about the annotations.
|
| 48 | 50 | l2l, la2la,
|
| ... | ... | @@ -513,7 +515,7 @@ instance Outputable TrailingAnn where |
| 513 | 515 | -- AZ: goal: only used when there is layout, so vertical alignment matters
|
| 514 | 516 | data AnnList
|
| 515 | 517 | = AnnList {
|
| 516 | - al_anchor :: !(Maybe EpaLocation), -- ^ start point of a list having layout
|
|
| 518 | + al_layout :: !AnnListLayout,
|
|
| 517 | 519 | al_brackets :: !AnnListBrackets,
|
| 518 | 520 | al_semis :: [EpToken ";"] -- decls
|
| 519 | 521 | } deriving (Data,Eq)
|
| ... | ... | @@ -523,6 +525,18 @@ data AnnListBrackets |
| 523 | 525 | | ListNone
|
| 524 | 526 | deriving (Data,Eq)
|
| 525 | 527 | |
| 528 | +-- | How the extent of a list was delimited in the source.
|
|
| 529 | +data AnnListLayout
|
|
| 530 | + = AnnListBraces -- ^ Explicit @{ ; }@ written by the user. The tokens
|
|
| 531 | + -- live in 'al_brackets' and 'al_semis'.
|
|
| 532 | + | AnnListLayout !EpaLocation
|
|
| 533 | + -- ^ The lexer opened an implicit layout context.
|
|
| 534 | + -- The 'EpaLocation' is the @vocurly@ token (or, for
|
|
| 535 | + -- MultiWayIf, the leading @|@), whose start column is
|
|
| 536 | + -- the layout column chosen by 'new_layout_context'.
|
|
| 537 | + | AnnListNoLayout -- ^ Neither: an Empty or compiler-generated list.
|
|
| 538 | + deriving (Data, Eq)
|
|
| 539 | + |
|
| 526 | 540 | -- ---------------------------------------------------------------------
|
| 527 | 541 | -- Annotations for parenthesised elements, such as tuples, lists
|
| 528 | 542 | -- ---------------------------------------------------------------------
|
| ... | ... | @@ -993,7 +1007,10 @@ instance NoAnn NoEpAnns where |
| 993 | 1007 | noAnn = NoEpAnns
|
| 994 | 1008 | |
| 995 | 1009 | instance NoAnn AnnList where
|
| 996 | - noAnn = AnnList Nothing ListNone noAnn
|
|
| 1010 | + noAnn = AnnList noAnn ListNone noAnn
|
|
| 1011 | + |
|
| 1012 | +instance NoAnn AnnListLayout where
|
|
| 1013 | + noAnn = AnnListNoLayout
|
|
| 997 | 1014 | |
| 998 | 1015 | instance NoAnn NameAnn where
|
| 999 | 1016 | noAnn = NameAnnTrailing []
|
| ... | ... | @@ -1094,6 +1111,11 @@ instance Outputable AnnListBrackets where |
| 1094 | 1111 | ppr (ListBraces o c) = text "ListBraces" <+> ppr o <+> ppr c
|
| 1095 | 1112 | ppr ListNone = text "ListNone"
|
| 1096 | 1113 | |
| 1114 | +instance Outputable AnnListLayout where
|
|
| 1115 | + ppr AnnListBraces = text "AnnListBraces"
|
|
| 1116 | + ppr (AnnListLayout l) = text "AnnListLayout" <+> ppr l
|
|
| 1117 | + ppr AnnListNoLayout = text "AnnListNoLayout"
|
|
| 1118 | + |
|
| 1097 | 1119 | instance Outputable AnnCType where
|
| 1098 | 1120 | ppr (AnnCType o c l ca)
|
| 1099 | 1121 | = text "AnnCType" <+> ppr o <+> ppr c <+> ppr l
|
| ... | ... | @@ -466,7 +466,7 @@ add_where w@(EpTok (EpaSpan (RealSrcSpan rs _))) (EpAnn a al cs) cs2 |
| 466 | 466 | = (EpAnn (widenAnchorT a w) al (cs Semi.<> cs2), w)
|
| 467 | 467 | | otherwise
|
| 468 | 468 | = (EpAnn (patch_anchor rs a)
|
| 469 | - (al { al_anchor = (fmap (patch_anchor rs) (al_anchor al))})
|
|
| 469 | + (al { al_layout = patch_layout (al_layout al)})
|
|
| 470 | 470 | (cs Semi.<> cs2), w)
|
| 471 | 471 | add_where _ _ _ = panic "add_where"
|
| 472 | 472 | -- EpaDelta should only be used for transformations
|
| ... | ... | @@ -484,6 +484,12 @@ patch_anchor r1 (EpaSpan (RealSrcSpan r0 mb)) = EpaSpan (RealSrcSpan r mb) |
| 484 | 484 | r = if srcSpanStartLine r0 < 0 then r1 else r0
|
| 485 | 485 | patch_anchor _ (EpaSpan ss) = EpaSpan ss
|
| 486 | 486 | |
| 487 | +-- If the decl list for where binds is empty, the anchor ends up
|
|
| 488 | +-- invalid. Explicitly mark it as not having layout
|
|
| 489 | +patch_layout :: AnnListLayout -> AnnListLayout
|
|
| 490 | +patch_layout (AnnListLayout _) = AnnListNoLayout
|
|
| 491 | +patch_layout lo = lo
|
|
| 492 | + |
|
| 487 | 493 | -- | The anchor for a stmtlist is based on either the location or
|
| 488 | 494 | -- the first semicolon annotion.
|
| 489 | 495 | stmtsAnchor :: Located (OrdList (EpToken tok),a) -> Maybe EpaLocation
|
| ... | ... | @@ -369,10 +369,15 @@ data UnitState = UnitState { |
| 369 | 369 | -- is always mentioned before the units it depends on.
|
| 370 | 370 | preloadUnits :: [UnitId],
|
| 371 | 371 | |
| 372 | - -- | Units which we explicitly depend on (from a command line flag).
|
|
| 373 | - -- We'll use this to generate version macros and the unused packages warning. The
|
|
| 374 | - -- original flag which was used to bring the unit into scope is recorded for the
|
|
| 375 | - -- -Wunused-packages warning.
|
|
| 372 | + -- | The units that can be used by the respective home unit. Despite the
|
|
| 373 | + -- identifier, this does not just cover units that are enabled explicitly
|
|
| 374 | + -- using flags but also units from the package database that are enabled
|
|
| 375 | + -- implicitly in case @-hide-all-packages@ is absent. The former are paired
|
|
| 376 | + -- with 'Just' applied to the respective flags, the latter are paired with
|
|
| 377 | + -- 'Nothing'.
|
|
| 378 | + --
|
|
| 379 | + -- This field is used for generating version macros and “unused packages”
|
|
| 380 | + -- warnings.
|
|
| 376 | 381 | explicitUnits :: [(Unit, Maybe PackageArg)],
|
| 377 | 382 | |
| 378 | 383 | homeUnitDepends :: Set UnitId,
|
| ... | ... | @@ -907,7 +912,7 @@ mkUnitState logger unit_index cfg = do |
| 907 | 912 | let pkgname_map = listToUFM [ (unitPackageName p, unitInstanceOf p)
|
| 908 | 913 | | p <- pkgs2
|
| 909 | 914 | ]
|
| 910 | - -- The explicitUnits accurately reflects the set of units we have turned
|
|
| 915 | + -- The explicitUnits accurately reflects the set of units that are turned
|
|
| 911 | 916 | -- on; as such, it also is the only way one can come up with requirements.
|
| 912 | 917 | -- The requirement context is directly based off of this: we simply
|
| 913 | 918 | -- look for nested unit IDs that are directly fed holes: the requirements
|
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | ((,)
|
| 71 | 71 | (FromSource)
|
| 72 | 72 | (AnnList
|
| 73 | - (Nothing)
|
|
| 73 | + (AnnListNoLayout)
|
|
| 74 | 74 | (ListNone)
|
| 75 | 75 | []))
|
| 76 | 76 | (L
|
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | ((,)
|
| 83 | 83 | (FromSource)
|
| 84 | 84 | (AnnList
|
| 85 | - (Nothing)
|
|
| 85 | + (AnnListNoLayout)
|
|
| 86 | 86 | (ListNone)
|
| 87 | 87 | []))
|
| 88 | 88 | (L
|
| ... | ... | @@ -97,7 +97,7 @@ |
| 97 | 97 | ((,)
|
| 98 | 98 | (FromSource)
|
| 99 | 99 | (AnnList
|
| 100 | - (Nothing)
|
|
| 100 | + (AnnListNoLayout)
|
|
| 101 | 101 | (ListNone)
|
| 102 | 102 | []))
|
| 103 | 103 | (L
|
| ... | ... | @@ -2223,7 +2223,7 @@ |
| 2223 | 2223 | ((,)
|
| 2224 | 2224 | (FromSource)
|
| 2225 | 2225 | (AnnList
|
| 2226 | - (Nothing)
|
|
| 2226 | + (AnnListNoLayout)
|
|
| 2227 | 2227 | (ListNone)
|
| 2228 | 2228 | []))
|
| 2229 | 2229 | (L
|
| ... | ... | @@ -90,7 +90,7 @@ |
| 90 | 90 | ((,)
|
| 91 | 91 | (FromSource)
|
| 92 | 92 | (AnnList
|
| 93 | - (Nothing)
|
|
| 93 | + (AnnListNoLayout)
|
|
| 94 | 94 | (ListNone)
|
| 95 | 95 | []))
|
| 96 | 96 | (L
|
| ... | ... | @@ -213,7 +213,7 @@ |
| 213 | 213 | ((,)
|
| 214 | 214 | (FromSource)
|
| 215 | 215 | (AnnList
|
| 216 | - (Nothing)
|
|
| 216 | + (AnnListNoLayout)
|
|
| 217 | 217 | (ListNone)
|
| 218 | 218 | []))
|
| 219 | 219 | (L
|
| ... | ... | @@ -291,7 +291,7 @@ |
| 291 | 291 | ((,)
|
| 292 | 292 | (Right
|
| 293 | 293 | (AnnList
|
| 294 | - (Just
|
|
| 294 | + (AnnListLayout
|
|
| 295 | 295 | (EpaSpan { DumpParsedAstComments.hs:16:3 }))
|
| 296 | 296 | (ListNone)
|
| 297 | 297 | []))
|
| ... | ... | @@ -361,7 +361,7 @@ |
| 361 | 361 | ((,)
|
| 362 | 362 | (FromSource)
|
| 363 | 363 | (AnnList
|
| 364 | - (Nothing)
|
|
| 364 | + (AnnListNoLayout)
|
|
| 365 | 365 | (ListNone)
|
| 366 | 366 | []))
|
| 367 | 367 | (L
|
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | ((,)
|
| 31 | 31 | (FromSource)
|
| 32 | 32 | (AnnList
|
| 33 | - (Nothing)
|
|
| 33 | + (AnnListNoLayout)
|
|
| 34 | 34 | (ListNone)
|
| 35 | 35 | []))
|
| 36 | 36 | (L
|
| ... | ... | @@ -261,7 +261,7 @@ |
| 261 | 261 | ((,)
|
| 262 | 262 | (FromSource)
|
| 263 | 263 | (AnnList
|
| 264 | - (Nothing)
|
|
| 264 | + (AnnListNoLayout)
|
|
| 265 | 265 | (ListNone)
|
| 266 | 266 | []))
|
| 267 | 267 | (L
|
| ... | ... | @@ -333,7 +333,7 @@ |
| 333 | 333 | ((,)
|
| 334 | 334 | (Right
|
| 335 | 335 | (AnnList
|
| 336 | - (Just
|
|
| 336 | + (AnnListLayout
|
|
| 337 | 337 | (EpaSpan { DumpSemis.hs:(11,3)-(12,3) }))
|
| 338 | 338 | (ListNone)
|
| 339 | 339 | []))
|
| ... | ... | @@ -364,7 +364,7 @@ |
| 364 | 364 | ((,)
|
| 365 | 365 | (Right
|
| 366 | 366 | (AnnList
|
| 367 | - (Just
|
|
| 367 | + (AnnListLayout
|
|
| 368 | 368 | (EpaSpan { DumpSemis.hs:11:8-13 }))
|
| 369 | 369 | (ListBraces
|
| 370 | 370 | (EpTok (EpaSpan { DumpSemis.hs:11:6 }))
|
| ... | ... | @@ -555,7 +555,7 @@ |
| 555 | 555 | ((,)
|
| 556 | 556 | (FromSource)
|
| 557 | 557 | (AnnList
|
| 558 | - (Nothing)
|
|
| 558 | + (AnnListNoLayout)
|
|
| 559 | 559 | (ListNone)
|
| 560 | 560 | []))
|
| 561 | 561 | (L
|
| ... | ... | @@ -627,7 +627,7 @@ |
| 627 | 627 | ((,)
|
| 628 | 628 | (Right
|
| 629 | 629 | (AnnList
|
| 630 | - (Just
|
|
| 630 | + (AnnListLayout
|
|
| 631 | 631 | (EpaSpan { DumpSemis.hs:(16,5)-(18,5) }))
|
| 632 | 632 | (ListBraces
|
| 633 | 633 | (EpTok (EpaSpan { DumpSemis.hs:16:3 }))
|
| ... | ... | @@ -808,7 +808,7 @@ |
| 808 | 808 | ((,)
|
| 809 | 809 | (FromSource)
|
| 810 | 810 | (AnnList
|
| 811 | - (Nothing)
|
|
| 811 | + (AnnListNoLayout)
|
|
| 812 | 812 | (ListNone)
|
| 813 | 813 | []))
|
| 814 | 814 | (L
|
| ... | ... | @@ -880,7 +880,7 @@ |
| 880 | 880 | ((,)
|
| 881 | 881 | (Right
|
| 882 | 882 | (AnnList
|
| 883 | - (Just
|
|
| 883 | + (AnnListLayout
|
|
| 884 | 884 | (EpaSpan { DumpSemis.hs:22:12-28 }))
|
| 885 | 885 | (ListBraces
|
| 886 | 886 | (EpTok (EpaSpan { DumpSemis.hs:22:10 }))
|
| ... | ... | @@ -1017,7 +1017,7 @@ |
| 1017 | 1017 | ((,)
|
| 1018 | 1018 | (FromSource)
|
| 1019 | 1019 | (AnnList
|
| 1020 | - (Nothing)
|
|
| 1020 | + (AnnListNoLayout)
|
|
| 1021 | 1021 | (ListNone)
|
| 1022 | 1022 | []))
|
| 1023 | 1023 | (L
|
| ... | ... | @@ -1122,7 +1122,7 @@ |
| 1122 | 1122 | ((,)
|
| 1123 | 1123 | (FromSource)
|
| 1124 | 1124 | (AnnList
|
| 1125 | - (Nothing)
|
|
| 1125 | + (AnnListNoLayout)
|
|
| 1126 | 1126 | (ListNone)
|
| 1127 | 1127 | []))
|
| 1128 | 1128 | (L
|
| ... | ... | @@ -1229,7 +1229,7 @@ |
| 1229 | 1229 | ((,)
|
| 1230 | 1230 | (FromSource)
|
| 1231 | 1231 | (AnnList
|
| 1232 | - (Nothing)
|
|
| 1232 | + (AnnListNoLayout)
|
|
| 1233 | 1233 | (ListNone)
|
| 1234 | 1234 | []))
|
| 1235 | 1235 | (L
|
| ... | ... | @@ -1731,7 +1731,7 @@ |
| 1731 | 1731 | ((,)
|
| 1732 | 1732 | (FromSource)
|
| 1733 | 1733 | (AnnList
|
| 1734 | - (Nothing)
|
|
| 1734 | + (AnnListNoLayout)
|
|
| 1735 | 1735 | (ListNone)
|
| 1736 | 1736 | []))
|
| 1737 | 1737 | (L
|
| ... | ... | @@ -1857,7 +1857,7 @@ |
| 1857 | 1857 | ((,)
|
| 1858 | 1858 | (FromSource)
|
| 1859 | 1859 | (AnnList
|
| 1860 | - (Nothing)
|
|
| 1860 | + (AnnListNoLayout)
|
|
| 1861 | 1861 | (ListNone)
|
| 1862 | 1862 | []))
|
| 1863 | 1863 | (L
|
| ... | ... | @@ -1936,7 +1936,7 @@ |
| 1936 | 1936 | (EpAnn
|
| 1937 | 1937 | (EpaSpan { DumpSemis.hs:34:13-31 })
|
| 1938 | 1938 | (AnnList
|
| 1939 | - (Just
|
|
| 1939 | + (AnnListLayout
|
|
| 1940 | 1940 | (EpaSpan { DumpSemis.hs:34:18-30 }))
|
| 1941 | 1941 | (ListBraces
|
| 1942 | 1942 | (EpTok (EpaSpan { DumpSemis.hs:34:13 }))
|
| ... | ... | @@ -1984,7 +1984,7 @@ |
| 1984 | 1984 | ((,)
|
| 1985 | 1985 | (FromSource)
|
| 1986 | 1986 | (AnnList
|
| 1987 | - (Nothing)
|
|
| 1987 | + (AnnListNoLayout)
|
|
| 1988 | 1988 | (ListNone)
|
| 1989 | 1989 | []))
|
| 1990 | 1990 | (L
|
| ... | ... | @@ -2097,7 +2097,7 @@ |
| 2097 | 2097 | ((,)
|
| 2098 | 2098 | (FromSource)
|
| 2099 | 2099 | (AnnList
|
| 2100 | - (Nothing)
|
|
| 2100 | + (AnnListNoLayout)
|
|
| 2101 | 2101 | (ListNone)
|
| 2102 | 2102 | []))
|
| 2103 | 2103 | (L
|
| ... | ... | @@ -2222,7 +2222,7 @@ |
| 2222 | 2222 | ((,)
|
| 2223 | 2223 | (FromSource)
|
| 2224 | 2224 | (AnnList
|
| 2225 | - (Nothing)
|
|
| 2225 | + (AnnListNoLayout)
|
|
| 2226 | 2226 | (ListNone)
|
| 2227 | 2227 | []))
|
| 2228 | 2228 | (L
|
| ... | ... | @@ -2333,7 +2333,7 @@ |
| 2333 | 2333 | ((,)
|
| 2334 | 2334 | (FromSource)
|
| 2335 | 2335 | (AnnList
|
| 2336 | - (Just
|
|
| 2336 | + (AnnListLayout
|
|
| 2337 | 2337 | (EpaSpan { DumpSemis.hs:(38,6)-(43,13) }))
|
| 2338 | 2338 | (ListBraces
|
| 2339 | 2339 | (EpTok (EpaSpan { DumpSemis.hs:38:4 }))
|
| ... | ... | @@ -1000,7 +1000,7 @@ |
| 1000 | 1000 | ((,)
|
| 1001 | 1001 | (FromSource)
|
| 1002 | 1002 | (AnnList
|
| 1003 | - (Nothing)
|
|
| 1003 | + (AnnListNoLayout)
|
|
| 1004 | 1004 | (ListNone)
|
| 1005 | 1005 | []))
|
| 1006 | 1006 | (L
|
| ... | ... | @@ -1719,7 +1719,7 @@ |
| 1719 | 1719 | ((,)
|
| 1720 | 1720 | (FromSource)
|
| 1721 | 1721 | (AnnList
|
| 1722 | - (Nothing)
|
|
| 1722 | + (AnnListNoLayout)
|
|
| 1723 | 1723 | (ListNone)
|
| 1724 | 1724 | []))
|
| 1725 | 1725 | (L
|
| ... | ... | @@ -8,14 +8,15 @@ |
| 8 | 8 | (EpAnn
|
| 9 | 9 | (EpaSpan { T15279.hs:1:1 })
|
| 10 | 10 | (AnnsModule
|
| 11 | - (NoEpTok)
|
|
| 11 | + (EpTok
|
|
| 12 | + (EpaSpan { <no location info> }))
|
|
| 12 | 13 | (EpTok
|
| 13 | 14 | (EpaSpan { T15279.hs:3:1-6 }))
|
| 14 | 15 | (EpTok
|
| 15 | 16 | (EpaSpan { T15279.hs:3:15-19 }))
|
| 16 | 17 | ((,,)
|
| 17 | - (NoEpTok)
|
|
| 18 | - (NoEpTok)
|
|
| 18 | + (EpTok (EpaSpan { <no location info> }))
|
|
| 19 | + (EpTok (EpaSpan { <no location info> }))
|
|
| 19 | 20 | [])
|
| 20 | 21 | []
|
| 21 | 22 | []
|
| ... | ... | @@ -100,7 +101,8 @@ |
| 100 | 101 | (EpaComments
|
| 101 | 102 | []))
|
| 102 | 103 | (HsTyVar
|
| 103 | - (NoEpTok)
|
|
| 104 | + (EpTok
|
|
| 105 | + (EpaSpan { <no location info> }))
|
|
| 104 | 106 | (NotPromoted)
|
| 105 | 107 | (L
|
| 106 | 108 | (EpAnn
|
| ... | ... | @@ -118,7 +120,8 @@ |
| 118 | 120 | (EpaComments
|
| 119 | 121 | []))
|
| 120 | 122 | (HsTyVar
|
| 121 | - (NoEpTok)
|
|
| 123 | + (EpTok
|
|
| 124 | + (EpaSpan { <no location info> }))
|
|
| 122 | 125 | (NotPromoted)
|
| 123 | 126 | (L
|
| 124 | 127 | (EpAnn
|
| ... | ... | @@ -152,7 +155,7 @@ |
| 152 | 155 | ((,)
|
| 153 | 156 | (FromSource)
|
| 154 | 157 | (AnnList
|
| 155 | - (Nothing)
|
|
| 158 | + (AnnListNoLayout)
|
|
| 156 | 159 | (ListNone)
|
| 157 | 160 | []))
|
| 158 | 161 | (L
|
| ... | ... | @@ -182,7 +185,8 @@ |
| 182 | 185 | (Prefix)
|
| 183 | 186 | (NoSrcStrict)
|
| 184 | 187 | (AnnFunRhs
|
| 185 | - (NoEpTok)
|
|
| 188 | + (EpTok
|
|
| 189 | + (EpaSpan { <no location info> }))
|
|
| 186 | 190 | []
|
| 187 | 191 | []))
|
| 188 | 192 | (L
|
| ... | ... | @@ -258,7 +262,8 @@ |
| 258 | 262 | (Prefix)
|
| 259 | 263 | (NoSrcStrict)
|
| 260 | 264 | (AnnFunRhs
|
| 261 | - (NoEpTok)
|
|
| 265 | + (EpTok
|
|
| 266 | + (EpaSpan { <no location info> }))
|
|
| 262 | 267 | []
|
| 263 | 268 | []))
|
| 264 | 269 | (L
|
| ... | ... | @@ -334,7 +339,8 @@ |
| 334 | 339 | (Prefix)
|
| 335 | 340 | (NoSrcStrict)
|
| 336 | 341 | (AnnFunRhs
|
| 337 | - (NoEpTok)
|
|
| 342 | + (EpTok
|
|
| 343 | + (EpaSpan { <no location info> }))
|
|
| 338 | 344 | []
|
| 339 | 345 | []))
|
| 340 | 346 | (L
|
| ... | ... | @@ -104,7 +104,7 @@ |
| 104 | 104 | ((,)
|
| 105 | 105 | (FromSource)
|
| 106 | 106 | (AnnList
|
| 107 | - (Nothing)
|
|
| 107 | + (AnnListNoLayout)
|
|
| 108 | 108 | (ListNone)
|
| 109 | 109 | []))
|
| 110 | 110 | (L
|
| ... | ... | @@ -94,7 +94,7 @@ |
| 94 | 94 | ((,)
|
| 95 | 95 | (FromSource)
|
| 96 | 96 | (AnnList
|
| 97 | - (Nothing)
|
|
| 97 | + (AnnListNoLayout)
|
|
| 98 | 98 | (ListNone)
|
| 99 | 99 | []))
|
| 100 | 100 | (L
|
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | ((,)
|
| 71 | 71 | (FromSource)
|
| 72 | 72 | (AnnList
|
| 73 | - (Nothing)
|
|
| 73 | + (AnnListNoLayout)
|
|
| 74 | 74 | (ListNone)
|
| 75 | 75 | []))
|
| 76 | 76 | (L
|
| ... | ... | @@ -161,8 +161,7 @@ |
| 161 | 161 | (EpAnn
|
| 162 | 162 | (EpaSpan { <no location info> })
|
| 163 | 163 | (AnnList
|
| 164 | - (Just
|
|
| 165 | - (EpaSpan { Test20297.hs:7:3-7 }))
|
|
| 164 | + (AnnListNoLayout)
|
|
| 166 | 165 | (ListNone)
|
| 167 | 166 | [])
|
| 168 | 167 | (EpaComments
|
| ... | ... | @@ -201,7 +200,7 @@ |
| 201 | 200 | ((,)
|
| 202 | 201 | (FromSource)
|
| 203 | 202 | (AnnList
|
| 204 | - (Nothing)
|
|
| 203 | + (AnnListNoLayout)
|
|
| 205 | 204 | (ListNone)
|
| 206 | 205 | []))
|
| 207 | 206 | (L
|
| ... | ... | @@ -286,7 +285,7 @@ |
| 286 | 285 | (EpAnn
|
| 287 | 286 | (EpaSpan { Test20297.hs:(10,3)-(11,26) })
|
| 288 | 287 | (AnnList
|
| 289 | - (Just
|
|
| 288 | + (AnnListLayout
|
|
| 290 | 289 | (EpaSpan { Test20297.hs:11:9-26 }))
|
| 291 | 290 | (ListNone)
|
| 292 | 291 | [])
|
| ... | ... | @@ -324,7 +323,7 @@ |
| 324 | 323 | ((,)
|
| 325 | 324 | (FromSource)
|
| 326 | 325 | (AnnList
|
| 327 | - (Nothing)
|
|
| 326 | + (AnnListNoLayout)
|
|
| 328 | 327 | (ListNone)
|
| 329 | 328 | []))
|
| 330 | 329 | (L
|
| ... | ... | @@ -396,7 +395,7 @@ |
| 396 | 395 | ((,)
|
| 397 | 396 | (Right
|
| 398 | 397 | (AnnList
|
| 399 | - (Just
|
|
| 398 | + (AnnListLayout
|
|
| 400 | 399 | (EpaSpan { Test20297.hs:11:22-26 }))
|
| 401 | 400 | (ListNone)
|
| 402 | 401 | []))
|
| ... | ... | @@ -513,7 +512,7 @@ |
| 513 | 512 | ((,)
|
| 514 | 513 | (FromSource)
|
| 515 | 514 | (AnnList
|
| 516 | - (Nothing)
|
|
| 515 | + (AnnListNoLayout)
|
|
| 517 | 516 | (ListNone)
|
| 518 | 517 | []))
|
| 519 | 518 | (L
|
| ... | ... | @@ -598,8 +597,7 @@ |
| 598 | 597 | (EpAnn
|
| 599 | 598 | (EpaSpan { <no location info> })
|
| 600 | 599 | (AnnList
|
| 601 | - (Just
|
|
| 602 | - (EpaSpan { Test20297.ppr.hs:5:3-7 }))
|
|
| 600 | + (AnnListNoLayout)
|
|
| 603 | 601 | (ListNone)
|
| 604 | 602 | [])
|
| 605 | 603 | (EpaComments
|
| ... | ... | @@ -632,7 +630,7 @@ |
| 632 | 630 | ((,)
|
| 633 | 631 | (FromSource)
|
| 634 | 632 | (AnnList
|
| 635 | - (Nothing)
|
|
| 633 | + (AnnListNoLayout)
|
|
| 636 | 634 | (ListNone)
|
| 637 | 635 | []))
|
| 638 | 636 | (L
|
| ... | ... | @@ -717,7 +715,7 @@ |
| 717 | 715 | (EpAnn
|
| 718 | 716 | (EpaSpan { Test20297.ppr.hs:(8,3)-(9,24) })
|
| 719 | 717 | (AnnList
|
| 720 | - (Just
|
|
| 718 | + (AnnListLayout
|
|
| 721 | 719 | (EpaSpan { Test20297.ppr.hs:9:7-24 }))
|
| 722 | 720 | (ListNone)
|
| 723 | 721 | [])
|
| ... | ... | @@ -749,7 +747,7 @@ |
| 749 | 747 | ((,)
|
| 750 | 748 | (FromSource)
|
| 751 | 749 | (AnnList
|
| 752 | - (Nothing)
|
|
| 750 | + (AnnListNoLayout)
|
|
| 753 | 751 | (ListNone)
|
| 754 | 752 | []))
|
| 755 | 753 | (L
|
| ... | ... | @@ -821,7 +819,7 @@ |
| 821 | 819 | ((,)
|
| 822 | 820 | (Right
|
| 823 | 821 | (AnnList
|
| 824 | - (Just
|
|
| 822 | + (AnnListLayout
|
|
| 825 | 823 | (EpaSpan { Test20297.ppr.hs:9:20-24 }))
|
| 826 | 824 | (ListNone)
|
| 827 | 825 | []))
|
| ... | ... | @@ -534,7 +534,7 @@ |
| 534 | 534 | ((,)
|
| 535 | 535 | (FromSource)
|
| 536 | 536 | (AnnList
|
| 537 | - (Nothing)
|
|
| 537 | + (AnnListNoLayout)
|
|
| 538 | 538 | (ListNone)
|
| 539 | 539 | []))
|
| 540 | 540 | (L
|
| ... | ... | @@ -1121,7 +1121,7 @@ |
| 1121 | 1121 | ((,)
|
| 1122 | 1122 | (FromSource)
|
| 1123 | 1123 | (AnnList
|
| 1124 | - (Nothing)
|
|
| 1124 | + (AnnListNoLayout)
|
|
| 1125 | 1125 | (ListNone)
|
| 1126 | 1126 | []))
|
| 1127 | 1127 | (L
|
| ... | ... | @@ -231,7 +231,7 @@ setAnchorAn (L (EpAnn _ an _) a) anc ts cs = (L (EpAnn anc (setTrailing an ts) c |
| 231 | 231 | -- `debug` ("setAnchorAn: anc=" ++ showAst anc)
|
| 232 | 232 | |
| 233 | 233 | setAnchorEpaL :: EpAnn AnnList -> EpaLocation -> [TrailingAnn] -> EpAnnComments -> EpAnn AnnList
|
| 234 | -setAnchorEpaL (EpAnn _ an _) anc ts cs = EpAnn anc (setTrailing (an {al_anchor = Nothing}) ts) cs
|
|
| 234 | +setAnchorEpaL (EpAnn _ an _) anc ts cs = EpAnn anc (setTrailing (an {al_layout = AnnListNoLayout}) ts) cs
|
|
| 235 | 235 | |
| 236 | 236 | -- ---------------------------------------------------------------------
|
| 237 | 237 | |
| ... | ... | @@ -2672,8 +2672,8 @@ instance ExactPrint (HsLocalBinds GhcPs) where |
| 2672 | 2672 | exact (HsValBinds (an0, w) valbinds) = do
|
| 2673 | 2673 | w' <- markEpToken w -- 'where'
|
| 2674 | 2674 | |
| 2675 | - case al_anchor $ anns an0 of
|
|
| 2676 | - Just anc -> do
|
|
| 2675 | + case al_layout $ anns an0 of
|
|
| 2676 | + AnnListLayout anc -> do
|
|
| 2677 | 2677 | when (not $ isEmptyValBinds valbinds) $ setExtraDP (Just anc)
|
| 2678 | 2678 | _ -> return ()
|
| 2679 | 2679 | |
| ... | ... | @@ -2684,7 +2684,7 @@ instance ExactPrint (HsLocalBinds GhcPs) where |
| 2684 | 2684 | Nothing -> return an1
|
| 2685 | 2685 | Just (ss,dp) -> do
|
| 2686 | 2686 | setExtraDPReturn Nothing
|
| 2687 | - return $ an1 { anns = (anns an1) { al_anchor = Just (EpaDelta ss dp []) }}
|
|
| 2687 | + return $ an1 { anns = (anns an1) { al_layout = AnnListLayout (EpaDelta ss dp []) }}
|
|
| 2688 | 2688 | return (HsValBinds (an2, w') valbinds')
|
| 2689 | 2689 | |
| 2690 | 2690 | exact (HsIPBinds (an,w) bs) = do
|
| ... | ... | @@ -521,8 +521,8 @@ changeLocalDecls libdir (L l p) = do |
| 521 | 521 | let oldDecls' = captureLineSpacing oldDecls
|
| 522 | 522 | let (VbSig o:oldBinds) = map wrapValBind oldDecls'
|
| 523 | 523 | o' = setEntryDP o (DifferentLine 2 0)
|
| 524 | - let (EpAnn anc (AnnList (Just _) a b) cs) = van
|
|
| 525 | - let van' = (EpAnn anc (AnnList (Just (EpaDelta noSrcSpan (DifferentLine 1 4) [])) a b) cs)
|
|
| 524 | + let (EpAnn anc (AnnList (AnnListLayout _) a b) cs) = van
|
|
| 525 | + let van' = (EpAnn anc (AnnList (AnnListLayout (EpaDelta noSrcSpan (DifferentLine 1 4) [])) a b) cs)
|
|
| 526 | 526 | let binds' = (HsValBinds (van',w)
|
| 527 | 527 | (ValBinds noExtField (VbSig sig':VbBind decl':VbSig o':oldBinds)))
|
| 528 | 528 | return (L lm (Match an mln pats (GRHSs emptyComments rhs binds')))
|
| ... | ... | @@ -548,7 +548,7 @@ changeLocalDecls2 libdir (L l p) = do |
| 548 | 548 | let anc = (EpaDelta noSrcSpan (DifferentLine 1 2) [])
|
| 549 | 549 | let anc2 = (EpaDelta noSrcSpan (DifferentLine 1 4) [])
|
| 550 | 550 | let an = (EpAnn anc
|
| 551 | - (AnnList (Just anc2) ListNone
|
|
| 551 | + (AnnList (AnnListLayout anc2) ListNone
|
|
| 552 | 552 | [])
|
| 553 | 553 | emptyComments, EpTok (EpaDelta noSrcSpan (SameLine 0) []))
|
| 554 | 554 | let decls = [VbSig sig', VbBind decl']
|
| ... | ... | @@ -1046,7 +1046,7 @@ newWhereAnnotation ww = (an, w) |
| 1046 | 1046 | WithWhere -> EpTok (EpaDelta noSrcSpan (SameLine 0) [])
|
| 1047 | 1047 | WithoutWhere -> noEpTok
|
| 1048 | 1048 | an = EpAnn anc
|
| 1049 | - (AnnList (Just anc2) ListNone [])
|
|
| 1049 | + (AnnList (AnnListLayout anc2) ListNone [])
|
|
| 1050 | 1050 | emptyComments
|
| 1051 | 1051 | |
| 1052 | 1052 | -- ---------------------------------------------------------------------
|