[commit: ghc] master: Fix floating of equalities (f5cf9d1)

git at git.haskell.org git at git.haskell.org
Thu Dec 21 14:55:44 UTC 2017


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

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

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

commit f5cf9d1a1b198edc929e1fa96c6d841d182fe766
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Dec 21 14:13:54 2017 +0000

    Fix floating of equalities
    
    This rather subtle patch fixes Trac #14584.  The problem was
    that we'd allowed a coercion, bound in a nested scope, to escape
    into an outer scope.
    
    The main changes are
    
    * TcSimplify.floatEqualities takes more care when floating
      equalities to make sure we don't float one out that mentions
      a locally-bound coercion.
      See Note [What prevents a constraint from floating]
    
    * TcSimplify.emitResidualConstraints (which emits the residual
      constraints in simplifyInfer) now avoids burying the constraints
      for escaping CoVars inside the implication constraint.
    
    * Since I had do to this stuff with CoVars, I moved the
      fancy footwork about not quantifying over CoVars from
      TcMType.quantifyTyVars to its caller
      TcSimplify.decideQuantifiedTyVars.  I think its other
      callers don't need to worry about all this CoVar stuff.
    
    This turned out to be surprisigly tricky, and took me a solid
    day to get right.  I think the result is reasonably neat, though,
    and well documented with Notes.


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

f5cf9d1a1b198edc929e1fa96c6d841d182fe766
 compiler/typecheck/TcMType.hs                      |  19 +-
 compiler/typecheck/TcSMonad.hs                     |   7 +-
 compiler/typecheck/TcSimplify.hs                   | 294 ++++++++++++++-------
 .../tests/indexed-types/should_fail/T13877.stderr  |  10 +-
 testsuite/tests/partial-sigs/should_fail/T14584.hs |  56 ++++
 .../tests/partial-sigs/should_fail/T14584.stderr   |  21 ++
 .../tests/partial-sigs/should_fail/T14584a.hs      |  16 ++
 .../tests/partial-sigs/should_fail/T14584a.stderr  |  24 ++
 testsuite/tests/partial-sigs/should_fail/all.T     |   2 +
 .../tests/typecheck/should_fail/VtaFail.stderr     |   6 -
 10 files changed, 339 insertions(+), 116 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 f5cf9d1a1b198edc929e1fa96c6d841d182fe766


More information about the ghc-commits mailing list