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.
Showing
- compiler/ghci/RtClosureInspect.hs 2 additions, 2 deletionscompiler/ghci/RtClosureInspect.hs
- compiler/typecheck/TcBackpack.hs 1 addition, 1 deletioncompiler/typecheck/TcBackpack.hs
- compiler/typecheck/TcBinds.hs 7 additions, 5 deletionscompiler/typecheck/TcBinds.hs
- compiler/typecheck/TcRnExports.hs 4 additions, 4 deletionscompiler/typecheck/TcRnExports.hs
- compiler/typecheck/TcRnMonad.hs 220 additions, 156 deletionscompiler/typecheck/TcRnMonad.hs
- compiler/typecheck/TcSigs.hs 17 additions, 6 deletionscompiler/typecheck/TcSigs.hs
- compiler/typecheck/TcSimplify.hs 5 additions, 3 deletionscompiler/typecheck/TcSimplify.hs
- compiler/typecheck/TcUnify.hs 8 additions, 1 deletioncompiler/typecheck/TcUnify.hs
- testsuite/tests/dependent/should_fail/BadTelescope2.hs 0 additions, 3 deletionstestsuite/tests/dependent/should_fail/BadTelescope2.hs
- testsuite/tests/dependent/should_fail/BadTelescope2.stderr 1 addition, 8 deletionstestsuite/tests/dependent/should_fail/BadTelescope2.stderr
- testsuite/tests/dependent/should_fail/BadTelescope5.hs 11 additions, 0 deletionstestsuite/tests/dependent/should_fail/BadTelescope5.hs
- testsuite/tests/dependent/should_fail/BadTelescope5.stderr 7 additions, 0 deletionstestsuite/tests/dependent/should_fail/BadTelescope5.stderr
- testsuite/tests/dependent/should_fail/T15743c.stderr 15 additions, 0 deletionstestsuite/tests/dependent/should_fail/T15743c.stderr
- testsuite/tests/dependent/should_fail/T16418.hs 13 additions, 0 deletionstestsuite/tests/dependent/should_fail/T16418.hs
- testsuite/tests/dependent/should_fail/T16418.stderr 7 additions, 0 deletionstestsuite/tests/dependent/should_fail/T16418.stderr
- testsuite/tests/dependent/should_fail/all.T 3 additions, 1 deletiontestsuite/tests/dependent/should_fail/all.T
- testsuite/tests/patsyn/should_fail/T9161-1.hs 2 additions, 0 deletionstestsuite/tests/patsyn/should_fail/T9161-1.hs
- testsuite/tests/patsyn/should_fail/T9161-1.stderr 1 addition, 1 deletiontestsuite/tests/patsyn/should_fail/T9161-1.stderr
- testsuite/tests/patsyn/should_fail/T9161-2.hs 2 additions, 0 deletionstestsuite/tests/patsyn/should_fail/T9161-2.hs
- testsuite/tests/patsyn/should_fail/T9161-2.stderr 1 addition, 1 deletiontestsuite/tests/patsyn/should_fail/T9161-2.stderr
Loading
Please register or sign in to comment