summaryrefslogtreecommitdiff
path: root/utils/check-exact
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2022-01-11 10:42:17 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-11 19:42:07 -0500
commit34d8bc24e33aa373acb6fdeef51427d968f28c0c (patch)
tree4eb89724f1b4e9e24ac3dc315497a5071ef463ef /utils/check-exact
parentaddf8e544841a3f7c818331e47fa89a2cbfb7b29 (diff)
downloadhaskell-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 'utils/check-exact')
-rw-r--r--utils/check-exact/ExactPrint.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils/check-exact/ExactPrint.hs b/utils/check-exact/ExactPrint.hs
index 8e9d84067f..967ae61035 100644
--- a/utils/check-exact/ExactPrint.hs
+++ b/utils/check-exact/ExactPrint.hs
@@ -3100,6 +3100,12 @@ instance ExactPrint (LocatedN RdrName) where
forM_ cs (\loc -> markKw (AddEpAnn AnnComma loc))
markKw (AddEpAnn kwc c)
markTrailing t
+ NameAnnBars a o bs c t -> do
+ let (kwo,kwc) = adornments a
+ markKw (AddEpAnn kwo o)
+ forM_ bs (\loc -> markKw (AddEpAnn AnnVbar loc))
+ markKw (AddEpAnn kwc c)
+ markTrailing t
NameAnnOnly a o c t -> do
markName a o Nothing c
markTrailing t