[commit: ghc] ghc-8.0: Fix two cloning-related bugs (c4e94cd)

git at git.haskell.org git at git.haskell.org
Wed Jan 27 12:05:12 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/c4e94cd3f1742cc5e2b8391d151fef2fc9f8fdbe/ghc

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

commit c4e94cd3f1742cc5e2b8391d151fef2fc9f8fdbe
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jan 26 09:30:50 2016 +0000

    Fix two cloning-related bugs
    
    Crikey!  Not just one but two bugs in type variable cloning,
    both dating from the days before PolyKinds.  Both were shown up
    by Trac #11330.
    
    1. In SetLevels, when floating a case expression we must clone its
       binders, *and* do so in a telescope-aware way, because the
       constructor may bind a kind variable that appears in the kind
       of a type variable.
    
       Instead of doing this (wrongly) by steam, call CoreSubst.cloneBndrs.
    
       I added Notes and did other refactoring at the same time.
    
    2. It turned out that CoreSubst.cloneBndrs calls TyCoRep.cloneTyVarBndr,
       and that too was bogus!  It didn't substitute in the kind of the
       TyVar being cloned.  There was even a comment to say "variables can't
       appear in kinds".  Thta hasn't been true for a long time now.
    
    Easily fixed.
    
    Interestingly, I then found that test
       dependent/should_compile/KindEqualities
    was emitting a new inexhaustive-pattern-match warning.  Sure enough
    it was valid!  So the lack of cloning in cloneTyVarBndr really was
    causing an observable bug; just one that we had not observed.
    
    (cherry picked from commit 016a0bd1ba129134dfa612db0d96e01644fa7b9f)


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

c4e94cd3f1742cc5e2b8391d151fef2fc9f8fdbe
 compiler/simplCore/SetLevels.hs                    | 84 +++++++++++++---------
 compiler/types/TyCoRep.hs                          | 21 +++---
 .../dependent/should_compile/KindEqualities.stderr |  5 ++
 3 files changed, 69 insertions(+), 41 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 c4e94cd3f1742cc5e2b8391d151fef2fc9f8fdbe


More information about the ghc-commits mailing list