From 9a53cd3fde89fb10599604e8d5c9127077eb0572 Mon Sep 17 00:00:00 2001
From: Alan Zimmerman <alan.zimm@gmail.com>
Date: Sat, 13 Apr 2024 17:31:13 +0100
Subject: [PATCH] EPA: Add additional comments field to AnnsModule

This is used in exact printing to store comments coming after the
`where` keyword but before any comments allocated to imports or decls.

It is used in ghc-exactprint, see
https://github.com/alanz/ghc-exactprint/commit/44bbed311fd8f0d053053fef195bf47c17d34fa7
---
 compiler/GHC/Hs.hs                            |  8 ++--
 compiler/GHC/Parser.y                         | 10 ++--
 .../tests/ghc-api/exactprint/T22919.stderr    |  1 +
 .../tests/ghc-api/exactprint/Test20239.stderr | 16 +++++--
 .../ghc-api/exactprint/ZeroWidthSemi.stderr   |  1 +
 .../should_compile_flag_haddock/T17544.stderr |  1 +
 .../T17544_kw.stderr                          |  6 ++-
 .../should_compile_flag_haddock/T24221.stderr |  1 +
 testsuite/tests/module/mod185.stderr          |  1 +
 .../should_compile/DumpParsedAst.stderr       | 46 +++++++++++++++----
 .../DumpParsedAstComments.stderr              |  1 +
 .../parser/should_compile/DumpSemis.stderr    |  1 +
 .../parser/should_compile/KindSigs.stderr     |  1 +
 .../tests/parser/should_compile/T15323.stderr |  6 ++-
 .../tests/parser/should_compile/T20452.stderr | 21 +++++++--
 .../tests/parser/should_compile/T20718.stderr |  1 +
 .../parser/should_compile/T20718b.stderr      |  1 +
 .../tests/parser/should_compile/T20846.stderr |  1 +
 .../should_compile/T23315/T23315.stderr       |  6 ++-
 testsuite/tests/printer/T18791.stderr         |  1 +
 testsuite/tests/printer/Test20297.stdout      |  2 +
 testsuite/tests/printer/Test24533.stdout      |  2 +
 utils/check-exact/ExactPrint.hs               |  6 ++-
 23 files changed, 112 insertions(+), 29 deletions(-)

diff --git a/compiler/GHC/Hs.hs b/compiler/GHC/Hs.hs
index 3f049e326dd1..bf902e25b4fb 100644
--- a/compiler/GHC/Hs.hs
+++ b/compiler/GHC/Hs.hs
@@ -101,12 +101,14 @@ deriving instance Data (HsModule GhcPs)
 data AnnsModule
   = AnnsModule {
     am_main :: [AddEpAnn],
-    am_decls :: [TrailingAnn],
-    am_eof :: Maybe (RealSrcSpan, RealSrcSpan) -- End of file and end of prior token
+    am_decls :: [TrailingAnn],                 -- ^ Semis before the start of top decls
+    am_cs :: [LEpaComment],                    -- ^ Comments before start of top decl,
+                                               --   used in exact printing only
+    am_eof :: Maybe (RealSrcSpan, RealSrcSpan) -- ^ End of file and end of prior token
     } deriving (Data, Eq)
 
 instance NoAnn AnnsModule where
-  noAnn = AnnsModule [] [] Nothing
+  noAnn = AnnsModule [] [] [] Nothing
 
 instance Outputable (HsModule GhcPs) where
     ppr (HsModule { hsmodExt = XModulePs { hsmodHaddockModHeader = mbDoc }
diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y
index b70c30d60e6e..54b524eef77b 100644
--- a/compiler/GHC/Parser.y
+++ b/compiler/GHC/Parser.y
@@ -881,7 +881,7 @@ signature :: { Located (HsModule GhcPs) }
        : 'signature' modid maybe_warning_pragma maybeexports 'where' body
              {% fileSrcSpan >>= \ loc ->
                 acs loc (\loc cs-> (L loc (HsModule (XModulePs
-                                               (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnSignature $1, mj AnnWhere $5] (fstOf3 $6) Nothing) cs)
+                                               (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnSignature $1, mj AnnWhere $5] (fstOf3 $6) [] Nothing) cs)
                                                (thdOf3 $6) $3 Nothing)
                                             (Just $2) $4 (fst $ sndOf3 $6)
                                             (snd $ sndOf3 $6)))
@@ -891,7 +891,7 @@ module :: { Located (HsModule GhcPs) }
        : 'module' modid maybe_warning_pragma maybeexports 'where' body
              {% fileSrcSpan >>= \ loc ->
                 acsFinal (\cs eof -> (L loc (HsModule (XModulePs
-                                                     (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1, mj AnnWhere $5] (fstOf3 $6) eof) cs)
+                                                     (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1, mj AnnWhere $5] (fstOf3 $6) [] eof) cs)
                                                      (thdOf3 $6) $3 Nothing)
                                                   (Just $2) $4 (fst $ sndOf3 $6)
                                                   (snd $ sndOf3 $6))
@@ -899,7 +899,7 @@ module :: { Located (HsModule GhcPs) }
         | body2
                 {% fileSrcSpan >>= \ loc ->
                    acsFinal (\cs eof -> (L loc (HsModule (XModulePs
-                                                        (EpAnn (spanAsAnchor loc) (AnnsModule [] (fstOf3 $1) eof) cs)
+                                                        (EpAnn (spanAsAnchor loc) (AnnsModule [] (fstOf3 $1) [] eof) cs)
                                                         (thdOf3 $1) Nothing Nothing)
                                                      Nothing Nothing
                                                      (fst $ sndOf3 $1) (snd $ sndOf3 $1)))) }
@@ -939,14 +939,14 @@ header  :: { Located (HsModule GhcPs) }
         : 'module' modid maybe_warning_pragma maybeexports 'where' header_body
                 {% fileSrcSpan >>= \ loc ->
                    acs loc (\loc cs -> (L loc (HsModule (XModulePs
-                                                   (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] Nothing) cs)
+                                                   (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] [] Nothing) cs)
                                                    EpNoLayout $3 Nothing)
                                                 (Just $2) $4 $6 []
                           ))) }
         | 'signature' modid maybe_warning_pragma maybeexports 'where' header_body
                 {% fileSrcSpan >>= \ loc ->
                    acs loc (\loc cs -> (L loc (HsModule (XModulePs
-                                                   (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] Nothing) cs)
+                                                   (EpAnn (spanAsAnchor loc) (AnnsModule [mj AnnModule $1,mj AnnWhere $5] [] [] Nothing) cs)
                                                    EpNoLayout $3 Nothing)
                                                 (Just $2) $4 $6 []
                           ))) }
diff --git a/testsuite/tests/ghc-api/exactprint/T22919.stderr b/testsuite/tests/ghc-api/exactprint/T22919.stderr
index 82684b25faa8..525a01a334c4 100644
--- a/testsuite/tests/ghc-api/exactprint/T22919.stderr
+++ b/testsuite/tests/ghc-api/exactprint/T22919.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T22919.hs:1:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T22919.hs:1:29-33 }))]
      []
+     []
      (Just
       ((,)
        { T22919.hs:3:1 }
diff --git a/testsuite/tests/ghc-api/exactprint/Test20239.stderr b/testsuite/tests/ghc-api/exactprint/Test20239.stderr
index 55b900ecc7d9..e07962967b4f 100644
--- a/testsuite/tests/ghc-api/exactprint/Test20239.stderr
+++ b/testsuite/tests/ghc-api/exactprint/Test20239.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { Test20239.hs:1:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { Test20239.hs:1:18-22 }))]
      []
+     []
      (Just
       ((,)
        { Test20239.hs:9:1 }
@@ -200,7 +201,10 @@
                   (EpaComments
                    []))
                  (HsParTy
-                  (AnnParen AnnParens (EpaSpan { Test20239.hs:7:50 }) (EpaSpan { Test20239.hs:7:86 }))
+                  (AnnParen
+                   AnnParens
+                   (EpaSpan { Test20239.hs:7:50 })
+                   (EpaSpan { Test20239.hs:7:86 }))
                   (L
                    (EpAnn
                     (EpaSpan { Test20239.hs:7:51-85 })
@@ -269,7 +273,10 @@
                         (EpaComments
                          []))
                        (HsParTy
-                        (AnnParen AnnParens (EpaSpan { Test20239.hs:7:68 }) (EpaSpan { Test20239.hs:7:85 }))
+                        (AnnParen
+                         AnnParens
+                         (EpaSpan { Test20239.hs:7:68 })
+                         (EpaSpan { Test20239.hs:7:85 }))
                         (L
                          (EpAnn
                           (EpaSpan { Test20239.hs:7:69-84 })
@@ -334,7 +341,10 @@
                             (EpaComments
                              []))
                            (HsTupleTy
-                            (AnnParen AnnParens (EpaSpan { Test20239.hs:7:83 }) (EpaSpan { Test20239.hs:7:84 }))
+                            (AnnParen
+                             AnnParens
+                             (EpaSpan { Test20239.hs:7:83 })
+                             (EpaSpan { Test20239.hs:7:84 }))
                             (HsBoxedOrConstraintTuple)
                             [])))))))))))))])
              (Nothing)))])
