Build only well-kinded types in type checker
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 11 Dec 2017 11:52:44 +0000 (11:52 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 11 Dec 2017 15:30:10 +0000 (15:30 +0000)
commit8b36ed129652df07af22b5e2a2e57b1df8cfbbc9
tree8f71c2ae80018db54fc34768b911c70503980ed8
parent716acbb5084db6ace5f06bd6112aa1e24b46423a
Build only well-kinded types in type checker

During type inference, we maintain the invariant that every type is
well-kinded /without/ zonking; and in particular that typeKind does
not fail (as it can for ill-kinded types).

But TcHsType.tcInferApps was not guaranteeing this invariant,
resulting in Trac #14174 and #14520.

This patch fixes it, making things better -- but it does /not/
fix the program in Trac #14174 comment:5, which still crashes.
So more work to be done.

See Note [Ensure well-kinded types] in TcHsType
compiler/typecheck/TcHsType.hs
testsuite/tests/polykinds/T14174.hs [new file with mode: 0644]
testsuite/tests/polykinds/T14174.stderr [new file with mode: 0644]
testsuite/tests/polykinds/T14174a.hs [new file with mode: 0644]
testsuite/tests/polykinds/T14174a.stderr [new file with mode: 0644]
testsuite/tests/polykinds/T14520.hs [new file with mode: 0644]
testsuite/tests/polykinds/T14520.stderr [new file with mode: 0644]
testsuite/tests/polykinds/all.T