Fix #15787 by squashing a coercion hole.
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Sun, 28 Oct 2018 20:06:17 +0000 (16:06 -0400)
committerBen Gamari <ben@smart-cactus.org>
Fri, 2 Nov 2018 14:59:49 +0000 (10:59 -0400)
commit7a439e7b13f350e1ac6163f1bfa60e30924dbeea
tree295028180484f598b9b67e0b6d8a4f1806d5e933
parentcfc3ad1fabe6a01da0571caf457811a30d1779c2
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

(cherry picked from commit 4427315a65b25db22e1754d41b43dd4b782b022f)
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