diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-10-26 11:54:20 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-10-26 12:05:43 +0100 |
commit | 503514b94f8dc7bd9eab5392206649aee45f140b (patch) | |
tree | 8c05957605cfc827381029b48b9bdd2aa85049ae /testsuite/tests/partial-sigs | |
parent | 4de4b2253caa685a39cc654d553cdf63b8babbee (diff) | |
download | haskell-503514b94f8dc7bd9eab5392206649aee45f140b.tar.gz |
Fix nasty bug in the type free-var finder, at last
Consider the type
forall k. b -> k
where
b :: k -> Type
Here the 'k' in b's kind must be a different 'k' to the forall k,
because 'b' is free in the expression. So we must return 'k'
among the free vars returned from tyCoVarsOfType applied that
type. But we weren't.
This is an outright bug, although we don't have a program that
fails because of it.
It's easy to fix, too: see TyCoRep
Note [Closing over free variable kinds]
This fix has been in the pipeline for ages because it fell into
the Trac #14880 swamp. But this patch nails it.
Diffstat (limited to 'testsuite/tests/partial-sigs')
6 files changed, 9 insertions, 9 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/T12844.stderr b/testsuite/tests/partial-sigs/should_compile/T12844.stderr index 7049818a7c..0e01cd30f3 100644 --- a/testsuite/tests/partial-sigs/should_compile/T12844.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T12844.stderr @@ -2,7 +2,7 @@ T12844.hs:12:9: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘(Foo rngs, Head rngs ~ '(r, r'))’ - Where: ‘rngs’, ‘r’, ‘k’, ‘r'’, ‘k1’ + Where: ‘rngs’, ‘k’, ‘r’, ‘k1’, ‘r'’ are rigid type variables bound by the inferred type of bar :: (Foo rngs, Head rngs ~ '(r, r')) => FooData rngs diff --git a/testsuite/tests/partial-sigs/should_compile/T15039a.stderr b/testsuite/tests/partial-sigs/should_compile/T15039a.stderr index d9c8e1056f..1563a2eb23 100644 --- a/testsuite/tests/partial-sigs/should_compile/T15039a.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T15039a.stderr @@ -25,7 +25,7 @@ T15039a.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)] T15039a.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Dict (a ~~ b)’ - Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by + Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by the type signature for: ex3 :: forall k a (b :: k). Dict (a ~~ b) -> () at T15039a.hs:24:1-43 diff --git a/testsuite/tests/partial-sigs/should_compile/T15039b.stderr b/testsuite/tests/partial-sigs/should_compile/T15039b.stderr index 5726c7fa65..21ec20ae40 100644 --- a/testsuite/tests/partial-sigs/should_compile/T15039b.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T15039b.stderr @@ -26,7 +26,7 @@ T15039b.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)] T15039b.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~~ (b :: k))’ - Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by + Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by the type signature for: ex3 :: forall k a (b :: k). Dict ((a :: *) ~~ (b :: k)) -> () at T15039b.hs:24:1-43 diff --git a/testsuite/tests/partial-sigs/should_compile/T15039c.stderr b/testsuite/tests/partial-sigs/should_compile/T15039c.stderr index b5a6b149de..40c126f061 100644 --- a/testsuite/tests/partial-sigs/should_compile/T15039c.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T15039c.stderr @@ -25,7 +25,7 @@ T15039c.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)] T15039c.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Dict (a ~~ b)’ - Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by + Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by the type signature for: ex3 :: forall k a (b :: k). Dict (a ~~ b) -> () at T15039c.hs:24:1-43 diff --git a/testsuite/tests/partial-sigs/should_compile/T15039d.stderr b/testsuite/tests/partial-sigs/should_compile/T15039d.stderr index 30b22f8fb2..620199a13c 100644 --- a/testsuite/tests/partial-sigs/should_compile/T15039d.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T15039d.stderr @@ -27,7 +27,7 @@ T15039d.hs:22:14: warning: [-Wpartial-type-signatures (in -Wdefault)] T15039d.hs:25:14: warning: [-Wpartial-type-signatures (in -Wdefault)] • Found type wildcard ‘_’ standing for ‘Dict ((a :: *) ~~ (b :: k))’ - Where: ‘a’, ‘b’, ‘k’ are rigid type variables bound by + Where: ‘a’, ‘k’, ‘b’ are rigid type variables bound by the type signature for: ex3 :: forall k a (b :: k). Dict ((a :: *) ~~ (b :: k)) -> () at T15039d.hs:24:1-43 diff --git a/testsuite/tests/partial-sigs/should_run/T15415.stderr b/testsuite/tests/partial-sigs/should_run/T15415.stderr index c11d54e322..daa791ffa4 100644 --- a/testsuite/tests/partial-sigs/should_run/T15415.stderr +++ b/testsuite/tests/partial-sigs/should_run/T15415.stderr @@ -1,8 +1,8 @@ <interactive>:1:7: error: Found type wildcard ‘_’ standing for ‘w0 :: k0’ - Where: ‘w0’ is an ambiguous type variable - ‘k0’ is an ambiguous type variable + Where: ‘k0’ is an ambiguous type variable + ‘w0’ is an ambiguous type variable To use the inferred type, enable PartialTypeSignatures <interactive>:1:17: error: @@ -16,8 +16,8 @@ <interactive>:1:7: warning: [-Wpartial-type-signatures (in -Wdefault)] Found type wildcard ‘_’ standing for ‘w0 :: k0’ - Where: ‘w0’ is an ambiguous type variable - ‘k0’ is an ambiguous type variable + Where: ‘k0’ is an ambiguous type variable + ‘w0’ is an ambiguous type variable <interactive>:1:17: warning: [-Wpartial-type-signatures (in -Wdefault)] Found type wildcard ‘_’ standing for ‘* -> *’ |