[commit: ghc] master, wip/disable-atomic-rename-on-windows: Improve error recovery in the typechecker (4927117)

git at git.haskell.org git at git.haskell.org
Sat Mar 16 14:45:05 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branches: master,wip/disable-atomic-rename-on-windows
Link       : http://ghc.haskell.org/trac/ghc/changeset/4927117cd6166a97455d788dbf7433c95441b57a/ghc

>---------------------------------------------------------------

commit 4927117cd6166a97455d788dbf7433c95441b57a
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.


>---------------------------------------------------------------

4927117cd6166a97455d788dbf7433c95441b57a
 compiler/ghci/RtClosureInspect.hs                  |   4 +-
 compiler/typecheck/TcBackpack.hs                   |   2 +-
 compiler/typecheck/TcBinds.hs                      |  12 +-
 compiler/typecheck/TcRnExports.hs                  |   8 +-
 compiler/typecheck/TcRnMonad.hs                    | 376 ++++++++++++---------
 compiler/typecheck/TcSigs.hs                       |  23 +-
 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 +
 .../tests/dependent/should_fail/T15743c.stderr     |  15 +
 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 --
 21 files changed, 317 insertions(+), 218 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 4927117cd6166a97455d788dbf7433c95441b57a


More information about the ghc-commits mailing list