diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-02-22 20:32:41 -0800 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-02-24 14:52:42 -0800 |
commit | 9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf (patch) | |
tree | 2e4f4f91b9f13c335896ca1dae6a29acd57bd0c7 /compiler/backpack | |
parent | 93ffcb028630df97bda82f16a103e3c8ffdaba35 (diff) | |
download | haskell-9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf.tar.gz |
Record full FieldLabel in ifConFields.
Summary:
The previous implementation tried to be "efficient" by
storing field names once in IfaceConDecls, and only just
enough information for us to reconstruct the FieldLabel.
But this came at a bit of code complexity cost.
This patch undos the optimization, instead storing a full
FieldLabel at each data constructor. Consequently, this fixes
bugs #12699 and #13250.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: adamgundry, bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3174
Diffstat (limited to 'compiler/backpack')
-rw-r--r-- | compiler/backpack/RnModIface.hs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/compiler/backpack/RnModIface.hs b/compiler/backpack/RnModIface.hs index 1b11a0f900..d4af5cc4ab 100644 --- a/compiler/backpack/RnModIface.hs +++ b/compiler/backpack/RnModIface.hs @@ -509,11 +509,9 @@ rnIfaceTyConParent (IfDataInstance n tc args) rnIfaceTyConParent IfNoParent = pure IfNoParent rnIfaceConDecls :: Rename IfaceConDecls -rnIfaceConDecls (IfDataTyCon ds b fs) +rnIfaceConDecls (IfDataTyCon ds) = IfDataTyCon <$> mapM rnIfaceConDecl ds - <*> return b - <*> return fs -rnIfaceConDecls (IfNewTyCon d b fs) = IfNewTyCon <$> rnIfaceConDecl d <*> return b <*> return fs +rnIfaceConDecls (IfNewTyCon d) = IfNewTyCon <$> rnIfaceConDecl d rnIfaceConDecls (IfAbstractTyCon b) = pure (IfAbstractTyCon b) rnIfaceConDecl :: Rename IfaceConDecl @@ -524,10 +522,7 @@ rnIfaceConDecl d = do con_eq_spec <- mapM rnIfConEqSpec (ifConEqSpec d) con_ctxt <- mapM rnIfaceType (ifConCtxt d) con_arg_tys <- mapM rnIfaceType (ifConArgTys d) - -- TODO: It seems like we really should rename the field labels, but this - -- breaks due to tcIfaceDataCons projecting back to the field's OccName and - -- then looking up it up in the name cache. See #12699. - --con_fields <- mapM rnIfaceGlobal (ifConFields d) + con_fields <- mapM rnFieldLabel (ifConFields d) let rnIfaceBang (IfUnpackCo co) = IfUnpackCo <$> rnIfaceCo co rnIfaceBang bang = pure bang con_stricts <- mapM rnIfaceBang (ifConStricts d) @@ -536,7 +531,7 @@ rnIfaceConDecl d = do , ifConEqSpec = con_eq_spec , ifConCtxt = con_ctxt , ifConArgTys = con_arg_tys - --, ifConFields = con_fields -- See TODO above + , ifConFields = con_fields , ifConStricts = con_stricts } |