diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-11-25 11:35:50 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-11-25 17:46:50 +0000 |
commit | 1bfff60fc57cd564382b86bdfb1f2764ca15d44f (patch) | |
tree | 44c82903fd11a6a51f8fb7dfd5cbc054917d09da /testsuite/tests/partial-sigs | |
parent | eb55ec2941239dee05afc6be818b129efe51660e (diff) | |
download | haskell-1bfff60fc57cd564382b86bdfb1f2764ca15d44f.tar.gz |
Fix inference of partial signatures
When we had
f :: ( _ ) => blah
we were failing to call growThetaTyVars, as we do in the
no-type-signature case, and that meant that we weren't generalising
over the right type variables. I'm quite surprised this didn't cause
problems earlier.
Anyway Trac #12844 showed it up and this patch fixes it
Diffstat (limited to 'testsuite/tests/partial-sigs')
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T12844.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T12844.stderr | 25 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/all.T | 1 |
3 files changed, 46 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/T12844.hs b/testsuite/tests/partial-sigs/should_compile/T12844.hs new file mode 100644 index 0000000000..d47b82cc64 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12844.hs @@ -0,0 +1,20 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} + +module T12844 where + +barWraper :: ('(r,r') ~ Head rngs, Foo rngs) => FooData rngs +barWraper = bar + +bar :: (_) => FooData rngs +bar = foo + +data FooData rngs + +class Foo xs where foo :: (Head xs ~ '(r,r')) => FooData xs + +type family Head (xs :: [k]) where Head (x ': xs) = x + diff --git a/testsuite/tests/partial-sigs/should_compile/T12844.stderr b/testsuite/tests/partial-sigs/should_compile/T12844.stderr new file mode 100644 index 0000000000..8ad3777f2a --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T12844.stderr @@ -0,0 +1,25 @@ + +T12844.hs:12:9: warning: [-Wpartial-type-signatures (in -Wdefault)] + • Found type wildcard ‘_’ + standing for ‘(Head rngs ~ '(r, r'), Foo rngs)’ + Where: ‘r’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘r'’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘rngs’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘k’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + ‘k1’ is a rigid type variable bound by + the inferred type of + bar :: (Head rngs ~ '(r, r'), Foo rngs) => FooData rngs + at T12844.hs:13:1-9 + • In the type signature: bar :: _ => FooData rngs diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index b3208518f4..10cdfaaf35 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -68,3 +68,4 @@ test('T11670', normal, compile, ['']) test('T12156', normal, compile_fail, ['-fdefer-typed-holes']) test('T12531', normal, compile, ['-fdefer-typed-holes']) test('T12845', normal, compile, ['']) +test('T12844', normal, compile, ['']) |