[commit: ghc] ghc-8.2: Fix the treatment of 'closed' definitions (15af715)
git at git.haskell.org
git at git.haskell.org
Fri Jun 16 22:41:13 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.2
Link : http://ghc.haskell.org/trac/ghc/changeset/15af7156087dec6b1031406bcbe4508b71cc3470/ghc
>---------------------------------------------------------------
commit 15af7156087dec6b1031406bcbe4508b71cc3470
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]
(cherry picked from commit dc8e6861dc5586a8222484afc3bd26c432e2d69c)
>---------------------------------------------------------------
15af7156087dec6b1031406bcbe4508b71cc3470
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 15af7156087dec6b1031406bcbe4508b71cc3470
More information about the ghc-commits
mailing list