diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2021-10-11 23:05:08 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-14 14:34:07 -0400 |
commit | 8b7f5424c67b5ec005e061db87d30e124cf7234d (patch) | |
tree | 49b7c66079e415d6151d7edd2c180169a26e991a /compiler/GHC/Parser/Lexer.x | |
parent | f450e9481eafa3a00c648c81154a9a8be2da7650 (diff) | |
download | haskell-8b7f5424c67b5ec005e061db87d30e124cf7234d.tar.gz |
EPA: Preserve semicolon order in annotations
Ensure the AddSemiAnn items appear in increasing order, so that if
they are converted to delta format they are still in the correct
order.
Prior to this the exact printer sorted by Span, which is meaningless
for EpaDelta locations.
Diffstat (limited to 'compiler/GHC/Parser/Lexer.x')
-rw-r--r-- | compiler/GHC/Parser/Lexer.x | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/Parser/Lexer.x b/compiler/GHC/Parser/Lexer.x index 10568814d7..d74d17be8f 100644 --- a/compiler/GHC/Parser/Lexer.x +++ b/compiler/GHC/Parser/Lexer.x @@ -3490,12 +3490,11 @@ clean_pragma prag = canon_ws (map toLower (unprefix prag)) -} --- |Given a 'SrcSpan' that surrounds a 'HsPar' or 'HsParTy', generate +-- |Given a 'RealSrcSpan' that surrounds a 'HsPar' or 'HsParTy', generate -- 'AddEpAnn' values for the opening and closing bordering on the start -- and end of the span -mkParensEpAnn :: SrcSpan -> [AddEpAnn] -mkParensEpAnn (UnhelpfulSpan _) = [] -mkParensEpAnn (RealSrcSpan ss _) = [AddEpAnn AnnOpenP (EpaSpan lo),AddEpAnn AnnCloseP (EpaSpan lc)] +mkParensEpAnn :: RealSrcSpan -> (AddEpAnn, AddEpAnn) +mkParensEpAnn ss = (AddEpAnn AnnOpenP (EpaSpan lo),AddEpAnn AnnCloseP (EpaSpan lc)) where f = srcSpanFile ss sl = srcSpanStartLine ss |