[commit: ghc] master: Fix solving of implicit parameter constraints (abed9bf)

git at git.haskell.org git at git.haskell.org
Mon Sep 25 13:02:09 UTC 2017


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

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

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

commit abed9bf5008baf6b3e84251fe4d07de80c532ead
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Sep 25 11:06:34 2017 +0100

    Fix solving of implicit parameter constraints
    
    Trac #14218 showed that we were not solving implicit-parameter
    constraints correctly.  In particular,
    
    - A tuple constraint could "hide" an implicit-parameter wanted
      constraint, and that in turn could that we solved it from the
      wrong implicit-parameter binding.
    
    - As a special case the HasCallStack constraint (which is just
      short for (IP "callStack" CallStack), was getting mis-solved.
    
    The big change is to arrange that, in TcSMonad.findDict when looking
    for a dictionary, either when looking for a matching inert or solved
    dictionary, we fail for
    
      - Tuples that are hiding implicit parameters
        See Note [Tuples hiding implicit parameters]
    
      - HasCallStack constraints where we have not yet pushed
        on the call-site info
        See Note [Solving CallStack constraints]
    
    I also did a little refactoring
    
    * Move naturallyCoherentClass from Class to TcInteract, its sole
      use site.  Class.hs seems like the wrong place.  (And I also
      do not understand the reason that we need the eq/Coercible/
      Typable stuff in this predicate, but I'll tackle that separately.)
    
    * Move the code that pushes call-site info onto a call stack
      from the "interact" part to the "canonicalise" part of the solver.


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

abed9bf5008baf6b3e84251fe4d07de80c532ead
 compiler/typecheck/TcCanonical.hs                  |  41 ++++++-
 compiler/typecheck/TcInteract.hs                   | 118 +++++++++------------
 compiler/typecheck/TcSMonad.hs                     |  80 +++++++++++---
 compiler/typecheck/TcSimplify.hs                   |   5 +-
 compiler/typecheck/TcType.hs                       |  23 ++--
 compiler/types/Class.hs                            |  13 ---
 testsuite/tests/typecheck/should_run/T14218.hs     |  34 ++++++
 testsuite/tests/typecheck/should_run/T14218.stdout |   2 +
 testsuite/tests/typecheck/should_run/all.T         |   1 +
 9 files changed, 214 insertions(+), 103 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 abed9bf5008baf6b3e84251fe4d07de80c532ead


More information about the ghc-commits mailing list