diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-06-29 15:26:54 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2017-06-29 15:30:53 +0100 |
commit | 3b0e7555fafe73b157a96ca48d8ddc04ad81b231 (patch) | |
tree | ea37a910eade51e2346a2e9d49ca8f266974fcf7 /testsuite | |
parent | 54ccf0c957a279c20e1a37a5a462612af8036739 (diff) | |
download | haskell-3b0e7555fafe73b157a96ca48d8ddc04ad81b231.tar.gz |
Fix lexically-scoped type variables
Trac #13881 showed that our handling of lexically scoped type
variables was way off when we bring into scope a name 'y' for
a pre-existing type variable 'a', perhaps with an entirely
different name.
This patch fixes it; see TcHsType
Note [Pattern signature binders]
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T13881.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T13881.hs b/testsuite/tests/typecheck/should_compile/T13881.hs new file mode 100644 index 0000000000..5f79f99ef8 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13881.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +module T13881 where + +data family Sing (a :: k) + +data instance Sing (z :: [a]) where + SNil :: Sing '[] + SCons :: Sing x -> Sing xs -> Sing (x ': xs) + +fl :: forall (l :: [a]). Sing l -> Sing l +fl (SNil :: Sing (l :: [y])) = SNil +fl (SCons x xs) = SCons x xs diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 2fc0241fb7..d6aaef53d2 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -566,3 +566,4 @@ test('T13804', normal, compile, ['']) test('T13822', normal, compile, ['']) test('T13871', normal, compile, ['']) test('T13879', normal, compile, ['']) +test('T13881', normal, compile, ['']) |