diff options
author | Alan Zimmerman <alan.zimm@gmail.com> | 2022-03-07 22:23:29 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-28 19:23:28 -0400 |
commit | 8229885cb6a9f78ab09468f3797e3ec48ea24f82 (patch) | |
tree | 568e100868454269d5e6a382d3503bd40a9ba548 /compiler/GHC/Parser/Annotation.hs | |
parent | 89cb13153dbe9a88706c43dbf0f681e90ecaa599 (diff) | |
download | haskell-8229885cb6a9f78ab09468f3797e3ec48ea24f82.tar.gz |
EPA: let stmt with semicolon has wrong anchor
The code
let ;x =1
Captures the semicolon annotation, but did not widen the anchor in the
ValBinds.
Fix that.
Closes #20247
Diffstat (limited to 'compiler/GHC/Parser/Annotation.hs')
-rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index dd0cdd3123..b5effa0797 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -43,7 +43,8 @@ module GHC.Parser.Annotation ( AnnSortKey(..), -- ** Trailing annotations in lists - TrailingAnn(..), addTrailingAnnToA, addTrailingAnnToL, addTrailingCommaToN, + TrailingAnn(..), trailingAnnToAddEpAnn, + addTrailingAnnToA, addTrailingAnnToL, addTrailingCommaToN, -- ** Utilities for converting between different 'GenLocated' when -- ** we do not care about the annotations. @@ -801,6 +802,11 @@ data AnnSortKey -- --------------------------------------------------------------------- +-- | Convert a 'TrailingAnn' to an 'AddEpAnn' +trailingAnnToAddEpAnn :: TrailingAnn -> AddEpAnn +trailingAnnToAddEpAnn (AddSemiAnn ss) = AddEpAnn AnnSemi ss +trailingAnnToAddEpAnn (AddCommaAnn ss) = AddEpAnn AnnComma ss +trailingAnnToAddEpAnn (AddVbarAnn ss) = AddEpAnn AnnVbar ss -- | Helper function used in the parser to add a 'TrailingAnn' items -- to an existing annotation. |