[commit: ghc] master: Orient TyVar/TyVar equalities with deepest on the left (2bbdd00)

git at git.haskell.org git at git.haskell.org
Fri May 18 16:16:42 UTC 2018


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

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

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

commit 2bbdd00c6d70bdc31ff78e2a42b26159c8717856
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri May 18 08:43:11 2018 +0100

    Orient TyVar/TyVar equalities with deepest on the left
    
    Trac #15009 showed that, for Given TyVar/TyVar equalities, we really
    want to orient them with the deepest-bound skolem on the left. As it
    happens, we also want to do the same for Wanteds, but for a different
    reason (more likely to be touchable).  Either way, deepest wins:
    see TcUnify Note [Deeper level on the left].
    
    This observation led me to some significant changes:
    
    * A SkolemTv already had a TcLevel, but the level wasn't really being
      used.   Now it is!
    
    * I updated added invariant (SkolInf) to TcType
      Note [TcLevel and untouchable type variables], documenting that
      the level number of all the ic_skols should be the same as the
      ic_tclvl of the implication
    
    * FlatSkolTvs and FlatMetaTvs previously had a dummy level-number of
      zero, which messed the scheme up.   Now they get a level number the
      same way as all other TcTyVars, instead of being a special case.
    
    * To make sure that FlatSkolTvs and FlatMetaTvs are untouchable (which
      was previously done via their magic zero level) isTouchableMetaTyVar
      just tests for those two cases.
    
    * TcUnify.swapOverTyVars is the crucial orientation function; see the
      new Note [TyVar/TyVar orientation].  I completely rewrote this function,
      and it's now much much easier to understand.
    
    I ended up doing some related refactoring, of course
    
    * I noticed that tcImplicitTKBndrsX and tcExplicitTKBndrsX were doing
      a lot of useless work in the case where there are no skolems; I
      added a fast-patch
    
    * Elminate the un-used tcExplicitTKBndrsSig; and thereby get rid of
      the higher-order parameter to tcExpliciTKBndrsX.
    
    * Replace TcHsType.emitTvImplication with TcUnify.checkTvConstraints,
      by analogy with TcUnify.checkConstraints.
    
    * Inline TcUnify.buildImplication into its only call-site in
      TcUnify.checkConstraints
    
    * TcS.buildImplication becomes TcS.CheckConstraintsTcS, with a
      simpler API
    
    * Now that we have NoEvBindsVar we have no need of termEvidenceAllowed;
      nuke the latter, adding Note [No evidence bindings] to TcEvidence.


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

2bbdd00c6d70bdc31ff78e2a42b26159c8717856
 compiler/typecheck/TcCanonical.hs                  |  29 +--
 compiler/typecheck/TcErrors.hs                     |   5 +-
 compiler/typecheck/TcEvidence.hs                   |  20 +-
 compiler/typecheck/TcHsType.hs                     | 102 ++++-----
 compiler/typecheck/TcMType.hs                      |  23 +-
 compiler/typecheck/TcPatSyn.hs                     |   6 +-
 compiler/typecheck/TcRnTypes.hs                    |   9 -
 compiler/typecheck/TcSMonad.hs                     |  76 ++++---
 compiler/typecheck/TcSimplify.hs                   |   8 +-
 compiler/typecheck/TcType.hs                       |  91 ++++----
 compiler/typecheck/TcUnify.hs                      | 246 +++++++++++++++------
 testsuite/tests/ado/T13242a.stderr                 |   5 +-
 .../tests/dependent/should_fail/T14066d.stderr     |  10 +-
 .../tests/deriving/should_compile/T14578.stderr    |   8 +-
 testsuite/tests/gadt/T15009.hs                     |  20 ++
 testsuite/tests/gadt/all.T                         |   1 +
 .../should_compile/PushedInAsGivens.stderr         |  12 +-
 .../tests/indexed-types/should_fail/T13784.stderr  |  34 ++-
 .../tests/partial-sigs/should_fail/T14040a.stderr  |  26 ++-
 testsuite/tests/polykinds/T13555.stderr            |   5 +-
 testsuite/tests/polykinds/T14846.hs                |   4 +-
 testsuite/tests/polykinds/T14846.stderr            |  51 ++---
 testsuite/tests/polykinds/T7230.stderr             |   4 +-
 testsuite/tests/polykinds/T8566.stderr             |   4 +-
 testsuite/tests/polykinds/T9222.stderr             |   2 +-
 .../typecheck/should_compile/ExPatFail.stderr      |   6 +-
 .../tests/typecheck/should_compile/T9834.stderr    |  10 +-
 .../tests/typecheck/should_compile/tc141.stderr    |  12 +-
 testsuite/tests/typecheck/should_fail/T14607.hs    |   7 +
 .../tests/typecheck/should_fail/T14607.stderr      |  13 +-
 testsuite/tests/typecheck/should_fail/T7453.stderr |  18 +-
 testsuite/tests/typecheck/should_fail/T7869.stderr |   8 +-
 testsuite/tests/typecheck/should_fail/all.T        |   4 +-
 .../tests/typecheck/should_fail/tcfail068.stderr   |  36 +--
 .../tests/typecheck/should_fail/tcfail076.stderr   |  10 +-
 .../tests/typecheck/should_fail/tcfail099.stderr   |   6 +-
 .../tests/typecheck/should_fail/tcfail103.stderr   |  10 +-
 .../tests/typecheck/should_fail/tcfail174.stderr   |  11 +-
 .../tests/typecheck/should_fail/tcfail198.stderr   |   6 +-
 39 files changed, 531 insertions(+), 427 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 2bbdd00c6d70bdc31ff78e2a42b26159c8717856


More information about the ghc-commits mailing list