[Git][ghc/ghc][wip/az/epa-hslet-tokens] 2 commits: EPA: Starting to remove EpAnn from Decl extension points

Alan Zimmerman (@alanz) gitlab at gitlab.haskell.org
Mon Dec 11 21:34:51 UTC 2023



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


Commits:
2ca4bc86 by Alan Zimmerman at 2023-12-10T23:11:11+00:00
EPA: Starting to remove EpAnn from Decl extension points

- - - - -
e7fec482 by Alan Zimmerman at 2023-12-11T21:33:36+00:00
EPA: Removing more EpAnn from Decls extension points

- - - - -


14 changed files:

- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.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/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/printer/T18791.stderr
- utils/check-exact/ExactPrint.hs


Changes:

=====================================
compiler/GHC/Hs/Decls.hs
=====================================
@@ -338,11 +338,11 @@ instance Outputable SpliceDecoration where
 
 type instance XFamDecl      (GhcPass _) = NoExtField
 
-type instance XSynDecl      GhcPs = EpAnn [AddEpAnn]
+type instance XSynDecl      GhcPs = [AddEpAnn]
 type instance XSynDecl      GhcRn = NameSet -- FVs
 type instance XSynDecl      GhcTc = NameSet -- FVs
 
-type instance XDataDecl     GhcPs = EpAnn [AddEpAnn]
+type instance XDataDecl     GhcPs = [AddEpAnn]
 type instance XDataDecl     GhcRn = DataDeclRn
 type instance XDataDecl     GhcTc = DataDeclRn
 
@@ -353,7 +353,7 @@ data DataDeclRn = DataDeclRn
   deriving Data
 
 type instance XClassDecl    GhcPs =
-  ( EpAnn [AddEpAnn]
+  ( [AddEpAnn]
   , EpLayout              -- See Note [Class EpLayout]
   , AnnSortKey DeclTag )  -- TODO:AZ:tidy up AnnSortKey
 
@@ -807,7 +807,7 @@ ppr_con_names = pprWithCommas (pprPrefixOcc . unLoc)
 ************************************************************************
 -}
 
-type instance XCFamEqn    (GhcPass _) r = EpAnn [AddEpAnn]
+type instance XCFamEqn    (GhcPass _) r = [AddEpAnn]
 type instance XXFamEqn    (GhcPass _) r = DataConCantHappen
 
 type instance Anno (FamEqn (GhcPass p) _) = SrcSpanAnnA
@@ -818,7 +818,7 @@ type instance XCClsInstDecl    GhcPs = ( Maybe (LWarningTxt GhcPs)
                                              -- The warning of the deprecated instance
                                              -- See Note [Implementation of deprecated instances]
                                              -- in GHC.Tc.Solver.Dict
-                                       , EpAnn [AddEpAnn]
+                                       , [AddEpAnn]
                                        , AnnSortKey DeclTag) -- For sorting the additional annotations
                                         -- TODO:AZ:tidy up
 type instance XCClsInstDecl    GhcRn = Maybe (LWarningTxt GhcRn)
@@ -1274,13 +1274,13 @@ pprFullRuleName st (L _ n) = pprWithSourceText st (doubleQuotes $ ftext n)
 ************************************************************************
 -}
 
-type instance XWarnings      GhcPs = (EpAnn [AddEpAnn], SourceText)
+type instance XWarnings      GhcPs = ([AddEpAnn], SourceText)
 type instance XWarnings      GhcRn = SourceText
 type instance XWarnings      GhcTc = SourceText
 
 type instance XXWarnDecls    (GhcPass _) = DataConCantHappen
 
-type instance XWarning      (GhcPass _) = EpAnn [AddEpAnn]
+type instance XWarning      (GhcPass _) = [AddEpAnn]
 type instance XXWarnDecl    (GhcPass _) = DataConCantHappen
 
 
@@ -1313,7 +1313,7 @@ instance OutputableBndrId p
 ************************************************************************
 -}
 
-type instance XHsAnnotation (GhcPass _) = (EpAnn AnnPragma, SourceText)
+type instance XHsAnnotation (GhcPass _) = (AnnPragma, SourceText)
 type instance XXAnnDecl     (GhcPass _) = DataConCantHappen
 
 instance (OutputableBndrId p) => Outputable (AnnDecl (GhcPass p)) where
@@ -1335,7 +1335,7 @@ pprAnnProvenance (TypeAnnProvenance (L _ name))
 ************************************************************************
 -}
 
-type instance XCRoleAnnotDecl GhcPs = EpAnn [AddEpAnn]
+type instance XCRoleAnnotDecl GhcPs = [AddEpAnn]
 type instance XCRoleAnnotDecl GhcRn = NoExtField
 type instance XCRoleAnnotDecl GhcTc = NoExtField
 


=====================================
compiler/GHC/Parser.y
=====================================
@@ -1257,8 +1257,8 @@ topdecl :: { LHsDecl GhcPs }
         | 'default' '(' comma_types0 ')'        {% acsA (\cs -> sLL $1 $>
                                                     (DefD noExtField (DefaultDecl (EpAnn (glEE $1 $>) [mj AnnDefault $1,mop $2,mcp $4] cs) $3))) }
         | 'foreign' fdecl                       {% acsA (\cs -> sLL $1 $> ((snd $ unLoc $2) (EpAnn (glEE $1 $>) (mj AnnForeign $1:(fst $ unLoc $2)) cs))) }
