Fix typechecking of kind signatures
authorSimon Peyton Jones <simonpj@microsoft.com>
Sat, 16 Jun 2018 22:50:02 +0000 (23:50 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 18 Jun 2018 07:23:17 +0000 (08:23 +0100)
commit30b029bea9abe1f5f2855d9e7f0ae26a18cf049b
treee1b39b481acd76a5d2c4750f24dfa15eca8b4bbd
parent850ae8c5343b46ce519a35dd9526d7d6f9454455
Fix typechecking of kind signatures

When typechecking a type like
   Maybe (a :: <kind-sig>)
with a kind signature, we were using tc_lhs_kind to
typecheck the signature.  But that's utterly wrong; we
need the signature to be fully solid (non unresolved
equalities) before using it.  In the case of Trac #14904
we went on to instantiate the kind signature, when it
still had embedded unsolved constraints.  This tripped
the level-checking assertion when unifying a variable.

The fix looks pretty easy to me: just call tcLHsKind
instead.  I had to add KindSigCtxt to
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcType.hs
compiler/typecheck/TcValidity.hs
testsuite/tests/indexed-types/should_fail/T14904.hs [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/T14904.stderr [new file with mode: 0644]
testsuite/tests/indexed-types/should_fail/all.T