summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs/Expr.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-01-18 15:38:09 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-29 23:09:58 -0500
commit3b8235334b7838013c9e955db3e7762a1c7fef43 (patch)
treebb601c302ad43b60552bdc775b4ccb592d357e71 /compiler/GHC/Hs/Expr.hs
parent5140841ca1acaeaeef893233ae3d08ce4573b01b (diff)
downloadhaskell-3b8235334b7838013c9e955db3e7762a1c7fef43.tar.gz
Make PatSyn immutable
Provoked by #19074, this patch makes GHC.Core.PatSyn.PatSyn immutable, by recording only the *Name* of the matcher and builder rather than (as currently) the *Id*. See Note [Keep Ids out of PatSyn] in GHC.Core.PatSyn. Updates haddock submodule.
Diffstat (limited to 'compiler/GHC/Hs/Expr.hs')
-rw-r--r--compiler/GHC/Hs/Expr.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs
index ac3a58a592..489c172e23 100644
--- a/compiler/GHC/Hs/Expr.hs
+++ b/compiler/GHC/Hs/Expr.hs
@@ -159,12 +159,6 @@ instance Outputable SyntaxExprTc where
ppr NoSyntaxExprTc = text "<no syntax expr>"
--- | Extra data fields for a 'RecordCon', added by the type checker
-data RecordConTc = RecordConTc
- { rcon_con_like :: ConLike -- The data constructor or pattern synonym
- , rcon_con_expr :: PostTcExpr -- Instantiated constructor function
- }
-
-- | Extra data fields for a 'RecordUpd', added by the type checker
data RecordUpdTc = RecordUpdTc
{ rupd_cons :: [ConLike]
@@ -254,7 +248,7 @@ type instance XExplicitList GhcTc = Type
type instance XRecordCon GhcPs = NoExtField
type instance XRecordCon GhcRn = NoExtField
-type instance XRecordCon GhcTc = RecordConTc
+type instance XRecordCon GhcTc = PostTcExpr -- Instantiated constructor function
type instance XRecordUpd GhcPs = NoExtField
type instance XRecordUpd GhcRn = NoExtField
@@ -474,8 +468,15 @@ ppr_expr (HsDo _ do_or_list_comp (L _ stmts)) = pprDo do_or_list_comp stmts
ppr_expr (ExplicitList _ _ exprs)
= brackets (pprDeeperList fsep (punctuate comma (map ppr_lexpr exprs)))
-ppr_expr (RecordCon { rcon_con_name = con_id, rcon_flds = rbinds })
- = hang (ppr con_id) 2 (ppr rbinds)
+ppr_expr (RecordCon { rcon_con = con, rcon_flds = rbinds })
+ = hang pp_con 2 (ppr rbinds)
+ where
+ -- con :: ConLikeP (GhcPass p)
+ -- so we need case analysis to know to print it
+ pp_con = case ghcPass @p of
+ GhcPs -> ppr con
+ GhcRn -> ppr con
+ GhcTc -> ppr con
ppr_expr (RecordUpd { rupd_expr = L _ aexp, rupd_flds = rbinds })
= hang (ppr aexp) 2 (braces (fsep (punctuate comma (map ppr rbinds))))