diff options
| author | sheaf <sam.derbyshire@gmail.com> | 2022-01-11 10:42:17 +0100 |
|---|---|---|
| committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-11 19:42:07 -0500 |
| commit | 34d8bc24e33aa373acb6fdeef51427d968f28c0c (patch) | |
| tree | 4eb89724f1b4e9e24ac3dc315497a5071ef463ef /compiler/GHC/Parser/Annotation.hs | |
| parent | addf8e544841a3f7c818331e47fa89a2cbfb7b29 (diff) | |
| download | haskell-34d8bc24e33aa373acb6fdeef51427d968f28c0c.tar.gz | |
Fix parsing & printing of unboxed sums
The pretty-printing of partially applied unboxed sums was incorrect,
as we incorrectly dropped the first half of the arguments, even
for a partial application such as
(# | #) @IntRep @DoubleRep Int#
which lead to the nonsensical (# DoubleRep | Int# #).
This patch also allows users to write unboxed sum type constructors
such as
(# | #) :: TYPE r1 -> TYPE r2 -> TYPE (SumRep '[r1,r2]).
Fixes #20858 and #20859.
Diffstat (limited to 'compiler/GHC/Parser/Annotation.hs')
| -rw-r--r-- | compiler/GHC/Parser/Annotation.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/GHC/Parser/Annotation.hs b/compiler/GHC/Parser/Annotation.hs index 964278920a..0265cc4ce2 100644 --- a/compiler/GHC/Parser/Annotation.hs +++ b/compiler/GHC/Parser/Annotation.hs @@ -736,6 +736,14 @@ data NameAnn nann_close :: EpaLocation, nann_trailing :: [TrailingAnn] } + -- | Used for @(# | | #)@ + | NameAnnBars { + nann_adornment :: NameAdornment, + nann_open :: EpaLocation, + nann_bars :: [EpaLocation], + nann_close :: EpaLocation, + nann_trailing :: [TrailingAnn] + } -- | Used for @()@, @(##)@, @[]@ | NameAnnOnly { nann_adornment :: NameAdornment, @@ -1274,6 +1282,8 @@ instance Outputable NameAnn where = text "NameAnn" <+> ppr a <+> ppr o <+> ppr n <+> ppr c <+> ppr t ppr (NameAnnCommas a o n c t) = text "NameAnnCommas" <+> ppr a <+> ppr o <+> ppr n <+> ppr c <+> ppr t + ppr (NameAnnBars a o n b t) + = text "NameAnnBars" <+> ppr a <+> ppr o <+> ppr n <+> ppr b <+> ppr t ppr (NameAnnOnly a o c t) = text "NameAnnOnly" <+> ppr a <+> ppr o <+> ppr c <+> ppr t ppr (NameAnnRArrow n t) |
