Fix error-message suppress on given equalities
authorSimon Peyton Jones <simonpj@microsoft.com>
Mon, 27 Mar 2017 09:32:08 +0000 (10:32 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Mon, 27 Mar 2017 15:31:01 +0000 (16:31 +0100)
commite0ad55f894a8d85dcc099c33c63cfe3d4515d464
tree081072be5152a98c56f8f74cce2102ead2f3b501
parent7c7479d047113a0cbf237c864d403bb638ca0241
Fix error-message suppress on given equalities

I'd got the logic slightly wrong when reporting type errors
for insoluble 'given' equalities.  We suppress insoluble givens
under some circumstances (see Note [Given errors]), but we then
suppressed subsequent 'wanted' errors because the (suppressed)
'given' error "won".  Result: no errors at all :-(.

This patch fixes it and
 - Renames TcType.isTyVarUnderDatatype to the more
   perspicuous TcType.isInsolubleOccursCheck

In doing this I realise that I don't understand why we need
to keep the insolubles partitioned out separately at all...
but that is for another day.
13 files changed:
compiler/typecheck/TcCanonical.hs
compiler/typecheck/TcErrors.hs
compiler/typecheck/TcType.hs
testsuite/tests/ghci/scripts/Defer02.stderr
testsuite/tests/indexed-types/should_fail/T2627b.stderr
testsuite/tests/indexed-types/should_fail/T5934.stderr
testsuite/tests/indexed-types/should_fail/T6123.stderr
testsuite/tests/indexed-types/should_fail/T7354.stderr
testsuite/tests/typecheck/should_compile/T12427a.stderr
testsuite/tests/typecheck/should_fail/T12589.stderr
testsuite/tests/typecheck/should_fail/T13446.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T13446.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T