[commit: ghc] master: Fix handling of closed type families in Backpack. (f59aad6)
git at git.haskell.org
git at git.haskell.org
Wed Jan 11 14:54:42 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f59aad6823359caf8d43730c9bc1a8b7e98719b6/ghc
>---------------------------------------------------------------
commit f59aad6823359caf8d43730c9bc1a8b7e98719b6
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date: Thu Jan 5 20:33:02 2017 -0800
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 at cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, simonpj, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2928
>---------------------------------------------------------------
f59aad6823359caf8d43730c9bc1a8b7e98719b6
compiler/backpack/RnModIface.hs | 4 +-
compiler/iface/TcIface.hs | 86 ++++++++++++++--------
compiler/typecheck/TcBackpack.hs | 34 +++++----
compiler/typecheck/TcRnDriver.hs | 9 ++-
compiler/typecheck/TcRnMonad.hs | 5 ++
compiler/typecheck/TcRnTypes.hs | 7 ++
compiler/types/TyCon.hs | 8 ++
testsuite/tests/backpack/should_compile/all.T | 2 +
testsuite/tests/backpack/should_compile/bkp48.bkp | 23 ++++++
.../tests/backpack/should_compile/bkp48.stderr | 22 ++++++
.../bkpfail33.bkp => should_compile/bkp49.bkp} | 4 +-
.../bkp49.stderr} | 3 -
testsuite/tests/backpack/should_fail/all.T | 1 +
testsuite/tests/backpack/should_fail/bkpfail42.bkp | 10 +++
.../tests/backpack/should_fail/bkpfail42.stderr | 12 +++
15 files changed, 177 insertions(+), 53 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f59aad6823359caf8d43730c9bc1a8b7e98719b6
More information about the ghc-commits
mailing list