summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-19 15:32:20 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-03-19 15:35:26 +0000
commit0a34a1f3aa67f428f1770d6e96eea53ec9a198cb (patch)
tree698e7027af97f1dadaf6e05d35ec75cadddcb5eb
parent559e3d3c2a93ef32e910b845187131627554aab4 (diff)
downloadhaskell-wip/ttg-rec-improvements.tar.gz
WIP WIP WIP: Split record "field vs projection" updateswip/ttg-rec-improvements
TTG avoid panicking
-rw-r--r--compiler/GHC/Hs/Expr.hs10
-rw-r--r--compiler/GHC/HsToCore/Expr.hs9
-rw-r--r--compiler/Language/Haskell/Syntax/Expr.hs13
3 files changed, 20 insertions, 12 deletions
diff --git a/compiler/GHC/Hs/Expr.hs b/compiler/GHC/Hs/Expr.hs
index cb8eb6d935..863c68e956 100644
--- a/compiler/GHC/Hs/Expr.hs
+++ b/compiler/GHC/Hs/Expr.hs
@@ -424,9 +424,13 @@ type instance XRecordCon GhcPs = EpAnn [AddEpAnn]
type instance XRecordCon GhcRn = NoExtField
type instance XRecordCon GhcTc = PostTcExpr -- Instantiated constructor function
-type instance XRecordUpd GhcPs = EpAnn [AddEpAnn]
-type instance XRecordUpd GhcRn = NoExtField
-type instance XRecordUpd GhcTc = RecordUpdTc
+type instance XRecordUpdField GhcPs = EpAnn [AddEpAnn]
+type instance XRecordUpdField GhcRn = NoExtField
+type instance XRecordUpdField GhcTc = RecordUpdTc
+
+type instance XRecordUpdProj GhcPs = EpAnn [AddEpAnn]
+type instance XRecordUpdProj GhcRn = NoExtField
+type instance XRecordUpdProj GhcTc = DataConCantHappen
type instance XGetField GhcPs = EpAnnCO
type instance XGetField GhcRn = NoExtField
diff --git a/compiler/GHC/HsToCore/Expr.hs b/compiler/GHC/HsToCore/Expr.hs
index c9e25c4582..7664420274 100644
--- a/compiler/GHC/HsToCore/Expr.hs
+++ b/compiler/GHC/HsToCore/Expr.hs
@@ -580,12 +580,9 @@ we want, namely
-}
-dsExpr RecordUpd { rupd_flds = Right _} =
- -- Not possible due to elimination in the renamer. See Note
- -- [Handling overloaded and rebindable constructs]
- panic "The impossible happened"
-dsExpr expr@(RecordUpd { rupd_expr = record_expr, rupd_flds = Left fields
- , rupd_ext = RecordUpdTc
+dsExpr expr@(RecordUpdField { rupd_ext = e } = dataConCantHappen e
+dsExpr expr@(RecordUpdProj { rupd_expr = record_expr, rupd_flds = fields
+ , rupd_ext = RecordUpdTc
{ rupd_cons = cons_to_upd
, rupd_in_tys = in_inst_tys
, rupd_out_tys = out_inst_tys
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs
index 748ea4ebed..878499a1a1 100644
--- a/compiler/Language/Haskell/Syntax/Expr.hs
+++ b/compiler/Language/Haskell/Syntax/Expr.hs
@@ -486,11 +486,18 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose' @'}'@
-- For details on above see Note [exact print annotations] in GHC.Parser.Annotation
- | RecordUpd
- { rupd_ext :: XRecordUpd p
+ | RecordUpdField
+ { rupd_ext :: XRecordUpdField p
, rupd_expr :: LHsExpr p
- , rupd_flds :: Either [LHsRecUpdField p] [LHsRecUpdProj p]
+ , rupd_flds :: [LHsRecUpdField p]
}
+
+ | RecordUpdProj
+ { rupd_ext :: XRecordUpdProj p
+ , rupd_expr :: LHsExpr p
+ , rupd_flds :: [LHsRecUpdProj p]
+ }
+
-- For a type family, the arg types are of the *instance* tycon,
-- not the family tycon