[commit: ghc] master: Fix isDroppableCt (Trac #14763) (6edafe3)

git at git.haskell.org git at git.haskell.org
Thu Feb 8 14:58:52 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6edafe3be0133fe69581fb3851a812c69ab9dbf7/ghc

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

commit 6edafe3be0133fe69581fb3851a812c69ab9dbf7
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 8 14:24:11 2018 +0000

    Fix isDroppableCt (Trac #14763)
    
    When finishing up an implication constraint, it's a bit tricky to
    decide which Derived constraints to retain (for error reporting) and
    which to discard.  I got this wrong in commit
       f20cf982f126aea968ed6a482551550ffb6650cf
       (Remove wc_insol from WantedConstraints)
    
    The particular problem in Trac #14763 was that we were reporting as an
    error a fundep-generated constraint
      (ex ~ T)
    where 'ex' is an existentially-bound variable in a pattern match.
    But this isn't really an error at all.
    
    This patch fixes the problem. Indeed, since I had to understand
    this rather tricky code, I took the opportunity to clean it up
    and document better.  See
      isDroppableCt :: Ct -> Bool
    and Note [Dropping derived constraints]
    
    I also removed wl_deriv altogether from the WorkList data type.  It
    was there in the hope of gaining efficiency by not even processing
    lots of derived constraints, but it has turned out that most derived
    constraints (notably equalities) must be processed anyway; see
    Note [Prioritise equalities] in TcSMonad.
    
    The two are coupled because to decide which constraints to put in
    wl_deriv I was using another variant of isDroppableCt.  Now it's much
    simpler -- and perhaps even more efficient too.


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

6edafe3be0133fe69581fb3851a812c69ab9dbf7
 compiler/typecheck/TcCanonical.hs                  |  15 ++-
 compiler/typecheck/TcErrors.hs                     |   2 +-
 compiler/typecheck/TcInteract.hs                   |   5 +-
 compiler/typecheck/TcRnTypes.hs                    | 109 +++++++++++++--------
 compiler/typecheck/TcSMonad.hs                     | 109 +++++++--------------
 testsuite/tests/typecheck/should_compile/T14763.hs |  34 +++++++
 testsuite/tests/typecheck/should_compile/all.T     |   1 +
 7 files changed, 148 insertions(+), 127 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 6edafe3be0133fe69581fb3851a812c69ab9dbf7


More information about the ghc-commits mailing list