[commit: ghc] master, wip/angerman/reinstallable-lib-ghc, wip/i386-win32-builds, wip/reapply-atomic-writes: Be more careful when naming TyCon binders (80dfcee)

git at git.haskell.org git at git.haskell.org
Tue Mar 5 21:44:11 UTC 2019


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

On branches: master,wip/angerman/reinstallable-lib-ghc,wip/i386-win32-builds,wip/reapply-atomic-writes
Link       : http://ghc.haskell.org/trac/ghc/changeset/80dfcee61e3bfb67f131cd674f96467e16c0f9d8/ghc

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

commit 80dfcee61e3bfb67f131cd674f96467e16c0f9d8
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Feb 25 08:31:33 2019 +0000

    Be more careful when naming TyCon binders
    
    This patch fixes two rather gnarly test cases:
      * Trac #16342 (mutual recursion)
        See Note [Tricky scoping in generaliseTcTyCon]
    
      * Trac #16221 (shadowing)
        See Note [Unification variables need fresh Names]
    
    The main changes are:
    
    * Substantial reworking of TcTyClsDecls.generaliseTcTyCon
      This is the big change, and involves the rather tricky
      function TcHsSyn.zonkRecTyVarBndrs.
    
      See Note [Inferring kinds for type declarations] and
      Note [Tricky scoping in generaliseTcTyCon] for the details.
    
    * bindExplicitTKBndrs_Tv and bindImplicitTKBndrs_Tv both now
      allocate /freshly-named/ unification variables. Indeed, more
      generally, unification variables are always fresh; see
      Note [Unification variables need fresh Names] in TcMType
    
    * Clarify the role of tcTyConScopedTyVars.
      See Note [Scoped tyvars in a TcTyCon] in TyCon
    
    As usual, this dragged in some more refactoring:
    
    * Renamed TcMType.zonkTyCoVarBndr to zonkAndSkolemise
    
    * I renamed checkValidTelescope to checkTyConTelescope;
      it's only used on TyCons, and indeed takes a TyCon as argument.
    
    * I folded the slightly-mysterious reportFloatingKvs into
      checkTyConTelescope. (Previously all its calls immediately
      followed a call to checkTyConTelescope.)  It makes much more
      sense there.
    
    * I inlined some called-once functions to simplify
      checkValidTyFamEqn. It's less spaghetti-like now.
    
    * This patch also fixes Trac #16251.  I'm not quite sure why #16251
      went wrong in the first place, nor how this patch fixes it, but
      hey, it's good, and life is short.


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

80dfcee61e3bfb67f131cd674f96467e16c0f9d8
 compiler/deSugar/DsMeta.hs                         |   4 +-
 compiler/hsSyn/HsTypes.hs                          |  13 +-
 compiler/rename/RnSource.hs                        |   5 +-
 compiler/typecheck/TcHsSyn.hs                      |  56 +++--
 compiler/typecheck/TcHsType.hs                     | 103 +++++----
 compiler/typecheck/TcMType.hs                      | 240 +++++++++++---------
 compiler/typecheck/TcSigs.hs                       |   4 +-
 compiler/typecheck/TcTyClsDecls.hs                 | 237 ++++++++++++++------
 compiler/typecheck/TcValidity.hs                   | 249 ++++++++++++++-------
 compiler/types/TyCon.hs                            |  40 +++-
 testsuite/tests/indexed-types/should_fail/all.T    |   2 +-
 .../tests/typecheck/should_compile/tc141.stderr    |  18 +-
 testsuite/tests/typecheck/should_fail/T2688.stderr |   4 +-
 13 files changed, 607 insertions(+), 368 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 80dfcee61e3bfb67f131cd674f96467e16c0f9d8


More information about the ghc-commits mailing list