[commit: ghc] master: Tidying could cause ill-kinded types (8bf865d)

git at git.haskell.org git at git.haskell.org
Thu Sep 14 09:12:44 UTC 2017


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

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

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

commit 8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Sat Sep 2 18:29:11 2017 +0100

    Tidying could cause ill-kinded types
    
    I found (Trac #14175) that the tidying we do when reporting
    type error messages could cause a well-kinded type to become
    ill-kinded. Reason: we initialised the tidy-env with a
    completely un-zonked TidyEnv accumulated in the TcLclEnv
    as we come across lexical type-varialbe bindings.
    
    Solution: zonk them.
    
    But I ended up refactoring a bit:
    
    * Get rid of tcl_tidy :: TidyEnv altogether
    
    * Instead use tcl_bndrs :: TcBinderStack
      This used to contain only Ids, but now I've added those
      lexically scoped TyVars too.
    
    * Change names:
         TcIdBinderStack -> TcBinderStack
         TcIdBinder      -> TcBinder
         extendTcIdBndrs -> extendTcBinderStack
    
    * Now tcInitTidyEnv can grab those TyVars from the
      tcl_bndrs, zonk, and tidy them.
    
    The only annoyance is that I had to add TcEnv.hs-boot, to
    break the recursion between the zonking code and the
    TrRnMonad functions like addErrTc that call tcInitTidyEnv.
    Tiresome, but in fact that file existed already.


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

8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0
 compiler/typecheck/TcBinds.hs                      | 16 ++--
 compiler/typecheck/TcEnv.hs                        | 86 ++++++++++++++--------
 compiler/typecheck/TcEnv.hs-boot                   | 17 +++--
 compiler/typecheck/TcErrors.hs                     | 18 +++--
 compiler/typecheck/TcRnMonad.hs                    | 18 +----
 compiler/typecheck/TcRnTypes.hs                    | 38 ++++++----
 compiler/typecheck/TcValidity.hs                   |  2 +-
 .../tests/indexed-types/should_fail/T14175.hs      |  7 ++
 .../tests/indexed-types/should_fail/T14175.stderr  |  5 ++
 testsuite/tests/indexed-types/should_fail/all.T    |  1 +
 10 files changed, 127 insertions(+), 81 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 8bf865d3db69c6f4a09f3e5e3880c087c0a7c7f0


More information about the ghc-commits mailing list