Do not discard insolubles in implications
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 27 Jul 2017 13:52:38 +0000 (14:52 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 28 Jul 2017 08:31:55 +0000 (09:31 +0100)
commit452755de717fad5d8fbfc6330cb42a3335c8912d
tree9907deeb28850a6f98322b7ef3386828baed4b2a
parentb1317a35770b19838c7f6b07e794bfc61419e889
Do not discard insolubles in implications

Trac #14000 showed up two errors

* In TcRnTypes.dropInsolubles we dropped all implications, which
  might contain the very insolubles we wanted to keep.  This was
  an outright error, and is why the out-of-scope error was actually
  lost altogether in Trac #14000

* In TcSimplify.simplifyInfer, if there are definite (insoluble)
  errors, it's better to suppress the following ambiguity test,
  because the type may be bogus anyway.  See TcSimplify
  Note [Quantification with errors].  This fix seems a bit clunky,
  but it'll do for now.
13 files changed:
compiler/typecheck/TcBinds.hs
compiler/typecheck/TcExpr.hs
compiler/typecheck/TcPatSyn.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSimplify.hs
testsuite/tests/parser/should_fail/T7848.hs
testsuite/tests/parser/should_fail/T7848.stderr
testsuite/tests/th/T5358.stderr
testsuite/tests/typecheck/should_fail/T14000.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T14000.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T8142.stderr
testsuite/tests/typecheck/should_fail/all.T