Use captureTopConstraints in TcRnDriver calls
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 7 Mar 2019 09:09:13 +0000 (09:09 +0000)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Fri, 8 Mar 2019 11:08:41 +0000 (06:08 -0500)
commit5be7ad7861c8d39f60b7101fd8d8e816ff50353a
tree3eeaf6e6add705eb2ae10b343aadd1307d8f2106
parent826282540492d64c59cd3ba9df5fd0b2e92f76ef
Use captureTopConstraints in TcRnDriver calls

Trac #16376 showed the danger of failing to report an error
that exists only in the unsolved constraints, if an exception
is raised (via failM).

Well, the commit 5c1f268e (Fail fast in solveLocalEqualities)
did just that -- i.e. it found errors in the constraints, and
called failM to avoid a misleading cascade.

So we need to be sure to call captureTopConstraints to report
those insolubles.  This was wrong in TcRnDriver.tcRnExpr and
in TcRnDriver.tcRnType.

As a result the error messages from test T13466 improved slightly,
a happy outcome.
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcSimplify.hs
testsuite/tests/ghci/scripts/T13466.stderr
testsuite/tests/ghci/scripts/T16376.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T16376.stderr [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T