diff --git a/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr b/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
index 98069a691e54..775cb7550f05 100644
--- a/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
+++ b/testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { ZeroWidthSemi.hs:1:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { ZeroWidthSemi.hs:1:22-26 }))]
      []
+     []
      (Just
       ((,)
        { ZeroWidthSemi.hs:9:1 }
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
index 5782d6f3b521..edc965c1c6b7 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T17544.hs:3:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T17544.hs:3:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T17544.hs:57:1 }
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
index 8ef5c80a424f..bab3007ca54d 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T17544_kw.hs:11:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T17544_kw.hs:13:13-17 }))]
      []
+     []
      (Just
       ((,)
        { T17544_kw.hs:25:1 }
@@ -227,7 +228,10 @@
                (EpaComments
                 []))
               (HsTupleTy
-               (AnnParen AnnParens (EpaSpan { T17544_kw.hs:19:18 }) (EpaSpan { T17544_kw.hs:19:19 }))
+               (AnnParen
+                AnnParens
+                (EpaSpan { T17544_kw.hs:19:18 })
+                (EpaSpan { T17544_kw.hs:19:19 }))
                (HsBoxedOrConstraintTuple)
                [])))])
           (L
diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
index 1e0e33d80cff..017c96e25a0c 100644
--- a/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
+++ b/testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T24221.hs:1:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T24221.hs:1:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T24221.hs:43:4 }
diff --git a/testsuite/tests/module/mod185.stderr b/testsuite/tests/module/mod185.stderr
index 038059ad34b1..0f176b1a67be 100644
--- a/testsuite/tests/module/mod185.stderr
+++ b/testsuite/tests/module/mod185.stderr
@@ -8,6 +8,7 @@
    (EpAnn
     (EpaSpan { mod185.hs:1:1 })
     (AnnsModule
+     []
      []
      []
      (Just
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index bda6ca8d7878..a97c900e9105 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { DumpParsedAst.hs:4:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAst.hs:4:22-26 }))]
      []
