[commit: ghc] ghc-instvis: Filter instance visibility based on set of visible orphans, fixes #2182. (4c834fd)

git at git.haskell.org git at git.haskell.org
Sun Nov 30 09:37:42 UTC 2014


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

On branch  : ghc-instvis
Link       : http://ghc.haskell.org/trac/ghc/changeset/4c834fdddf4d44d12039da4d6a2c63a660975b95/ghc

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

commit 4c834fdddf4d44d12039da4d6a2c63a660975b95
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Mon Nov 17 21:23:52 2014 -0800

    Filter instance visibility based on set of visible orphans, fixes #2182.
    
    Summary:
    Amazingly, the fix for this very old bug is quite simple: when type-checking,
    maintain a set of "visible orphan modules" based on the orphans list of
    modules which we explicitly imported.  When we import an instance and it
    is an orphan, we check if it is in the visible modules set, and if not,
    ignore it.  A little bit of refactoring for when orphan-hood is calculated
    happens so that we always know if an instance is an orphan or not.
    
    For GHCi, we preinitialize the visible modules set based on the list of
    interactive imports which are active.
    
    Future work: Cache the visible orphan modules set for GHCi, rather than
    recomputing it every type-checking round.  (But it's tricky what to do when you
    /remove/ a module: you need a data structure a little more complicated than
    just a set of modules.)
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>
    
    Test Plan: new tests and validate
    
    Reviewers: simonpj, austin
    
    Subscribers: thomie, carter
    
    Differential Revision: https://phabricator.haskell.org/D488
    
    GHC Trac Issues: #2182


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

4c834fdddf4d44d12039da4d6a2c63a660975b95
 compiler/basicTypes/Module.lhs                     |   7 +-
 compiler/iface/IfaceSyn.lhs                        |   7 +-
 compiler/iface/MkIface.lhs                         |  55 +++------
 compiler/iface/TcIface.lhs                         |   5 +-
 compiler/main/HscTypes.lhs                         |  10 +-
 compiler/typecheck/FunDeps.lhs                     |   4 +-
 compiler/typecheck/Inst.lhs                        |  13 +-
 compiler/typecheck/TcEnv.lhs                       |   8 +-
 compiler/typecheck/TcPluginM.hs                    |   2 +-
 compiler/typecheck/TcRnDriver.lhs                  |  22 +++-
 compiler/typecheck/TcRnMonad.lhs                   |   9 +-
 compiler/typecheck/TcRnTypes.lhs                   |   5 +
 compiler/typecheck/TcSMonad.lhs                    |   2 +-
 compiler/types/InstEnv.lhs                         | 137 ++++++++++++++++++---
 compiler/vectorise/Vectorise/Env.hs                |   9 +-
 compiler/vectorise/Vectorise/Monad.hs              |   7 +-
 testsuite/tests/driver/Makefile                    |   5 +
 testsuite/tests/driver/T2182.hs                    |   6 +
 testsuite/tests/driver/T2182.stderr                |  28 +++++
 testsuite/tests/driver/T2182_A.hs                  |   4 +
 testsuite/tests/driver/all.T                       |   1 +
 .../tests/ghci.debugger/scripts/break006.stderr    |  22 ++--
 .../tests/ghci.debugger/scripts/print019.stderr    |  12 +-
 testsuite/tests/ghci/scripts/T2182ghci.script      |  49 ++++++++
 testsuite/tests/ghci/scripts/T2182ghci.stderr      |  30 +++++
 testsuite/tests/ghci/scripts/T2182ghci.stdout      |  22 ++++
 testsuite/tests/ghci/scripts/T2182ghci2.script     |  15 +++
 testsuite/tests/ghci/scripts/T2182ghci2.stderr     |  10 ++
 testsuite/tests/ghci/scripts/T2182ghci2.stdout     |   4 +
 testsuite/tests/ghci/scripts/T2182ghci_A.hs        |   4 +
 testsuite/tests/ghci/scripts/T2182ghci_B.hs        |   2 +
 testsuite/tests/ghci/scripts/T2182ghci_C.hs        |   2 +
 testsuite/tests/ghci/scripts/all.T                 |   2 +
 testsuite/tests/typecheck/should_fail/T5095.stderr |   7 ++
 34 files changed, 429 insertions(+), 98 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 4c834fdddf4d44d12039da4d6a2c63a660975b95


More information about the ghc-commits mailing list