Exclude TyVars from the constraint solver
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Feb 2016 09:02:07 +0000 (09:02 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Feb 2016 17:16:20 +0000 (17:16 +0000)
commit7496be5c0ab96bcc9ab70ab873aa561674b7789d
tree8641befe7a4f4fbd4b6d8802a2a22d362cb31781
parent4ddfe1352e20d805a0ad6eeea0400ee218023bfb
Exclude TyVars from the constraint solver

There is a general invariant that the constraint solver doesn't see
TyVars, only TcTyVars.  But when checking the generic-default
signature of a class, we called checkValidType on the generic-default
type, which had the class TyVar free. That in turn meant that it wasn't
considered during flattening, which led to the error reported in
Trac #11608.

The fix is simple: call checkValidType on the /closed/ type. Easy.

While I was at it, I added a bunch of ASSERTs about the TcTyVar
invariant.
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/typecheck/TcType.hs
testsuite/tests/typecheck/should_compile/T11608.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T