-        | '{-# DEPRECATED' deprecations '#-}'   {% acsA (\cs -> sLL $1 $> $ WarningD noExtField (Warnings ((EpAnn (glEE $1 $>) [mo $1,mc $3] cs), (getDEPRECATED_PRAGs $1)) (fromOL $2))) }
-        | '{-# WARNING' warnings '#-}'          {% acsA (\cs -> sLL $1 $> $ WarningD noExtField (Warnings ((EpAnn (glEE $1 $>) [mo $1,mc $3] cs), (getWARNING_PRAGs $1)) (fromOL $2))) }
+        | '{-# DEPRECATED' deprecations '#-}'   {% amsA' (sLL $1 $> $ WarningD noExtField (Warnings ([mo $1,mc $3], (getDEPRECATED_PRAGs $1)) (fromOL $2))) }
+        | '{-# WARNING' warnings '#-}'          {% amsA' (sLL $1 $> $ WarningD noExtField (Warnings ([mo $1,mc $3], (getWARNING_PRAGs $1)) (fromOL $2))) }
         | '{-# RULES' rules '#-}'               {% acsA (\cs -> sLL $1 $> $ RuleD noExtField (HsRules ((EpAnn (glEE $1 $>) [mo $1,mc $3] cs), (getRULES_PRAGs $1)) (reverse $2))) }
         | annotation { $1 }
         | decl_no_th                            { $1 }
@@ -1347,15 +1347,15 @@ inst_decl :: { LInstDecl GhcPs }
         : 'instance' maybe_warning_pragma overlap_pragma inst_type where_inst
        {% do { (binds, sigs, _, ats, adts, _) <- cvBindsAndSigs (snd $ unLoc $5)
              ; let anns = (mj AnnInstance $1 : (fst $ unLoc $5))
-             ; let cid cs = ClsInstDecl
-                                     { cid_ext = ($2, EpAnn (spanAsAnchor (comb3 $1 $4 $5)) anns cs, NoAnnSortKey)
-                                     , cid_poly_ty = $4, cid_binds = binds
-                                     , cid_sigs = mkClassOpSigs sigs
-                                     , cid_tyfam_insts = ats
-                                     , cid_overlap_mode = $3
-                                     , cid_datafam_insts = adts }
-             ; acsA (\cs -> L (comb3 $1 $4 $5)
-                             (ClsInstD { cid_d_ext = noExtField, cid_inst = cid cs }))
+             ; let cid = ClsInstDecl
+                                  { cid_ext = ($2, anns, NoAnnSortKey)
+                                  , cid_poly_ty = $4, cid_binds = binds
+                                  , cid_sigs = mkClassOpSigs sigs
+                                  , cid_tyfam_insts = ats
+                                  , cid_overlap_mode = $3
+                                  , cid_datafam_insts = adts }
+             ; amsA' (L (comb3 $1 $4 $5)
+                             (ClsInstD { cid_d_ext = noExtField, cid_inst = cid }))
                    } }
 
            -- type instance declarations
@@ -2002,8 +2002,8 @@ warnings :: { OrdList (LWarnDecl GhcPs) }
 -- SUP: TEMPORARY HACK, not checking for `module Foo'
 warning :: { OrdList (LWarnDecl GhcPs) }
         : warning_category namelist strings
-                {% fmap unitOL $ acsA (\cs -> L (comb3 $1 $2 $3)
-                     (Warning (EpAnn (glMR $1 $2) (fst $ unLoc $3) cs) (unLoc $2)
+                {% fmap unitOL $ amsA' (L (comb3 $1 $2 $3)
+                     (Warning (fst $ unLoc $3) (unLoc $2)
                               (WarningTxt $1 NoSourceText $ map stringLiteralToHsDocWst $ snd $ unLoc $3))) }
 
 deprecations :: { OrdList (LWarnDecl GhcPs) }
@@ -2026,7 +2026,7 @@ deprecations :: { OrdList (LWarnDecl GhcPs) }
 -- SUP: TEMPORARY HACK, not checking for `module Foo'
 deprecation :: { OrdList (LWarnDecl GhcPs) }
         : namelist strings
-             {% fmap unitOL $ acsA (\cs -> sLL $1 $> $ (Warning (EpAnn (glEE $1 $>) (fst $ unLoc $2) cs) (unLoc $1)
+             {% fmap unitOL $ acsA (\cs -> sLL $1 $> $ (Warning (fst $ unLoc $2) (unLoc $1)
                                           (DeprecatedTxt NoSourceText $ map stringLiteralToHsDocWst $ snd $ unLoc $2))) }
 
 strings :: { Located ([AddEpAnn],[Located StringLiteral]) }
@@ -2052,19 +2052,19 @@ stringlist :: { Located (OrdList (Located StringLiteral)) }
 annotation :: { LHsDecl GhcPs }
     : '{-# ANN' name_var aexp '#-}'      {% runPV (unECP $3) >>= \ $3 ->
                                             acsA (\cs -> sLL $1 $> (AnnD noExtField $ HsAnnotation
-                                            ((EpAnn (glEE $1 $>) (AnnPragma (mo $1) (mc $4) []) cs),
+                                            (AnnPragma (mo $1) (mc $4) [],
                                             (getANN_PRAGs $1))
                                             (ValueAnnProvenance $2) $3)) }
 
     | '{-# ANN' 'type' otycon aexp '#-}' {% runPV (unECP $4) >>= \ $4 ->
                                             acsA (\cs -> sLL $1 $> (AnnD noExtField $ HsAnnotation
-                                            ((EpAnn (glEE $1 $>) (AnnPragma (mo $1) (mc $5) [mj AnnType $2]) cs),
+                                            (AnnPragma (mo $1) (mc $5) [mj AnnType $2],
                                             (getANN_PRAGs $1))
                                             (TypeAnnProvenance $3) $4)) }
 
     | '{-# ANN' 'module' aexp '#-}'      {% runPV (unECP $3) >>= \ $3 ->
                                             acsA (\cs -> sLL $1 $> (AnnD noExtField $ HsAnnotation
-                                                ((EpAnn (glEE $1 $>) (AnnPragma (mo $1) (mc $4) [mj AnnModule $2]) cs),
+                                                (AnnPragma (mo $1) (mc $4) [mj AnnModule $2],
                                                 (getANN_PRAGs $1))
                                                  ModuleAnnProvenance $3)) }
 


=====================================
compiler/GHC/Parser/PostProcess.hs
=====================================
@@ -203,8 +203,7 @@ mkClassDecl loc' (L _ (mcxt, tycl_hdr)) fds where_cls layout annsIn
        ; (binds, sigs, ats, at_defs, _, docs) <- cvBindsAndSigs where_cls
        ; (cls, tparams, fixity, ann) <- checkTyClHdr True tycl_hdr
        ; tyvars <- checkTyVars (text "class") whereDots cls tparams
-       ; cs <- getCommentsFor (locA loc) -- Get any remaining comments
-       ; let anns' = addAnns (EpAnn (spanAsAnchor $ locA loc) annsIn emptyComments) ann cs
+       ; let anns' = annsIn Semi.<> ann
        ; return (L loc (ClassDecl { tcdCExt = (anns', layout, NoAnnSortKey)
                                   , tcdCtxt = mcxt
                                   , tcdLName = cls, tcdTyVars = tyvars
@@ -230,8 +229,7 @@ mkTyData loc' is_type_data new_or_data cType (L _ (mcxt, tycl_hdr))
   = do { let loc = noAnnSrcSpan loc'
        ; (tc, tparams, fixity, ann) <- checkTyClHdr False tycl_hdr
        ; tyvars <- checkTyVars (ppr new_or_data) equalsDots tc tparams
-       ; cs <- getCommentsFor (locA loc) -- Get any remaining comments
-       ; let anns' = addAnns (EpAnn (spanAsAnchor $ locA loc) annsIn emptyComments) ann cs
+       ; let anns' = annsIn Semi.<> ann
        ; data_cons <- checkNewOrData (locA loc) (unLoc tc) is_type_data new_or_data data_cons
        ; defn <- mkDataDefn cType mcxt ksig data_cons maybe_deriv
        ; return (L loc (DataDecl { tcdDExt = anns',
@@ -261,10 +259,8 @@ mkTySynonym :: SrcSpan
             -> P (LTyClDecl GhcPs)
 mkTySynonym loc lhs rhs annsIn
   = do { (tc, tparams, fixity, ann) <- checkTyClHdr False lhs
-       ; cs1 <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan [temp]
        ; tyvars <- checkTyVars (text "type") equalsDots tc tparams
-       ; cs2 <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan [temp]
-       ; let anns' = addAnns (EpAnn (spanAsAnchor loc) annsIn emptyComments) ann (cs1 Semi.<> cs2)
+       ; let anns' = annsIn Semi.<> ann
        ; return (L (noAnnSrcSpan loc) (SynDecl
                                 { tcdSExt = anns'
                                 , tcdLName = tc, tcdTyVars = tyvars
@@ -304,9 +300,8 @@ mkTyFamInstEqn :: SrcSpan
                -> P (LTyFamInstEqn GhcPs)
 mkTyFamInstEqn loc bndrs lhs rhs anns
   = do { (tc, tparams, fixity, ann) <- checkTyClHdr False lhs
-       ; cs <- getCommentsFor loc
        ; return (L (noAnnSrcSpan loc) $ FamEqn
-                        { feqn_ext    = EpAnn (spanAsAnchor loc) (anns `mappend` ann) cs
+                        { feqn_ext    = anns `mappend` ann
                         , feqn_tycon  = tc
                         , feqn_bndrs  = bndrs
                         , feqn_pats   = tparams
@@ -326,12 +321,10 @@ mkDataFamInst :: SrcSpan
 mkDataFamInst loc new_or_data cType (mcxt, bndrs, tycl_hdr)
               ksig data_cons (L _ maybe_deriv) anns
   = do { (tc, tparams, fixity, ann) <- checkTyClHdr False tycl_hdr
-       ; cs <- getCommentsFor loc -- Add any API Annotations to the top SrcSpan
-       ; let fam_eqn_ans = addAnns (EpAnn (spanAsAnchor loc) ann cs) anns emptyComments
        ; data_cons <- checkNewOrData loc (unLoc tc) False new_or_data data_cons
        ; defn <- mkDataDefn cType mcxt ksig data_cons maybe_deriv
        ; return (L (noAnnSrcSpan loc) (DataFamInstD noExtField (DataFamInstDecl
-                  (FamEqn { feqn_ext    = fam_eqn_ans
+                  (FamEqn { feqn_ext    = ann Semi.<> anns
                           , feqn_tycon  = tc
                           , feqn_bndrs  = bndrs
                           , feqn_pats   = tparams
@@ -425,8 +418,8 @@ mkRoleAnnotDecl :: SrcSpan
 mkRoleAnnotDecl loc tycon roles anns
   = do { roles' <- mapM parse_role roles
        ; cs <- getCommentsFor loc
-       ; return $ L (noAnnSrcSpan loc)
-         $ RoleAnnotDecl (EpAnn (spanAsAnchor loc) anns cs) tycon roles' }
+       ; return $ L (EpAnn (spanAsAnchor loc) noAnn cs)
+         $ RoleAnnotDecl anns tycon roles' }
   where
     role_data_type = dataTypeOf (undefined :: Role)
     all_roles = map fromConstr $ dataTypeConstrs role_data_type


=====================================
testsuite/tests/ghc-api/exactprint/Test20239.stderr
=====================================
@@ -58,26 +58,23 @@
         (EpaComment
          (EpaLineComment
           "-- Running over two lines")
-         { Test20239.hs:3:1-28 }))]))
+         { Test20239.hs:3:1-28 }))
+      ,(L
+        (EpaSpan
+         { Test20239.hs:6:34-70 })
+        (EpaComment
+         (EpaLineComment
+          "-- ^ Run a query against the database")
+         { Test20239.hs:5:51-55 }))]))
     (InstD
      (NoExtField)
      (DataFamInstD
       (NoExtField)
       (DataFamInstDecl
        (FamEqn
-        (EpAnn
-         (EpaSpan { Test20239.hs:(5,1)-(7,86) })
-         [(AddEpAnn AnnData (EpaSpan { Test20239.hs:5:1-4 }))
-         ,(AddEpAnn AnnInstance (EpaSpan { Test20239.hs:5:6-13 }))
-         ,(AddEpAnn AnnEqual (EpaSpan { Test20239.hs:5:34 }))]
-         (EpaComments
-          [(L
-            (EpaSpan
-             { Test20239.hs:6:34-70 })
-            (EpaComment
-             (EpaLineComment
-              "-- ^ Run a query against the database")
-             { Test20239.hs:5:51-55 }))]))
+        [(AddEpAnn AnnData (EpaSpan { Test20239.hs:5:1-4 }))
+        ,(AddEpAnn AnnInstance (EpaSpan { Test20239.hs:5:6-13 }))
+        ,(AddEpAnn AnnEqual (EpaSpan { Test20239.hs:5:34 }))]
         (L
          (EpAnn
           (EpaSpan { Test20239.hs:5:15-20 })


=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
=====================================
@@ -44,12 +44,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:(5,1)-(6,16) })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:5:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:5:12-16 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:5:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:5:12-16 }))]
        (EpVirtualBraces
         (3))
        (NoAnnSortKey))
@@ -211,12 +207,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:(9,1)-(10,16) })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:9:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:9:12-16 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:9:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:9:12-16 }))]
        (EpVirtualBraces
         (3))
        (NoAnnSortKey))
@@ -376,12 +368,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:(13,1)-(14,16) })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:13:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:13:12-16 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:13:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:13:12-16 }))]
        (EpVirtualBraces
         (3))
        (NoAnnSortKey))
@@ -544,12 +532,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:(17,1)-(20,16) })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:17:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:17:12-16 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:17:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:17:12-16 }))]
        (EpVirtualBraces
         (3))
        (NoAnnSortKey))
@@ -777,14 +761,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:22:1-30 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:22:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:22:12-16 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:22:18 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:22:30 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:22:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:22:12-16 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:22:18 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:22:30 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:22:18 }))
@@ -900,12 +880,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(23,1)-(25,18) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:23:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:23:17-21 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:23:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:23:17-21 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -978,12 +954,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(24,3)-(25,18) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:24:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:24:15-19 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:24:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:24:15-19 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:24:8-9 })
@@ -1126,14 +1098,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:28:1-30 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:28:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:28:12-16 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:28:18 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:28:30 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:28:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:28:12-16 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:28:18 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:28:30 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:28:18 }))
@@ -1249,12 +1217,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(29,1)-(31,18) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:29:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:29:17-21 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:29:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:29:17-21 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -1327,12 +1291,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(30,3)-(31,18) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:30:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:30:15-19 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:30:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:30:15-19 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:30:8-9 })
@@ -1475,14 +1435,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:34:1-30 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:34:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:34:12-16 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:34:18 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:34:30 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:34:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:34:12-16 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:34:18 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:34:30 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:34:18 }))
@@ -1598,12 +1554,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(35,1)-(37,18) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:35:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:35:17-21 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:35:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:35:17-21 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -1676,12 +1628,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(36,3)-(37,18) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:36:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:36:15-19 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:36:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:36:15-19 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:36:8-9 })
@@ -1824,14 +1772,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:40:1-30 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:40:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:40:12-16 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:40:18 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:40:30 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:40:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:40:12-16 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:40:18 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:40:30 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:40:18 }))
@@ -1947,12 +1891,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(41,1)-(43,18) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:41:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:41:17-21 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:41:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:41:17-21 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -2025,12 +1965,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(42,3)-(43,18) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:42:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:42:15-19 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:42:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:42:15-19 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:42:8-9 })
@@ -2173,14 +2109,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:46:1-30 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:46:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:46:12-16 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:46:18 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:46:30 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:46:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:46:12-16 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:46:18 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:46:30 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:46:18 }))
@@ -2296,12 +2228,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(47,1)-(49,18) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:47:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:47:17-21 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:47:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:47:17-21 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -2374,12 +2302,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(48,3)-(49,18) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:48:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:48:15-19 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:48:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:48:15-19 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:48:8-9 })
@@ -2522,14 +2446,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544.hs:52:1-32 })
-        [(AddEpAnn AnnClass (EpaSpan { T17544.hs:52:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:52:13-17 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:52:19 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:52:32 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544.hs:52:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:52:13-17 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T17544.hs:52:19 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T17544.hs:52:32 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T17544.hs:52:19 }))
@@ -2645,12 +2565,8 @@
       (ClsInstDecl
        ((,,)
         (Nothing)
-        (EpAnn
-         (EpaSpan { T17544.hs:(53,1)-(55,20) })
-         [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:53:1-8 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:53:18-22 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnInstance (EpaSpan { T17544.hs:53:1-8 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:53:18-22 }))]
         (NoAnnSortKey))
        (L
         (EpAnn
@@ -2723,12 +2639,8 @@
            []))
          (DataFamInstDecl
           (FamEqn
-           (EpAnn
-            (EpaSpan { T17544.hs:(54,3)-(55,20) })
-            [(AddEpAnn AnnData (EpaSpan { T17544.hs:54:3-6 }))
-            ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:54:16-20 }))]
-            (EpaComments
-             []))
+           [(AddEpAnn AnnData (EpaSpan { T17544.hs:54:3-6 }))
+           ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:54:16-20 }))]
            (L
             (EpAnn
              (EpaSpan { T17544.hs:54:8-10 })


=====================================
testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
=====================================
@@ -55,12 +55,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T17544_kw.hs:(15,1)-(16,20) })
-       [(AddEpAnn AnnData (EpaSpan { T17544_kw.hs:15:1-4 }))
-       ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:16:3-7 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { T17544_kw.hs:15:1-4 }))
+      ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:16:3-7 }))]
       (L
        (EpAnn
         (EpaSpan { T17544_kw.hs:15:6-8 })
@@ -165,12 +161,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T17544_kw.hs:(18,1)-(19,26) })
-       [(AddEpAnn AnnNewtype (EpaSpan { T17544_kw.hs:18:1-7 }))
-       ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:19:3-7 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnNewtype (EpaSpan { T17544_kw.hs:18:1-7 }))
+      ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:19:3-7 }))]
       (L
        (EpAnn
         (EpaSpan { T17544_kw.hs:18:9-11 })
@@ -293,12 +285,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T17544_kw.hs:(21,1)-(24,18) })
-        [(AddEpAnn AnnClass (EpaSpan { T17544_kw.hs:21:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:23:3-7 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T17544_kw.hs:21:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:23:3-7 }))]
        (EpVirtualBraces
         (5))
        (NoAnnSortKey))


