[Git][ghc/ghc][wip/az/epa-hslet-tokens] EPA: Moving EpAnn out of extension points

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Fri Dec 8 12:07:08 UTC 2023



Alan Zimmerman pushed to branch wip/az/epa-hslet-tokens at Glasgow Haskell Compiler / GHC


Commits:
b0429b24 by Alan Zimmerman at 2023-12-08T12:03:12+00:00
EPA: Moving EpAnn out of extension points

A lot done, more to do still.

I am making ' versions of helper functions, when the work is complete
the originals will disappear and the ' will go.

Dump.hs needed to be able to properly blank out `[AddEpAnn]`, they
used to be wrapped in an `EpAnn` which was easy to blank.

- - - - -


26 changed files:

- compiler/GHC/Hs/Dump.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Type.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Splice.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/TyCl/PatSyn.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/ThToHs.hs
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.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/printer/Test20297.stdout
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Dump.hs
=====================================
@@ -102,13 +102,25 @@ showAstData bs ba a0 = blankLine $$ showAstData' a0
             bytestring = text . normalize_newlines . show
 
             list []    = brackets empty
-            list [x]   = brackets (showAstData' x)
-            list (x1 : x2 : xs) =  (text "[" <> showAstData' x1)
-                                $$ go x2 xs
+            list [x]   = hideOr x (brackets (showAstData' x))
+            list (x1 : x2 : xs) = hideOr x1
+                                      ((text "[" <> showAstData' x1)
+                                        $$ go x2 xs)
               where
                 go y [] = text "," <> showAstData' y <> text "]"
                 go y1 (y2 : ys) = (text "," <> showAstData' y1) $$ go y2 ys
 
+            hideOr :: forall a .(Data a, Typeable a) => a -> SDoc -> SDoc
+            hideOr x f = if hide x
+                           then text "blanked:[AddEpAnn]"
+                           else f
+
+            hide :: forall a .(Data a, Typeable a) => a -> Bool
+            hide x = ba == BlankEpAnnotations && isAddEpAnn x
+
+            isAddEpAnn :: forall a .(Data a, Typeable a) => a -> Bool
+            isAddEpAnn x = (showConstr (toConstr x)) == "AddEpAnn"
+
             -- Eliminate word-size dependence
             lit :: HsLit GhcPs -> SDoc
             lit (HsWordPrim   s x) = numericLit "HsWord{64}Prim" x s


=====================================
compiler/GHC/Hs/Expr.hs
=====================================
@@ -240,8 +240,8 @@ type instance XIPVar         GhcRn = NoExtField
 type instance XIPVar         GhcTc = DataConCantHappen
 type instance XOverLitE      (GhcPass _) = NoExtField
 type instance XLitE          (GhcPass _) = NoExtField
-type instance XLam           (GhcPass _) = EpAnn [AddEpAnn]
-type instance XApp           (GhcPass _) = EpAnnCO
+type instance XLam           (GhcPass _) = [AddEpAnn]
+type instance XApp           (GhcPass _) = NoExtField
 
 type instance XAppTypeE      GhcPs = EpToken "@"
 type instance XAppTypeE      GhcRn = NoExtField
@@ -249,21 +249,21 @@ type instance XAppTypeE      GhcTc = Type
 
 -- OpApp not present in GhcTc pass; see GHC.Rename.Expr
 -- Note [Handling overloaded and rebindable constructs]
-type instance XOpApp         GhcPs = EpAnn [AddEpAnn]
+type instance XOpApp         GhcPs = [AddEpAnn]
 type instance XOpApp         GhcRn = Fixity
 type instance XOpApp         GhcTc = DataConCantHappen
 
 -- SectionL, SectionR not present in GhcTc pass; see GHC.Rename.Expr
 -- Note [Handling overloaded and rebindable constructs]
-type instance XSectionL      GhcPs = EpAnnCO
-type instance XSectionR      GhcPs = EpAnnCO
-type instance XSectionL      GhcRn = EpAnnCO
-type instance XSectionR      GhcRn = EpAnnCO
+type instance XSectionL      GhcPs = NoExtField
+type instance XSectionR      GhcPs = NoExtField
+type instance XSectionL      GhcRn = NoExtField
+type instance XSectionR      GhcRn = NoExtField
 type instance XSectionL      GhcTc = DataConCantHappen
 type instance XSectionR      GhcTc = DataConCantHappen
 
 
-type instance XNegApp        GhcPs = EpAnn [AddEpAnn]
+type instance XNegApp        GhcPs = [AddEpAnn]
 type instance XNegApp        GhcRn = NoExtField
 type instance XNegApp        GhcTc = NoExtField
 
@@ -275,19 +275,19 @@ type instance XExplicitTuple GhcPs = EpAnn [AddEpAnn]
 type instance XExplicitTuple GhcRn = NoExtField
 type instance XExplicitTuple GhcTc = NoExtField
 
-type instance XExplicitSum   GhcPs = EpAnn AnnExplicitSum
+type instance XExplicitSum   GhcPs = AnnExplicitSum
 type instance XExplicitSum   GhcRn = NoExtField
 type instance XExplicitSum   GhcTc = [Type]
 
-type instance XCase          GhcPs = EpAnn EpAnnHsCase
+type instance XCase          GhcPs = EpAnnHsCase
 type instance XCase          GhcRn = HsMatchContext GhcTc
 type instance XCase          GhcTc = HsMatchContext GhcTc
 
-type instance XIf            GhcPs = EpAnn AnnsIf
+type instance XIf            GhcPs = AnnsIf
 type instance XIf            GhcRn = NoExtField
 type instance XIf            GhcTc = NoExtField
 
-type instance XMultiIf       GhcPs = EpAnn [AddEpAnn]
+type instance XMultiIf       GhcPs = [AddEpAnn]
 type instance XMultiIf       GhcRn = NoExtField
 type instance XMultiIf       GhcTc = Type
 
@@ -295,7 +295,7 @@ type instance XLet           GhcPs = (EpToken "let", EpToken "in")
 type instance XLet           GhcRn = NoExtField
 type instance XLet           GhcTc = NoExtField
 
-type instance XDo            GhcPs = EpAnn AnnList
+type instance XDo            GhcPs = AnnList
 type instance XDo            GhcRn = NoExtField
 type instance XDo            GhcTc = Type
 
@@ -1123,7 +1123,7 @@ type instance XCmdArrApp  GhcPs = EpAnn AddEpAnn
 type instance XCmdArrApp  GhcRn = NoExtField
 type instance XCmdArrApp  GhcTc = Type
 
-type instance XCmdArrForm GhcPs = EpAnn AnnList
+type instance XCmdArrForm GhcPs = AnnList
 type instance XCmdArrForm GhcRn = NoExtField
 type instance XCmdArrForm GhcTc = NoExtField
 


=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -369,18 +369,18 @@ type instance XSpliceTy        GhcPs = NoExtField
 type instance XSpliceTy        GhcRn = HsUntypedSpliceResult (LHsType GhcRn)
 type instance XSpliceTy        GhcTc = Kind
 
-type instance XDocTy           (GhcPass _) = EpAnn [AddEpAnn]
-type instance XBangTy          (GhcPass _) = EpAnn [AddEpAnn]
+type instance XDocTy           (GhcPass _) = [AddEpAnn]
+type instance XBangTy          (GhcPass _) = [AddEpAnn]
 
 type instance XRecTy           GhcPs = EpAnn AnnList
 type instance XRecTy           GhcRn = NoExtField
 type instance XRecTy           GhcTc = NoExtField
 
-type instance XExplicitListTy  GhcPs = EpAnn [AddEpAnn]
+type instance XExplicitListTy  GhcPs = [AddEpAnn]
 type instance XExplicitListTy  GhcRn = NoExtField
 type instance XExplicitListTy  GhcTc = Kind
 
-type instance XExplicitTupleTy GhcPs = EpAnn [AddEpAnn]
+type instance XExplicitTupleTy GhcPs = [AddEpAnn]
 type instance XExplicitTupleTy GhcRn = NoExtField
 type instance XExplicitTupleTy GhcTc = [Kind]
 


=====================================
compiler/GHC/Hs/Utils.hs
=====================================
@@ -239,14 +239,14 @@ mkLocatedList ms = case nonEmpty ms of
     Just ms1 -> L (noAnnSrcSpan $ locA $ combineLocsA (NE.head ms1) (NE.last ms1)) ms
 
 mkHsApp :: LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
-mkHsApp e1 e2 = addCLocA e1 e2 (HsApp noComments e1 e2)
+mkHsApp e1 e2 = addCLocA e1 e2 (HsApp noExtField e1 e2)
 
 mkHsAppWith
   :: (LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> HsExpr (GhcPass id) -> LHsExpr (GhcPass id))
   -> LHsExpr (GhcPass id)
   -> LHsExpr (GhcPass id)
   -> LHsExpr (GhcPass id)
-mkHsAppWith mkLocated e1 e2 = mkLocated e1 e2 (HsApp noAnn e1 e2)
+mkHsAppWith mkLocated e1 e2 = mkLocated e1 e2 (HsApp noExtField e1 e2)
 
 mkHsApps
   :: LHsExpr (GhcPass id) -> [LHsExpr (GhcPass id)] -> LHsExpr (GhcPass id)
@@ -331,11 +331,11 @@ mkHsIntegral   :: IntegralLit -> HsOverLit GhcPs
 mkHsFractional :: FractionalLit -> HsOverLit GhcPs
 mkHsIsString   :: SourceText -> FastString -> HsOverLit GhcPs
 mkHsDo         :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> HsExpr GhcPs
-mkHsDoAnns     :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> EpAnn AnnList -> HsExpr GhcPs
+mkHsDoAnns     :: HsDoFlavour -> LocatedL [ExprLStmt GhcPs] -> AnnList -> HsExpr GhcPs
 mkHsComp       :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
                -> HsExpr GhcPs
 mkHsCompAnns   :: HsDoFlavour -> [ExprLStmt GhcPs] -> LHsExpr GhcPs
-               -> EpAnn AnnList
+               -> AnnList
                -> HsExpr GhcPs
 
 mkNPat      :: LocatedAn NoEpAnns (HsOverLit GhcPs) -> Maybe (SyntaxExpr GhcPs) -> EpAnn [AddEpAnn]
@@ -396,7 +396,7 @@ mkHsCompAnns ctxt stmts expr@(L l e) anns = mkHsDoAnns ctxt (L loc (stmts ++ [la
     loc  = noAnnSrcSpan $ getHasLocList (last_stmt:stmts)
 
 -- restricted to GhcPs because other phases might need a SyntaxExpr
-mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> EpAnn AnnsIf
+mkHsIf :: LHsExpr GhcPs -> LHsExpr GhcPs -> LHsExpr GhcPs -> AnnsIf
        -> HsExpr GhcPs
 mkHsIf c a b anns = HsIf anns c a b
 
@@ -526,7 +526,7 @@ nlLitPat :: HsLit GhcPs -> LPat GhcPs
 nlLitPat l = noLocA (LitPat noExtField l)
 
 nlHsApp :: IsPass id => LHsExpr (GhcPass id) -> LHsExpr (GhcPass id) -> LHsExpr (GhcPass id)
-nlHsApp f x = noLocA (HsApp noComments f (mkLHsPar x))
+nlHsApp f x = noLocA (HsApp noExtField f (mkLHsPar x))
 
 nlHsSyntaxApps :: SyntaxExprTc -> [LHsExpr GhcTc]
                -> LHsExpr GhcTc
@@ -541,7 +541,7 @@ nlHsVarApps :: IsSrcSpanAnn p a
 nlHsVarApps f xs = noLocA (foldl' mk (HsVar noExtField (noLocA f))
                                          (map ((HsVar noExtField) . noLocA) xs))
                  where
-                   mk f a = HsApp noComments (noLocA f) (noLocA a)
+                   mk f a = HsApp noExtField (noLocA f) (noLocA a)
 
 nlConVarPat :: RdrName -> [RdrName] -> LPat GhcPs
 nlConVarPat con vars = nlConPat con (map nlVarPat vars)


=====================================
compiler/GHC/HsToCore/Arrows.hs
=====================================
@@ -784,9 +784,9 @@ dsCases ids local_vars stack_id stack_ty res_ty
   let
       left_id  = mkConLikeTc (RealDataCon left_con)
       right_id = mkConLikeTc (RealDataCon right_con)
-      left_expr  ty1 ty2 e = noLocA $ HsApp noComments
+      left_expr  ty1 ty2 e = noLocA $ HsApp noExtField
                          (noLocA $ mkHsWrap (mkWpTyApps [ty1, ty2]) left_id ) e
-      right_expr ty1 ty2 e = noLocA $ HsApp noComments
+      right_expr ty1 ty2 e = noLocA $ HsApp noExtField
                          (noLocA $ mkHsWrap (mkWpTyApps [ty1, ty2]) right_id) e
 
       -- Prefix each tuple with a distinct series of Left's and Right's,


=====================================
compiler/GHC/Parser.y
=====================================
@@ -2266,8 +2266,8 @@ atype :: { LHsType GhcPs }
                                                ; return $ sL1a $1 (HsStarTy noExtField (isUnicode $1)) } }
 
         -- See Note [Whitespace-sensitive operator parsing] in GHC.Parser.Lexer
-        | PREFIX_TILDE atype             {% acsA (\cs -> sLL $1 $> (mkBangTy (EpAnn (glEE $1 $>) [mj AnnTilde $1] cs) SrcLazy $2)) }
-        | PREFIX_BANG  atype             {% acsA (\cs -> sLL $1 $> (mkBangTy (EpAnn (glEE $1 $>) [mj AnnBang $1] cs) SrcStrict $2)) }
+        | PREFIX_TILDE atype             {% amsA' (sLL $1 $> (mkBangTy [mj AnnTilde $1] SrcLazy $2)) }
+        | PREFIX_BANG  atype             {% amsA' (sLL $1 $> (mkBangTy [mj AnnBang $1] SrcStrict $2)) }
 
         | '{' fielddecls '}'             {% do { decls <- acsA (\cs -> (sLL $1 $> $ HsRecTy (EpAnn (glEE $1 $>) (AnnList (listAsAnchorM $2) (Just $ moc $1) (Just $ mcc $3) [] []) cs) $2))
                                                ; checkRecordSyntax decls }}
@@ -2288,8 +2288,8 @@ atype :: { LHsType GhcPs }
         | SIMPLEQUOTE qcon_nowiredlist {% acsA (\cs -> sLL $1 $> $ HsTyVar (EpAnn (glEE $1 $>) [mj AnnSimpleQuote $1,mjN AnnName $2] cs) IsPromoted $2) }
         | SIMPLEQUOTE  '(' ktype ',' comma_types1 ')'
                              {% do { h <- addTrailingCommaA $3 (gl $4)
-                                   ; acsA (\cs -> sLL $1 $> $ HsExplicitTupleTy (EpAnn (glEE $1 $>) [mj AnnSimpleQuote $1,mop $2,mcp $6] cs) (h : $5)) }}
-        | SIMPLEQUOTE  '[' comma_types0 ']'     {% acsA (\cs -> sLL $1 $> $ HsExplicitListTy (EpAnn (glEE $1 $>) [mj AnnSimpleQuote $1,mos $2,mcs $4] cs) IsPromoted $3) }
+                                   ; amsA' (sLL $1 $> $ HsExplicitTupleTy [mj AnnSimpleQuote $1,mop $2,mcp $6] (h : $5)) }}
+        | SIMPLEQUOTE  '[' comma_types0 ']'     {% amsA' (sLL $1 $> $ HsExplicitListTy [mj AnnSimpleQuote $1,mos $2,mcs $4] IsPromoted $3) }
         | SIMPLEQUOTE var                       {% acsA (\cs -> sLL $1 $> $ HsTyVar (EpAnn (glEE $1 $>) [mj AnnSimpleQuote $1,mjN AnnName $2] cs) IsPromoted $2) }
 
         -- Two or more [ty, ty, ty] must be a promoted list type, just as
@@ -2297,7 +2297,7 @@ atype :: { LHsType GhcPs }
         -- (One means a list type, zero means the list type constructor,
         -- so you have to quote those.)
         | '[' ktype ',' comma_types1 ']'  {% do { h <- addTrailingCommaA $2 (gl $3)
-                                                ; acsA (\cs -> sLL $1 $> $ HsExplicitListTy (EpAnn (glEE $1 $>) [mos $1,mcs $5] cs) NotPromoted (h:$4)) }}
+                                                ; amsA' (sLL $1 $> $ HsExplicitListTy [mos $1,mcs $5] NotPromoted (h:$4)) }}
         | INTEGER              { sLLa $1 $> $ HsTyLit noExtField $ HsNumTy (getINTEGERs $1)
                                                            (il_value (getINTEGER $1)) }
         | CHAR                 { sLLa $1 $> $ HsTyLit noExtField $ HsCharTy (getCHARs $1)
@@ -2902,7 +2902,7 @@ aexp    :: { ECP }
 
         | 'if' ifgdpats                 {% hintMultiWayIf (getLoc $1) >>= \_ ->
                                            fmap ecpFromExp $
-                                           acsA (\cs -> sLL $1 $> $ HsMultiIf (EpAnn (glEE $1 $>) (mj AnnIf $1:(fst $ unLoc $2)) cs)
+                                           amsA' (sLL $1 $> $ HsMultiIf (mj AnnIf $1:(fst $ unLoc $2))
                                                      (reverse $ snd $ unLoc $2)) }
         | 'case' exp 'of' altslist(pats1) {% runPV (unECP $2) >>= \ ($2 :: LHsExpr GhcPs) ->
                                              return $ ECP $
@@ -2920,11 +2920,11 @@ aexp    :: { ECP }
                                                  (AnnList (Just $ glR $2) Nothing Nothing [mj AnnDo $1] []) }
         | MDO stmtlist             {% hintQualifiedDo $1 >> runPV $2 >>= \ $2 ->
                                        fmap ecpFromExp $
-                                       acsA (\cs -> L (comb2 $1 $2)
+                                       amsA' (L (comb2 $1 $2)
                                               (mkHsDoAnns (MDoExpr $
                                                           fmap mkModuleNameFS (getMDO $1))
                                                           $2
-                                           (EpAnn (glEE $1 $>) (AnnList (Just $ glR $2) Nothing Nothing [mj AnnMdo $1] []) cs) )) }
+                                              (AnnList (Just $ glR $2) Nothing Nothing [mj AnnMdo $1] []) )) }
         | 'proc' aexp '->' exp
                        {% (checkPattern <=< runPV) (unECP $2) >>= \ p ->
                            runPV (unECP $4) >>= \ $4 at cmd ->
@@ -3028,7 +3028,7 @@ aexp2   :: { ECP }
         -- arrow notation extension
         | '(|' aexp cmdargs '|)'  {% runPV (unECP $2) >>= \ $2 ->
                                       fmap ecpFromCmd $
-                                      acsA (\cs -> sLL $1 $> $ HsCmdArrForm (EpAnn (glEE $1 $>) (AnnList (glRM $1) (Just $ mu AnnOpenB $1) (Just $ mu AnnCloseB $4) [] []) cs) $2 Prefix
+                                      amsA' (sLL $1 $> $ HsCmdArrForm (AnnList (glRM $1) (Just $ mu AnnOpenB $1) (Just $ mu AnnCloseB $4) [] []) $2 Prefix
                                                            Nothing (reverse $3)) }
 
 projection :: { Located (NonEmpty (LocatedAn NoEpAnns (DotFieldOcc GhcPs))) }
@@ -3096,12 +3096,12 @@ texp :: { ECP }
                                 runPV (rejectPragmaPV $1) >>
                                 runPV $2 >>= \ $2 ->
                                 return $ ecpFromExp $
-                                sLLa $1 $> $ SectionL noAnn $1 (n2l $2) }
+                                sLLa $1 $> $ SectionL noExtField $1 (n2l $2) }
         | qopm infixexp      { ECP $
                                 superInfixOp $
                                 unECP $2 >>= \ $2 ->
                                 $1 >>= \ $1 ->
-                                pvA $ mkHsSectionR_PV (comb2 $1 $>) (n2l $1) $2 }
+                                pvA' $ mkHsSectionR_PV (comb2 $1 $>) (n2l $1) $2 }
 
        -- View patterns get parenthesized above
         | exp '->' texp   { ECP $
@@ -3185,7 +3185,7 @@ list :: { forall b. DisambECP b => SrcSpan -> (AddEpAnn, AddEpAnn) -> PV (Locate
              { \loc (ao,ac) ->
                 checkMonadComp >>= \ ctxt ->
                 unECP $1 >>= \ $1 -> do { t <- addTrailingVbarA $1 (gl $2)
-                ; acsA (\cs -> L loc $ mkHsCompAnns ctxt (unLoc $3) t (EpAnn (spanAsAnchor loc) (AnnList Nothing (Just ao) (Just ac) [] []) cs))
+                ; amsA' (L loc $ mkHsCompAnns ctxt (unLoc $3) t (AnnList Nothing (Just ao) (Just ac) [] []))
                     >>= ecpFromExp' } }
 
 lexps :: { forall b. DisambECP b => PV [LocatedA b] }
@@ -4360,6 +4360,11 @@ ams1 (L l a) b = do
   cs <- getCommentsFor (locA l)
   return (L (EpAnn (spanAsAnchor l) noAnn cs) b)
 
+amsA' :: MonadP m => Located a -> m (LocatedA a)
+amsA' (L l a) = do
+  cs <- getCommentsFor l
+  return (L (EpAnn (spanAsAnchor l) noAnn cs) a)
+
 amsA :: MonadP m => LocatedA a -> [TrailingAnn] -> m (LocatedA a)
 amsA (L l a) bs = do
   cs <- getCommentsFor (locA l)
@@ -4415,6 +4420,10 @@ pvA :: (MonadP m, NoAnn t) => m (Located a) -> m (LocatedAn t a)
 pvA a = do { av <- a
            ; return (reLoc av) }
 
+pvA' :: (MonadP m, NoAnn t) => m (LocatedAn t a) -> m (LocatedAn t a)
+pvA' a = do { av <- a
+           ; return av }
+
 pvN :: MonadP m => m (LocatedN a) -> m (LocatedN a)
 pvN a = do { (L l av) <- a
            ; return (L l av) }


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -1445,7 +1445,7 @@ isFunLhs e = go e [] [] []
                  _ -> return Nothing }
    go _ _ _ _ = return Nothing
 
-mkBangTy :: EpAnn [AddEpAnn] -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs
+mkBangTy :: [AddEpAnn] -> SrcStrictness -> LHsType GhcPs -> HsType GhcPs
 mkBangTy anns strictness =
   HsBangTy anns (HsSrcBang NoSourceText NoSrcUnpack strictness)
 
@@ -1457,9 +1457,7 @@ data UnpackednessPragma =
 addUnpackednessP :: MonadP m => Located UnpackednessPragma -> LHsType GhcPs -> m (LHsType GhcPs)
 addUnpackednessP (L lprag (UnpackednessPragma anns prag unpk)) ty = do
     let l' = combineSrcSpans lprag (getLocA ty)
-    cs <- getCommentsFor l'
-    let an = EpAnn (spanAsAnchor l') anns cs
-        t' = addUnpackedness an ty
+    let t' = addUnpackedness anns ty
     return (L (noAnnSrcSpan l') t')
   where
     -- If we have a HsBangTy that only has a strictness annotation,
@@ -1468,7 +1466,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 (epAnnAnns x) (epAnnComments x)) (HsSrcBang prag unpk strictness) t
+      = HsBangTy (an Semi.<> x) (HsSrcBang prag unpk strictness) t
     addUnpackedness an t
       = HsBangTy an (HsSrcBang prag unpk NoSrcStrict) t
 
@@ -1632,7 +1630,7 @@ class (b ~ (Body b) GhcPs, AnnoBody b) => DisambECP b where
   mkHsNegAppPV :: SrcSpan -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
   -- | Disambiguate "(# a)" (right operator section)
   mkHsSectionR_PV
-    :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (Located b)
+    :: SrcSpan -> LocatedA (InfixOp b) -> LocatedA b -> PV (LocatedA b)
   -- | Disambiguate "(a -> b)" (view pattern)
   mkHsViewPatPV
     :: SrcSpan -> LHsExpr GhcPs -> LocatedA b -> [AddEpAnn] -> PV (LocatedA b)
@@ -1717,7 +1715,7 @@ instance DisambECP (HsCmd GhcPs) where
   mkHsOpAppPV l c1 op c2 = do
     let cmdArg c = L (l2l $ getLoc c) $ HsCmdTop noExtField c
     cs <- getCommentsFor l
-    return $ L (noAnnSrcSpan l) $ HsCmdArrForm (EpAnn (spanAsAnchor l) (AnnList Nothing Nothing Nothing [] []) cs) (reLoc op) Infix Nothing [cmdArg c1, cmdArg c2]
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) $ HsCmdArrForm (AnnList Nothing Nothing Nothing [] []) (reLoc op) Infix Nothing [cmdArg c1, cmdArg c2]
 
   mkHsCasePV l c (L lm m) anns = do
     cs <- getCommentsFor l
@@ -1797,33 +1795,33 @@ instance DisambECP (HsExpr GhcPs) where
   superInfixOp m = m
   mkHsOpAppPV l e1 op e2 = do
     cs <- getCommentsFor l
-    return $ L (noAnnSrcSpan l) $ OpApp (EpAnn (spanAsAnchor l) [] cs) e1 (reLoc op) e2
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) $ OpApp [] e1 (reLoc op) e2
   mkHsCasePV l e (L lm m) anns = do
     cs <- getCommentsFor l
     let mg = mkMatchGroup FromSource (L lm m)
-    return $ L (noAnnSrcSpan l) (HsCase (EpAnn (spanAsAnchor l) anns cs) e mg)
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsCase anns e mg)
   mkHsLamPV l lam_variant (L lm m) anns = do
     cs <- getCommentsFor l
     let mg = mkLamCaseMatchGroup FromSource lam_variant (L lm m)
     checkLamMatchGroup l lam_variant mg
-    return $ L (noAnnSrcSpan l) (HsLam (EpAnn (spanAsAnchor l) anns cs) lam_variant mg)
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsLam anns lam_variant mg)
   type FunArg (HsExpr GhcPs) = HsExpr GhcPs
   superFunArg m = m
-  mkHsAppPV l e1 e2 = do
+  mkHsAppPV l@(EpAnn anc an csIn) e1 e2 = do
     cs <- getCommentsFor (locA l)
     checkExpBlockArguments e1
     checkExpBlockArguments e2
-    return $ L l (HsApp (comment (realSrcSpan $ locA l) cs) e1 e2)
+    return $ L (EpAnn anc an (csIn Semi.<> cs)) (HsApp noExtField e1 e2)
   mkHsAppTypePV l e at t = do
     checkExpBlockArguments e
     return $ L l (HsAppType at e (mkHsWildCardBndrs t))
   mkHsIfPV l c semi1 a semi2 b anns = do
     checkDoAndIfThenElse PsErrSemiColonsInCondExpr c semi1 a semi2 b
     cs <- getCommentsFor l
-    return $ L (noAnnSrcSpan l) (mkHsIf c a b (EpAnn (spanAsAnchor l) anns cs))
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (mkHsIf c a b anns)
   mkHsDoPV l mod stmts anns = do
     cs <- getCommentsFor l
-    return $ L (noAnnSrcSpan l) (HsDo (EpAnn (spanAsAnchor l) anns cs) (DoExpr mod) stmts)
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsDo anns (DoExpr mod) stmts)
   mkHsParPV l lpar e rpar = do
     cs <- getCommentsFor l
     return $ L (EpAnn (spanAsAnchor l) noAnn cs) (HsPar (lpar, rpar) e)
@@ -1852,10 +1850,10 @@ instance DisambECP (HsExpr GhcPs) where
     checkRecordSyntax (L (noAnnSrcSpan l) r)
   mkHsNegAppPV l a anns = do
     cs <- getCommentsFor l
-    return $ L (noAnnSrcSpan l) (NegApp (EpAnn (spanAsAnchor l) anns cs) a noSyntaxExpr)
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (NegApp anns a noSyntaxExpr)
   mkHsSectionR_PV l op e = do
     cs <- getCommentsFor l
-    return $ L l (SectionR (comment (realSrcSpan l) cs) op e)
+    return $ L (EpAnn (spanAsAnchor l) noAnn cs) (SectionR noExtField op e)
   mkHsViewPatPV l a b _ = addError (mkPlainErrorMsgEnvelope l $ PsErrViewPatInExpr a b)
                           >> return (L (noAnnSrcSpan l) (hsHoleExpr noAnn))
   mkHsAsPatPV l v _ e   = addError (mkPlainErrorMsgEnvelope l $ PsErrTypeAppWithoutSpace (unLoc v) e)
@@ -3145,13 +3143,13 @@ mkSumOrTupleExpr l boxity (Tuple es) anns = do
 -- Sum
 -- mkSumOrTupleExpr l Unboxed (Sum alt arity e) =
 --     return $ L l (ExplicitSum noExtField alt arity e)
-mkSumOrTupleExpr l Unboxed (Sum alt arity e barsp barsa) anns = do
+mkSumOrTupleExpr l@(EpAnn anc anIn csIn) Unboxed (Sum alt arity e barsp barsa) anns = do
     let an = case anns of
                [AddEpAnn AnnOpenPH o, AddEpAnn AnnClosePH c] ->
                  AnnExplicitSum o barsp barsa c
                _ -> panic "mkSumOrTupleExpr"
     cs <- getCommentsFor (locA l)
-    return $ L l (ExplicitSum (EpAnn (spanAsAnchor $ locA l) an cs) alt arity e)
+    return $ L (EpAnn anc anIn (csIn Semi.<> cs)) (ExplicitSum an alt arity e)
 mkSumOrTupleExpr l Boxed a at Sum{} _ =
     addFatalError $ mkPlainErrorMsgEnvelope (locA l) $ PsErrUnsupportedBoxedSumExpr a
 


=====================================
compiler/GHC/Rename/Expr.hs
=====================================
@@ -316,7 +316,7 @@ rnExpr (HsOverLit x lit)
        ; case mb_neg of
               Nothing -> return (HsOverLit x lit', fvs)
               Just neg ->
-                 return (HsApp noComments (noLocA neg) (noLocA (HsOverLit x lit'))
+                 return (HsApp noExtField (noLocA neg) (noLocA (HsOverLit x lit'))
                         , fvs ) }
 
 rnExpr (HsApp x fun arg)
@@ -639,9 +639,9 @@ rnSection section@(SectionL x expr op)
                         -- Note [Left and right sections]
         ; let rn_section = SectionL x expr' op'
               ds_section
-                | postfix_ops = HsApp noAnn op' expr'
+                | postfix_ops = HsApp noExtField op' expr'
                 | otherwise   = genHsApps leftSectionName
-                                   [wrapGenSpan $ HsApp noAnn op' expr']
+                                   [wrapGenSpan $ HsApp noExtField op' expr']
         ; return ( mkExpandedExpr rn_section ds_section
                  , fvs_op `plusFV` fvs_expr) }
 
@@ -2186,7 +2186,7 @@ stmtTreeToStmts monad_names ctxt (StmtTreeApplicative trees) tail tail_fvs = do
              -- Need 'pureAName' and not 'returnMName' here, so that it requires
              -- 'Applicative' and not 'Monad' whenever possible (until #20540 is fixed).
              (ret, _) <- lookupQualifiedDoExpr (HsDoStmt ctxt) pureAName
-             let expr = HsApp noComments (noLocA ret) tup
+             let expr = HsApp noExtField (noLocA ret) tup
              return (expr, emptyFVs)
      return ( ApplicativeArgMany
               { xarg_app_arg_many = noExtField


=====================================
compiler/GHC/Rename/Splice.hs
=====================================
@@ -389,8 +389,8 @@ mkQuasiQuoteExpr :: UntypedSpliceFlavour -> Name
 -- Return the expression (quoter "...quote...")
 -- which is what we must run in a quasi-quote
 mkQuasiQuoteExpr flavour quoter (L q_span' quote)
-  = L q_span $ HsApp noComments (L q_span
-             $ HsApp noComments (L q_span
+  = L q_span $ HsApp noExtField (L q_span
+             $ HsApp noExtField (L q_span
                     (HsVar noExtField (L (l2l q_span) quote_selector)))
                                 quoterExpr)
                     quoteExpr


=====================================
compiler/GHC/Rename/Utils.hs
=====================================
@@ -728,7 +728,7 @@ genHsApps' (L _ fun) [] = genHsVar fun
 genHsApps' (L loc fun) (arg:args) = foldl genHsApp (unLoc $ mkHsApp (L (l2l loc) $ genHsVar fun) arg) args
 
 genHsApp :: HsExpr GhcRn -> LHsExpr GhcRn -> HsExpr GhcRn
-genHsApp fun arg = HsApp noAnn (wrapGenSpan fun) arg
+genHsApp fun arg = HsApp noExtField (wrapGenSpan fun) arg
 
 genLHsApp :: HsExpr GhcRn -> LHsExpr GhcRn -> LHsExpr GhcRn
 genLHsApp fun arg = wrapGenSpan (genHsApp fun arg)


=====================================
compiler/GHC/Tc/Gen/Expr.hs
=====================================
@@ -463,7 +463,7 @@ tcExpr (HsStatic fvs expr) res_ty
         ; let wrap = mkWpEvVarApps [typeable_ev] <.> mkWpTyApps [expr_ty]
         ; loc <- getSrcSpanM
         ; static_ptr_ty_con <- tcLookupTyCon staticPtrTyConName
-        ; return $ mkHsWrapCo co $ HsApp noComments
+        ; return $ mkHsWrapCo co $ HsApp noExtField
                             (L (noAnnSrcSpan loc) $ mkHsWrap wrap fromStaticPtr)
                             (L (noAnnSrcSpan loc) (HsStatic (fvs, mkTyConApp static_ptr_ty_con [expr_ty]) expr'))
         }


=====================================
compiler/GHC/Tc/Gen/Head.hs
=====================================
@@ -381,7 +381,7 @@ rebuild_hs_apps fun _ [] = fun
 rebuild_hs_apps fun ctxt (arg : args)
   = case arg of
       EValArg { eva_arg = ValArg arg, eva_ctxt = ctxt' }
-        -> rebuild_hs_apps (HsApp noAnn lfun arg) ctxt' args
+        -> rebuild_hs_apps (HsApp noExtField lfun arg) ctxt' args
       ETypeArg { eva_hs_ty = hs_ty, eva_ty = ty, eva_ctxt = ctxt' }
         -> rebuild_hs_apps (HsAppType ty lfun hs_ty) ctxt' args
       EPrag ctxt' p
@@ -1087,7 +1087,7 @@ tcInferOverLit lit@(OverLit { ol_val = val
                         HsLit noExtField hs_lit
              from_expr = mkHsWrap (wrap2 <.> wrap1) $
                          HsVar noExtField (L loc from_id)
-             witness = HsApp noAnn (L (l2l loc) from_expr) lit_expr
+             witness = HsApp noExtField (L (l2l loc) from_expr) lit_expr
              lit' = lit { ol_ext = OverLitTc { ol_rebindable = rebindable
                                              , ol_witness = witness
                                              , ol_type = res_ty } }


=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -1002,7 +1002,7 @@ runAnnotation target expr = do
               ; let specialised_to_annotation_wrapper_expr
                       = L loc' (mkHsWrap wrapper
                                  (HsVar noExtField (L (noAnnSrcSpan loc) to_annotation_wrapper_id)))
-              ; return (L loc' (HsApp noComments
+              ; return (L loc' (HsApp noExtField
                                 specialised_to_annotation_wrapper_expr expr'))
                                 })
 


=====================================
compiler/GHC/Tc/TyCl/Instance.hs
=====================================
@@ -1332,7 +1332,7 @@ tcInstDecl2 (InstInfo { iSpec = ispec, iBinds = ibinds })
              con_app_args = foldl' app_to_meth con_app_tys sc_meth_ids
 
              app_to_meth :: HsExpr GhcTc -> Id -> HsExpr GhcTc
-             app_to_meth fun meth_id = HsApp noComments (L loc' fun)
+             app_to_meth fun meth_id = HsApp noExtField (L loc' fun)
                                             (L loc' (wrapId arg_wrapper meth_id))
 
              inst_tv_tys = mkTyVarTys inst_tyvars
@@ -1869,7 +1869,7 @@ tcMethods skol_info dfun_id clas tyvars dfun_ev_vars inst_tys
       where
         inst_loc' = noAnnSrcSpan inst_loc
         error_rhs dflags = L inst_loc'
-                         $ HsApp noComments error_fun (error_msg dflags)
+                         $ HsApp noExtField error_fun (error_msg dflags)
         error_fun    = L inst_loc' $
                        wrapId (mkWpTyApps
                                 [ getRuntimeRep meth_tau, meth_tau])


=====================================
compiler/GHC/Tc/TyCl/PatSyn.hs
=====================================
@@ -1061,7 +1061,7 @@ tcPatToExpr args pat = go pat
       Nothing      -> notInvertible p
       Just inverse ->
         fmap
-          (\ expr -> HsApp noAnn (wrapGenSpan inverse) (wrapGenSpan expr))
+          (\ expr -> HsApp noExtField (wrapGenSpan inverse) (wrapGenSpan expr))
           (go1 (unLoc pat))
 
     -- The following patterns are not invertible.


=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -2393,7 +2393,7 @@ shortCutLit platform val res_ty
       | otherwise         = Nothing
 
 mkLit :: DataCon -> HsLit GhcTc -> HsExpr GhcTc
-mkLit con lit = HsApp noComments (nlHsDataCon con) (nlHsLit lit)
+mkLit con lit = HsApp noExtField (nlHsDataCon con) (nlHsLit lit)
 
 ------------------------------
 hsOverLitName :: OverLitVal -> Name


=====================================
compiler/GHC/ThToHs.hs
=====================================
@@ -1043,7 +1043,7 @@ cvtl e = wrapLA (cvt e)
           if is_compound_lit l' then wrapParLA gHsPar e' else pure e'
     cvt (AppE e1 e2)   = do { e1' <- parenthesizeHsExpr opPrec <$> cvtl e1
                             ; e2' <- parenthesizeHsExpr appPrec <$> cvtl e2
-                            ; return $ HsApp noComments e1' e2' }
+                            ; return $ HsApp noExtField e1' e2' }
     cvt (AppTypeE e t) = do { e' <- parenthesizeHsExpr opPrec <$> cvtl e
                             ; t' <- parenthesizeHsType appPrec <$> cvtType t
                             ; return $ HsAppType noAnn e'
@@ -1112,12 +1112,12 @@ cvtl e = wrapLA (cvt e)
     cvt (InfixE Nothing  s (Just y)) = ensureValidOpExp s $
                                        do { s' <- cvtl s; y' <- cvtl y
                                           ; wrapParLA gHsPar $
-                                                          SectionR noComments s' y' }
+                                                          SectionR noExtField s' y' }
                                             -- See Note [Sections in HsSyn] in GHC.Hs.Expr
     cvt (InfixE (Just x) s Nothing ) = ensureValidOpExp s $
                                        do { x' <- cvtl x; s' <- cvtl s
                                           ; wrapParLA gHsPar $
-                                                          SectionL noComments x' s' }
+                                                          SectionL noExtField x' s' }
 
     cvt (InfixE Nothing  s Nothing ) = ensureValidOpExp s $
                                        do { s' <- cvtl s


=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
=====================================
@@ -175,11 +175,7 @@
                (EpaComments
                 []))
               (HsDocTy
-               (EpAnn
-                (EpaDelta (SameLine 0) [])
-                []
-                (EpaComments
-                 []))
+               []
                (L
                 (EpAnn
                  (EpaSpan { T17544.hs:6:14-16 })


=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -577,13 +577,9 @@
                 (EpaComments
                  []))
                (HsExplicitListTy
-                (EpAnn
-                 (EpaSpan { DumpParsedAst.hs:12:10-12 })
-                 [(AddEpAnn AnnSimpleQuote (EpaSpan { DumpParsedAst.hs:12:10 }))
-                 ,(AddEpAnn AnnOpenS (EpaSpan { DumpParsedAst.hs:12:11 }))
-                 ,(AddEpAnn AnnCloseS (EpaSpan { DumpParsedAst.hs:12:12 }))]
-                 (EpaComments
-                  []))
+                [(AddEpAnn AnnSimpleQuote (EpaSpan { DumpParsedAst.hs:12:10 }))
+                ,(AddEpAnn AnnOpenS (EpaSpan { DumpParsedAst.hs:12:11 }))
+                ,(AddEpAnn AnnCloseS (EpaSpan { DumpParsedAst.hs:12:12 }))]
                 (IsPromoted)
                 [])))]
             (Prefix)
@@ -2377,11 +2373,7 @@
                  (EpaComments
                   []))
                 (HsApp
-                 (EpAnn
-                  (EpaSpan { DumpParsedAst.hs:25:8-23 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (L
                   (EpAnn
                    (EpaSpan { DumpParsedAst.hs:25:8-15 })


=====================================
testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
=====================================
@@ -258,25 +258,21 @@
                  (AnnListItem
                   [])
                  (EpaComments
-                  []))
+                  [(L
+                    (EpaSpan
+                     { DumpParsedAstComments.hs:15:3-19 })
+                    (EpaComment
+                     (EpaLineComment
+                      "-- normal comment")
+                     { DumpParsedAstComments.hs:14:7-8 }))]))
                 (HsDo
-                 (EpAnn
-                  (EpaSpan { DumpParsedAstComments.hs:(14,7)-(16,3) })
-                  (AnnList
-                   (Just
-                    (EpaSpan { DumpParsedAstComments.hs:16:3 }))
-                   (Nothing)
-                   (Nothing)
-                   [(AddEpAnn AnnDo (EpaSpan { DumpParsedAstComments.hs:14:7-8 }))]
-                   [])
-                  (EpaComments
-                   [(L
-                     (EpaSpan
-                      { DumpParsedAstComments.hs:15:3-19 })
-                     (EpaComment
-                      (EpaLineComment
-                       "-- normal comment")
-                      { DumpParsedAstComments.hs:14:7-8 }))]))
+                 (AnnList
+                  (Just
+                   (EpaSpan { DumpParsedAstComments.hs:16:3 }))
+                  (Nothing)
+                  (Nothing)
+                  [(AddEpAnn AnnDo (EpaSpan { DumpParsedAstComments.hs:14:7-8 }))]
+                  [])
                  (DoExpr
                   (Nothing))
                  (L
@@ -411,11 +407,7 @@
                  (EpaComments
                   []))
                 (HsApp
-                 (EpAnn
-                  (EpaSpan { DumpParsedAstComments.hs:19:8-23 })
-                  (NoEpAnns)
-                  (EpaComments
-                   []))
+                 (NoExtField)
                  (L
                   (EpAnn
                    (EpaSpan { DumpParsedAstComments.hs:19:8-15 })


=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -92,11 +92,7 @@
                       (EpaComments
                        []))
                      (HsApp
-                      (EpAnn
-                       (EpaSpan { DumpRenamedAst.hs:35:8-23 })
-                       (NoEpAnns)
-                       (EpaComments
-                        []))
+                      (NoExtField)
                       (L
                        (EpAnn
                         (EpaSpan { DumpRenamedAst.hs:35:8-15 })


=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -320,17 +320,13 @@
                  (EpaComments
                   []))
                 (HsDo
-                 (EpAnn
-                  (EpaSpan { DumpSemis.hs:(10,7)-(12,3) })
-                  (AnnList
-                   (Just
-                    (EpaSpan { DumpSemis.hs:(11,3)-(12,3) }))
-                   (Nothing)
-                   (Nothing)
-                   [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:10:7-8 }))]
-                   [])
-                  (EpaComments
-                   []))
+                 (AnnList
+                  (Just
+                   (EpaSpan { DumpSemis.hs:(11,3)-(12,3) }))
+                  (Nothing)
+                  (Nothing)
+                  [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:10:7-8 }))]
+                  [])
                  (DoExpr
                   (Nothing))
                  (L
@@ -362,17 +358,13 @@
                        (EpaComments
                         []))
                       (HsDo
-                       (EpAnn
-                        (EpaSpan { DumpSemis.hs:11:3-15 })
-                        (AnnList
-                         (Just
-                          (EpaSpan { DumpSemis.hs:11:6-15 }))
-                         (Nothing)
-                         (Nothing)
-                         [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:11:3-4 }))]
-                         [])
-                        (EpaComments
-                         []))
+                       (AnnList
+                        (Just
+                         (EpaSpan { DumpSemis.hs:11:6-15 }))
+                        (Nothing)
+                        (Nothing)
+                        [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:11:3-4 }))]
+                        [])
                        (DoExpr
                         (Nothing))
                        (L
@@ -635,17 +627,13 @@
                  (EpaComments
                   []))
                 (HsDo
-                 (EpAnn
-                  (EpaSpan { DumpSemis.hs:(15,7)-(19,3) })
-                  (AnnList
-                   (Just
-                    (EpaSpan { DumpSemis.hs:(16,3)-(19,3) }))
-                   (Nothing)
-                   (Nothing)
-                   [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:15:7-8 }))]
-                   [])
-                  (EpaComments
-                   []))
+                 (AnnList
+                  (Just
+                   (EpaSpan { DumpSemis.hs:(16,3)-(19,3) }))
+                  (Nothing)
+                  (Nothing)
+                  [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:15:7-8 }))]
+                  [])
                  (DoExpr
                   (Nothing))
                  (L
@@ -901,17 +889,13 @@
                  (EpaComments
                   []))
                 (HsDo
-                 (EpAnn
-                  (EpaSpan { DumpSemis.hs:22:7-30 })
-                  (AnnList
-                   (Just
-                    (EpaSpan { DumpSemis.hs:22:10-30 }))
-                   (Nothing)
-                   (Nothing)
-                   [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:22:7-8 }))]
-                   [])
-                  (EpaComments
-                   []))
+                 (AnnList
+                  (Just
+                   (EpaSpan { DumpSemis.hs:22:10-30 }))
+                  (Nothing)
+                  (Nothing)
+                  [(AddEpAnn AnnDo (EpaSpan { DumpSemis.hs:22:7-8 }))]
+                  [])
                  (DoExpr
                   (Nothing))
                  (L
@@ -2296,14 +2280,10 @@
                  (EpaComments
                   []))
                 (HsCase
-                 (EpAnn
-                  (EpaSpan { DumpSemis.hs:(37,3)-(44,4) })
-                  (EpAnnHsCase
-                   (EpaSpan { DumpSemis.hs:37:3-6 })
-                   (EpaSpan { DumpSemis.hs:37:10-11 })
-                   [])
-                  (EpaComments
-                   []))
+                 (EpAnnHsCase
+                  (EpaSpan { DumpSemis.hs:37:3-6 })
+                  (EpaSpan { DumpSemis.hs:37:10-11 })
+                  [])
                  (L
                   (EpAnn
                    (EpaSpan { DumpSemis.hs:37:8 })


=====================================
testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
=====================================
@@ -20,11 +20,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -33,11 +29,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -46,11 +38,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -59,11 +47,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -72,11 +56,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -85,11 +65,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -156,11 +132,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -230,11 +202,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -243,11 +211,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -256,11 +220,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -269,11 +229,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -282,11 +238,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -295,11 +247,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -366,11 +314,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -440,11 +384,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -453,11 +393,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -466,11 +402,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -479,11 +411,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -492,11 +420,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -505,11 +429,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -576,11 +496,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -650,11 +566,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -663,11 +575,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -676,11 +584,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -689,11 +593,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -702,11 +602,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -715,11 +611,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -786,11 +678,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -860,11 +748,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -873,11 +757,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -886,11 +766,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -899,11 +775,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -912,11 +784,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -925,11 +793,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -996,11 +860,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -1070,11 +930,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1120,11 +976,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1170,11 +1022,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1220,11 +1068,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1233,11 +1077,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1302,11 +1142,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1315,11 +1151,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1384,11 +1216,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1397,11 +1225,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1466,11 +1290,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1479,11 +1299,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1548,11 +1364,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1561,11 +1373,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1630,11 +1438,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1643,11 +1447,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -1694,11 +1494,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -1707,11 +1503,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -1765,11 +1557,7 @@
               (EpaComments
                []))
              (HsApp
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               (NoEpAnns)
-               (EpaComments
-                []))
+              (NoExtField)
               (L
                (EpAnn
                 (EpaSpan { <no location info> })
@@ -1778,11 +1566,7 @@
                 (EpaComments
                  []))
                (HsApp
-                (EpAnn
-                 (EpaDelta (SameLine 0) [])
-                 (NoEpAnns)
-                 (EpaComments
-                  []))
+                (NoExtField)
                 (L
                  (EpAnn
                   (EpaSpan { <no location info> })
@@ -1836,11 +1620,7 @@
                   (EpaComments
                    []))
                  (HsApp
-                  (EpAnn
-                   (EpaDelta (SameLine 0) [])
-                   (NoEpAnns)
-                   (EpaComments
-                    []))
+                  (NoExtField)
                   (L
                    (EpAnn
                     (EpaSpan { <no location info> })
@@ -1849,11 +1629,7 @@
                     (EpaComments
                      []))
                    (HsApp
-                    (EpAnn
-                     (EpaDelta (SameLine 0) [])
-                     (NoEpAnns)
-                     (EpaComments
-                      []))
+                    (NoExtField)
                     (L
                      (EpAnn
                       (EpaSpan { <no location info> })
@@ -1927,11 +1703,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -1940,11 +1712,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -2011,11 +1779,7 @@
       (EpaComments
        []))
      (HsApp
-      (EpAnn
-       (EpaDelta (SameLine 0) [])
-       (NoEpAnns)
-       (EpaComments
-        []))
+      (NoExtField)
       (L
        (EpAnn
         (EpaSpan { <no location info> })
@@ -2024,11 +1788,7 @@
         (EpaComments
          []))
        (HsApp
-        (EpAnn
-         (EpaDelta (SameLine 0) [])
-         (NoEpAnns)
-         (EpaComments
-          []))
+        (NoExtField)
         (L
          (EpAnn
           (EpaSpan { <no location info> })
@@ -2058,11 +1818,7 @@
             (EpaComments
              []))
            (HsApp
-            (EpAnn
-             (EpaDelta (SameLine 0) [])
-             (NoEpAnns)
-             (EpaComments
-              []))
+            (NoExtField)
             (L
              (EpAnn
               (EpaSpan { <no location info> })
@@ -2104,11 +1860,7 @@
           (EpaComments
            []))
          (HsApp
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           (NoEpAnns)
-           (EpaComments
-            []))
+          (NoExtField)
           (L
            (EpAnn
             (EpaSpan { <no location info> })
@@ -2242,11 +1994,7 @@
                     (EpaComments
                      []))
                    (HsApp
-                    (EpAnn
-                     (EpaDelta (SameLine 0) [])
-                     (NoEpAnns)
-                     (EpaComments
-                      []))
+                    (NoExtField)
                     (L
                      (EpAnn
                       (EpaSpan { DumpTypecheckedAst.hs:20:8-15 })


=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -1231,13 +1231,9 @@
         (EpaComments
          []))
        (HsExplicitListTy
-        (EpAnn
-         (EpaSpan { KindSigs.hs:26:13-29 })
-         [(AddEpAnn AnnSimpleQuote (EpaSpan { KindSigs.hs:26:13 }))
-         ,(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:26:14 }))
-         ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:26:29 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnSimpleQuote (EpaSpan { KindSigs.hs:26:13 }))
+        ,(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:26:14 }))
+        ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:26:29 }))]
         (IsPromoted)
         [(L
           (EpAnn
@@ -1335,12 +1331,8 @@
         (EpaComments
          []))
        (HsExplicitListTy
-        (EpAnn
-         (EpaSpan { KindSigs.hs:27:14-45 })
-         [(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:27:14 }))
-         ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:27:45 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:27:14 }))
+        ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:27:45 }))]
         (NotPromoted)
         [(L
           (EpAnn
@@ -1521,13 +1513,9 @@
         (EpaComments
          []))
        (HsExplicitTupleTy
-        (EpAnn
-         (EpaSpan { KindSigs.hs:28:16-44 })
-         [(AddEpAnn AnnSimpleQuote (EpaSpan { KindSigs.hs:28:16 }))
-         ,(AddEpAnn AnnOpenP (EpaSpan { KindSigs.hs:28:17 }))
-         ,(AddEpAnn AnnCloseP (EpaSpan { KindSigs.hs:28:44 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnSimpleQuote (EpaSpan { KindSigs.hs:28:16 }))
+        ,(AddEpAnn AnnOpenP (EpaSpan { KindSigs.hs:28:17 }))
+        ,(AddEpAnn AnnCloseP (EpaSpan { KindSigs.hs:28:44 }))]
         [(L
           (EpAnn
            (EpaSpan { KindSigs.hs:28:19-39 })
@@ -1550,12 +1538,8 @@
              (EpaComments
               []))
             (HsExplicitListTy
-             (EpAnn
-              (EpaSpan { KindSigs.hs:28:19-29 })
-              [(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:28:19 }))
-              ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:28:29 }))]
-              (EpaComments
-               []))
+             [(AddEpAnn AnnOpenS (EpaSpan { KindSigs.hs:28:19 }))
+             ,(AddEpAnn AnnCloseS (EpaSpan { KindSigs.hs:28:29 }))]
              (NotPromoted)
              [(L
                (EpAnn


=====================================
testsuite/tests/printer/Test20297.stdout
=====================================
@@ -362,17 +362,13 @@
                              (EpaComments
                               []))
                             (HsDo
-                             (EpAnn
-                              (EpaSpan { Test20297.hs:11:19-26 })
-                              (AnnList
-                               (Just
-                                (EpaSpan { Test20297.hs:11:22-26 }))
-                               (Nothing)
-                               (Nothing)
-                               [(AddEpAnn AnnDo (EpaSpan { Test20297.hs:11:19-20 }))]
-                               [])
-                              (EpaComments
-                               []))
+                             (AnnList
+                              (Just
+                               (EpaSpan { Test20297.hs:11:22-26 }))
+                              (Nothing)
+                              (Nothing)
+                              [(AddEpAnn AnnDo (EpaSpan { Test20297.hs:11:19-20 }))]
+                              [])
                              (DoExpr
                               (Nothing))
                              (L
@@ -767,17 +763,13 @@
                              (EpaComments
                               []))
                             (HsDo
-                             (EpAnn
-                              (EpaSpan { Test20297.ppr.hs:9:17-24 })
-                              (AnnList
-                               (Just
-                                (EpaSpan { Test20297.ppr.hs:9:20-24 }))
-                               (Nothing)
-                               (Nothing)
-                               [(AddEpAnn AnnDo (EpaSpan { Test20297.ppr.hs:9:17-18 }))]
-                               [])
-                              (EpaComments
-                               []))
+                             (AnnList
+                              (Just
+                               (EpaSpan { Test20297.ppr.hs:9:20-24 }))
+                              (Nothing)
+                              (Nothing)
+                              [(AddEpAnn AnnDo (EpaSpan { Test20297.ppr.hs:9:17-18 }))]
+                              [])
                              (DoExpr
                               (Nothing))
                              (L


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -748,6 +748,14 @@ markLensMAA (EpAnn anc a cs) l =
       aa' <- markAddEpAnn aa
       return (EpAnn anc (set l (Just aa') a) cs)
 
+markLensMAA' :: (Monad m, Monoid w) => a -> Lens a (Maybe AddEpAnn) -> EP w m a
+markLensMAA' a l =
+  case view l a of
+    Nothing -> return a
+    Just aa -> do
+      aa' <- markAddEpAnn aa
+      return (set l (Just aa') a)
+
 markLensAA :: (Monad m, Monoid w) => EpAnn a -> Lens a AddEpAnn -> EP w m (EpAnn a)
 markLensAA (EpAnn anc a cs) l = do
   a' <- markKw (view l a)
@@ -768,6 +776,34 @@ markEpAnnLMS (EpAnn anc a cs) l kw (Just str) = do
           return (AddEpAnn kw' r')
       | otherwise = return (AddEpAnn kw' r)
 
+markEpAnnLMS'' :: (Monad m, Monoid w)
+  => a -> Lens a [AddEpAnn] -> AnnKeywordId -> Maybe String -> EP w m a
+markEpAnnLMS'' an l kw Nothing = markEpAnnL' an l kw
+markEpAnnLMS'' a l kw (Just str) = do
+  anns <- mapM go (view l a)
+  return (set l anns a)
+  where
+    go :: (Monad m, Monoid w) => AddEpAnn -> EP w m AddEpAnn
+    go (AddEpAnn kw' r)
+      | kw' == kw = do
+          r' <- printStringAtAA r str
+          return (AddEpAnn kw' r')
+      | otherwise = return (AddEpAnn kw' r)
+
+
+markEpAnnMS' :: (Monad m, Monoid w)
+  => [AddEpAnn] -> AnnKeywordId -> Maybe String -> EP w m [AddEpAnn]
+markEpAnnMS' anns kw Nothing = mark' anns kw
+markEpAnnMS' anns kw (Just str) = do
+  mapM go anns
+  where
+    go :: (Monad m, Monoid w) => AddEpAnn -> EP w m AddEpAnn
+    go (AddEpAnn kw' r)
+      | kw' == kw = do
+          r' <- printStringAtAA r str
+          return (AddEpAnn kw' r')
+      | otherwise = return (AddEpAnn kw' r)
+
 markEpAnnLMS' :: (Monad m, Monoid w)
                 => EpAnn a -> Lens a AddEpAnn -> AnnKeywordId -> Maybe String -> EP w m (EpAnn a)
 markEpAnnLMS' an l _kw Nothing = markLensKwA an l
@@ -1263,6 +1299,13 @@ markLensKw (EpAnn anc a cs) l kw = do
   loc <- markKwA kw (view l a)
   return (EpAnn anc (set l loc a) cs)
 
+markLensKw' :: (Monad m, Monoid w)
+  => a -> Lens a EpaLocation -> AnnKeywordId -> EP w m a
+markLensKw' a l kw = do
+  loc <- markKwA kw (view l a)
+  return (set l loc a)
+
+-- TODO: delete this in favour of markLensKw
 markAnnKwL :: (Monad m, Monoid w)
   => EpAnn a -> Lens a EpaLocation -> AnnKeywordId -> EP w m (EpAnn a)
 markAnnKwL = markLensKw
@@ -1273,6 +1316,12 @@ markAnnKwAllL (EpAnn anc a cs) l kw = do
   anns <- mapM (markKwA kw) (view l a)
   return (EpAnn anc (set l anns a) cs)
 
+markAnnKwAllL' :: (Monad m, Monoid w)
+  => a -> Lens a [EpaLocation] -> AnnKeywordId -> EP w m a
+markAnnKwAllL' a l kw = do
+  anns <- mapM (markKwA kw) (view l a)
+  return (set l anns a)
+
 markLensKwM :: (Monad m, Monoid w)
   => EpAnn a -> Lens a (Maybe EpaLocation) -> AnnKeywordId -> EP w m (EpAnn a)
 markLensKwM (EpAnn anc a cs) l kw = do
@@ -1282,6 +1331,15 @@ markLensKwM (EpAnn anc a cs) l kw = do
     go Nothing = return Nothing
     go (Just s) = Just <$> markKwA kw s
 
+markLensKwM' :: (Monad m, Monoid w)
+  => a -> Lens a (Maybe EpaLocation) -> AnnKeywordId -> EP w m a
+markLensKwM' a l kw = do
+  new <- go (view l a)
+  return (set l new a)
+  where
+    go Nothing = return Nothing
+    go (Just s) = Just <$> markKwA kw s
+
 -- ---------------------------------------------------------------------
 
 markEpAnnL :: (Monad m, Monoid w)
@@ -1290,6 +1348,12 @@ markEpAnnL (EpAnn anc a cs) l kw = do
   anns <- mark' (view l a) kw
   return (EpAnn anc (set l anns a) cs)
 
+markEpAnnL' :: (Monad m, Monoid w)
+  => ann -> Lens ann [AddEpAnn] -> AnnKeywordId -> EP w m ann
+markEpAnnL' a l kw = do
+  anns <- mark' (view l a) kw
+  return (set l anns a)
+
 markEpAnnAllL :: (Monad m, Monoid w)
   => EpAnn ann -> Lens ann [AddEpAnn] -> AnnKeywordId -> EP w m (EpAnn ann)
 markEpAnnAllL (EpAnn anc a cs) l kw = do
@@ -1301,6 +1365,17 @@ markEpAnnAllL (EpAnn anc a cs) l kw = do
           then markKw an
           else return an
 
+markEpAnnAllL' :: (Monad m, Monoid w)
+  => ann -> Lens ann [AddEpAnn] -> AnnKeywordId -> EP w m ann
+markEpAnnAllL' a l kw = do
+  anns <- mapM doit (view l a)
+  return (set l anns a)
+  where
+    doit an@(AddEpAnn ka _)
+      = if ka == kw
+          then markKw an
+          else return an
+
 markAddEpAnn :: (Monad m, Monoid w) => AddEpAnn -> EP w m AddEpAnn
 markAddEpAnn a@(AddEpAnn kw _) = do
   r <- mark' [a] kw
@@ -1375,6 +1450,17 @@ markAnnListA an action = do
   an3 <- markLensMAA an2 lal_close
   return (an3, r)
 
+markAnnListA' :: (Monad m, Monoid w)
+  => AnnList
+  -> (AnnList -> EP w m (AnnList, a))
+  -> EP w m (AnnList, a)
+markAnnListA' an action = do
+  an0 <- markLensMAA' an lal_open
+  an1 <- markEpAnnAllL' an0 lal_rest AnnSemi
+  (an2, r) <- action an1
+  an3 <- markLensMAA' an2 lal_close
+  return (an3, r)
+
 -- ---------------------------------------------------------------------
 
 printCommentsBefore :: (Monad m, Monoid w) => RealSrcSpan -> EP w m ()
@@ -2864,21 +2950,21 @@ instance ExactPrint (HsExpr GhcPs) where
   getAnnotationEntry (HsIPVar{})                  = NoEntryVal
   getAnnotationEntry (HsOverLit{})                = NoEntryVal
   getAnnotationEntry (HsLit{})                    = NoEntryVal
-  getAnnotationEntry (HsLam an _ _)               = fromAnn an
-  getAnnotationEntry (HsApp an _ _)               = fromAnn an
+  getAnnotationEntry (HsLam{})                    = NoEntryVal
+  getAnnotationEntry (HsApp{})                    = NoEntryVal
   getAnnotationEntry (HsAppType _ _ _)            = NoEntryVal
-  getAnnotationEntry (OpApp an _ _ _)             = fromAnn an
-  getAnnotationEntry (NegApp an _ _)              = fromAnn an
+  getAnnotationEntry (OpApp _ _ _ _)              = NoEntryVal
+  getAnnotationEntry (NegApp _ _ _)               = NoEntryVal
   getAnnotationEntry (HsPar{})                    = NoEntryVal
-  getAnnotationEntry (SectionL an _ _)            = fromAnn an
-  getAnnotationEntry (SectionR an _ _)            = fromAnn an
+  getAnnotationEntry (SectionL _ _ _)             = NoEntryVal
+  getAnnotationEntry (SectionR _ _ _)             = NoEntryVal
   getAnnotationEntry (ExplicitTuple an _ _)       = fromAnn an
-  getAnnotationEntry (ExplicitSum an _ _ _)       = fromAnn an
-  getAnnotationEntry (HsCase an _ _)              = fromAnn an
-  getAnnotationEntry (HsIf an _ _ _)              = fromAnn an
-  getAnnotationEntry (HsMultiIf an _)             = fromAnn an
+  getAnnotationEntry (ExplicitSum _ _ _ _)        = NoEntryVal
+  getAnnotationEntry (HsCase _ _ _)               = NoEntryVal
+  getAnnotationEntry (HsIf _ _ _ _)               = NoEntryVal
+  getAnnotationEntry (HsMultiIf _ _)              = NoEntryVal
   getAnnotationEntry (HsLet _ _ _)                = NoEntryVal
-  getAnnotationEntry (HsDo an _ _)                = fromAnn an
+  getAnnotationEntry (HsDo _ _ _)                 = NoEntryVal
   getAnnotationEntry (ExplicitList an _)          = fromAnn an
   getAnnotationEntry (RecordCon an _ _)           = fromAnn an
   getAnnotationEntry (RecordUpd an _ _)           = fromAnn an
@@ -2902,21 +2988,21 @@ instance ExactPrint (HsExpr GhcPs) where
   setAnnotationAnchor a@(HsIPVar{})             _ _ _s = a
   setAnnotationAnchor a@(HsOverLit {})          _ _ _s = a
   setAnnotationAnchor a@(HsLit {})              _ _ _s = a
-  setAnnotationAnchor (HsLam an a b)         anc ts cs = (HsLam (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (HsApp an a b)         anc ts cs = (HsApp (setAnchorEpa an anc ts cs) a b)
+  setAnnotationAnchor a@(HsLam{})               _ _ _s = a
+  setAnnotationAnchor a@(HsApp{})               _ _ _s = a
   setAnnotationAnchor a@(HsAppType {})          _ _ _s = a
-  setAnnotationAnchor (OpApp an a b c)       anc ts cs = (OpApp (setAnchorEpa an anc ts cs) a b c)
-  setAnnotationAnchor (NegApp an a b)        anc ts cs = (NegApp (setAnchorEpa an anc ts cs) a b)
+  setAnnotationAnchor a@(OpApp{})               _ _ _s = a
+  setAnnotationAnchor a@(NegApp{})              _ _ _s = a
   setAnnotationAnchor a@(HsPar {})              _ _ _s = a
-  setAnnotationAnchor (SectionL an a b)      anc ts cs = (SectionL (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (SectionR an a b)      anc ts cs = (SectionR (setAnchorEpa an anc ts cs) a b)
+  setAnnotationAnchor a@(SectionL{})            _ _ _s = a
+  setAnnotationAnchor a@(SectionR{})            _ _ _s = a
   setAnnotationAnchor (ExplicitTuple an a b) anc ts cs = (ExplicitTuple (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (ExplicitSum an a b c) anc ts cs = (ExplicitSum (setAnchorEpa an anc ts cs) a b c)
-  setAnnotationAnchor (HsCase an a b)        anc ts cs = (HsCase (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (HsIf an a b c)        anc ts cs = (HsIf (setAnchorEpa an anc ts cs) a b c)
-  setAnnotationAnchor (HsMultiIf an a)       anc ts cs = (HsMultiIf (setAnchorEpa an anc ts cs) a)
-  setAnnotationAnchor a@(HsLet{})            _ _ _s    = a
-  setAnnotationAnchor (HsDo an a b)          anc ts cs = (HsDo (setAnchorEpa an anc ts cs) a b)
+  setAnnotationAnchor a@(ExplicitSum{})         _ _ _s = a
+  setAnnotationAnchor a@(HsCase{})              _ _ _s = a
+  setAnnotationAnchor a@(HsIf{})                _ _ _s = a
+  setAnnotationAnchor a@(HsMultiIf{})           _ _ _s = a
+  setAnnotationAnchor a@(HsLet{})               _ _ _s = a
+  setAnnotationAnchor a@(HsDo{})                _ _ _s = a
   setAnnotationAnchor (ExplicitList an a)    anc ts cs = (ExplicitList (setAnchorEpa an anc ts cs) a)
   setAnnotationAnchor (RecordCon an a b)     anc ts cs = (RecordCon (setAnchorEpa an anc ts cs) a b)
   setAnnotationAnchor (RecordUpd an a b)     anc ts cs = (RecordUpd (setAnchorEpa an anc ts cs) a b)
@@ -2976,11 +3062,11 @@ instance ExactPrint (HsExpr GhcPs) where
     return (HsLit an lit')
 
   exact (HsLam an lam_variant mg) = do
-    an0 <- markEpAnnL an lidl AnnLam
+    an0 <- mark' an AnnLam
     an1 <- case lam_variant of
              LamSingle -> return an0
-             LamCase -> markEpAnnL an0 lidl AnnCase
-             LamCases -> markEpAnnL an0 lidl AnnCases
+             LamCase -> mark' an0 AnnCase
+             LamCases -> mark' an0 AnnCases
     mg' <- markAnnotated mg
     return (HsLam an1 lam_variant mg')
 
@@ -3002,7 +3088,7 @@ instance ExactPrint (HsExpr GhcPs) where
     return (OpApp an e1' e2' e3')
 
   exact (NegApp an e s) = do
-    an0 <- markEpAnnL an lidl AnnMinus
+    an0 <- markEpAnnL' an lidl AnnMinus
     e' <- markAnnotated e
     return (NegApp an0 e' s)
 
@@ -3036,39 +3122,39 @@ instance ExactPrint (HsExpr GhcPs) where
     return (ExplicitTuple an1 args' b)
 
   exact (ExplicitSum an alt arity expr) = do
-    an0 <- markLensKw an laesOpen AnnOpenPH
-    an1 <- markAnnKwAllL an0 laesBarsBefore AnnVbar
+    an0 <- markLensKw' an laesOpen AnnOpenPH
+    an1 <- markAnnKwAllL' an0 laesBarsBefore AnnVbar
     expr' <- markAnnotated expr
-    an2 <- markAnnKwAllL an1 laesBarsAfter AnnVbar
-    an3 <- markLensKw an2 laesClose AnnClosePH
+    an2 <- markAnnKwAllL' an1 laesBarsAfter AnnVbar
+    an3 <- markLensKw' an2 laesClose AnnClosePH
     return (ExplicitSum an3 alt arity expr')
 
   exact (HsCase an e alts) = do
-    an0 <- markAnnKwL an lhsCaseAnnCase AnnCase
+    an0 <- markLensKw' an lhsCaseAnnCase AnnCase
     e' <- markAnnotated e
-    an1 <- markAnnKwL an0 lhsCaseAnnOf AnnOf
-    an2 <- markEpAnnL an1 lhsCaseAnnsRest AnnOpenC
-    an3 <- markEpAnnAllL an2 lhsCaseAnnsRest AnnSemi
+    an1 <- markLensKw' an0 lhsCaseAnnOf AnnOf
+    an2 <- markEpAnnL' an1 lhsCaseAnnsRest AnnOpenC
+    an3 <- markEpAnnAllL' an2 lhsCaseAnnsRest AnnSemi
     alts' <- setLayoutBoth $ markAnnotated alts
-    an4 <- markEpAnnL an3 lhsCaseAnnsRest AnnCloseC
+    an4 <- markEpAnnL' an3 lhsCaseAnnsRest AnnCloseC
     return (HsCase an4 e' alts')
 
   exact (HsIf an e1 e2 e3) = do
-    an0 <- markAnnKwL an laiIf AnnIf
+    an0 <- markLensKw' an laiIf AnnIf
     e1' <- markAnnotated e1
-    an1 <- markLensKwM an0 laiThenSemi AnnSemi
-    an2 <- markAnnKwL an1 laiThen AnnThen
+    an1 <- markLensKwM' an0 laiThenSemi AnnSemi
+    an2 <- markLensKw' an1 laiThen AnnThen
     e2' <- markAnnotated e2
-    an3 <- markLensKwM an2 laiElseSemi AnnSemi
-    an4 <- markAnnKwL an3 laiElse AnnElse
+    an3 <- markLensKwM' an2 laiElseSemi AnnSemi
+    an4 <- markLensKw' an3 laiElse AnnElse
     e3' <- markAnnotated e3
     return (HsIf an4 e1' e2' e3')
 
   exact (HsMultiIf an mg) = do
-    an0 <- markEpAnnL an lidl AnnIf
-    an1 <- markEpAnnL an0 lidl AnnOpenC -- optional
+    an0 <- markEpAnnL' an lidl AnnIf
+    an1 <- markEpAnnL' an0 lidl AnnOpenC -- optional
     mg' <- markAnnotated mg
-    an2 <- markEpAnnL an1 lidl AnnCloseC -- optional
+    an2 <- markEpAnnL' an1 lidl AnnCloseC -- optional
     return (HsMultiIf an2 mg')
 
   exact (HsLet (tkLet, tkIn) binds e) = do
@@ -3081,7 +3167,7 @@ instance ExactPrint (HsExpr GhcPs) where
 
   exact (HsDo an do_or_list_comp stmts) = do
     debugM $ "HsDo"
-    (an',stmts') <- markAnnListA an $ \a -> exactDo a do_or_list_comp stmts
+    (an',stmts') <- markAnnListA' an $ \a -> exactDo a do_or_list_comp stmts
     return (HsDo an' do_or_list_comp stmts')
 
   exact (ExplicitList an es) = do
@@ -3230,23 +3316,23 @@ instance ExactPrint (HsExpr GhcPs) where
 -- ---------------------------------------------------------------------
 
 exactDo :: (Monad m, Monoid w, ExactPrint (LocatedAn an a))
-        => EpAnn AnnList -> HsDoFlavour -> LocatedAn an a
-        -> EP w m (EpAnn AnnList, LocatedAn an a)
-exactDo an (DoExpr m)    stmts = exactMdo an m AnnDo          >>= \an0 -> markMaybeDodgyStmts an0 stmts
-exactDo an GhciStmtCtxt  stmts = markEpAnnL an lal_rest AnnDo >>= \an0 -> markMaybeDodgyStmts an0 stmts
-exactDo an (MDoExpr m)   stmts = exactMdo an m AnnMdo         >>= \an0 -> markMaybeDodgyStmts an0 stmts
+        => AnnList -> HsDoFlavour -> LocatedAn an a
+        -> EP w m (AnnList, LocatedAn an a)
+exactDo an (DoExpr m)    stmts = exactMdo an m AnnDo           >>= \an0 -> markMaybeDodgyStmts an0 stmts
+exactDo an GhciStmtCtxt  stmts = markEpAnnL' an lal_rest AnnDo >>= \an0 -> markMaybeDodgyStmts an0 stmts
+exactDo an (MDoExpr m)   stmts = exactMdo an m AnnMdo          >>= \an0 -> markMaybeDodgyStmts an0 stmts
 exactDo an ListComp      stmts = markMaybeDodgyStmts an stmts
 exactDo an MonadComp     stmts = markMaybeDodgyStmts an stmts
 
 exactMdo :: (Monad m, Monoid w)
-  => EpAnn AnnList -> Maybe ModuleName -> AnnKeywordId -> EP w m (EpAnn AnnList)
-exactMdo an Nothing            kw = markEpAnnL   an lal_rest kw
-exactMdo an (Just module_name) kw = markEpAnnLMS an lal_rest kw (Just n)
+  => AnnList -> Maybe ModuleName -> AnnKeywordId -> EP w m AnnList
+exactMdo an Nothing            kw = markEpAnnL'    an lal_rest kw
+exactMdo an (Just module_name) kw = markEpAnnLMS'' an lal_rest kw (Just n)
     where
       n = (moduleNameString module_name) ++ "." ++ (keywordToString kw)
 
 markMaybeDodgyStmts :: (Monad m, Monoid w, ExactPrint (LocatedAn an a))
-  => EpAnn AnnList -> LocatedAn an a -> EP w m (EpAnn AnnList, LocatedAn an a)
+  => AnnList -> LocatedAn an a -> EP w m (AnnList, LocatedAn an a)
 markMaybeDodgyStmts an stmts =
   if isGoodSrcSpan (getLocA stmts)
     then do
@@ -3440,7 +3526,7 @@ instance ExactPrint (HsCmdTop GhcPs) where
 
 instance ExactPrint (HsCmd GhcPs) where
   getAnnotationEntry (HsCmdArrApp an _ _ _ _)   = fromAnn an
-  getAnnotationEntry (HsCmdArrForm an _ _ _ _ ) = fromAnn an
+  getAnnotationEntry (HsCmdArrForm _ _ _ _ _ )  = NoEntryVal
   getAnnotationEntry (HsCmdApp an _ _ )         = fromAnn an
   getAnnotationEntry (HsCmdPar _ _)             = NoEntryVal
   getAnnotationEntry (HsCmdCase an _ _)         = fromAnn an
@@ -3450,7 +3536,7 @@ instance ExactPrint (HsCmd GhcPs) where
   getAnnotationEntry (HsCmdDo an _)             = fromAnn an
 
   setAnnotationAnchor (HsCmdArrApp an a b c d)   anc ts cs = (HsCmdArrApp (setAnchorEpa an anc ts cs) a b c d)
-  setAnnotationAnchor (HsCmdArrForm an a b c d ) anc ts cs = (HsCmdArrForm (setAnchorEpa an anc ts cs) a b c d )
+  setAnnotationAnchor a@(HsCmdArrForm{})            _ _ _s = a
   setAnnotationAnchor (HsCmdApp an a b )         anc ts cs = (HsCmdApp (setAnchorEpa an anc ts cs) a b )
   setAnnotationAnchor (HsCmdLam an a b)          anc ts cs = (HsCmdLam (setAnchorEpa an anc ts cs) a b)
   setAnnotationAnchor a@(HsCmdPar _ _)              _ _ _s = a
@@ -3475,7 +3561,7 @@ instance ExactPrint (HsCmd GhcPs) where
         return (HsCmdArrApp an1 arr' arg' o isRightToLeft)
 
   exact (HsCmdArrForm an e fixity mf cs) = do
-    an0 <- markLensMAA an lal_open
+    an0 <- markLensMAA' an lal_open
     (e',cs') <- case (fixity, cs) of
       (Infix, (arg1:argrest)) -> do
         arg1' <- markAnnotated arg1
@@ -3487,7 +3573,7 @@ instance ExactPrint (HsCmd GhcPs) where
         cs' <- markAnnotated cs
         return (e', cs')
       (Infix, []) -> error "Not possible"
-    an1 <- markLensMAA an0 lal_close
+    an1 <- markLensMAA' an0 lal_close
     return (HsCmdArrForm an1 e' fixity mf cs')
 
   exact (HsCmdApp an e1 e2) = do
@@ -4032,11 +4118,11 @@ instance ExactPrint (HsType GhcPs) where
   getAnnotationEntry (HsStarTy _ _)            = NoEntryVal
   getAnnotationEntry (HsKindSig an _ _)        = fromAnn an
   getAnnotationEntry (HsSpliceTy _ _)          = NoEntryVal
-  getAnnotationEntry (HsDocTy an _ _)          = fromAnn an
-  getAnnotationEntry (HsBangTy an _ _)         = fromAnn an
+  getAnnotationEntry (HsDocTy _ _ _)           = NoEntryVal
+  getAnnotationEntry (HsBangTy _ _ _)          = NoEntryVal
   getAnnotationEntry (HsRecTy an _)            = fromAnn an
-  getAnnotationEntry (HsExplicitListTy an _ _) = fromAnn an
-  getAnnotationEntry (HsExplicitTupleTy an _)  = fromAnn an
+  getAnnotationEntry (HsExplicitListTy _ _ _)  = NoEntryVal
+  getAnnotationEntry (HsExplicitTupleTy _ _)   = NoEntryVal
   getAnnotationEntry (HsTyLit _ _)             = NoEntryVal
   getAnnotationEntry (HsWildCardTy _)          = NoEntryVal
   getAnnotationEntry (XHsType _)               = NoEntryVal
@@ -4056,11 +4142,11 @@ instance ExactPrint (HsType GhcPs) where
   setAnnotationAnchor a@(HsStarTy _ _)             _ _ _s = a
   setAnnotationAnchor (HsKindSig an a b)        anc ts cs = (HsKindSig (setAnchorEpa an anc ts cs) a b)
   setAnnotationAnchor a@(HsSpliceTy _ _)           _ _ _s = a
-  setAnnotationAnchor (HsDocTy an a b)          anc ts cs = (HsDocTy (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (HsBangTy an a b)         anc ts cs = (HsBangTy (setAnchorEpa an anc ts cs) a b)
+  setAnnotationAnchor a@(HsDocTy{})                _ _ _s = a
+  setAnnotationAnchor a@(HsBangTy{})               _ _ _s = a
   setAnnotationAnchor (HsRecTy an a)            anc ts cs = (HsRecTy (setAnchorEpa an anc ts cs) a)
-  setAnnotationAnchor (HsExplicitListTy an a b) anc ts cs = (HsExplicitListTy (setAnchorEpa an anc ts cs) a b)
-  setAnnotationAnchor (HsExplicitTupleTy an a)  anc ts cs = (HsExplicitTupleTy (setAnchorEpa an anc ts cs) a)
+  setAnnotationAnchor a@(HsExplicitListTy{})       _ _ _s = a
+  setAnnotationAnchor a@(HsExplicitTupleTy{})      _ _ _s = a
   setAnnotationAnchor a@(HsTyLit _ _)              _ _ _s = a
   setAnnotationAnchor a@(HsWildCardTy _)           _ _ _s = a
   setAnnotationAnchor a@(XHsType _)                _ _ _s = a
@@ -4151,30 +4237,30 @@ instance ExactPrint (HsType GhcPs) where
         NoSourceText -> return an
         SourceText src -> do
           debugM $ "HsBangTy: src=" ++ showAst src
-          an0 <- markEpAnnLMS an lid AnnOpen  (Just $ unpackFS src)
-          an1 <- markEpAnnLMS an0 lid AnnClose (Just "#-}")
+          an0 <- markEpAnnMS' an AnnOpen  (Just $ unpackFS src)
+          an1 <- markEpAnnMS' an0 AnnClose (Just "#-}")
           debugM $ "HsBangTy: done unpackedness"
           return an1
     an1 <-
       case str of
-        SrcLazy     -> markEpAnnL an0 lidl AnnTilde
-        SrcStrict   -> markEpAnnL an0 lidl AnnBang
+        SrcLazy     -> mark' an0 AnnTilde
+        SrcStrict   -> mark' an0 AnnBang
         NoSrcStrict -> return an0
     ty' <- markAnnotated ty
     return (HsBangTy an1 (HsSrcBang mt up str) ty')
   exact (HsExplicitListTy an prom tys) = do
     an0 <- if (isPromoted prom)
-             then markEpAnnL an lidl AnnSimpleQuote
+             then mark' an AnnSimpleQuote
              else return an
-    an1 <- markEpAnnL an0 lidl AnnOpenS
+    an1 <- mark' an0 AnnOpenS
     tys' <- markAnnotated tys
-    an2 <- markEpAnnL an1 lidl AnnCloseS
+    an2 <- mark' an1 AnnCloseS
     return (HsExplicitListTy an2 prom tys')
   exact (HsExplicitTupleTy an tys) = do
-    an0 <- markEpAnnL an lidl AnnSimpleQuote
-    an1 <- markEpAnnL an0 lidl AnnOpenP
+    an0 <- mark' an AnnSimpleQuote
+    an1 <- mark' an0 AnnOpenP
     tys' <- markAnnotated tys
-    an2 <- markEpAnnL an1 lidl AnnCloseP
+    an2 <- mark' an1 AnnCloseP
     return (HsExplicitTupleTy an2 tys')
   exact (HsTyLit a lit) = do
     case lit of



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b0429b242c14d008ff59a0bbd2e5133860579bb7

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b0429b242c14d008ff59a0bbd2e5133860579bb7
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231208/a28130f3/attachment-0001.html>


More information about the ghc-commits mailing list