Do not allow Typeable on constraints (Trac #9858)
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 14 Apr 2015 14:39:01 +0000 (15:39 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 14 Apr 2015 14:40:41 +0000 (15:40 +0100)
commit7b042d5adabdb0fc06286db1a7f9cbf1e9fd1fbf
treee64937585d861ab945f411a7468390f1ab199815
parent6dd2765a300bb139b4ab67688dbc6f48de66969b
Do not allow Typeable on constraints (Trac #9858)

The astonishingly-ingenious trio of
Shachaf Ben-Kiki, Ørjan Johansen and Nathan van Doorn
managed to persuade GHC 7.10.1 to cough up unsafeCoerce.

That is very bad. This patch fixes it by no allowing Typable
on Constraint-kinded things.  And that seems right, since
it is, in effect, a form of impredicative polymorphism,
which Typeable definitely doesn't support.

We may want to creep back in the direction of allowing
Typeable on constraints one day, but this is a good
fix for now, and closes a terrible hole.
compiler/typecheck/TcInteract.hs
compiler/types/TypeRep.hs
testsuite/tests/typecheck/should_fail/T9858a.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T9858a.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T
testsuite/tests/typecheck/should_run/T9858b.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_run/T9858b.stdout [new file with mode: 0644]
testsuite/tests/typecheck/should_run/all.T