Quantify class variables first in associated families' kinds
authorRyan Scott <ryan.gl.scott@gmail.com>
Mon, 1 Oct 2018 16:05:12 +0000 (12:05 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Mon, 1 Oct 2018 16:05:12 +0000 (12:05 -0400)
commita57fa24746421c0e13d0c09b72cbabea3622779f
treeefa4ad972bfbc380088bec97f8df9bbb92a4e40e
parent309438e948359a0ae71ffac4a41ebcd855cf5657
Quantify class variables first in associated families' kinds

Summary:
Previously, `kcLHsQTyVars` would always quantify class-bound
variables invisibly in the kinds of associated types, resulting in
#15591. We counteract this by explicitly passing the class-bound
variables to `kcLHsQTyVars` and quantifying over the ones that are
mentioned in the associated type such that (1) they are specified,
and (2) they come before other kind variables.
See `Note [Kind variable ordering for associated types]`.

Test Plan: make test TEST=T15591

Reviewers: goldfire, simonpj, bgamari

Reviewed By: simonpj

Subscribers: rwbarton, carter

GHC Trac Issues: #15591

Differential Revision: https://phabricator.haskell.org/D5159
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcTyClsDecls.hs
docs/users_guide/glasgow_exts.rst
testsuite/tests/ghci/scripts/T15591.hs [new file with mode: 0644]
testsuite/tests/ghci/scripts/T15591.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T15591.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T