Commit c738b123 authored by Matthew Pickering's avatar Matthew Pickering Committed by Ben Gamari

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
parent b89c4913
...@@ -712,7 +712,9 @@ cvtl e = wrapL (cvt e) ...@@ -712,7 +712,9 @@ cvtl e = wrapL (cvt e)
; return $ RecordCon c' noPostTcExpr (HsRecFields flds' Nothing)} ; return $ RecordCon c' noPostTcExpr (HsRecFields flds' Nothing)}
cvt (RecUpdE e flds) = do { e' <- cvtl e cvt (RecUpdE e flds) = do { e' <- cvtl e
; flds' <- mapM cvtFld flds ; 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 cvt (StaticE e) = fmap HsStatic $ cvtl e
{- Note [Dropping constructors] {- Note [Dropping constructors]
......
...@@ -293,11 +293,12 @@ data HsExpr id ...@@ -293,11 +293,12 @@ data HsExpr id
(HsRecordBinds id) (HsRecordBinds id)
-- (HsMatchGroup Id) -- Filled in by the type checker to be -- (HsMatchGroup Id) -- Filled in by the type checker to be
-- -- a match that does the job -- -- a match that does the job
[DataCon] -- Filled in by the type checker to the (PostTc id [DataCon])
-- _non-empty_ list of DataCons that have -- Filled in by the type checker to the
-- all the upd'd fields -- _non-empty_ list of DataCons that have
[PostTc id Type] -- Argument types of *input* record type -- all the upd'd fields
[PostTc id Type] -- and *output* record type (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, -- For a type family, the arg types are of the *instance* tycon,
-- not the family tycon -- not the family tycon
......
...@@ -12,6 +12,7 @@ import NameSet ...@@ -12,6 +12,7 @@ import NameSet
import RdrName import RdrName
import Var import Var
import Coercion import Coercion
import DataCon (DataCon)
import Data.Data hiding ( Fixity ) import Data.Data hiding ( Fixity )
import BasicTypes (Fixity) import BasicTypes (Fixity)
...@@ -102,4 +103,6 @@ type DataId id = ...@@ -102,4 +103,6 @@ type DataId id =
, Data (PostTc id Type) , Data (PostTc id Type)
, Data (PostTc id Coercion) , Data (PostTc id Coercion)
, Data (PostTc id [Type])
, Data (PostTc id [DataCon])
) )
...@@ -1178,7 +1178,8 @@ mkRecConstrOrUpdate (L l (HsVar c)) _ (fs,dd) ...@@ -1178,7 +1178,8 @@ mkRecConstrOrUpdate (L l (HsVar c)) _ (fs,dd)
| isRdrDataCon c | isRdrDataCon c
= return (RecordCon (L l c) noPostTcExpr (mk_rec_fields fs dd)) = return (RecordCon (L l c) noPostTcExpr (mk_rec_fields fs dd))
mkRecConstrOrUpdate exp _ (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 :: [LHsRecField id arg] -> Bool -> HsRecFields id arg
mk_rec_fields fs False = HsRecFields { rec_flds = fs, rec_dotdot = Nothing } mk_rec_fields fs False = HsRecFields { rec_flds = fs, rec_dotdot = Nothing }
......
...@@ -258,7 +258,7 @@ rnExpr (RecordCon con_id _ rbinds) ...@@ -258,7 +258,7 @@ rnExpr (RecordCon con_id _ rbinds)
rnExpr (RecordUpd expr rbinds _ _ _) rnExpr (RecordUpd expr rbinds _ _ _)
= do { (expr', fvExpr) <- rnLExpr expr = do { (expr', fvExpr) <- rnLExpr expr
; (rbinds', fvRbinds) <- rnHsRecBinds HsRecFieldUpd rbinds ; (rbinds', fvRbinds) <- rnHsRecBinds HsRecFieldUpd rbinds
; return (RecordUpd expr' rbinds' [] [] [], ; return (RecordUpd expr' rbinds' PlaceHolder PlaceHolder PlaceHolder,
fvExpr `plusFV` fvRbinds) } fvExpr `plusFV` fvRbinds) }
rnExpr (ExprWithTySig expr pty PlaceHolder) rnExpr (ExprWithTySig expr pty PlaceHolder)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment