Fail fast in solveLocalEqualities
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 14 Feb 2019 08:28:43 +0000 (08:28 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 14 Feb 2019 08:40:03 +0000 (08:40 +0000)
commit5c1f268e2744fab2d36e64c163858995451d7095
treecb9b05c9112e6df43d90f28b6e3a252b2a077d46
parent682783828275cca5fd8bf5be5b52054c75e0e22c
Fail fast in solveLocalEqualities

This patch makes us fail fast in TcSimplify.solveLocalEqualities,
and in TcHsType.tc_hs_sig_type, if there are insoluble constraints.

Previously we ploughed on even if there were insoluble constraints,
leading to a cascade of hard-to-understand type errors. Failing
eagerly is much better; hence a lot of testsuite error message
changes.  Eg if we have
          f :: [Maybe] -> blah
          f xs = e
then trying typecheck 'f x = e' with an utterly bogus type
is just asking for trouble.

I can't quite remember what provoked me to make this change,
but I think the error messages are notably improved, by
removing confusing clutter and focusing on the real error.
24 files changed:
compiler/typecheck/TcHsType.hs
compiler/typecheck/TcSimplify.hs
testsuite/tests/dependent/should_fail/DepFail1.stderr
testsuite/tests/ghci/scripts/T15898.stderr
testsuite/tests/indexed-types/should_fail/T13877.stderr
testsuite/tests/partial-sigs/should_fail/T11976.stderr
testsuite/tests/partial-sigs/should_fail/T12634.stderr
testsuite/tests/patsyn/should_fail/T15289.stderr
testsuite/tests/polykinds/T12593.stderr
testsuite/tests/polykinds/T15577.stderr
testsuite/tests/typecheck/should_fail/T11112.stderr
testsuite/tests/typecheck/should_fail/T13819.stderr
testsuite/tests/typecheck/should_fail/T14232.stderr
testsuite/tests/typecheck/should_fail/T3540.stderr
testsuite/tests/typecheck/should_fail/T7778.stderr
testsuite/tests/typecheck/should_fail/T8806.stderr
testsuite/tests/typecheck/should_fail/VtaFail.stderr
testsuite/tests/typecheck/should_fail/tcfail057.stderr
testsuite/tests/typecheck/should_fail/tcfail058.stderr
testsuite/tests/typecheck/should_fail/tcfail063.stderr
testsuite/tests/typecheck/should_fail/tcfail113.stderr
testsuite/tests/typecheck/should_fail/tcfail160.stderr
testsuite/tests/typecheck/should_fail/tcfail161.stderr
testsuite/tests/typecheck/should_fail/tcfail212.stderr