Fix #15787 by squashing a coercion hole.
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Sun, 28 Oct 2018 20:06:17 +0000 (16:06 -0400)
committerRichard Eisenberg <rae@cs.brynmawr.edu>
Mon, 29 Oct 2018 03:17:47 +0000 (23:17 -0400)
commit4427315a65b25db22e1754d41b43dd4b782b022f
tree345b7293b2db9a4db36447fe469ebcc066b9a8f1
parent5e45ad10ffca1ad175b10f6ef3327e1ed8ba25f3
Fix #15787 by squashing a coercion hole.

In type-incorrect code, we can sometimes let a coercion
hole make it through the zonker. If this coercion hole then
ends up in the environment (e.g., in the type of a data
constructor), then it causes trouble later.

This patch avoids trouble by substituting the coercion hole
for its representative CoVar. Really, any coercion would do,
but the CoVar was very handy.

test case: polykinds/T15787
compiler/typecheck/TcHsSyn.hs
testsuite/tests/polykinds/T15787.hs [new file with mode: 0644]
testsuite/tests/polykinds/T15787.stderr [new file with mode: 0644]
testsuite/tests/polykinds/all.T