[commit: ghc] master: Fix the treatment of 'closed' definitions (dc8e686)

git at git.haskell.org git at git.haskell.org
Fri Jun 16 21:20:44 UTC 2017


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

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

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

commit dc8e6861dc5586a8222484afc3bd26c432e2d69c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jun 16 22:16:14 2017 +0100

    Fix the treatment of 'closed' definitions
    
    The IdBindingInfo field of ATcId serves two purposes
    
    - to control generalisation when we have -XMonoLocalBinds
    - to check for floatability when dealing with (static e)
    
    These are related, but not the same, and they'd becomme confused.
    Trac #13804 showed this up via an example like this:
    
      f periph = let sr :: forall a. [a] -> [a]
                     sr = if periph then reverse else id
    
                     sr2 = sr
                     -- The question: is sr2 generalised?
                     -- It should be, because sr has a type sig
                     -- even though it has periph free
                 in
                 (sr2 [True], sr2 "c")
    
    Here sr2 should be generalised, despite the free var 'periph'
    in 'sr' because 'sr' has a closed type signature.
    
    I documented all this very carefully this time, in TcRnTypes:
      Note [Meaning of IdBindingInfo]
      Note [Bindings with closed types: ClosedTypeId]


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

dc8e6861dc5586a8222484afc3bd26c432e2d69c
 compiler/main/StaticPtrTable.hs                    |  12 +-
 compiler/typecheck/TcBinds.hs                      |  87 ++++----
 compiler/typecheck/TcEnv.hs                        |  88 ++++----
 compiler/typecheck/TcRnTypes.hs                    | 231 +++++++++++++--------
 compiler/typecheck/TcSigs.hs                       |   9 +-
 testsuite/tests/typecheck/should_compile/T13804.hs |  13 ++
 testsuite/tests/typecheck/should_compile/all.T     |   1 +
 7 files changed, 263 insertions(+), 178 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 dc8e6861dc5586a8222484afc3bd26c432e2d69c


More information about the ghc-commits mailing list