[commit: ghc] ghc-8.6: Remove the type-checking knot. (59f3858)

git at git.haskell.org git at git.haskell.org
Thu Aug 2 02:42:37 UTC 2018


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

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/59f38587d44efd00b10a6d98f6a7a1b22e87f13a/ghc

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

commit 59f38587d44efd00b10a6d98f6a7a1b22e87f13a
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Tue Jul 17 00:12:34 2018 -0400

    Remove the type-checking knot.
    
    Bug #15380 hangs because a knot-tied TyCon ended up in a kind.
    Looking at the code in tcInferApps, I'm amazed this hasn't happened
    before! I couldn't think of a good way to fix it (with dependent
    types, we can't really keep types out of kinds, after all), so
    I just went ahead and removed the knot.
    
    This was remarkably easy to do. In tcTyVar, when we find a TcTyCon,
    just use it. (Previously, we looked up the knot-tied TyCon and used
    that.) Then, during the final zonk, replace TcTyCons with the real,
    full-blooded TyCons in the global environment. It's all very easy.
    
    The new bit is explained in the existing
    Note [Type checking recursive type and class declarations]
    in TcTyClsDecls.
    
    Naturally, I removed various references to the knot and the
    zonkTcTypeInKnot (and related) functions. Now, we can print types
    during type checking with abandon!
    
    NB: There is a teensy error message regression with this patch,
    around the ordering of quantified type variables. This ordering
    problem is fixed (I believe) with the patch for #14880. The ordering
    affects only internal variables that cannot be instantiated with
    any kind of visible type application.
    
    There is also a teensy regression around the printing of types
    in TH splices. I think this is really a TH bug and will file
    separately.
    
    Test case: dependent/should_fail/T15380
    
    (cherry picked from commit f8618a9b15177ee8c84771b927cb3583c9cd8408)


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

59f38587d44efd00b10a6d98f6a7a1b22e87f13a
 compiler/basicTypes/DataCon.hs                     |  46 +++----
 compiler/iface/BuildTyCl.hs                        |  14 +-
 compiler/typecheck/FamInst.hs                      |   2 +-
 compiler/typecheck/TcEnv.hs                        |  11 +-
 compiler/typecheck/TcHsSyn.hs                      |  45 ++++---
 compiler/typecheck/TcHsType.hs                     | 146 ++++++---------------
 compiler/typecheck/TcMType.hs                      |  24 +---
 compiler/typecheck/TcTyClsDecls.hs                 |  64 +++++----
 compiler/typecheck/TcType.hs                       |  24 +---
 compiler/types/TyCoRep.hs                          |   6 +
 compiler/types/TyCon.hs                            |  21 ++-
 compiler/types/Type.hs                             |  25 +++-
 .../tests/dependent/should_compile/T14066a.stderr  |   2 +-
 testsuite/tests/dependent/should_fail/T15380.hs    |  20 +++
 .../tests/dependent/should_fail/T15380.stderr      |   6 +
 testsuite/tests/dependent/should_fail/all.T        |   2 +-
 testsuite/tests/ghci/scripts/T6018ghcifail.stderr  |   2 +-
 testsuite/tests/polykinds/T7524.stderr             |   2 +-
 testsuite/tests/th/T10267.stderr                   |   6 +-
 .../tests/typecheck/should_fail/T6018fail.stderr   |   5 +-
 .../typecheck/should_fail/T6018failclosed.stderr   |   4 +-
 21 files changed, 240 insertions(+), 237 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 59f38587d44efd00b10a6d98f6a7a1b22e87f13a


More information about the ghc-commits mailing list