Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

24 changed files:

Changes:

  • compiler/GHC/Hs/Decls.hs
    ... ... @@ -1354,10 +1354,10 @@ type instance XForeignExport GhcTc = Coercion
    1354 1354
     
    
    1355 1355
     type instance XXForeignDecl    (GhcPass _) = DataConCantHappen
    
    1356 1356
     
    
    1357
    -type instance XCImport (GhcPass _) = LocatedE SourceText -- original source text for the C entity
    
    1357
    +type instance XCImport (GhcPass _) = LocatedA SourceText -- original source text for the C entity
    
    1358 1358
     type instance XXForeignImport  (GhcPass _) = DataConCantHappen
    
    1359 1359
     
    
    1360
    -type instance XCExport (GhcPass _) = LocatedE SourceText -- original source text for the C entity
    
    1360
    +type instance XCExport (GhcPass _) = LocatedA SourceText -- original source text for the C entity
    
    1361 1361
     type instance XXForeignExport  (GhcPass _) = DataConCantHappen
    
    1362 1362
     
    
    1363 1363
     
    
    ... ... @@ -1610,6 +1610,6 @@ type instance Anno (WarnDecl (GhcPass p)) = SrcSpanAnnA
    1610 1610
     type instance Anno (AnnDecl (GhcPass p)) = SrcSpanAnnA
    
    1611 1611
     type instance Anno (RoleAnnotDecl (GhcPass p)) = SrcSpanAnnA
    
    1612 1612
     type instance Anno (Maybe Role) = EpAnnCO
    
    1613
    -type instance Anno CCallConv   = EpaLocation
    
    1614
    -type instance Anno Safety      = EpaLocation
    
    1615
    -type instance Anno CExportSpec = EpaLocation
    1613
    +type instance Anno CCallConv   = SrcSpanAnnA
    
    1614
    +type instance Anno Safety      = SrcSpanAnnA
    
    1615
    +type instance Anno CExportSpec = SrcSpanAnnA

  • compiler/GHC/Hs/Expr.hs
    ... ... @@ -2662,7 +2662,7 @@ type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))
    2662 2662
     type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsCmd  (GhcPass p))))] = SrcSpanAnnA
    
    2663 2663
     type instance Anno (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = SrcSpanAnnA
    
    2664 2664
     type instance Anno (Match (GhcPass p) (LocatedA (HsCmd  (GhcPass p)))) = SrcSpanAnnA
    
    2665
    -type instance Anno [LocatedA (Pat (GhcPass p))] = EpaLocation
    
    2665
    +type instance Anno [LocatedA (Pat (GhcPass p))] = SrcSpanAnnA
    
    2666 2666
     type instance Anno (GRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = EpAnnCO
    
    2667 2667
     type instance Anno (GRHS (GhcPass p) (LocatedA (HsCmd  (GhcPass p)))) = EpAnnCO
    
    2668 2668
     type instance Anno (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr)))) = SrcSpanAnnA
    

  • compiler/GHC/Hs/Pat.hs
    ... ... @@ -353,7 +353,7 @@ hsRecFieldId = hsRecFieldSel
    353 353
     ************************************************************************
    
    354 354
     -}
    
    355 355
     
    
    356
    -instance (Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedE RecFieldsDotDot)
    
    356
    +instance (Outputable arg, Outputable (XRec p (HsRecField p arg)), XRec p RecFieldsDotDot ~ LocatedA RecFieldsDotDot)
    
    357 357
           => Outputable (HsRecFields p arg) where
    
    358 358
       ppr (HsRecFields { rec_flds = flds, rec_dotdot = Nothing })
    
    359 359
             = braces (fsep (punctuate comma (map ppr flds)))
    
    ... ... @@ -1178,4 +1178,4 @@ type instance Anno (Pat (GhcPass p)) = SrcSpanAnnA
    1178 1178
     type instance Anno (HsOverLit (GhcPass p)) = EpAnnCO
    
    1179 1179
     type instance Anno ConLike = SrcSpanAnnN
    
    1180 1180
     type instance Anno (HsFieldBind lhs rhs) = SrcSpanAnnA
    
    1181
    -type instance Anno RecFieldsDotDot = EpaLocation
    1181
    +type instance Anno RecFieldsDotDot = SrcSpanAnnA

  • compiler/GHC/Hs/Utils.hs
    ... ... @@ -179,7 +179,7 @@ mkSimpleMatch :: (Anno (Match (GhcPass p) (LocatedA (body (GhcPass p))))
    179 179
                       Anno (GRHS (GhcPass p) (LocatedA (body (GhcPass p))))
    
    180 180
                             ~ EpAnn NoEpAnns)
    
    181 181
                   => HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
    
    182
    -              -> LocatedE [LPat (GhcPass p)] -> LocatedA (body (GhcPass p))
    
    182
    +              -> LocatedA [LPat (GhcPass p)] -> LocatedA (body (GhcPass p))
    
    183 183
                   -> LMatch (GhcPass p) (LocatedA (body (GhcPass p)))
    
    184 184
     mkSimpleMatch ctxt (L l pats) rhs
    
    185 185
       = L loc $
    
    ... ... @@ -264,7 +264,7 @@ mkHsAppTypes :: LHsExpr GhcRn -> [LHsWcType GhcRn] -> LHsExpr GhcRn
    264 264
     mkHsAppTypes = foldl' mkHsAppType
    
    265 265
     
    
    266 266
     mkHsLam :: (IsPass p, XMG (GhcPass p) (LHsExpr (GhcPass p)) ~ (Origin, MatchGroupAnn))
    
    267
    -        => LocatedE [LPat (GhcPass p)]
    
    267
    +        => LocatedA [LPat (GhcPass p)]
    
    268 268
             -> LHsExpr (GhcPass p)
    
    269 269
             -> LHsExpr (GhcPass p)
    
    270 270
     mkHsLam (L l pats) body = mkHsPar (L (getLoc body) (HsLam noAnn LamSingle matches))
    
    ... ... @@ -904,7 +904,7 @@ get_bind_spans binds sigs
    904 904
     ------------
    
    905 905
     -- | Convenience function using 'mkFunBind'.
    
    906 906
     -- This is for generated bindings only, do not use for user-written code.
    
    907
    -mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedE [LPat GhcPs]
    
    907
    +mkSimpleGeneratedFunBind :: SrcSpan -> RdrName -> LocatedA [LPat GhcPs]
    
    908 908
                              -> LHsExpr GhcPs -> LHsBind GhcPs
    
    909 909
     mkSimpleGeneratedFunBind loc fun pats expr
    
    910 910
       = L (noAnnSrcSpan loc) $ mkFunBind (Generated OtherExpansion SkipPmc) (L (noAnnSrcSpan loc) fun)
    
    ... ... @@ -923,7 +923,7 @@ mkPrefixFunRhs n an = FunRhs { mc_fun = n
    923 923
     ------------
    
    924 924
     mkMatch :: forall p. IsPass p
    
    925 925
             => HsMatchContext (LIdP (NoGhcTc (GhcPass p)))
    
    926
    -        -> LocatedE [LPat (GhcPass p)]
    
    926
    +        -> LocatedA [LPat (GhcPass p)]
    
    927 927
             -> LHsExpr (GhcPass p)
    
    928 928
             -> HsLocalBinds (GhcPass p)
    
    929 929
             -> LMatch (GhcPass p) (LHsExpr (GhcPass p))
    

  • compiler/GHC/Iface/Ext/Ast.hs
    ... ... @@ -2212,15 +2212,15 @@ instance ToHie (LocatedA (ForeignDecl GhcRn)) where
    2212 2212
     
    
    2213 2213
     instance ToHie (ForeignImport GhcRn) where
    
    2214 2214
       toHie (CImport (L c _) (L a _) (L b _) _ _) = concatM $
    
    2215
    -    [ locOnlyE a
    
    2216
    -    , locOnlyE b
    
    2217
    -    , locOnlyE c
    
    2215
    +    [ locOnlyE (entry a)
    
    2216
    +    , locOnlyE (entry b)
    
    2217
    +    , locOnlyE (entry c)
    
    2218 2218
         ]
    
    2219 2219
     
    
    2220 2220
     instance ToHie (ForeignExport GhcRn) where
    
    2221 2221
       toHie (CExport (L b _) (L a _)) = concatM $
    
    2222
    -    [ locOnlyE a
    
    2223
    -    , locOnlyE b
    
    2222
    +    [ locOnlyE (entry a)
    
    2223
    +    , locOnlyE (entry b)
    
    2224 2224
         ]
    
    2225 2225
     
    
    2226 2226
     instance ToHie (LocatedA (WarnDecls GhcRn)) where
    

  • compiler/GHC/Parser.y
    ... ... @@ -2086,7 +2086,7 @@ maybe_warning_pragma :: { Maybe (LWarningTxt GhcPs) }
    2086 2086
                                                $2 (snd $ unLoc $3))}
    
    2087 2087
             |  {- empty -}      { Nothing }
    
    2088 2088
     
    
    2089
    -warning_category :: { Maybe (LocatedE (InWarningCategory GhcPs)) }
    
    2089
    +warning_category :: { Maybe (LocatedA (InWarningCategory GhcPs)) }
    
    2090 2090
             : 'in' STRING                  { Just (reLoc $ sLL $1 $> $ InWarningCategory (epTok $1, getSTRINGs $2)
    
    2091 2091
                                                                         (reLoc $ sL1 $2 $ mkWarningCategory (getSTRING $2))) }
    
    2092 2092
             | {- empty -}                  { Nothing }
    

  • compiler/GHC/Parser/Annotation.hs
    ... ... @@ -28,7 +28,7 @@ module GHC.Parser.Annotation (
    28 28
     
    
    29 29
       -- ** Annotations in 'GenLocated'
    
    30 30
       LocatedA, LocatedN, LocatedAn,
    
    31
    -  LocatedE, LocatedBF,
    
    31
    +  LocatedBF,
    
    32 32
       SrcSpanAnnA, SrcSpanAnnN,
    
    33 33
       SrcSpanAnnBF,
    
    34 34
     
    
    ... ... @@ -442,8 +442,6 @@ type SrcSpanAnnN = EpAnn NameAnn
    442 442
     
    
    443 443
     type SrcSpanAnnBF = EpAnn AnnBooleanFormula
    
    444 444
     
    
    445
    -type LocatedE = GenLocated EpaLocation
    
    446
    -
    
    447 445
     -- | General representation of a 'GenLocated' type carrying a
    
    448 446
     -- parameterised annotation type.
    
    449 447
     type LocatedAn an = GenLocated (EpAnn an)
    
    ... ... @@ -840,8 +838,8 @@ widenSpanT :: SrcSpan -> EpToken tok -> SrcSpan
    840 838
     widenSpanT l (EpTok loc) = widenSpanL l [loc]
    
    841 839
     widenSpanT l NoEpTok = l
    
    842 840
     
    
    843
    -listLocation :: [LocatedAn an a] -> EpaLocation
    
    844
    -listLocation as = EpaSpan (go noSrcSpan as)
    
    841
    +listLocation :: [LocatedAn an a] -> SrcSpanAnnA
    
    842
    +listLocation as = EpAnn (EpaSpan (go noSrcSpan as)) noAnn emptyComments
    
    845 843
       where
    
    846 844
         combine l r = combineSrcSpans l r
    
    847 845
     
    

  • compiler/GHC/Parser/PostProcess.hs
    ... ... @@ -1518,7 +1518,7 @@ checkFunBind :: SrcSpan
    1518 1518
                  -> AnnFunRhs
    
    1519 1519
                  -> LocatedN RdrName
    
    1520 1520
                  -> LexicalFixity
    
    1521
    -             -> LocatedE [LocatedA (PatBuilder GhcPs)]
    
    1521
    +             -> LocatedA [LocatedA (PatBuilder GhcPs)]
    
    1522 1522
                  -> Located (GRHSs GhcPs (LHsExpr GhcPs))
    
    1523 1523
                  -> P (HsBind GhcPs)
    
    1524 1524
     checkFunBind locF ann_fun (L lf fun) is_infix (L lp pats) (L _ grhss)
    
    ... ... @@ -3214,7 +3214,7 @@ mkImport cconv safety (L loc sLit, v, ty) (timport, td) =
    3214 3214
     -- the string "foo" is ambiguous: either a header or a C identifier.  The
    
    3215 3215
     -- C identifier case comes first in the alternatives below, so we pick
    
    3216 3216
     -- that one.
    
    3217
    -parseCImport :: LocatedE CCallConv -> LocatedE Safety -> HText -> String
    
    3217
    +parseCImport :: LocatedA CCallConv -> LocatedA Safety -> HText -> String
    
    3218 3218
                  -> Located SourceText
    
    3219 3219
                  -> Maybe (ForeignImport GhcPs)
    
    3220 3220
     parseCImport cconv safety nm str sourceText =
    

  • compiler/GHC/Rename/Pat.hs
    ... ... @@ -859,7 +859,7 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot })
    859 859
                      , hfbRHS = arg'
    
    860 860
                      , hfbPun = pun } }
    
    861 861
     
    
    862
    -    rn_dotdot :: Maybe (LocatedE RecFieldsDotDot)     -- See Note [DotDot fields] in GHC.Hs.Pat
    
    862
    +    rn_dotdot :: Maybe (LocatedA RecFieldsDotDot)     -- See Note [DotDot fields] in GHC.Hs.Pat
    
    863 863
                   -> Maybe (WithUserRdr Name)
    
    864 864
                       -- The constructor (Nothing for an out of scope constructor)
    
    865 865
                   -> [LHsRecField GhcRn (LocatedA arg)] -- Explicit fields
    

  • compiler/GHC/Unit/Module/Warnings.hs
    ... ... @@ -165,8 +165,8 @@ type instance XInWarningCategory (GhcPass _) = (EpToken "in", SourceText)
    165 165
     type instance XXInWarningCategory  (GhcPass _) = DataConCantHappen
    
    166 166
     
    
    167 167
     type instance Anno (WithHsDocIdentifiers (StringLiteral pass) pass) = SrcSpanAnnA
    
    168
    -type instance Anno (InWarningCategory (GhcPass pass)) = EpaLocation
    
    169
    -type instance Anno (WarningCategory) = EpaLocation
    
    168
    +type instance Anno (InWarningCategory (GhcPass pass)) = SrcSpanAnnA
    
    169
    +type instance Anno (WarningCategory) = SrcSpanAnnA
    
    170 170
     type instance Anno (WarningTxt (GhcPass pass)) = SrcSpanAnnA
    
    171 171
     
    
    172 172
     deriving stock instance Eq (WarningTxt GhcPs)
    

  • testsuite/tests/ghc-api/exactprint/T22919.stderr
    ... ... @@ -105,7 +105,11 @@
    105 105
                  []
    
    106 106
                  []))
    
    107 107
                (L
    
    108
    -            (EpaSpan { <no location info> })
    
    108
    +            (EpAnn
    
    109
    +             (EpaSpan { <no location info> })
    
    110
    +             []
    
    111
    +             (EpaComments
    
    112
    +              []))
    
    109 113
                 [])
    
    110 114
                (GRHSs
    
    111 115
                 (EpaComments
    

  • testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
    ... ... @@ -117,7 +117,11 @@
    117 117
                  []
    
    118 118
                  []))
    
    119 119
                (L
    
    120
    -            (EpaSpan { <no location info> })
    
    120
    +            (EpAnn
    
    121
    +             (EpaSpan { <no location info> })
    
    122
    +             []
    
    123
    +             (EpaComments
    
    124
    +              []))
    
    121 125
                 [])
    
    122 126
                (GRHSs
    
    123 127
                 (EpaComments
    

  • testsuite/tests/module/mod185.stderr
    ... ... @@ -129,7 +129,11 @@
    129 129
                  []
    
    130 130
                  []))
    
    131 131
                (L
    
    132
    -            (EpaSpan { <no location info> })
    
    132
    +            (EpAnn
    
    133
    +             (EpaSpan { <no location info> })
    
    134
    +             []
    
    135
    +             (EpaComments
    
    136
    +              []))
    
    133 137
                 [])
    
    134 138
                (GRHSs
    
    135 139
                 (EpaComments
    

  • testsuite/tests/parser/should_compile/DumpParsedAst.stderr
    ... ... @@ -2157,7 +2157,11 @@
    2157 2157
                  []
    
    2158 2158
                  []))
    
    2159 2159
                (L
    
    2160
    -            (EpaSpan { <no location info> })
    
    2160
    +            (EpAnn
    
    2161
    +             (EpaSpan { <no location info> })
    
    2162
    +             []
    
    2163
    +             (EpaComments
    
    2164
    +              []))
    
    2161 2165
                 [])
    
    2162 2166
                (GRHSs
    
    2163 2167
                 (EpaComments
    

  • testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
    ... ... @@ -125,7 +125,11 @@
    125 125
                  []
    
    126 126
                  []))
    
    127 127
                (L
    
    128
    -            (EpaSpan { <no location info> })
    
    128
    +            (EpAnn
    
    129
    +             (EpaSpan { <no location info> })
    
    130
    +             []
    
    131
    +             (EpaComments
    
    132
    +              []))
    
    129 133
                 [])
    
    130 134
                (GRHSs
    
    131 135
                 (EpaComments
    
    ... ... @@ -245,7 +249,11 @@
    245 249
                  []
    
    246 250
                  []))
    
    247 251
                (L
    
    248
    -            (EpaSpan { <no location info> })
    
    252
    +            (EpAnn
    
    253
    +             (EpaSpan { <no location info> })
    
    254
    +             []
    
    255
    +             (EpaComments
    
    256
    +              []))
    
    249 257
                 [])
    
    250 258
                (GRHSs
    
    251 259
                 (EpaComments
    
    ... ... @@ -391,7 +399,11 @@
    391 399
                  []
    
    392 400
                  []))
    
    393 401
                (L
    
    394
    -            (EpaSpan { <no location info> })
    
    402
    +            (EpAnn
    
    403
    +             (EpaSpan { <no location info> })
    
    404
    +             []
    
    405
    +             (EpaComments
    
    406
    +              []))
    
    395 407
                 [])
    
    396 408
                (GRHSs
    
    397 409
                 (EpaComments
    

  • testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
    ... ... @@ -65,7 +65,11 @@
    65 65
                      []
    
    66 66
                      []))
    
    67 67
                    (L
    
    68
    -                (EpaSpan { <no location info> })
    
    68
    +                (EpAnn
    
    69
    +                 (EpaSpan { <no location info> })
    
    70
    +                 []
    
    71
    +                 (EpaComments
    
    72
    +                  []))
    
    69 73
                     [])
    
    70 74
                    (GRHSs
    
    71 75
                     (EpaComments
    

  • testsuite/tests/parser/should_compile/DumpSemis.stderr
    ... ... @@ -293,7 +293,11 @@
    293 293
                  []
    
    294 294
                  []))
    
    295 295
                (L
    
    296
    -            (EpaSpan { <no location info> })
    
    296
    +            (EpAnn
    
    297
    +             (EpaSpan { <no location info> })
    
    298
    +             []
    
    299
    +             (EpaComments
    
    300
    +              []))
    
    297 301
                 [])
    
    298 302
                (GRHSs
    
    299 303
                 (EpaComments
    
    ... ... @@ -583,7 +587,11 @@
    583 587
                  []
    
    584 588
                  []))
    
    585 589
                (L
    
    586
    -            (EpaSpan { <no location info> })
    
    590
    +            (EpAnn
    
    591
    +             (EpaSpan { <no location info> })
    
    592
    +             []
    
    593
    +             (EpaComments
    
    594
    +              []))
    
    587 595
                 [])
    
    588 596
                (GRHSs
    
    589 597
                 (EpaComments
    
    ... ... @@ -831,7 +839,11 @@
    831 839
                  []
    
    832 840
                  []))
    
    833 841
                (L
    
    834
    -            (EpaSpan { <no location info> })
    
    842
    +            (EpAnn
    
    843
    +             (EpaSpan { <no location info> })
    
    844
    +             []
    
    845
    +             (EpaComments
    
    846
    +              []))
    
    835 847
                 [])
    
    836 848
                (GRHSs
    
    837 849
                 (EpaComments
    
    ... ... @@ -1036,7 +1048,11 @@
    1036 1048
                  []
    
    1037 1049
                  []))
    
    1038 1050
                (L
    
    1039
    -            (EpaSpan { <no location info> })
    
    1051
    +            (EpAnn
    
    1052
    +             (EpaSpan { <no location info> })
    
    1053
    +             []
    
    1054
    +             (EpaComments
    
    1055
    +              []))
    
    1040 1056
                 [])
    
    1041 1057
                (GRHSs
    
    1042 1058
                 (EpaComments
    
    ... ... @@ -1138,7 +1154,11 @@
    1138 1154
                  []
    
    1139 1155
                  []))
    
    1140 1156
                (L
    
    1141
    -            (EpaSpan { <no location info> })
    
    1157
    +            (EpAnn
    
    1158
    +             (EpaSpan { <no location info> })
    
    1159
    +             []
    
    1160
    +             (EpaComments
    
    1161
    +              []))
    
    1142 1162
                 [])
    
    1143 1163
                (GRHSs
    
    1144 1164
                 (EpaComments
    
    ... ... @@ -1242,7 +1262,11 @@
    1242 1262
                  []
    
    1243 1263
                  []))
    
    1244 1264
                (L
    
    1245
    -            (EpaSpan { <no location info> })
    
    1265
    +            (EpAnn
    
    1266
    +             (EpaSpan { <no location info> })
    
    1267
    +             []
    
    1268
    +             (EpaComments
    
    1269
    +              []))
    
    1246 1270
                 [])
    
    1247 1271
                (GRHSs
    
    1248 1272
                 (EpaComments
    
    ... ... @@ -1730,7 +1754,11 @@
    1730 1754
                  []
    
    1731 1755
                  []))
    
    1732 1756
                (L
    
    1733
    -            (EpaSpan { DumpSemis.hs:32:3 })
    
    1757
    +            (EpAnn
    
    1758
    +             (EpaSpan { DumpSemis.hs:32:3 })
    
    1759
    +             []
    
    1760
    +             (EpaComments
    
    1761
    +              []))
    
    1734 1762
                 [(L
    
    1735 1763
                   (EpAnn
    
    1736 1764
                    (EpaSpan { DumpSemis.hs:32:3 })
    
    ... ... @@ -1853,7 +1881,11 @@
    1853 1881
                  []
    
    1854 1882
                  []))
    
    1855 1883
                (L
    
    1856
    -            (EpaSpan { <no location info> })
    
    1884
    +            (EpAnn
    
    1885
    +             (EpaSpan { <no location info> })
    
    1886
    +             []
    
    1887
    +             (EpaComments
    
    1888
    +              []))
    
    1857 1889
                 [])
    
    1858 1890
                (GRHSs
    
    1859 1891
                 (EpaComments
    
    ... ... @@ -1976,7 +2008,11 @@
    1976 2008
                                   []
    
    1977 2009
                                   []))
    
    1978 2010
                                 (L
    
    1979
    -                             (EpaSpan { <no location info> })
    
    2011
    +                             (EpAnn
    
    2012
    +                              (EpaSpan { <no location info> })
    
    2013
    +                              []
    
    2014
    +                              (EpaComments
    
    2015
    +                               []))
    
    1980 2016
                                  [])
    
    1981 2017
                                 (GRHSs
    
    1982 2018
                                  (EpaComments
    
    ... ... @@ -2086,7 +2122,11 @@
    2086 2122
                                   []
    
    2087 2123
                                   []))
    
    2088 2124
                                 (L
    
    2089
    -                             (EpaSpan { <no location info> })
    
    2125
    +                             (EpAnn
    
    2126
    +                              (EpaSpan { <no location info> })
    
    2127
    +                              []
    
    2128
    +                              (EpaComments
    
    2129
    +                               []))
    
    2090 2130
                                  [])
    
    2091 2131
                                 (GRHSs
    
    2092 2132
                                  (EpaComments
    
    ... ... @@ -2208,7 +2248,11 @@
    2208 2248
                  []
    
    2209 2249
                  []))
    
    2210 2250
                (L
    
    2211
    -            (EpaSpan { DumpSemis.hs:36:5 })
    
    2251
    +            (EpAnn
    
    2252
    +             (EpaSpan { DumpSemis.hs:36:5 })
    
    2253
    +             []
    
    2254
    +             (EpaComments
    
    2255
    +              []))
    
    2212 2256
                 [(L
    
    2213 2257
                   (EpAnn
    
    2214 2258
                    (EpaSpan { DumpSemis.hs:36:5 })
    
    ... ... @@ -2311,7 +2355,11 @@
    2311 2355
                           (NoExtField)
    
    2312 2356
                           (CaseAlt)
    
    2313 2357
                           (L
    
    2314
    -                       (EpaSpan { DumpSemis.hs:39:6 })
    
    2358
    +                       (EpAnn
    
    2359
    +                        (EpaSpan { DumpSemis.hs:39:6 })
    
    2360
    +                        []
    
    2361
    +                        (EpaComments
    
    2362
    +                         []))
    
    2315 2363
                            [(L
    
    2316 2364
                              (EpAnn
    
    2317 2365
                               (EpaSpan { DumpSemis.hs:39:6 })
    
    ... ... @@ -2383,7 +2431,11 @@
    2383 2431
                           (NoExtField)
    
    2384 2432
                           (CaseAlt)
    
    2385 2433
                           (L
    
    2386
    -                       (EpaSpan { DumpSemis.hs:40:6 })
    
    2434
    +                       (EpAnn
    
    2435
    +                        (EpaSpan { DumpSemis.hs:40:6 })
    
    2436
    +                        []
    
    2437
    +                        (EpaComments
    
    2438
    +                         []))
    
    2387 2439
                            [(L
    
    2388 2440
                              (EpAnn
    
    2389 2441
                               (EpaSpan { DumpSemis.hs:40:6 })
    
    ... ... @@ -2458,7 +2510,11 @@
    2458 2510
                           (NoExtField)
    
    2459 2511
                           (CaseAlt)
    
    2460 2512
                           (L
    
    2461
    -                       (EpaSpan { DumpSemis.hs:41:6 })
    
    2513
    +                       (EpAnn
    
    2514
    +                        (EpaSpan { DumpSemis.hs:41:6 })
    
    2515
    +                        []
    
    2516
    +                        (EpaComments
    
    2517
    +                         []))
    
    2462 2518
                            [(L
    
    2463 2519
                              (EpAnn
    
    2464 2520
                               (EpaSpan { DumpSemis.hs:41:6 })
    
    ... ... @@ -2536,7 +2592,11 @@
    2536 2592
                           (NoExtField)
    
    2537 2593
                           (CaseAlt)
    
    2538 2594
                           (L
    
    2539
    -                       (EpaSpan { DumpSemis.hs:42:6 })
    
    2595
    +                       (EpAnn
    
    2596
    +                        (EpaSpan { DumpSemis.hs:42:6 })
    
    2597
    +                        []
    
    2598
    +                        (EpaComments
    
    2599
    +                         []))
    
    2540 2600
                            [(L
    
    2541 2601
                              (EpAnn
    
    2542 2602
                               (EpaSpan { DumpSemis.hs:42:6 })
    

  • testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr
    ... ... @@ -1731,7 +1731,11 @@
    1731 1731
                   []
    
    1732 1732
                   []))
    
    1733 1733
                 (L
    
    1734
    -             (EpaSpan { <no location info> })
    
    1734
    +             (EpAnn
    
    1735
    +              (EpaSpan { <no location info> })
    
    1736
    +              []
    
    1737
    +              (EpaComments
    
    1738
    +               []))
    
    1735 1739
                  [])
    
    1736 1740
                 (GRHSs
    
    1737 1741
                  (EpaComments
    

  • testsuite/tests/parser/should_compile/KindSigs.stderr
    ... ... @@ -998,7 +998,11 @@
    998 998
                  []
    
    999 999
                  []))
    
    1000 1000
                (L
    
    1001
    -            (EpaSpan { KindSigs.hs:23:5-7 })
    
    1001
    +            (EpAnn
    
    1002
    +             (EpaSpan { KindSigs.hs:23:5-7 })
    
    1003
    +             []
    
    1004
    +             (EpaComments
    
    1005
    +              []))
    
    1002 1006
                 [(L
    
    1003 1007
                   (EpAnn
    
    1004 1008
                    (EpaSpan { KindSigs.hs:23:5 })
    
    ... ... @@ -1694,7 +1698,11 @@
    1694 1698
                  []
    
    1695 1699
                  []))
    
    1696 1700
                (L
    
    1697
    -            (EpaSpan { <no location info> })
    
    1701
    +            (EpAnn
    
    1702
    +             (EpaSpan { <no location info> })
    
    1703
    +             []
    
    1704
    +             (EpaComments
    
    1705
    +              []))
    
    1698 1706
                 [])
    
    1699 1707
                (GRHSs
    
    1700 1708
                 (EpaComments
    

  • testsuite/tests/parser/should_compile/T20718.stderr
    ... ... @@ -139,7 +139,11 @@
    139 139
                  []
    
    140 140
                  []))
    
    141 141
                (L
    
    142
    -            (EpaSpan { <no location info> })
    
    142
    +            (EpAnn
    
    143
    +             (EpaSpan { <no location info> })
    
    144
    +             []
    
    145
    +             (EpaComments
    
    146
    +              []))
    
    143 147
                 [])
    
    144 148
                (GRHSs
    
    145 149
                 (EpaComments
    

  • testsuite/tests/parser/should_compile/T20846.stderr
    ... ... @@ -133,7 +133,11 @@
    133 133
                  []
    
    134 134
                  []))
    
    135 135
                (L
    
    136
    -            (EpaSpan { <no location info> })
    
    136
    +            (EpAnn
    
    137
    +             (EpaSpan { <no location info> })
    
    138
    +             []
    
    139
    +             (EpaComments
    
    140
    +              []))
    
    137 141
                 [])
    
    138 142
                (GRHSs
    
    139 143
                 (EpaComments
    

  • testsuite/tests/printer/Test20297.stdout
    ... ... @@ -105,7 +105,11 @@
    105 105
                  []
    
    106 106
                  []))
    
    107 107
                (L
    
    108
    -            (EpaSpan { <no location info> })
    
    108
    +            (EpAnn
    
    109
    +             (EpaSpan { <no location info> })
    
    110
    +             []
    
    111
    +             (EpaComments
    
    112
    +              []))
    
    109 113
                 [])
    
    110 114
                (GRHSs
    
    111 115
                 (EpaComments
    
    ... ... @@ -233,7 +237,11 @@
    233 237
                  []
    
    234 238
                  []))
    
    235 239
                (L
    
    236
    -            (EpaSpan { <no location info> })
    
    240
    +            (EpAnn
    
    241
    +             (EpaSpan { <no location info> })
    
    242
    +             []
    
    243
    +             (EpaComments
    
    244
    +              []))
    
    237 245
                 [])
    
    238 246
                (GRHSs
    
    239 247
                 (EpaComments
    
    ... ... @@ -353,7 +361,11 @@
    353 361
                              []
    
    354 362
                              []))
    
    355 363
                            (L
    
    356
    -                        (EpaSpan { <no location info> })
    
    364
    +                        (EpAnn
    
    365
    +                         (EpaSpan { <no location info> })
    
    366
    +                         []
    
    367
    +                         (EpaComments
    
    368
    +                          []))
    
    357 369
                             [])
    
    358 370
                            (GRHSs
    
    359 371
                             (EpaComments
    
    ... ... @@ -539,7 +551,11 @@
    539 551
                  []
    
    540 552
                  []))
    
    541 553
                (L
    
    542
    -            (EpaSpan { <no location info> })
    
    554
    +            (EpAnn
    
    555
    +             (EpaSpan { <no location info> })
    
    556
    +             []
    
    557
    +             (EpaComments
    
    558
    +              []))
    
    543 559
                 [])
    
    544 560
                (GRHSs
    
    545 561
                 (EpaComments
    
    ... ... @@ -655,7 +671,11 @@
    655 671
                  []
    
    656 672
                  []))
    
    657 673
                (L
    
    658
    -            (EpaSpan { <no location info> })
    
    674
    +            (EpAnn
    
    675
    +             (EpaSpan { <no location info> })
    
    676
    +             []
    
    677
    +             (EpaComments
    
    678
    +              []))
    
    659 679
                 [])
    
    660 680
                (GRHSs
    
    661 681
                 (EpaComments
    
    ... ... @@ -769,7 +789,11 @@
    769 789
                              []
    
    770 790
                              []))
    
    771 791
                            (L
    
    772
    -                        (EpaSpan { <no location info> })
    
    792
    +                        (EpAnn
    
    793
    +                         (EpaSpan { <no location info> })
    
    794
    +                         []
    
    795
    +                         (EpaComments
    
    796
    +                          []))
    
    773 797
                             [])
    
    774 798
                            (GRHSs
    
    775 799
                             (EpaComments
    

  • testsuite/tests/printer/Test24533.stdout
    ... ... @@ -555,7 +555,11 @@
    555 555
                       []
    
    556 556
                       []))
    
    557 557
                     (L
    
    558
    -                 (EpaSpan { Test24533.hs:16:3-12 })
    
    558
    +                 (EpAnn
    
    559
    +                  (EpaSpan { Test24533.hs:16:3-12 })
    
    560
    +                  []
    
    561
    +                  (EpaComments
    
    562
    +                   []))
    
    559 563
                      [(L
    
    560 564
                        (EpAnn
    
    561 565
                         (EpaSpan { Test24533.hs:16:3-5 })
    
    ... ... @@ -1124,7 +1128,11 @@
    1124 1128
                       []
    
    1125 1129
                       []))
    
    1126 1130
                     (L
    
    1127
    -                 (EpaSpan { Test24533.ppr.hs:6:3-12 })
    
    1131
    +                 (EpAnn
    
    1132
    +                  (EpaSpan { Test24533.ppr.hs:6:3-12 })
    
    1133
    +                  []
    
    1134
    +                  (EpaComments
    
    1135
    +                   []))
    
    1128 1136
                      [(L
    
    1129 1137
                        (EpAnn
    
    1130 1138
                         (EpaSpan { Test24533.ppr.hs:6:3-5 })
    

  • utils/check-exact/ExactPrint.hs
    ... ... @@ -723,6 +723,11 @@ printStringAtMLocL an l s = do
    723 723
     printStringAdvanceA :: (Monad m, Monoid w) => String -> EP w m ()
    
    724 724
     printStringAdvanceA str = printStringAtAA (EpaDelta noSrcSpan (SameLine 0) []) str >> return ()
    
    725 725
     
    
    726
    +printStringAtA :: (Monad m, Monoid w) => EpAnn a -> String -> EP w m (EpAnn a)
    
    727
    +printStringAtA ann s = do
    
    728
    +  l' <- printStringAtAA (entry ann) s
    
    729
    +  return ann { entry = l' }
    
    730
    +
    
    726 731
     printStringAtAA :: (Monad m, Monoid w) => EpaLocation -> String -> EP w m EpaLocation
    
    727 732
     printStringAtAA el str = printStringAtAAC CaptureComments el str
    
    728 733
     
    
    ... ... @@ -747,9 +752,13 @@ printStringAtAAC capture (EpaDelta ss d cs) s = do
    747 752
     
    
    748 753
     -- ---------------------------------------------------------------------
    
    749 754
     
    
    750
    -markExternalSourceTextE :: (Monad m, Monoid w) => EpaLocation -> SourceText -> String -> EP w m EpaLocation
    
    751
    -markExternalSourceTextE l NoSourceText txt   = printStringAtAA l txt
    
    752
    -markExternalSourceTextE l (SourceText txt) _ = printStringAtAA l (unpackFS txt)
    
    755
    +markExternalSourceTextA :: (Monad m, Monoid w) => EpAnn a -> SourceText -> String -> EP w m (EpAnn a)
    
    756
    +markExternalSourceTextA ann src txt = do
    
    757
    +  l' <- mark_source_text ann src txt
    
    758
    +  return (ann { entry = l'})
    
    759
    +  where
    
    760
    +    mark_source_text l NoSourceText txt'   = printStringAtAA (entry l) txt'
    
    761
    +    mark_source_text l (SourceText txt') _ = printStringAtAA (entry l) (unpackFS txt')
    
    753 762
     
    
    754 763
     -- ---------------------------------------------------------------------
    
    755 764
     
    
    ... ... @@ -1415,15 +1424,6 @@ instance (ExactPrint a) => ExactPrint (Located a) where
    1415 1424
     
    
    1416 1425
       exact (L l a) = L l <$> markAnnotated a
    
    1417 1426
     
    
    1418
    -instance (ExactPrint a) => ExactPrint (LocatedE a) where
    
    1419
    -  getAnnotationEntry (L l _) = Entry l [] emptyComments NoFlushComments CanUpdateAnchorOnly
    
    1420
    -  setAnnotationAnchor (L _ a) anc _ts _cs = L anc a
    
    1421
    -
    
    1422
    -  exact (L la a) = do
    
    1423
    -    debugM $ "LocatedE a:la loc=" ++ show (ss2range $ locA la)
    
    1424
    -    a' <- markAnnotated a
    
    1425
    -    return (L la a')
    
    1426
    -
    
    1427 1427
     instance (ExactPrint a) => ExactPrint (LocatedA a) where
    
    1428 1428
       getAnnotationEntry = entryFromLocatedA
    
    1429 1429
       setAnnotationAnchor la anc ts cs = setAnchorAn la anc ts cs
    
    ... ... @@ -1865,11 +1865,11 @@ instance ExactPrint (ForeignImport GhcPs) where
    1865 1865
       setAnnotationAnchor a _ _ _ = a
    
    1866 1866
       exact (CImport (L ls src) cconv safety@(L l _) mh imp) = do
    
    1867 1867
         cconv' <- markAnnotated cconv
    
    1868
    -    safety' <- if notDodgyE l
    
    1868
    +    safety' <- if notDodgyE (entry l)
    
    1869 1869
             then markAnnotated safety
    
    1870 1870
             else return safety
    
    1871
    -    ls' <- if notDodgyE ls
    
    1872
    -        then markExternalSourceTextE ls src ""
    
    1871
    +    ls' <- if notDodgyE (entry ls)
    
    1872
    +        then markExternalSourceTextA ls src ""
    
    1873 1873
             else return ls
    
    1874 1874
         return (CImport (L ls' src) cconv' safety' mh imp)
    
    1875 1875
     
    
    ... ... @@ -1881,8 +1881,8 @@ instance ExactPrint (ForeignExport GhcPs) where
    1881 1881
       exact (CExport (L ls src) spec) = do
    
    1882 1882
         debugM $ "CExport starting"
    
    1883 1883
         spec' <- markAnnotated spec
    
    1884
    -    ls' <- if notDodgyE ls
    
    1885
    -        then markExternalSourceTextE ls src ""
    
    1884
    +    ls' <- if notDodgyE (entry ls)
    
    1885
    +        then markExternalSourceTextA ls src ""
    
    1886 1886
             else return ls
    
    1887 1887
         return (CExport (L ls' src) spec')
    
    1888 1888
     
    
    ... ... @@ -3212,7 +3212,7 @@ instance (ExactPrint body) => ExactPrint (HsRecFields GhcPs body) where
    3212 3212
         mdot' <- case mdot of
    
    3213 3213
           Nothing -> return Nothing
    
    3214 3214
           Just (L ss d) -> do
    
    3215
    -        ss' <- printStringAtAA ss ".."
    
    3215
    +        ss' <- printStringAtA ss ".."
    
    3216 3216
             return $ Just (L ss' d)
    
    3217 3217
           -- Note: mdot contains the SrcSpan where the ".." appears, if present
    
    3218 3218
         cc' <- markEpToken cc