+     []
      (Just
       ((,)
        { DumpParsedAst.hs:26:1 }
@@ -228,7 +229,10 @@
             (EpaComments
              []))
            (HsListTy
-            (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:9:16 }) (EpaSpan { DumpParsedAst.hs:9:18 }))
+            (AnnParen
+             AnnParensSquare
+             (EpaSpan { DumpParsedAst.hs:9:16 })
+             (EpaSpan { DumpParsedAst.hs:9:18 }))
             (L
              (EpAnn
               (EpaSpan { DumpParsedAst.hs:9:17 })
@@ -315,7 +319,10 @@
                 (EpaComments
                  []))
                (HsParTy
-                (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:10 }) (EpaSpan { DumpParsedAst.hs:11:17 }))
+                (AnnParen
+                 AnnParens
+                 (EpaSpan { DumpParsedAst.hs:11:10 })
+                 (EpaSpan { DumpParsedAst.hs:11:17 }))
                 (L
                  (EpAnn
                   (EpaSpan { DumpParsedAst.hs:11:11-16 })
@@ -410,7 +417,10 @@
                 (EpaComments
                  []))
                (HsParTy
-                (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:11:26 }) (EpaSpan { DumpParsedAst.hs:11:36 }))
+                (AnnParen
+                 AnnParens
+                 (EpaSpan { DumpParsedAst.hs:11:26 })
+                 (EpaSpan { DumpParsedAst.hs:11:36 }))
                 (L
                  (EpAnn
                   (EpaSpan { DumpParsedAst.hs:11:27-35 })
@@ -555,7 +565,10 @@
              (EpaComments
               []))
             (HsListTy
-             (AnnParen AnnParensSquare (EpaSpan { DumpParsedAst.hs:10:27 }) (EpaSpan { DumpParsedAst.hs:10:29 }))
+             (AnnParen
+              AnnParensSquare
+              (EpaSpan { DumpParsedAst.hs:10:27 })
+              (EpaSpan { DumpParsedAst.hs:10:29 }))
              (L
               (EpAnn
                (EpaSpan { DumpParsedAst.hs:10:28 })
@@ -732,7 +745,10 @@
                 (EpaComments
                  []))
                (HsParTy
-                (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:15:25 }) (EpaSpan { DumpParsedAst.hs:15:29 }))
+                (AnnParen
+                 AnnParens
+                 (EpaSpan { DumpParsedAst.hs:15:25 })
+                 (EpaSpan { DumpParsedAst.hs:15:29 }))
                 (L
                  (EpAnn
                   (EpaSpan { DumpParsedAst.hs:15:26-28 })
@@ -867,7 +883,10 @@
               (EpaComments
                []))
              (HsParTy
-              (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:17:17 }) (EpaSpan { DumpParsedAst.hs:17:27 }))
+              (AnnParen
+               AnnParens
+               (EpaSpan { DumpParsedAst.hs:17:17 })
+               (EpaSpan { DumpParsedAst.hs:17:27 }))
               (L
                (EpAnn
                 (EpaSpan { DumpParsedAst.hs:17:18-26 })
@@ -1460,7 +1479,10 @@
             (EpaComments
              []))
            (HsParTy
-            (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:22 }) (EpaSpan { DumpParsedAst.hs:22:37 }))
+            (AnnParen
+             AnnParens
+             (EpaSpan { DumpParsedAst.hs:22:22 })
+             (EpaSpan { DumpParsedAst.hs:22:37 }))
             (L
              (EpAnn
               (EpaSpan { DumpParsedAst.hs:22:23-36 })
@@ -1567,7 +1589,10 @@
               (EpaComments
                []))
              (HsParTy
-              (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:22:42 }) (EpaSpan { DumpParsedAst.hs:22:52 }))
+              (AnnParen
+               AnnParens
+               (EpaSpan { DumpParsedAst.hs:22:42 })
+               (EpaSpan { DumpParsedAst.hs:22:52 }))
               (L
                (EpAnn
                 (EpaSpan { DumpParsedAst.hs:22:43-51 })
@@ -1688,7 +1713,10 @@
                  (EpaComments
                   []))
                 (HsParTy
-                 (AnnParen AnnParens (EpaSpan { DumpParsedAst.hs:23:10 }) (EpaSpan { DumpParsedAst.hs:23:34 }))
+                 (AnnParen
+                  AnnParens
+                  (EpaSpan { DumpParsedAst.hs:23:10 })
+                  (EpaSpan { DumpParsedAst.hs:23:34 }))
                  (L
                   (EpAnn
                    (EpaSpan { DumpParsedAst.hs:23:11-33 })
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr b/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
index 6ffa0eaa043f..17ee66f5292a 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { DumpParsedAstComments.hs:5:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { DumpParsedAstComments.hs:5:30-34 }))]
      []
+     []
      (Just
       ((,)
        { DumpParsedAstComments.hs:20:1 }
diff --git a/testsuite/tests/parser/should_compile/DumpSemis.stderr b/testsuite/tests/parser/should_compile/DumpSemis.stderr
index 06813fabfe1f..12af0facf54d 100644
--- a/testsuite/tests/parser/should_compile/DumpSemis.stderr
+++ b/testsuite/tests/parser/should_compile/DumpSemis.stderr
@@ -22,6 +22,7 @@
        (EpaSpan { DumpSemis.hs:4:7 }))
      ,(AddSemiAnn
        (EpaSpan { DumpSemis.hs:4:8 }))]
+     []
      (Just
       ((,)
        { DumpSemis.hs:46:1 }
diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr
index f336dda4c54e..f73e7fcea48b 100644
--- a/testsuite/tests/parser/should_compile/KindSigs.stderr
+++ b/testsuite/tests/parser/should_compile/KindSigs.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { KindSigs.hs:6:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { KindSigs.hs:6:17-21 }))]
      []
+     []
      (Just
       ((,)
        { KindSigs.hs:36:1 }
diff --git a/testsuite/tests/parser/should_compile/T15323.stderr b/testsuite/tests/parser/should_compile/T15323.stderr
index e840115848ad..d193c1e41769 100644
--- a/testsuite/tests/parser/should_compile/T15323.stderr
+++ b/testsuite/tests/parser/should_compile/T15323.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T15323.hs:3:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T15323.hs:3:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T15323.hs:7:1 }
@@ -163,7 +164,10 @@
                 (EpaComments
                  []))
                (HsParTy
-                (AnnParen AnnParens (EpaSpan { T15323.hs:6:31 }) (EpaSpan { T15323.hs:6:36 }))
+                (AnnParen
+                 AnnParens
+                 (EpaSpan { T15323.hs:6:31 })
+                 (EpaSpan { T15323.hs:6:36 }))
                 (L
                  (EpAnn
                   (EpaSpan { T15323.hs:6:32-35 })
diff --git a/testsuite/tests/parser/should_compile/T20452.stderr b/testsuite/tests/parser/should_compile/T20452.stderr
index 884ab4500a98..f313d998ab1c 100644
--- a/testsuite/tests/parser/should_compile/T20452.stderr
+++ b/testsuite/tests/parser/should_compile/T20452.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T20452.hs:3:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T20452.hs:3:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T20452.hs:10:1 }
@@ -376,7 +377,10 @@
             (EpaComments
              []))
            (HsListTy
-            (AnnParen AnnParensSquare (EpaSpan { T20452.hs:8:57 }) (EpaSpan { T20452.hs:8:74 }))
+            (AnnParen
+             AnnParensSquare
+             (EpaSpan { T20452.hs:8:57 })
+             (EpaSpan { T20452.hs:8:74 }))
             (L
              (EpAnn
               (EpaSpan { T20452.hs:8:58-73 })
@@ -385,7 +389,10 @@
               (EpaComments
                []))
              (HsTupleTy
-              (AnnParen AnnParens (EpaSpan { T20452.hs:8:58 }) (EpaSpan { T20452.hs:8:73 }))
+              (AnnParen
+               AnnParens
+               (EpaSpan { T20452.hs:8:58 })
+               (EpaSpan { T20452.hs:8:73 }))
               (HsBoxedOrConstraintTuple)
               [(L
                 (EpAnn
@@ -585,7 +592,10 @@
             (EpaComments
              []))
            (HsListTy
-            (AnnParen AnnParensSquare (EpaSpan { T20452.hs:9:57 }) (EpaSpan { T20452.hs:9:74 }))
+            (AnnParen
+             AnnParensSquare
+             (EpaSpan { T20452.hs:9:57 })
+             (EpaSpan { T20452.hs:9:74 }))
             (L
              (EpAnn
               (EpaSpan { T20452.hs:9:58-73 })
@@ -594,7 +604,10 @@
               (EpaComments
                []))
              (HsTupleTy
-              (AnnParen AnnParens (EpaSpan { T20452.hs:9:58 }) (EpaSpan { T20452.hs:9:73 }))
+              (AnnParen
+               AnnParens
+               (EpaSpan { T20452.hs:9:58 })
+               (EpaSpan { T20452.hs:9:73 }))
               (HsBoxedOrConstraintTuple)
               [(L
                 (EpAnn
diff --git a/testsuite/tests/parser/should_compile/T20718.stderr b/testsuite/tests/parser/should_compile/T20718.stderr
index 23d9c9c88d12..f2e32d2867da 100644
--- a/testsuite/tests/parser/should_compile/T20718.stderr
+++ b/testsuite/tests/parser/should_compile/T20718.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T20718.hs:3:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T20718.hs:3:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T20718.hs:12:1 }
diff --git a/testsuite/tests/parser/should_compile/T20718b.stderr b/testsuite/tests/parser/should_compile/T20718b.stderr
index b4c80196bb5f..7569fdc6cda1 100644
--- a/testsuite/tests/parser/should_compile/T20718b.stderr
+++ b/testsuite/tests/parser/should_compile/T20718b.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T20718b.hs:4:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T20718b.hs:4:16-20 }))]
      []
+     []
      (Just
       ((,)
        { T20718b.hs:8:1 }
diff --git a/testsuite/tests/parser/should_compile/T20846.stderr b/testsuite/tests/parser/should_compile/T20846.stderr
index 535db2237910..11d54ee15861 100644
--- a/testsuite/tests/parser/should_compile/T20846.stderr
+++ b/testsuite/tests/parser/should_compile/T20846.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T20846.hs:1:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T20846.hs:1:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T20846.hs:5:1 }
diff --git a/testsuite/tests/parser/should_compile/T23315/T23315.stderr b/testsuite/tests/parser/should_compile/T23315/T23315.stderr
index e4c265ca2fc2..a7613953f206 100644
--- a/testsuite/tests/parser/should_compile/T23315/T23315.stderr
+++ b/testsuite/tests/parser/should_compile/T23315/T23315.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnSignature (EpaSpan { T23315.hsig:1:1-9 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T23315.hsig:1:18-22 }))]
      []
+     []
      (Nothing))
     (EpaComments
      []))
@@ -94,7 +95,10 @@
            (EpaComments
             []))
           (HsTupleTy
-           (AnnParen AnnParens (EpaSpan { T23315.hsig:3:6 }) (EpaSpan { T23315.hsig:3:7 }))
+           (AnnParen
+            AnnParens
+            (EpaSpan { T23315.hsig:3:6 })
+            (EpaSpan { T23315.hsig:3:7 }))
            (HsBoxedOrConstraintTuple)
            []))))))))
   ,(L
diff --git a/testsuite/tests/printer/T18791.stderr b/testsuite/tests/printer/T18791.stderr
index 95df4dda5d7a..451b2a591e5c 100644
--- a/testsuite/tests/printer/T18791.stderr
+++ b/testsuite/tests/printer/T18791.stderr
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { T18791.hs:2:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { T18791.hs:2:15-19 }))]
      []
