diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-08-26 17:32:42 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-08-26 17:35:38 +0100 |
commit | 0050aff22ba04baca732bf5124002417ab667f8a (patch) | |
tree | 7ba4cacd42cff192820898957e821cd1be070238 /testsuite/tests | |
parent | a60ea709c2b58b77a920823f2d095b1e3c02e2b5 (diff) | |
download | haskell-0050aff22ba04baca732bf5124002417ab667f8a.tar.gz |
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.
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/rename/should_compile/T12533.hs | 10 | ||||
-rw-r--r-- | testsuite/tests/rename/should_compile/all.T | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/testsuite/tests/rename/should_compile/T12533.hs b/testsuite/tests/rename/should_compile/T12533.hs new file mode 100644 index 0000000000..a120babf3f --- /dev/null +++ b/testsuite/tests/rename/should_compile/T12533.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE ScopedTypeVariables, DefaultSignatures #-} + +module T12533 where + +class Foo x where + foo :: forall a . x a -> x a + default foo :: forall a . x a -> x a + foo x = go + where go :: x a + go = undefined diff --git a/testsuite/tests/rename/should_compile/all.T b/testsuite/tests/rename/should_compile/all.T index 90b1d605bc..b6318aeeed 100644 --- a/testsuite/tests/rename/should_compile/all.T +++ b/testsuite/tests/rename/should_compile/all.T @@ -242,3 +242,4 @@ test('T12127', [extra_clean(['T12127a.hi', 'T12127a.o'])], multimod_compile, ['T12127', '-v0']) +test('T12533', normal, compile, ['']) |