From c738b1231bc63a45be87d49cc42b7644681e509d Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Sun, 20 Sep 2015 12:18:21 +0200 Subject: [PATCH] Replace [PostTc id Type] with PostTc id [Type] This gives a clearer indication as to what gets filled in when. It was suggested by Richard on D1152. Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1245 --- compiler/hsSyn/Convert.hs | 4 +++- compiler/hsSyn/HsExpr.hs | 11 ++++++----- compiler/hsSyn/PlaceHolder.hs | 3 +++ compiler/parser/RdrHsSyn.hs | 3 ++- compiler/rename/RnExpr.hs | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index 9466ab0577..0d4eaea1ab 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -712,7 +712,9 @@ cvtl e = wrapL (cvt e) ; return $ RecordCon c' noPostTcExpr (HsRecFields flds' Nothing)} cvt (RecUpdE e flds) = do { e' <- cvtl e ; flds' <- mapM cvtFld flds - ; return $ RecordUpd e' (HsRecFields flds' Nothing) [] [] [] } + ; return $ RecordUpd e' + (HsRecFields flds' Nothing) + PlaceHolder PlaceHolder PlaceHolder } cvt (StaticE e) = fmap HsStatic $ cvtl e {- Note [Dropping constructors] diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index a3c1f6ce5b..63fea7a1a2 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -293,11 +293,12 @@ data HsExpr id (HsRecordBinds id) -- (HsMatchGroup Id) -- Filled in by the type checker to be -- -- a match that does the job - [DataCon] -- Filled in by the type checker to the - -- _non-empty_ list of DataCons that have - -- all the upd'd fields - [PostTc id Type] -- Argument types of *input* record type - [PostTc id Type] -- and *output* record type + (PostTc id [DataCon]) + -- Filled in by the type checker to the + -- _non-empty_ list of DataCons that have + -- all the upd'd fields + (PostTc id [Type]) -- Argument types of *input* record type + (PostTc id [Type]) -- and *output* record type -- For a type family, the arg types are of the *instance* tycon, -- not the family tycon diff --git a/compiler/hsSyn/PlaceHolder.hs b/compiler/hsSyn/PlaceHolder.hs index 91d37eaab3..19f2bd4489 100644 --- a/compiler/hsSyn/PlaceHolder.hs +++ b/compiler/hsSyn/PlaceHolder.hs @@ -12,6 +12,7 @@ import NameSet import RdrName import Var import Coercion +import DataCon (DataCon) import Data.Data hiding ( Fixity ) import BasicTypes (Fixity) @@ -102,4 +103,6 @@ type DataId id = , Data (PostTc id Type) , Data (PostTc id Coercion) + , Data (PostTc id [Type]) + , Data (PostTc id [DataCon]) ) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index beb3b3bffa..a83f6b36da 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1178,7 +1178,8 @@ mkRecConstrOrUpdate (L l (HsVar c)) _ (fs,dd) | isRdrDataCon c = return (RecordCon (L l c) noPostTcExpr (mk_rec_fields fs dd)) mkRecConstrOrUpdate exp _ (fs,dd) - = return (RecordUpd exp (mk_rec_fields fs dd) [] [] []) + = return (RecordUpd exp (mk_rec_fields fs dd) + PlaceHolder PlaceHolder PlaceHolder) mk_rec_fields :: [LHsRecField id arg] -> Bool -> HsRecFields id arg mk_rec_fields fs False = HsRecFields { rec_flds = fs, rec_dotdot = Nothing } diff --git a/compiler/rename/RnExpr.hs b/compiler/rename/RnExpr.hs index aaac8f10de..d4b5e7288d 100644 --- a/compiler/rename/RnExpr.hs +++ b/compiler/rename/RnExpr.hs @@ -258,7 +258,7 @@ rnExpr (RecordCon con_id _ rbinds) rnExpr (RecordUpd expr rbinds _ _ _) = do { (expr', fvExpr) <- rnLExpr expr ; (rbinds', fvRbinds) <- rnHsRecBinds HsRecFieldUpd rbinds - ; return (RecordUpd expr' rbinds' [] [] [], + ; return (RecordUpd expr' rbinds' PlaceHolder PlaceHolder PlaceHolder, fvExpr `plusFV` fvRbinds) } rnExpr (ExprWithTySig expr pty PlaceHolder) -- GitLab