+     []
      (Just
       ((,)
        { T18791.hs:6:1 }
diff --git a/testsuite/tests/printer/Test20297.stdout b/testsuite/tests/printer/Test20297.stdout
index f52290b5c33f..64c78e96fc7d 100644
--- a/testsuite/tests/printer/Test20297.stdout
+++ b/testsuite/tests/printer/Test20297.stdout
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { Test20297.hs:2:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { Test20297.hs:2:18-22 }))]
      []
+     []
      (Just
       ((,)
        { Test20297.hs:12:1 }
@@ -418,6 +419,7 @@
      [(AddEpAnn AnnModule (EpaSpan { Test20297.ppr.hs:2:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { Test20297.ppr.hs:2:18-22 }))]
      []
+     []
      (Just
       ((,)
        { Test20297.ppr.hs:9:25 }
diff --git a/testsuite/tests/printer/Test24533.stdout b/testsuite/tests/printer/Test24533.stdout
index aaa556bb58a8..4a0fb2ae7d08 100644
--- a/testsuite/tests/printer/Test24533.stdout
+++ b/testsuite/tests/printer/Test24533.stdout
@@ -11,6 +11,7 @@
      [(AddEpAnn AnnModule (EpaSpan { Test24533.hs:2:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { Test24533.hs:2:18-22 }))]
      []
+     []
      (Just
       ((,)
        { Test24533.hs:17:1 }
@@ -643,6 +644,7 @@
      [(AddEpAnn AnnModule (EpaSpan { Test24533.ppr.hs:2:1-6 }))
      ,(AddEpAnn AnnWhere (EpaSpan { Test24533.ppr.hs:2:18-22 }))]
      []
+     []
      (Just
       ((,)
        { Test24533.ppr.hs:6:20 }
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 1ddc7b3443d0..45d2e57a8535 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -965,8 +965,10 @@ lepa k epAnn = fmap (\newAnns -> epAnn { anns = newAnns })
 
 -- data AnnsModule
 --   = AnnsModule {
---     am_main :: [AddEpAnn],
---     am_decls :: AnnList
+--     am_main  :: [AddEpAnn],
+--     am_decls :: [TrailingAnn],
+--     am_cs    :: [LEpaComment],
+--     am_eof   :: Maybe (RealSrcSpan, RealSrcSpan)
 --     } deriving (Data, Eq)
 
 lam_main :: Lens AnnsModule [AddEpAnn]
-- 
GitLab