[commit: ghc] wip/T16418: Improve error recovery in the typechecker (9edc8f2)
git at git.haskell.org
git at git.haskell.org
Wed Mar 13 23:44:16 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T16418
Link : http://ghc.haskell.org/trac/ghc/changeset/9edc8f2645cd3f01ad96fd24db4802e85382625f/ghc
>---------------------------------------------------------------
commit 9edc8f2645cd3f01ad96fd24db4802e85382625f
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Mar 13 11:15:20 2019 +0000
Improve error recovery in the typechecker
Issue #16418 showed that we were carrying on too eagerly after a bogus
type signature was identified (a bad telescope in fact), leading to a
subsequent crash.
This led me in to a maze of twisty little passages in the typechecker's
error recovery, and I ended up doing some refactoring in TcRnMonad.
Some specfifics
* TcRnMonad.try_m is now called attemptM.
* I switched the order of the result pair in tryTc,
to make it consistent with other similar functions.
* The actual exception used in the Tc monad is irrelevant so,
to avoid polluting type signatures, I made tcTryM, a simple
wrapper around tryM, and used it.
The more important changes are in
* TcSimplify.captureTopConstraints, where we should have been calling
simplifyTop rather than reportUnsolved, so that levity defaulting
takes place properly.
* TcUnify.emitResidualTvConstraint, where we need to set the correct
status for a new implication constraint. (Previously we ended up
with an Insoluble constraint wrapped in an Unsolved implication,
which meant that insolubleWC gave the wrong answer.
>---------------------------------------------------------------
9edc8f2645cd3f01ad96fd24db4802e85382625f
compiler/ghci/RtClosureInspect.hs | 4 +-
compiler/typecheck/TcBackpack.hs | 2 +-
compiler/typecheck/TcBinds.hs | 12 +-
compiler/typecheck/TcRnExports.hs | 8 +-
compiler/typecheck/TcRnMonad.hs | 354 ++++++++++++---------
compiler/typecheck/TcSigs.hs | 28 +-
compiler/typecheck/TcSimplify.hs | 8 +-
compiler/typecheck/TcUnify.hs | 9 +-
.../tests/dependent/should_fail/BadTelescope2.hs | 3 -
.../dependent/should_fail/BadTelescope2.stderr | 9 +-
.../{BadTelescope2.hs => BadTelescope5.hs} | 5 +-
.../dependent/should_fail/BadTelescope5.stderr | 7 +
testsuite/tests/dependent/should_fail/T16418.hs | 13 +
.../tests/dependent/should_fail/T16418.stderr | 7 +
testsuite/tests/dependent/should_fail/all.T | 4 +-
testsuite/tests/patsyn/should_fail/T9161-1.hs | 2 +
testsuite/tests/patsyn/should_fail/T9161-1.stderr | 2 +-
testsuite/tests/patsyn/should_fail/T9161-2.hs | 2 +
testsuite/tests/patsyn/should_fail/T9161-2.stderr | 2 +-
.../tests/typecheck/should_fail/tcfail212.stderr | 22 --
20 files changed, 283 insertions(+), 220 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9edc8f2645cd3f01ad96fd24db4802e85382625f
More information about the ghc-commits
mailing list