Fix nasty bug in the type free-var finder, at last
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Oct 2018 10:54:20 +0000 (11:54 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Oct 2018 11:05:43 +0000 (12:05 +0100)
commit503514b94f8dc7bd9eab5392206649aee45f140b
tree8c05957605cfc827381029b48b9bdd2aa85049ae
parent4de4b2253caa685a39cc654d553cdf63b8babbee
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.
compiler/types/TyCoRep.hs
testsuite/tests/partial-sigs/should_compile/T12844.stderr
testsuite/tests/partial-sigs/should_compile/T15039a.stderr
testsuite/tests/partial-sigs/should_compile/T15039b.stderr
testsuite/tests/partial-sigs/should_compile/T15039c.stderr
testsuite/tests/partial-sigs/should_compile/T15039d.stderr
testsuite/tests/partial-sigs/should_run/T15415.stderr
testsuite/tests/polykinds/T14265.stderr