[commit: ghc] master: Remove knot-tying bug in TcHsSyn.zonkTyVarOcc (565ef4c)

git at git.haskell.org git at git.haskell.org
Fri Aug 31 18:05:54 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/565ef4cc036905f9f9801c1e775236bb007b026c/ghc

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

commit 565ef4cc036905f9f9801c1e775236bb007b026c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Aug 31 11:33:08 2018 +0100

    Remove knot-tying bug in TcHsSyn.zonkTyVarOcc
    
    There was a subtle knot-tying bug in TcHsSyn.zonkTyVarOcc, revealed
    in Trac #15552.
    
    I fixed it by
    
    * Eliminating the short-circuiting optimisation in zonkTyVarOcc,
      instead adding a finite map to get sharing of zonked unification
      variables.
    
      See Note [Sharing when zonking to Type] in TcHsSyn
    
    * On the way I /added/ the short-circuiting optimisation to
      TcMType.zonkTcTyVar, which has no such problem.  This turned
      out (based on non-systematic measurements) to be a modest win.
    
      See Note [Sharing in zonking] in TcMType
    
    On the way I renamed some of the functions in TcHsSyn:
    
    * Ones ending in "X" (like zonkTcTypeToTypeX) take a ZonkEnv
    
    * Ones that do not end in "x" (like zonkTcTypeToType), don't.
      Instead they whiz up an empty ZonkEnv.


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

565ef4cc036905f9f9801c1e775236bb007b026c
 compiler/ghci/RtClosureInspect.hs                  |   5 +-
 compiler/typecheck/TcDefaults.hs                   |   2 +-
 compiler/typecheck/TcHsSyn.hs                      | 277 ++++++++++++++-------
 compiler/typecheck/TcHsType.hs                     |   8 +-
 compiler/typecheck/TcInstDcls.hs                   |  11 +-
 compiler/typecheck/TcMType.hs                      |  28 ++-
 compiler/typecheck/TcPatSyn.hs                     |  13 +-
 compiler/typecheck/TcRnDriver.hs                   |   2 +-
 compiler/typecheck/TcSplice.hs                     |   2 +-
 compiler/typecheck/TcTyClsDecls.hs                 |  42 ++--
 testsuite/tests/typecheck/should_fail/T15552.hs    |  17 ++
 testsuite/tests/typecheck/should_fail/T15552a.hs   |  28 +++
 .../tests/typecheck/should_fail/T15552a.stderr     |  21 ++
 testsuite/tests/typecheck/should_fail/all.T        |   2 +
 14 files changed, 321 insertions(+), 137 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 565ef4cc036905f9f9801c1e775236bb007b026c


More information about the ghc-commits mailing list