[commit: ghc] master: Fix scoping of type variables in instances (0050aff)

git at git.haskell.org git at git.haskell.org
Fri Aug 26 16:36:09 UTC 2016


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

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

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

commit 0050aff22ba04baca732bf5124002417ab667f8a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Aug 26 17:32:42 2016 +0100

    Fix scoping of type variables in instances
    
    This fixes Trac #12531:
    
       class Foo x where
         foo :: forall a . x a -> x a
         default foo :: forall b . x b -> x b
         foo x = go
           where go :: x b
                 go = undefined
    
    We want 'b' to scope over the code for 'foo', but we were
    using 'a' instead.


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

0050aff22ba04baca732bf5124002417ab667f8a
 compiler/hsSyn/HsUtils.hs                       | 29 +++++++++++++++++++-
 compiler/rename/RnBinds.hs                      | 31 ++++++++++-----------
 compiler/typecheck/TcClassDcl.hs                | 36 +++++++++++++++----------
 compiler/typecheck/TcInstDcls.hs                |  6 ++---
 testsuite/tests/rename/should_compile/T12533.hs | 10 +++++++
 testsuite/tests/rename/should_compile/all.T     |  1 +
 6 files changed, 78 insertions(+), 35 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 0050aff22ba04baca732bf5124002417ab667f8a


More information about the ghc-commits mailing list