[commit: ghc] master: Check local type family instances against all imported ones (bedcb71)

git at git.haskell.org git at git.haskell.org
Tue Feb 14 21:57:59 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/bedcb71659253bb8ab5d449df8e3ee884cc85d46/ghc

>---------------------------------------------------------------

commit bedcb71659253bb8ab5d449df8e3ee884cc85d46
Author: Reid Barton <rwbarton at gmail.com>
Date:   Tue Feb 14 13:13:37 2017 -0500

    Check local type family instances against all imported ones
    
    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: austin, simonpj, bgamari
    
    Reviewed By: simonpj, bgamari
    
    Subscribers: ggreif, thomie
    
    Differential Revision: https://phabricator.haskell.org/D2992


>---------------------------------------------------------------

bedcb71659253bb8ab5d449df8e3ee884cc85d46
 compiler/basicTypes/Name.hs                        |  14 +-
 compiler/main/HscTypes.hs                          |   7 +-
 compiler/typecheck/FamInst.hs                      | 158 +++++++++++++++++++--
 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 ++
 testsuite/tests/perf/compiler/all.T                |   3 +-
 24 files changed, 312 insertions(+), 20 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 bedcb71659253bb8ab5d449df8e3ee884cc85d46


More information about the ghc-commits mailing list