[commit: ghc] master: Fix TcSimplify.decideQuantification for kind variables (7e96526)

git at git.haskell.org git at git.haskell.org
Fri Mar 10 16:06:01 UTC 2017


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

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

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

commit 7e96526ac2ef5987ecb03217d3d616b6281c1441
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Mar 10 11:20:00 2017 +0000

    Fix TcSimplify.decideQuantification for kind variables
    
    TcSimplify.decideQuantification was doing the Wrong Thing when
    "growing" the type variables to quantify over. We were trying to do
    this on a tyvar set where we'd split off the dependent type varaibles;
    and we just got it wrong.  A kind variable wasn't being generalised
    properly, with confusing knock on consequences.
    
    All this led to Trac #13371 and Trac #13393.
    
    This commit tidies it all up:
    
    * The type TcDepVars is renamed as CandidateQTvs;
      and splitDepVarsOfType to candidateQTyVarsOfType
    
    * The code in TcSimplify.decideQuantification is simpler.
      It no longer does the tricky "grow" stuff over TcDepVars.
      Instead it use ordinary VarSets (thereby eliminating the
      nasty growThetaTyVarsDSet) and uses that to filter the
      result of candidateQTyVarsOfType.
    
    * I documented that candidateQTyVarsOfType returns the type
      variables in a good order in which to quantify, and rewrote
      it to use an accumulator pattern, so that we would predicatably
      get left-to-right ordering.
    
    In doing all this I also made UniqDFM behave a little more nicely:
    
    * When inserting an element that is there already, keep the old tag,
      while still overwriting with the new value.
    
    * This means that when doing udfmToList we get back elements in the
      order they were originally inserted, rather than in reverse order.
    
    It's not a big deal, but in a subsequent commit I use it to improve
    the order of type variables in inferred types.
    
    All this led to a lot of error message wibbles:
     - changing the order of quantified variables
     - changing the order in which instances are listed in GHCi
     - changing the tidying of variables in typechecker erors
    
    There's a submodule update for 'array' because one of its tests
    has an error-message change.
    
    I may not have associated all of them with the correct commit.


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

7e96526ac2ef5987ecb03217d3d616b6281c1441
 compiler/typecheck/TcMType.hs                      |  16 +--
 compiler/typecheck/TcSimplify.hs                   |  58 ++++------
 compiler/typecheck/TcType.hs                       | 121 ++++++++++++---------
 compiler/utils/UniqDFM.hs                          |  42 ++++---
 libraries/array                                    |   2 +-
 testsuite/tests/ado/ado004.stderr                  |  24 ++--
 .../tests/determinism/determ021/determ021.stdout   |   4 +-
 testsuite/tests/driver/werror.stderr               |   2 +-
 testsuite/tests/gadt/gadt7.stderr                  |  16 +--
 .../tests/ghci.debugger/scripts/break026.stdout    |  20 ++--
 testsuite/tests/ghci/scripts/T11524a.stdout        |   8 +-
 testsuite/tests/ghci/scripts/T11975.stdout         |   2 +-
 testsuite/tests/ghci/scripts/T12550.stdout         |  28 ++---
 testsuite/tests/ghci/scripts/T4175.stdout          |  32 +++---
 testsuite/tests/ghci/scripts/T6018ghcifail.stderr  |   6 +-
 testsuite/tests/ghci/scripts/T7627.stdout          |  26 ++---
 testsuite/tests/ghci/scripts/T7939.stdout          |   4 +-
 testsuite/tests/ghci/scripts/T8469.stdout          |  10 +-
 testsuite/tests/ghci/scripts/T8535.stdout          |   2 +-
 testsuite/tests/ghci/scripts/T9881.stdout          |  16 +--
 testsuite/tests/ghci/scripts/ghci011.stdout        |  38 +++----
 testsuite/tests/ghci/scripts/ghci020.stdout        |   2 +-
 testsuite/tests/ghci/should_run/T10145.stdout      |   2 +-
 testsuite/tests/ghci/should_run/T12549.stdout      |   2 +-
 .../indexed-types/should_compile/T3017.stderr      |   2 +-
 .../tests/indexed-types/should_fail/T1897b.stderr  |   2 +-
 .../tests/indexed-types/should_fail/T8518.stderr   |   8 +-
 .../tests/indexed-types/should_fail/T9662.stderr   |   4 +-
 testsuite/tests/module/mod72.stderr                |   2 +-
 .../tests/parser/should_fail/readFail003.stderr    |   6 +-
 .../should_compile/ExtraConstraints3.stderr        |  86 +++++++--------
 .../partial-sigs/should_compile/Meltdown.stderr    |   2 +-
 .../partial-sigs/should_compile/NamedTyVar.stderr  |   2 +-
 .../partial-sigs/should_compile/SkipMany.stderr    |   2 +-
 .../partial-sigs/should_compile/T10438.stderr      |   4 +-
 .../partial-sigs/should_compile/T11192.stderr      |  10 +-
 .../partial-sigs/should_compile/Uncurry.stderr     |   2 +-
 .../should_compile/UncurryNamed.stderr             |   2 +-
 .../WarningWildcardInstantiations.stderr           |   2 +-
 .../NamedExtraConstraintsWildcard.stderr           |   4 +-
 .../should_fail/NamedWildcardsNotInMonotype.stderr |   4 +-
 .../tests/partial-sigs/should_fail/T10045.stderr   |  10 +-
 .../partial-sigs/should_fail/TidyClash.stderr      |  12 +-
 .../partial-sigs/should_fail/TidyClash2.stderr     |  36 +++---
 .../tests/patsyn/should_compile/T11213.stderr      |   4 +-
 testsuite/tests/polykinds/T13371.hs                |  42 +++++++
 testsuite/tests/polykinds/T13393.hs                |  66 +++++++++++
 testsuite/tests/polykinds/T13393.stderr            |  25 +++++
 testsuite/tests/polykinds/T7438.stderr             |  14 +--
 testsuite/tests/polykinds/T7524.stderr             |   2 +-
 testsuite/tests/polykinds/all.T                    |   2 +
 testsuite/tests/rename/should_fail/T2993.stderr    |   2 +-
 .../tests/simplCore/should_compile/T3234.stderr    |   2 +-
 .../tests/typecheck/should_compile/tc141.stderr    |  16 +--
 .../tests/typecheck/should_compile/tc231.stderr    |   2 +-
 .../tests/typecheck/should_fail/T12177.stderr      |  16 +--
 .../tests/typecheck/should_fail/T6018fail.stderr   |   8 +-
 .../typecheck/should_fail/T6018failclosed.stderr   |   4 +-
 testsuite/tests/typecheck/should_fail/T7734.stderr |  12 +-
 testsuite/tests/typecheck/should_fail/T8142.stderr |   2 +-
 testsuite/tests/typecheck/should_fail/T8883.stderr |   2 +-
 testsuite/tests/typecheck/should_fail/mc25.stderr  |   8 +-
 .../tests/typecheck/should_fail/tcfail049.stderr   |   2 +-
 .../tests/typecheck/should_fail/tcfail050.stderr   |   2 +-
 64 files changed, 533 insertions(+), 385 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 7e96526ac2ef5987ecb03217d3d616b6281c1441


More information about the ghc-commits mailing list