diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2021-10-02 03:15:14 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-04 23:46:21 -0400 |
commit | a762933454f1dbecaa2048f810f6ab6bbfe3a93d (patch) | |
tree | 05d54919ee3e2ccddb1b4ddce580afee479b620d | |
parent | a0f44cebb217b3586d861750366301b973073dd1 (diff) | |
download | haskell-a762933454f1dbecaa2048f810f6ab6bbfe3a93d.tar.gz |
Bespoke TokenLocation data type
The EpaAnnCO we were using contained an Anchor instead of EpaLocation,
making it harder to work with.
At the same time, using EpaLocation by itself isn't possible either,
as we may have tokens without location information.
Hence the new data type:
data TokenLocation = NoTokenLoc
| TokenLoc !EpaLocation
-rw-r--r-- | compiler/GHC/Hs/Extension.hs | 12 | ||||
-rw-r--r-- | compiler/GHC/Parser.y | 4 | ||||
-rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/Parser/PostProcess.hs | 26 | ||||
-rw-r--r-- | testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr | 45 | ||||
-rw-r--r-- | testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr | 9 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/DumpParsedAst.stderr | 17 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/DumpRenamedAst.stderr | 80 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr | 40 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/KindSigs.stderr | 18 | ||||
-rw-r--r-- | testsuite/tests/parser/should_compile/T14189.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/printer/T18791.stderr | 9 | ||||
-rw-r--r-- | utils/check-exact/ExactPrint.hs | 7 |
13 files changed, 104 insertions, 173 deletions
diff --git a/compiler/GHC/Hs/Extension.hs b/compiler/GHC/Hs/Extension.hs index 841604ecb9..ce28e0355d 100644 --- a/compiler/GHC/Hs/Extension.hs +++ b/compiler/GHC/Hs/Extension.hs @@ -236,12 +236,12 @@ pprIfTc :: forall p. IsPass p => (p ~ 'Typechecked => SDoc) -> SDoc pprIfTc pp = case ghcPass @p of GhcTc -> pp _ -> empty -type instance Anno (HsToken tok) = EpAnnCO +type instance Anno (HsToken tok) = TokenLocation -noHsTok :: GenLocated (EpAnn a) (HsToken tok) -noHsTok = L noAnn HsTok +noHsTok :: GenLocated TokenLocation (HsToken tok) +noHsTok = L NoTokenLoc HsTok -type instance Anno (HsUniToken tok utok) = EpAnnCO +type instance Anno (HsUniToken tok utok) = TokenLocation -noHsUniTok :: GenLocated (EpAnn a) (HsUniToken tok utok) -noHsUniTok = L noAnn HsNormalTok +noHsUniTok :: GenLocated TokenLocation (HsUniToken tok utok) +noHsUniTok = L NoTokenLoc HsNormalTok diff --git a/compiler/GHC/Parser.y b/compiler/GHC/Parser.y index 6d0a276ab7..0cc1bc732a 100644 --- a/compiler/GHC/Parser.y +++ b/compiler/GHC/Parser.y @@ -4354,11 +4354,11 @@ listAsAnchor [] = spanAsAnchor noSrcSpan listAsAnchor (L l _:_) = spanAsAnchor (locA l) hsTok :: Located Token -> LHsToken tok GhcPs -hsTok (L l _) = L (EpAnn (spanAsAnchor l) NoEpAnns emptyComments) HsTok +hsTok (L l _) = L (mkTokenLocation l) HsTok hsUniTok :: Located Token -> LHsUniToken tok utok GhcPs hsUniTok t@(L l _) = - L (EpAnn (spanAsAnchor l) NoEpAnns emptyComments) + L (mkTokenLocation l) (if isUnicode t then HsUnicodeTok else HsNormalTok) -- ------------------------------------- diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index a914a14b71..b414e70be5 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -14,6 +14,7 @@ module GHC.Parser.Annotation ( -- * In-tree Exact Print Annotations AddEpAnn(..), EpaLocation(..), epaLocationRealSrcSpan, epaLocationFromSrcAnn, + TokenLocation(..), DeltaPos(..), deltaPos, getDeltaLine, EpAnn(..), Anchor(..), AnchorOperation(..), @@ -405,6 +406,11 @@ data EpaLocation = EpaSpan RealSrcSpan | EpaDelta DeltaPos deriving (Data,Show,Eq,Ord) +-- | Tokens embedded in the AST have an EpaLocation, unless they come from +-- generated code (e.g. by TH). +data TokenLocation = NoTokenLoc | TokenLoc !EpaLocation + deriving (Data,Show,Eq,Ord) + -- | Spacing between output items when exact printing. It captures -- the spacing from the current print position on the page to the -- position required for the thing about to be printed. This is diff --git a/compiler/GHC/Parser/PostProcess.hs b/compiler/GHC/Parser/PostProcess.hs index 688464dd9d..55b3c0d8a9 100644 --- a/compiler/GHC/Parser/PostProcess.hs +++ b/compiler/GHC/Parser/PostProcess.hs @@ -74,6 +74,9 @@ module GHC.Parser.PostProcess ( UnpackednessPragma(..), mkMultTy, + -- Token location + mkTokenLocation, + -- Help with processing exports ImpExpSubSpec(..), ImpExpQcSpec(..), @@ -2994,13 +2997,28 @@ mkLHsOpTy x op y = mkMultTy :: LHsToken "%" GhcPs -> LHsType GhcPs -> LHsUniToken "->" "→" GhcPs -> HsArrow GhcPs mkMultTy pct t@(L _ (HsTyLit _ (HsNumTy (SourceText "1") 1))) arr -- See #18888 for the use of (SourceText "1") above - = HsLinearArrow (HsPct1 (L (getLoc pct Semi.<> locOf1) HsTok) arr) + = HsLinearArrow (HsPct1 (L locOfPct1 HsTok) arr) where - -- The location of "1" in "%1". - locOf1 :: EpAnn NoEpAnns - locOf1 = EpAnn (spanAsAnchor (locA (getLoc t))) NoEpAnns emptyComments + -- The location of "%" combined with the location of "1". + locOfPct1 :: TokenLocation + locOfPct1 = token_location_widenR (getLoc pct) (locA (getLoc t)) mkMultTy pct t arr = HsExplicitMult pct t arr +mkTokenLocation :: SrcSpan -> TokenLocation +mkTokenLocation (UnhelpfulSpan _) = NoTokenLoc +mkTokenLocation (RealSrcSpan r _) = TokenLoc (EpaSpan r) + +-- Precondition: the TokenLocation has EpaSpan, never EpaDelta. +token_location_widenR :: TokenLocation -> SrcSpan -> TokenLocation +token_location_widenR NoTokenLoc _ = NoTokenLoc +token_location_widenR tl (UnhelpfulSpan _) = tl +token_location_widenR (TokenLoc (EpaSpan r1)) (RealSrcSpan r2 _) = + (TokenLoc (EpaSpan (combineRealSrcSpans r1 r2))) +token_location_widenR (TokenLoc (EpaDelta _)) _ = + -- Never happens because the parser does not produce EpaDelta. + panic "token_location_widenR: EpaDelta" + + ----------------------------------------------------------------------------- -- Token symbols diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr index 8054c405c8..0fcb9122ed 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr @@ -117,13 +117,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544.hs:6:11-12 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544.hs:6:11-12 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:6:9 }) @@ -251,13 +246,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544.hs:10:11-12 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544.hs:10:11-12 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:10:9 }) @@ -381,13 +371,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544.hs:14:11-12 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544.hs:14:11-12 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:14:9 }) @@ -514,13 +499,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544.hs:18:11-12 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544.hs:18:11-12 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:18:9 }) @@ -587,13 +567,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544.hs:20:11-12 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544.hs:20:11-12 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { T17544.hs:20:9 }) 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 6831df7140..d294430cd4 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr @@ -167,13 +167,8 @@ [(HsScaled (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T17544_kw.hs:19:21-22 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T17544_kw.hs:19:21-22 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnn diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr index faf63b8a90..d68daf6738 100644 --- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr @@ -146,10 +146,10 @@ (HsLinearArrow (HsPct1 (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsNormalTok)))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpParsedAst.hs:8:26-30 }) @@ -556,10 +556,10 @@ (HsLinearArrow (HsPct1 (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsNormalTok)))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpParsedAst.hs:15:25-29 }) @@ -846,13 +846,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpParsedAst.hs:17:33-34 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpParsedAst.hs:17:33-34 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpParsedAst.hs:17:31 }) diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr index 66ff512a53..84519126fc 100644 --- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr @@ -151,10 +151,10 @@ (HsLinearArrow (HsPct1 (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsNormalTok)))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:10:26-30 }) @@ -386,13 +386,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:16:22-23 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:16:22-23 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:16:20 }) @@ -414,13 +409,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:16:27-28 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:16:27-28 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:16:25 }) @@ -496,13 +486,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:19:30-31 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:19:30-31 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:19:28 }) @@ -539,13 +524,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:19:54-55 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:19:54-55 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:19:42-52 }) @@ -563,13 +543,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:19:45-46 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:19:45-46 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:19:43 }) @@ -612,13 +587,8 @@ [(HsScaled (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:20:36-37 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:20:36-37 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnn @@ -663,13 +633,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:20:27-28 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:20:27-28 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:20:22-25 }) @@ -828,10 +793,10 @@ (HsLinearArrow (HsPct1 (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsNormalTok)))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:22:25-29 }) @@ -1020,13 +985,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { DumpRenamedAst.hs:24:33-34 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { DumpRenamedAst.hs:24:33-34 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { DumpRenamedAst.hs:24:31 }) diff --git a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr index addb3d0ff2..55c10d4729 100644 --- a/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr +++ b/testsuite/tests/parser/should_compile/DumpTypecheckedAst.stderr @@ -108,7 +108,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -141,7 +141,7 @@ (NoSourceText) "T"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -268,7 +268,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -301,7 +301,7 @@ (NoSourceText) "'MkT"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -428,7 +428,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -461,7 +461,7 @@ (NoSourceText) "Peano"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -588,7 +588,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -621,7 +621,7 @@ (NoSourceText) "'Zero"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -748,7 +748,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -781,7 +781,7 @@ (NoSourceText) "'Succ"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1190,7 +1190,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1238,7 +1238,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1286,7 +1286,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1344,13 +1344,13 @@ [] [])))))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))))) ,(L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1442,7 +1442,7 @@ (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1475,14 +1475,14 @@ (NoSourceText) "main"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) (HsPar (EpAnnNotUsed) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L (SrcSpanAnn (EpAnnNotUsed) { <no location info> }) @@ -1515,7 +1515,7 @@ (NoSourceText) "DumpTypecheckedAst"))))) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)))))))) ,(L (SrcSpanAnn (EpAnnNotUsed) { DumpTypecheckedAst.hs:19:1-23 }) diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr index 66d76ca683..a8914e9c78 100644 --- a/testsuite/tests/parser/should_compile/KindSigs.stderr +++ b/testsuite/tests/parser/should_compile/KindSigs.stderr @@ -684,13 +684,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { KindSigs.hs:22:22-23 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { KindSigs.hs:22:22-23 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:22:8-20 }) @@ -757,13 +752,8 @@ [])) (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { KindSigs.hs:22:30-31 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { KindSigs.hs:22:30-31 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnnNotUsed) { KindSigs.hs:22:25-28 }) diff --git a/testsuite/tests/parser/should_compile/T14189.stderr b/testsuite/tests/parser/should_compile/T14189.stderr index ecfcae56c8..c845817586 100644 --- a/testsuite/tests/parser/should_compile/T14189.stderr +++ b/testsuite/tests/parser/should_compile/T14189.stderr @@ -63,10 +63,10 @@ (HsLinearArrow (HsPct1 (L - (EpAnnNotUsed) + (NoTokenLoc) (HsTok)) (L - (EpAnnNotUsed) + (NoTokenLoc) (HsNormalTok)))) (L (SrcSpanAnn (EpAnnNotUsed) { T14189.hs:6:18-20 }) diff --git a/testsuite/tests/printer/T18791.stderr b/testsuite/tests/printer/T18791.stderr index abde8320b1..90b3db958d 100644 --- a/testsuite/tests/printer/T18791.stderr +++ b/testsuite/tests/printer/T18791.stderr @@ -91,13 +91,8 @@ [(HsScaled (HsUnrestrictedArrow (L - (EpAnn - (Anchor - { T18791.hs:5:14-15 } - (UnchangedAnchor)) - (NoEpAnns) - (EpaComments - [])) + (TokenLoc + (EpaSpan { T18791.hs:5:14-15 })) (HsNormalTok))) (L (SrcSpanAnn (EpAnn diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs index 16631d0bd2..583adc682f 100644 --- a/utils/check-exact/ExactPrint.hs +++ b/utils/check-exact/ExactPrint.hs @@ -627,11 +627,8 @@ markKwA :: AnnKeywordId -> EpaLocation -> EPP () markKwA kw aa = printStringAtAA aa (keywordToString (G kw)) markToken :: forall tok. KnownSymbol tok => LHsToken tok GhcPs -> EPP () -markToken (L EpAnnNotUsed _) = return () -markToken (L (EpAnn (Anchor a a_op) _ _) _) = printStringAtAA aa (symbolVal (Proxy @tok)) - where aa = case a_op of - UnchangedAnchor -> EpaSpan a - MovedAnchor dp -> EpaDelta dp +markToken (L NoTokenLoc _) = return () +markToken (L (TokenLoc aa) _) = printStringAtAA aa (symbolVal (Proxy @tok)) markUniToken :: forall tok utok. (KnownSymbol tok, KnownSymbol utok) => LHsUniToken tok utok GhcPs -> EPP () markUniToken (L l HsNormalTok) = markToken (L l (HsTok @tok)) |