[commit: ghc] wip/rwbarton-D2992: Check local type family instances against all imported ones (28da0a9)
git at git.haskell.org
git at git.haskell.org
Fri Feb 10 15:45:06 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/rwbarton-D2992
Link : http://ghc.haskell.org/trac/ghc/changeset/28da0a94ea7640a94565500ee66093816f2cfe7f/ghc
>---------------------------------------------------------------
commit 28da0a94ea7640a94565500ee66093816f2cfe7f
Author: Reid Barton <rwbarton at gmail.com>
Date: Wed Feb 8 17:55:31 2017 -0500
Check local type family instances against all imported ones
Summary:
We previously checked type family instance declarations
in a module for consistency with all instances that we happened
to have read into the EPS or HPT. It was possible to arrange that
an imported type family instance (used by an imported function)
was in a module whose interface file was never read during
compilation; then we wouldn't check consistency of local instances
with this imported instance and as a result type safety was lost.
With this patch, we still check consistency of local type family
instances with all type family instances that we have loaded; but
we make sure to load the interface files of all our imports that
define family instances first. More selective consistency checking
is left to #13102.
On the other hand, we can now safely assume when we import a module
that it has been checked for consistency with its imports. So we
can save checking in checkFamInstConsistency, and overall we should
have less work to do now.
This patch also adds a note describing the Plan for ensuring type
family consistency.
Test Plan: Two new tests added; harbormaster
Reviewers: bgamari, austin, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2992
>---------------------------------------------------------------
28da0a94ea7640a94565500ee66093816f2cfe7f
compiler/basicTypes/Name.hs | 12 +-
compiler/main/HscTypes.hs | 7 +-
compiler/typecheck/FamInst.hs | 151 +++++++++++++++++++--
compiler/typecheck/TcRnDriver.hs | 16 ++-
testsuite/tests/ghci/scripts/T4175.stdout | 2 +-
.../indexed-types/should_compile/T13092b/Makefile | 10 ++
.../should_compile/T13092b/T13092b_1.hs | 7 +
.../should_compile/T13092b/T13092b_2.hs | 8 ++
.../indexed-types/should_compile/T13092b/all.T | 5 +
.../tests/indexed-types/should_fail/T13092/A.hs | 3 +
.../tests/indexed-types/should_fail/T13092/B.hs | 5 +
.../tests/indexed-types/should_fail/T13092/C.hs | 6 +
.../tests/indexed-types/should_fail/T13092/Main.hs | 18 +++
.../indexed-types/should_fail/T13092/Makefile | 9 ++
.../indexed-types/should_fail/T13092/T13092.stderr | 5 +
.../tests/indexed-types/should_fail/T13092/all.T | 5 +
.../indexed-types/should_fail/T13092c/Makefile | 12 ++
.../should_fail/T13092c/T13092c.stderr | 5 +
.../indexed-types/should_fail/T13092c/T13092c_1.hs | 6 +
.../indexed-types/should_fail/T13092c/T13092c_2.hs | 8 ++
.../indexed-types/should_fail/T13092c/T13092c_3.hs | 5 +
.../indexed-types/should_fail/T13092c/T13092c_4.hs | 7 +
.../tests/indexed-types/should_fail/T13092c/all.T | 8 ++
23 files changed, 301 insertions(+), 19 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 28da0a94ea7640a94565500ee66093816f2cfe7f
More information about the ghc-commits
mailing list