diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-01-05 20:33:02 -0800 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-01-11 06:54:07 -0800 |
commit | f59aad6823359caf8d43730c9bc1a8b7e98719b6 (patch) | |
tree | a8f57c613792f9af5ea33fec594eb898a994a706 /compiler/backpack | |
parent | 8744869e3cb4a82b88e595c55f1fcc9ea1e6d0b7 (diff) | |
download | haskell-f59aad6823359caf8d43730c9bc1a8b7e98719b6.tar.gz |
Fix handling of closed type families in Backpack.
Summary:
A few related problems:
- CoAxioms, like DFuns, are implicit and never exported,
so we have to make sure we treat them the same way as
DFuns: in RnModIface we need to rename references to
them with rnIfaceImplicit and in mergeSignatures we need
to NOT check them directly for compatibility (the
test on the type family will do this check for us.)
- But actually, we weren't checking if the axioms WERE
consistent. This is because we were forwarding all
embedded CoAxiom references in the type family TyThing
to the merged version, but that reference was what
checkBootDeclM was using as a comparison point.
This is similar to a problem we saw with DFuns.
To fix this, I refactored the handling of implicit entities in TcIface
for Backpack. See Note [The implicit TypeEnv] for the gory details.
Instead of passing the TypeEnv around explicitly, we stuffed it in
IfLclEnv.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, simonpj, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2928
Diffstat (limited to 'compiler/backpack')
-rw-r--r-- | compiler/backpack/RnModIface.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/backpack/RnModIface.hs b/compiler/backpack/RnModIface.hs index ea3eb54b2a..b7d4623bef 100644 --- a/compiler/backpack/RnModIface.hs +++ b/compiler/backpack/RnModIface.hs @@ -466,7 +466,7 @@ rnIfaceDecl d@IfaceClass{} = do , ifSigs = sigs } rnIfaceDecl d@IfaceAxiom{} = do - name <- rnIfaceGlobal (ifName d) + name <- rnIfaceImplicit (ifName d) tycon <- rnIfaceTyCon (ifTyCon d) ax_branches <- mapM rnIfaceAxBranch (ifAxBranches d) return d { ifName = name @@ -497,7 +497,7 @@ rnIfaceDecl d@IfacePatSyn{} = do rnIfaceFamTyConFlav :: Rename IfaceFamTyConFlav rnIfaceFamTyConFlav (IfaceClosedSynFamilyTyCon (Just (n, axs))) - = IfaceClosedSynFamilyTyCon . Just <$> ((,) <$> rnIfaceGlobal n + = IfaceClosedSynFamilyTyCon . Just <$> ((,) <$> rnIfaceImplicit n <*> mapM rnIfaceAxBranch axs) rnIfaceFamTyConFlav flav = pure flav |