=====================================
testsuite/tests/parser/should_compile/DumpParsedAst.stderr
=====================================
@@ -78,12 +78,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { DumpParsedAst.hs:7:1-30 })
-       [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:7:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:7:12 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:7:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:7:12 }))]
       (L
        (EpAnn
         (EpaSpan { DumpParsedAst.hs:7:6-10 })
@@ -316,11 +312,7 @@
             (EpaComments
              []))
            (FamEqn
-            (EpAnn
-             (EpaSpan { DumpParsedAst.hs:11:3-36 })
-             [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:11:19 }))]
-             (EpaComments
-              []))
+            [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:11:19 }))]
             (L
              (EpAnn
               (EpaSpan { DumpParsedAst.hs:11:3-8 })
@@ -499,11 +491,7 @@
             (EpaComments
              []))
            (FamEqn
-            (EpAnn
-             (EpaSpan { DumpParsedAst.hs:12:3-24 })
-             [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:12:19 }))]
-             (EpaComments
-              []))
+            [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:12:19 }))]
             (L
              (EpAnn
               (EpaSpan { DumpParsedAst.hs:12:3-8 })
@@ -654,12 +642,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { DumpParsedAst.hs:15:1-29 })
-       [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:15:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:15:19 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { DumpParsedAst.hs:15:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:15:19 }))]
       (L
        (EpAnn
         (EpaSpan { DumpParsedAst.hs:15:6 })
@@ -1026,11 +1010,7 @@
             (EpaComments
              []))
            (FamEqn
-            (EpAnn
-             (EpaSpan { DumpParsedAst.hs:19:3-30 })
-             [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:19:17 }))]
-             (EpaComments
-              []))
+            [(AddEpAnn AnnEqual (EpaSpan { DumpParsedAst.hs:19:17 }))]
             (L
              (EpAnn
               (EpaSpan { DumpParsedAst.hs:19:3-4 })
@@ -1505,14 +1485,10 @@
       (NoExtField)
       (DataFamInstDecl
        (FamEqn
-        (EpAnn
-         (EpaSpan { DumpParsedAst.hs:(22,1)-(23,45) })
-         [(AddEpAnn AnnNewtype (EpaSpan { DumpParsedAst.hs:22:1-7 }))
-         ,(AddEpAnn AnnInstance (EpaSpan { DumpParsedAst.hs:22:9-16 }))
-         ,(AddEpAnn AnnDcolon (EpaSpan { DumpParsedAst.hs:22:39-40 }))
-         ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAst.hs:22:62-66 }))]
-         (EpaComments
-          []))
+        [(AddEpAnn AnnNewtype (EpaSpan { DumpParsedAst.hs:22:1-7 }))
+        ,(AddEpAnn AnnInstance (EpaSpan { DumpParsedAst.hs:22:9-16 }))
+        ,(AddEpAnn AnnDcolon (EpaSpan { DumpParsedAst.hs:22:39-40 }))
+        ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAst.hs:22:62-66 }))]
         (L
          (EpAnn
           (EpaSpan { DumpParsedAst.hs:22:18-20 })


=====================================
testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
=====================================
@@ -259,11 +259,7 @@
               (EpaComments
                []))
              (FamEqn
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               []
-               (EpaComments
-                []))
+              []
               (L
                (EpAnn
                 (EpaSpan { DumpRenamedAst.hs:13:3-8 })
@@ -436,11 +432,7 @@
               (EpaComments
                []))
              (FamEqn
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               []
-               (EpaComments
-                []))
+              []
               (L
                (EpAnn
                 (EpaSpan { DumpRenamedAst.hs:14:3-8 })
@@ -791,11 +783,7 @@
         (NoExtField)
         (DataFamInstDecl
          (FamEqn
-          (EpAnn
-           (EpaDelta (SameLine 0) [])
-           []
-           (EpaComments
-            []))
+          []
           (L
            (EpAnn
             (EpaSpan { DumpRenamedAst.hs:19:18-20 })
@@ -1452,11 +1440,7 @@
               (EpaComments
                []))
              (FamEqn
-              (EpAnn
-               (EpaDelta (SameLine 0) [])
-               []
-               (EpaComments
-                []))
+              []
               (L
                (EpAnn
                 (EpaSpan { DumpRenamedAst.hs:26:3-4 })
@@ -2141,11 +2125,7 @@
              (EpaComments
               []))
             (FamEqn
-             (EpAnn
-              (EpaDelta (SameLine 0) [])
-              []
-              (EpaComments
-               []))
+             []
              (L
               (EpAnn
                (EpaSpan { DumpRenamedAst.hs:32:8 })


=====================================
testsuite/tests/parser/should_compile/DumpSemis.stderr
=====================================
@@ -1289,12 +1289,8 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { DumpSemis.hs:(28,1)-(29,23) })
-        [(AddEpAnn AnnClass (EpaSpan { DumpSemis.hs:28:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { DumpSemis.hs:28:40-44 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { DumpSemis.hs:28:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { DumpSemis.hs:28:40-44 }))]
        (EpVirtualBraces
         (3))
        (NoAnnSortKey))


=====================================
testsuite/tests/parser/should_compile/KindSigs.stderr
=====================================
@@ -97,11 +97,7 @@
             (EpaComments
              []))
            (FamEqn
-            (EpAnn
-             (EpaSpan { KindSigs.hs:12:3-21 })
-             [(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:12:9 }))]
-             (EpaComments
-              []))
+            [(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:12:9 }))]
             (L
              (EpAnn
               (EpaSpan { KindSigs.hs:12:3-5 })
@@ -234,12 +230,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:15:1-51 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:15:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:15:12 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:15:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:15:12 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:15:6-8 })
@@ -438,12 +430,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:16:1-54 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:16:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:16:13 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:16:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:16:13 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:16:6-9 })
@@ -642,12 +630,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:19:1-26 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:19:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:19:10 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:19:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:19:10 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:19:6-8 })
@@ -1044,12 +1028,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:26:1-29 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:26:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:26:11 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:26:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:26:11 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:26:6-9 })
@@ -1132,12 +1112,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:27:1-45 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:27:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:27:12 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:27:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:27:12 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:27:6-10 })
@@ -1267,12 +1243,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:28:1-44 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:28:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:28:14 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:28:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:28:14 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:28:6-10 })
@@ -1436,12 +1408,8 @@
     (TyClD
      (NoExtField)
      (SynDecl
-      (EpAnn
-       (EpaSpan { KindSigs.hs:31:1-31 })
-       [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:31:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:31:19 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnType (EpaSpan { KindSigs.hs:31:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { KindSigs.hs:31:19 }))]
       (L
        (EpAnn
         (EpaSpan { KindSigs.hs:31:6-17 })


=====================================
testsuite/tests/parser/should_compile/T15323.stderr
=====================================
@@ -43,12 +43,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T15323.hs:(5,1)-(6,54) })
-       [(AddEpAnn AnnData (EpaSpan { T15323.hs:5:1-4 }))
-       ,(AddEpAnn AnnWhere (EpaSpan { T15323.hs:5:21-25 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { T15323.hs:5:1-4 }))
+      ,(AddEpAnn AnnWhere (EpaSpan { T15323.hs:5:21-25 }))]
       (L
        (EpAnn
         (EpaSpan { T15323.hs:5:6-17 })


=====================================
testsuite/tests/parser/should_compile/T20452.stderr
=====================================
@@ -43,12 +43,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T20452.hs:5:1-31 })
-       [(AddEpAnn AnnData (EpaSpan { T20452.hs:5:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { T20452.hs:5:24 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { T20452.hs:5:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { T20452.hs:5:24 }))]
       (L
        (EpAnn
         (EpaSpan { T20452.hs:5:6-11 })
@@ -149,12 +145,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T20452.hs:6:1-31 })
-       [(AddEpAnn AnnData (EpaSpan { T20452.hs:6:1-4 }))
-       ,(AddEpAnn AnnEqual (EpaSpan { T20452.hs:6:24 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { T20452.hs:6:1-4 }))
+      ,(AddEpAnn AnnEqual (EpaSpan { T20452.hs:6:24 }))]
       (L
        (EpAnn
         (EpaSpan { T20452.hs:6:6-11 })
@@ -258,14 +250,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T20452.hs:8:1-85 })
-        [(AddEpAnn AnnClass (EpaSpan { T20452.hs:8:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:8:78-82 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T20452.hs:8:84 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T20452.hs:8:85 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T20452.hs:8:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:8:78-82 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T20452.hs:8:84 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T20452.hs:8:85 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T20452.hs:8:84 }))
@@ -471,14 +459,10 @@
      (NoExtField)
      (ClassDecl
       ((,,)
-       (EpAnn
-        (EpaSpan { T20452.hs:9:1-85 })
-        [(AddEpAnn AnnClass (EpaSpan { T20452.hs:9:1-5 }))
-        ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:9:78-82 }))
-        ,(AddEpAnn AnnOpenC (EpaSpan { T20452.hs:9:84 }))
-        ,(AddEpAnn AnnCloseC (EpaSpan { T20452.hs:9:85 }))]
-        (EpaComments
-         []))
+       [(AddEpAnn AnnClass (EpaSpan { T20452.hs:9:1-5 }))
+       ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:9:78-82 }))
+       ,(AddEpAnn AnnOpenC (EpaSpan { T20452.hs:9:84 }))
+       ,(AddEpAnn AnnCloseC (EpaSpan { T20452.hs:9:85 }))]
        (EpExplicitBraces
         (EpTok
          (EpaSpan { T20452.hs:9:84 }))


=====================================
testsuite/tests/printer/T18791.stderr
=====================================
@@ -43,12 +43,8 @@
     (TyClD
      (NoExtField)
      (DataDecl
-      (EpAnn
-       (EpaSpan { T18791.hs:(4,1)-(5,17) })
-       [(AddEpAnn AnnData (EpaSpan { T18791.hs:4:1-4 }))
-       ,(AddEpAnn AnnWhere (EpaSpan { T18791.hs:4:8-12 }))]
-       (EpaComments
-        []))
+      [(AddEpAnn AnnData (EpaSpan { T18791.hs:4:1-4 }))
+      ,(AddEpAnn AnnWhere (EpaSpan { T18791.hs:4:8-12 }))]
       (L
        (EpAnn
         (EpaSpan { T18791.hs:4:6 })


=====================================
utils/check-exact/ExactPrint.hs
=====================================
@@ -622,6 +622,21 @@ annotationsToComments (EpAnn anc a cs) l kws = do
       | Set.member k keywords = go ((mkKWComment k (epaToNoCommentsLocation ss)):cs', ans) ls
       | otherwise             = go (cs', (AddEpAnn k ss):ans)    ls
 
+annotationsToComments' :: (Monad m, Monoid w)
+  => a -> Lens a [AddEpAnn] -> [AnnKeywordId] -> EP w m a
+annotationsToComments' a l kws = do
+  let (newComments, newAnns) = go ([],[]) (view l a)
+  addComments newComments
+  return (set l (reverse newAnns) a)
+  where
+    keywords = Set.fromList kws
+
+    go :: ([Comment], [AddEpAnn]) -> [AddEpAnn] -> ([Comment], [AddEpAnn])
+    go acc [] = acc
+    go (cs',ans) ((AddEpAnn k ss) : ls)
+      | Set.member k keywords = go ((mkKWComment k (epaToNoCommentsLocation ss)):cs', ans) ls
+      | otherwise             = go (cs', (AddEpAnn k ss):ans)    ls
+
 -- ---------------------------------------------------------------------
 
 -- Temporary function to simply reproduce the "normal" pretty printer output
@@ -818,6 +833,20 @@ markEpAnnLMS' (EpAnn anc a cs) l kw (Just str) = do
           return (AddEpAnn kw' r')
       | otherwise = return (AddEpAnn kw' r)
 
+markEpAnnLMS0 :: (Monad m, Monoid w)
+                => a -> Lens a AddEpAnn -> AnnKeywordId -> Maybe String -> EP w m a
+markEpAnnLMS0 an l _kw Nothing = markLensKwA' an l
+markEpAnnLMS0 a l kw (Just str) = do
+  anns <- 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)
+
 -- ---------------------------------------------------------------------
 
 markEpToken :: forall m w tok . (Monad m, Monoid w, KnownSymbol tok)
@@ -860,14 +889,25 @@ markArrow (HsExplicitMult (pct, arr) t) = do
 markAnnCloseP :: (Monad m, Monoid w) => EpAnn AnnPragma -> EP w m (EpAnn AnnPragma)
 markAnnCloseP an = markEpAnnLMS' an lapr_close AnnClose (Just "#-}")
 
+markAnnCloseP' :: (Monad m, Monoid w) => AnnPragma -> EP w m AnnPragma
+markAnnCloseP' an = markEpAnnLMS0 an lapr_close AnnClose (Just "#-}")
+
 markAnnOpenP :: (Monad m, Monoid w) => EpAnn AnnPragma -> SourceText -> String -> EP w m (EpAnn AnnPragma)
 markAnnOpenP an NoSourceText txt   = markEpAnnLMS' an lapr_open AnnOpen (Just txt)
 markAnnOpenP an (SourceText txt) _ = markEpAnnLMS' an lapr_open AnnOpen (Just $ unpackFS txt)
 
+markAnnOpenP' :: (Monad m, Monoid w) => AnnPragma -> SourceText -> String -> EP w m AnnPragma
+markAnnOpenP' an NoSourceText txt   = markEpAnnLMS0 an lapr_open AnnOpen (Just txt)
+markAnnOpenP' an (SourceText txt) _ = markEpAnnLMS0 an lapr_open AnnOpen (Just $ unpackFS txt)
+
 markAnnOpen :: (Monad m, Monoid w) => EpAnn [AddEpAnn] -> SourceText -> String -> EP w m (EpAnn [AddEpAnn])
 markAnnOpen an NoSourceText txt   = markEpAnnLMS an lidl AnnOpen (Just txt)
 markAnnOpen an (SourceText txt) _ = markEpAnnLMS an lidl AnnOpen (Just $ unpackFS txt)
 
+markAnnOpen0 :: (Monad m, Monoid w) => [AddEpAnn] -> SourceText -> String -> EP w m [AddEpAnn]
+markAnnOpen0 an NoSourceText txt   = markEpAnnLMS'' an lidl AnnOpen (Just txt)
+markAnnOpen0 an (SourceText txt) _ = markEpAnnLMS'' an lidl AnnOpen (Just $ unpackFS txt)
+
 markAnnOpen' :: (Monad m, Monoid w)
   => Maybe EpaLocation -> SourceText -> String -> EP w m (Maybe EpaLocation)
 markAnnOpen' ms NoSourceText txt   = printStringAtMLoc' ms txt
@@ -1268,6 +1308,12 @@ markLensKwA (EpAnn anc a cs) l = do
   loc <- markKw (view l a)
   return (EpAnn anc (set l loc a) cs)
 
+markLensKwA' :: (Monad m, Monoid w)
+  => a -> Lens a AddEpAnn -> EP w m a
+markLensKwA' a l = do
+  loc <- markKw (view l a)
+  return (set l loc a)
+
 markLensKw :: (Monad m, Monoid w)
   => EpAnn a -> Lens a EpaLocation -> AnnKeywordId -> EP w m (EpAnn a)
 markLensKw (EpAnn anc a cs) l kw = do
@@ -1876,16 +1922,14 @@ instance ExactPrint (InstDecl GhcPs) where
 
 data DataFamInstDeclWithContext
   = DataFamInstDeclWithContext
-    { _dc_a :: EpAnn [AddEpAnn]
+    { _dc_a :: [AddEpAnn]
     , _dc_f :: TopLevelFlag
     , dc_d :: DataFamInstDecl GhcPs
     }
 
 instance ExactPrint DataFamInstDeclWithContext where
-  getAnnotationEntry (DataFamInstDeclWithContext _ _ (DataFamInstDecl (FamEqn { feqn_ext = an})))
-    = fromAnn an
-  setAnnotationAnchor (DataFamInstDeclWithContext a c (DataFamInstDecl fe)) anc ts cs
-    = (DataFamInstDeclWithContext a c (DataFamInstDecl (fe { feqn_ext = (setAnchorEpa (feqn_ext fe) anc ts cs)})))
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
   exact (DataFamInstDeclWithContext an c d) = do
     debugM $ "starting DataFamInstDeclWithContext:an=" ++ showAst an
     (an', d') <- exactDataFamInstDecl an c d
@@ -1894,8 +1938,8 @@ instance ExactPrint DataFamInstDeclWithContext where
 -- ---------------------------------------------------------------------
 
 exactDataFamInstDecl :: (Monad m, Monoid w)
-                     => EpAnn [AddEpAnn] -> TopLevelFlag -> DataFamInstDecl GhcPs
-                     -> EP w m (EpAnn [AddEpAnn], DataFamInstDecl GhcPs)
+                     => [AddEpAnn] -> TopLevelFlag -> DataFamInstDecl GhcPs
+                     -> EP w m ([AddEpAnn], DataFamInstDecl GhcPs)
 exactDataFamInstDecl an top_lvl
   (DataFamInstDecl (FamEqn { feqn_ext    = an2
                            , feqn_tycon  = tycon
@@ -1917,14 +1961,14 @@ exactDataFamInstDecl an top_lvl
   where
     pp_hdr :: (Monad m, Monoid w)
            => Maybe (LHsContext GhcPs)
-           -> EP w m ( EpAnn [AddEpAnn]
+           -> EP w m ( [AddEpAnn]
                      , LocatedN RdrName
                      , HsOuterTyVarBndrs () GhcPs
                      , HsFamEqnPats GhcPs
                      , Maybe (LHsContext GhcPs))
     pp_hdr mctxt = do
       an0 <- case top_lvl of
-               TopLevel -> markEpAnnL an lidl AnnInstance -- TODO: maybe in toplevel
+               TopLevel -> markEpAnnL' an lidl AnnInstance -- TODO: maybe in toplevel
                NotTopLevel -> return an
       exactHsFamInstLHS an0 tycon bndrs pats fixity mctxt
 
@@ -2033,34 +2077,34 @@ instance ExactPrint CCallConv where
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (WarnDecls GhcPs) where
-  getAnnotationEntry (Warnings (an,_) _) = fromAnn an
-  setAnnotationAnchor (Warnings (an,a) b) anc ts cs = Warnings ((setAnchorEpa an anc ts cs),a) b
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
 
   exact (Warnings (an,src) warns) = do
-    an0 <- markAnnOpen an src "{-# WARNING" -- Note: might be {-# DEPRECATED
+    an0 <- markAnnOpen0 an src "{-# WARNING" -- Note: might be {-# DEPRECATED
     warns' <- markAnnotated warns
-    an1 <- markEpAnnLMS an0 lidl AnnClose (Just "#-}")
+    an1 <- markEpAnnLMS'' an0 lidl AnnClose (Just "#-}")
     return (Warnings (an1,src) warns')
 
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (WarnDecl GhcPs) where
-  getAnnotationEntry (Warning an _ _) = fromAnn an
-  setAnnotationAnchor (Warning an a b) anc ts cs = Warning (setAnchorEpa an anc ts cs) a b
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
 
   exact (Warning an lns  (WarningTxt mb_cat src ls )) = do
     mb_cat' <- markAnnotated mb_cat
     lns' <- markAnnotated lns
-    an0 <- markEpAnnL an lidl AnnOpenS -- "["
+    an0 <- markEpAnnL' an lidl AnnOpenS -- "["
     ls' <- markAnnotated ls
-    an1 <- markEpAnnL an0 lidl AnnCloseS -- "]"
+    an1 <- markEpAnnL' an0 lidl AnnCloseS -- "]"
     return (Warning an1 lns'  (WarningTxt mb_cat' src ls'))
 
   exact (Warning an lns (DeprecatedTxt src ls)) = do
     lns' <- markAnnotated lns
-    an0 <- markEpAnnL an lidl AnnOpenS -- "["
+    an0 <- markEpAnnL' an lidl AnnOpenS -- "["
     ls' <- markAnnotated ls
-    an1 <- markEpAnnL an0 lidl AnnCloseS -- "]"
+    an1 <- markEpAnnL' an0 lidl AnnCloseS -- "]"
     return (Warning an1 lns' (DeprecatedTxt src ls'))
 
 -- ---------------------------------------------------------------------
@@ -2172,11 +2216,12 @@ instance ExactPrint (DocDecl GhcPs) where
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (RoleAnnotDecl GhcPs) where
-  getAnnotationEntry (RoleAnnotDecl an _ _) = fromAnn an
-  setAnnotationAnchor (RoleAnnotDecl an a b) anc ts cs = RoleAnnotDecl (setAnchorEpa an anc ts cs) a b
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
+
   exact (RoleAnnotDecl an ltycon roles) = do
-    an0 <- markEpAnnL an lidl AnnType
-    an1 <- markEpAnnL an0 lidl AnnRole
+    an0 <- markEpAnnL' an lidl AnnType
+    an1 <- markEpAnnL' an0 lidl AnnRole
     ltycon' <- markAnnotated ltycon
     let markRole (L l (Just r)) = do
           (L _ r') <- markAnnotated (L l r)
@@ -2214,8 +2259,8 @@ instance ExactPrint (RuleBndr GhcPs) where
 -- ---------------------------------------------------------------------
 
 instance (ExactPrint body) => ExactPrint (FamEqn GhcPs body) where
-  getAnnotationEntry (FamEqn { feqn_ext = an}) = fromAnn an
-  setAnnotationAnchor fe anc ts cs = fe {feqn_ext = setAnchorEpa (feqn_ext fe) anc ts cs}
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor fe _ _ _s = fe
   exact (FamEqn { feqn_ext = an
                 , feqn_tycon  = tycon
                 , feqn_bndrs  = bndrs
@@ -2223,7 +2268,7 @@ instance (ExactPrint body) => ExactPrint (FamEqn GhcPs body) where
                 , feqn_fixity = fixity
                 , feqn_rhs    = rhs }) = do
     (an0, tycon', bndrs', pats', _) <- exactHsFamInstLHS an tycon bndrs pats fixity Nothing
-    an1 <- markEpAnnL an0 lidl AnnEqual
+    an1 <- markEpAnnL' an0 lidl AnnEqual
     rhs' <- markAnnotated rhs
     return (FamEqn { feqn_ext = an1
                    , feqn_tycon  = tycon'
@@ -2236,34 +2281,34 @@ instance (ExactPrint body) => ExactPrint (FamEqn GhcPs body) where
 
 exactHsFamInstLHS ::
       (Monad m, Monoid w)
-   => EpAnn [AddEpAnn]
+   => [AddEpAnn]
    -> LocatedN RdrName
    -> HsOuterTyVarBndrs () GhcPs
    -> HsFamEqnPats GhcPs
    -> LexicalFixity
    -> Maybe (LHsContext GhcPs)
-   -> EP w m ( EpAnn [AddEpAnn]
+   -> EP w m ( [AddEpAnn]
              , LocatedN RdrName
              , HsOuterTyVarBndrs () GhcPs
              , HsFamEqnPats GhcPs, Maybe (LHsContext GhcPs))
 exactHsFamInstLHS an thing bndrs typats fixity mb_ctxt = do
-  an0 <- markEpAnnL an lidl AnnForall
+  an0 <- markEpAnnL' an lidl AnnForall
   bndrs' <- markAnnotated bndrs
-  an1 <- markEpAnnL an0 lidl AnnDot
+  an1 <- markEpAnnL' an0 lidl AnnDot
   mb_ctxt' <- mapM markAnnotated mb_ctxt
   (an2, thing', typats') <- exact_pats an1 typats
   return (an2, thing', bndrs', typats', mb_ctxt')
   where
     exact_pats :: (Monad m, Monoid w)
-      => EpAnn [AddEpAnn] -> HsFamEqnPats GhcPs -> EP w m (EpAnn [AddEpAnn], LocatedN RdrName, HsFamEqnPats GhcPs)
+      => [AddEpAnn] -> HsFamEqnPats GhcPs -> EP w m ([AddEpAnn], LocatedN RdrName, HsFamEqnPats GhcPs)
     exact_pats an' (patl:patr:pats)
       | Infix <- fixity
       = let exact_op_app = do
-              an0 <- markEpAnnAllL an' lidl AnnOpenP
+              an0 <- markEpAnnAllL' an' lidl AnnOpenP
               patl' <- markAnnotated patl
               thing' <- markAnnotated thing
               patr' <- markAnnotated patr
-              an1 <- markEpAnnAllL an0 lidl AnnCloseP
+              an1 <- markEpAnnAllL' an0 lidl AnnCloseP
               return (an1, thing', [patl',patr'])
         in case pats of
              [] -> exact_op_app
@@ -2273,10 +2318,10 @@ exactHsFamInstLHS an thing bndrs typats fixity mb_ctxt = do
                return (an0, thing', p++pats')
 
     exact_pats an' pats = do
-      an0 <- markEpAnnAllL an' lidl AnnOpenP
+      an0 <- markEpAnnAllL' an' lidl AnnOpenP
       thing' <- markAnnotated thing
       pats' <- markAnnotated pats
-      an1 <- markEpAnnAllL an0 lidl AnnCloseP
+      an1 <- markEpAnnAllL' an0 lidl AnnCloseP
       return (an1, thing', pats')
 
 -- ---------------------------------------------------------------------
@@ -2293,9 +2338,8 @@ instance (ExactPrint tm, ExactPrint ty, Outputable tm, Outputable ty)
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (ClsInstDecl GhcPs) where
-  getAnnotationEntry (ClsInstDecl { cid_ext = (_, an, _) }) = fromAnn an
-  setAnnotationAnchor (cid at ClsInstDecl { cid_ext = (mbWarn, an, sortKey) }) anc ts cs
-    = cid { cid_ext = (mbWarn, setAnchorEpa an anc ts cs, sortKey) }
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
 
   exact (ClsInstDecl { cid_ext = (mbWarn, an, sortKey)
                      , cid_poly_ty = inst_ty, cid_binds = binds
@@ -2304,15 +2348,15 @@ instance ExactPrint (ClsInstDecl GhcPs) where
                      , cid_datafam_insts = adts })
       = do
           (mbWarn', an0, mbOverlap', inst_ty') <- top_matter
-          an1 <- markEpAnnL an0 lidl AnnOpenC
-          an2 <- markEpAnnAllL an1 lid AnnSemi
+          an1 <- markEpAnnL' an0 lidl AnnOpenC
+          an2 <- markEpAnnAllL' an1 lid AnnSemi
           ds <- withSortKey sortKey
                                [(ClsAtdTag, prepareListAnnotationA ats),
                                 (ClsAtdTag, prepareListAnnotationF an adts),
                                 (ClsMethodTag, prepareListAnnotationA (bagToList binds)),
                                 (ClsSigTag, prepareListAnnotationA sigs)
                                ]
-          an3 <- markEpAnnL an2 lidl AnnCloseC -- '}'
+          an3 <- markEpAnnL' an2 lidl AnnCloseC -- '}'
           let
             ats'   = undynamic ds
             adts'  = undynamic ds
@@ -2326,11 +2370,11 @@ instance ExactPrint (ClsInstDecl GhcPs) where
 
       where
         top_matter = do
-          an0 <- markEpAnnL an lidl AnnInstance
+          an0 <- markEpAnnL' an lidl AnnInstance
           mw <- mapM markAnnotated mbWarn
           mo <- mapM markAnnotated mbOverlap
           it <- markAnnotated inst_ty
-          an1 <- markEpAnnL an0 lidl AnnWhere -- Optional
+          an1 <- markEpAnnL' an0 lidl AnnWhere -- Optional
           return (mw, an1, mo,it)
 
 -- ---------------------------------------------------------------------
@@ -2661,7 +2705,7 @@ instance ExactPrint HsIPName where
 -- Managing lists which have been separated, e.g. Sigs and Binds
 
 prepareListAnnotationF :: (Monad m, Monoid w) =>
-  EpAnn [AddEpAnn] -> [LDataFamInstDecl GhcPs] -> [(RealSrcSpan,EP w m Dynamic)]
+  [AddEpAnn] -> [LDataFamInstDecl GhcPs] -> [(RealSrcSpan,EP w m Dynamic)]
 prepareListAnnotationF an ls = map (\b -> (realSrcSpan $ getLocA b, go b)) ls
   where
     go (L l a) = do
@@ -2834,26 +2878,26 @@ instance ExactPrint (DefaultDecl GhcPs) where
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (AnnDecl GhcPs) where
-  getAnnotationEntry (HsAnnotation (an, _) _ _) = fromAnn an
-  setAnnotationAnchor (HsAnnotation (an,a) b c) anc ts cs = HsAnnotation ((setAnchorEpa an anc ts cs),a) b c
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _ = a
 
   exact (HsAnnotation (an, src) prov e) = do
-    an0 <- markAnnOpenP an src "{-# ANN"
+    an0 <- markAnnOpenP' an src "{-# ANN"
     (an1, prov') <-
       case prov of
         (ValueAnnProvenance n) -> do
           n' <- markAnnotated n
           return (an0, ValueAnnProvenance n')
         (TypeAnnProvenance n) -> do
-          an1 <- markEpAnnL an0 lapr_rest AnnType
+          an1 <- markEpAnnL' an0 lapr_rest AnnType
           n' <- markAnnotated n
           return (an1, TypeAnnProvenance n')
         ModuleAnnProvenance -> do
-          an1 <- markEpAnnL an lapr_rest AnnModule
+          an1 <- markEpAnnL' an lapr_rest AnnModule
           return (an1, prov)
 
     e' <- markAnnotated e
-    an2 <- markAnnCloseP an1
+    an2 <- markAnnCloseP' an1
     return (HsAnnotation (an2,src) prov' e')
 
 -- ---------------------------------------------------------------------
@@ -3639,17 +3683,8 @@ exactTransStmt an by using GroupForm = do
 -- ---------------------------------------------------------------------
 
 instance ExactPrint (TyClDecl GhcPs) where
-  getAnnotationEntry (FamDecl   { })                   = NoEntryVal
-  getAnnotationEntry (SynDecl   { tcdSExt = an })      = fromAnn an
-  getAnnotationEntry (DataDecl  { tcdDExt = an })      = fromAnn an
-  getAnnotationEntry (ClassDecl { tcdCExt = (an, _, _) }) = fromAnn an
-
-  setAnnotationAnchor a at FamDecl{}      _ _ _s = a
-  setAnnotationAnchor x at SynDecl{}   anc ts cs = x { tcdSExt = setAnchorEpa (tcdSExt x) anc ts cs }
-  setAnnotationAnchor x at DataDecl{}  anc ts cs = x { tcdDExt = setAnchorEpa (tcdDExt x) anc ts cs }
-  setAnnotationAnchor x at ClassDecl{} anc ts cs = x { tcdCExt = (setAnchorEpa an anc ts cs, layout, a) }
-    where
-      (an,layout,a) = tcdCExt x
+  getAnnotationEntry _ = NoEntryVal
+  setAnnotationAnchor a _ _ _s = a
 
   exact (FamDecl a decl) = do
     decl' <- markAnnotated decl
@@ -3661,11 +3696,11 @@ instance ExactPrint (TyClDecl GhcPs) where
     -- There may be arbitrary parens around parts of the constructor
     -- that are infix.  Turn these into comments so that they feed
     -- into the right place automatically
-    an0 <- annotationsToComments an lidl [AnnOpenP,AnnCloseP]
-    an1 <- markEpAnnL an0 lidl AnnType
+    an0 <- annotationsToComments' an lidl [AnnOpenP,AnnCloseP]
+    an1 <- markEpAnnL' an0 lidl AnnType
 
     (_anx, ltycon', tyvars',_,_) <- exactVanillaDeclHead ltycon tyvars fixity Nothing
-    an2 <- markEpAnnL an1 lidl AnnEqual
+    an2 <- markEpAnnL' an1 lidl AnnEqual
     rhs' <- markAnnotated rhs
     return (SynDecl { tcdSExt = an2
                     , tcdLName = ltycon', tcdTyVars = tyvars', tcdFixity = fixity
@@ -3692,8 +3727,8 @@ instance ExactPrint (TyClDecl GhcPs) where
       | null sigs && isEmptyBag methods && null ats && null at_defs -- No "where" part
       = do
           (an0, fds', lclas', tyvars',context') <- top_matter
-          an1 <- markEpAnnL an0 lidl AnnOpenC
-          an2 <- markEpAnnL an1 lidl AnnCloseC
+          an1 <- markEpAnnL' an0 lidl AnnOpenC
+          an2 <- markEpAnnL' an1 lidl AnnCloseC
           return (ClassDecl {tcdCExt = (an2, lo, sortKey),
                              tcdCtxt = context', tcdLName = lclas', tcdTyVars = tyvars',
                              tcdFixity = fixity,
@@ -3705,8 +3740,8 @@ instance ExactPrint (TyClDecl GhcPs) where
       | otherwise       -- Laid out
       = do
           (an0, fds', lclas', tyvars',context') <- top_matter
-          an1 <- markEpAnnL    an0 lidl AnnOpenC
-          an2 <- markEpAnnAllL an1 lidl AnnSemi
+          an1 <- markEpAnnL'    an0 lidl AnnOpenC
+          an2 <- markEpAnnAllL' an1 lidl AnnSemi
           ds <- withSortKey sortKey
                                [(ClsSigTag, prepareListAnnotationA sigs),
                                 (ClsMethodTag, prepareListAnnotationA (bagToList methods)),
@@ -3714,7 +3749,7 @@ instance ExactPrint (TyClDecl GhcPs) where
                                 (ClsAtdTag, prepareListAnnotationA at_defs)
                              -- ++ prepareListAnnotation docs
                                ]
-          an3 <- markEpAnnL an2 lidl AnnCloseC
+          an3 <- markEpAnnL' an2 lidl AnnCloseC
           let
             sigs'    = undynamic ds
             methods' = listToBag $ undynamic ds
@@ -3729,16 +3764,16 @@ instance ExactPrint (TyClDecl GhcPs) where
                              tcdDocs = _docs})
       where
         top_matter = do
-          an' <- annotationsToComments an lidl  [AnnOpenP, AnnCloseP]
-          an0 <- markEpAnnL an' lidl AnnClass
+          an' <- annotationsToComments' an lidl  [AnnOpenP, AnnCloseP]
+          an0 <- markEpAnnL' an' lidl AnnClass
           (_, lclas', tyvars',_,context') <-  exactVanillaDeclHead lclas tyvars fixity context
           (an1, fds') <- if (null fds)
             then return (an0, fds)
             else do
-              an1 <- markEpAnnL an0 lidl AnnVbar
+              an1 <- markEpAnnL' an0 lidl AnnVbar
               fds' <- markAnnotated fds
               return (an1, fds')
-          an2 <- markEpAnnL an1 lidl AnnWhere
+          an2 <- markEpAnnL' an1 lidl AnnWhere
           return (an2, fds', lclas', tyvars',context')
 
 
@@ -3836,15 +3871,15 @@ exactFlavour an (ClosedTypeFamily {}) = markEpAnnL an lidl AnnType
 
 exactDataDefn
   :: (Monad m, Monoid w)
-  => EpAnn [AddEpAnn]
-  -> (Maybe (LHsContext GhcPs) -> EP w m (EpAnn [AddEpAnn]
+  => [AddEpAnn]
+  -> (Maybe (LHsContext GhcPs) -> EP w m ([AddEpAnn]
                                          , LocatedN RdrName
                                          , a
                                          , b
                                          , Maybe (LHsContext GhcPs))) -- Printing the header
   -> HsDataDefn GhcPs
-  -> EP w m ( EpAnn [AddEpAnn] -- ^ from exactHdr
-            , EpAnn [AddEpAnn] -- ^ updated one passed in
+  -> EP w m ( [AddEpAnn] -- ^ from exactHdr
+            , [AddEpAnn] -- ^ updated one passed in
             , LocatedN RdrName, a, b, Maybe (LHsContext GhcPs), HsDataDefn GhcPs)
 exactDataDefn an exactHdr
                  (HsDataDefn { dd_ext = x, dd_ctxt = context
@@ -3852,36 +3887,36 @@ exactDataDefn an exactHdr
                              , dd_kindSig = mb_sig
                              , dd_cons = condecls, dd_derivs = derivings }) = do
 
-  an' <- annotationsToComments an lidl [AnnOpenP, AnnCloseP]
+  an' <- annotationsToComments' an lidl [AnnOpenP, AnnCloseP]
 
   an0 <- case condecls of
     DataTypeCons is_type_data _ -> do
       an0' <- if is_type_data
-                then markEpAnnL an' lidl AnnType
+                then markEpAnnL' an' lidl AnnType
                 else return an'
-      markEpAnnL an0' lidl AnnData
-    NewTypeCon   _ -> markEpAnnL an' lidl AnnNewtype
+      markEpAnnL' an0' lidl AnnData
+    NewTypeCon   _ -> markEpAnnL' an' lidl AnnNewtype
 
-  an1 <- markEpAnnL an0 lidl AnnInstance -- optional
+  an1 <- markEpAnnL' an0 lidl AnnInstance -- optional
   mb_ct' <- mapM markAnnotated mb_ct
   (anx, ln', tvs', b, mctxt') <- exactHdr context
   (an2, mb_sig') <- case mb_sig of
     Nothing -> return (an1, Nothing)
     Just kind -> do
-      an2 <- markEpAnnL an1 lidl AnnDcolon
+      an2 <- markEpAnnL' an1 lidl AnnDcolon
       kind' <- markAnnotated kind
       return (an2, Just kind')
   an3 <- if (needsWhere condecls)
-    then markEpAnnL an2 lidl AnnWhere
+    then markEpAnnL' an2 lidl AnnWhere
     else return an2
-  an4 <- markEpAnnL an3 lidl AnnOpenC
+  an4 <- markEpAnnL' an3 lidl AnnOpenC
   (an5, condecls') <- exact_condecls an4 (toList condecls)
   let condecls'' = case condecls of
         DataTypeCons d _ -> DataTypeCons d condecls'
         NewTypeCon _     -> case condecls' of
           [decl] -> NewTypeCon decl
           _ -> panic "exacprint NewTypeCon"
-  an6 <- markEpAnnL an5 lidl AnnCloseC
+  an6 <- markEpAnnL' an5 lidl AnnCloseC
   derivings' <- mapM markAnnotated derivings
   return (anx, an6, ln', tvs', b, mctxt',
                  (HsDataDefn { dd_ext = x, dd_ctxt = context
@@ -3895,7 +3930,7 @@ exactVanillaDeclHead :: (Monad m, Monoid w)
                      -> LHsQTyVars GhcPs
                      -> LexicalFixity
                      -> Maybe (LHsContext GhcPs)
-                     -> EP w m ( EpAnn [AddEpAnn]
+                     -> EP w m ( [AddEpAnn]
                                , LocatedN RdrName
                                , LHsQTyVars GhcPs
                                , (), Maybe (LHsContext GhcPs))
@@ -4329,7 +4364,7 @@ markTrailing ts = do
 
 -- based on pp_condecls in Decls.hs
 exact_condecls :: (Monad m, Monoid w)
-  => EpAnn [AddEpAnn] -> [LConDecl GhcPs] -> EP w m (EpAnn [AddEpAnn],[LConDecl GhcPs])
+  => [AddEpAnn] -> [LConDecl GhcPs] -> EP w m ([AddEpAnn],[LConDecl GhcPs])
 exact_condecls an cs
   | gadt_syntax                  -- In GADT syntax
   = do
@@ -4337,7 +4372,7 @@ exact_condecls an cs
       return (an, cs')
   | otherwise                    -- In H98 syntax
   = do
-      an0 <- markEpAnnL an lidl AnnEqual
+      an0 <- markEpAnnL' an lidl AnnEqual
       cs' <- mapM markAnnotated cs
       return (an0, cs')
   where



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e848e044e94eeed1fc54c32edf436cdf175ca1c1...e7fec482471f3fede91fb119ae60182fb8054408

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e848e044e94eeed1fc54c32edf436cdf175ca1c1...e7fec482471f3fede91fb119ae60182fb8054408
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/20231211/4bc1984d/attachment-0001.html>


More information about the ghc-commits mailing list