Ensure that insolubles are fully rewritten
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 19 May 2017 09:50:35 +0000 (10:50 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 19 May 2017 09:54:55 +0000 (10:54 +0100)
commit433b80dec1cfef787fc1327a9eada1791b11c12e
tree786621c3d42147db996738242d2c5492f8e0068e
parent7b52525ecb2a09b21e7e5393f45a72ed1dfa3bc8
Ensure that insolubles are fully rewritten

I was alerted to this by Trac #12468 and #11325.  We were treating
insolubles (and "hole" constraints are treated as insoluble)
inconsistently.  In some places we were carefully rewriting them
e.g. Note [Make sure that insolubles are fully rewritten] in
TcCanonical.  But in TcSimplify we weren't feeding them into
the solver.

As a result, "hole" constraints were not being rewritten, which
some users found confusing, and I think rightly so.

This patch also fixes a bug in TcSMonad.emitInsoluble, in which two
different "hole" constriants could be treated (bogusly) as duplicates,
thereby losing one.
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
compiler/typecheck/TcSimplify.hs
testsuite/tests/gadt/T12468.hs [new file with mode: 0644]
testsuite/tests/gadt/T12468.stderr [new file with mode: 0644]
testsuite/tests/gadt/all.T
testsuite/tests/typecheck/should_compile/hole_constraints.stderr