Do not discard insoluble Derived constraints
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Sep 2014 09:44:46 +0000 (10:44 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 26 Sep 2014 09:56:47 +0000 (10:56 +0100)
commit20632d37b5bcb68bb0ca34238f1ed49c7be3a8f7
treebd989d8a78331093ef62294939104c22fcc84fe3
parent74ae59896e4222a8115f5548845f13495f5bb76e
Do not discard insoluble Derived constraints

This is preparing for a fix to Trac #9612. The idea is that insoluble
constraints are nice solid errors that we should not discard before
we have a chance to report them.  So TcRnTypes.dropDerivedWC now
keeps insoluble Derived constrains, and instead TcSimplify.solve_wanteds
filters them out

We get somewhat better error message for kind-equality failures too.

A slight downside is that to avoid *duplicate* kind-equality failures
when we float a kind-incompatible equality (e.g.  alpha:* ~ Int#),
I've disabled constraint-floating when there are insolubles.  But that
in turn makes a handful of error messages a little less informative;
good examples are mc21, mc22, mc25.  But I am re-jigging the
constraint floating machinery in another branch, which will make this
go back to the way it was before.
17 files changed:
compiler/typecheck/TcRnTypes.lhs
compiler/typecheck/TcSimplify.lhs
testsuite/tests/indexed-types/should_fail/T3330c.stderr
testsuite/tests/typecheck/should_fail/T3950.stderr
testsuite/tests/typecheck/should_fail/T5570.stderr
testsuite/tests/typecheck/should_fail/T7368.stderr
testsuite/tests/typecheck/should_fail/T7368a.stderr
testsuite/tests/typecheck/should_fail/T8262.stderr
testsuite/tests/typecheck/should_fail/T8603.stderr
testsuite/tests/typecheck/should_fail/mc21.stderr
testsuite/tests/typecheck/should_fail/mc22.stderr
testsuite/tests/typecheck/should_fail/mc25.stderr
testsuite/tests/typecheck/should_fail/tcfail090.stderr
testsuite/tests/typecheck/should_fail/tcfail122.stderr
testsuite/tests/typecheck/should_fail/tcfail123.stderr
testsuite/tests/typecheck/should_fail/tcfail159.stderr
testsuite/tests/typecheck/should_fail/tcfail200.stderr