[commit: ghc] master: Fix two cloning-related bugs (016a0bd)

git at git.haskell.org git at git.haskell.org
Tue Jan 26 10:48:46 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/016a0bd1ba129134dfa612db0d96e01644fa7b9f/ghc

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

commit 016a0bd1ba129134dfa612db0d96e01644fa7b9f
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.


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

016a0bd1ba129134dfa612db0d96e01644fa7b9f
 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 016a0bd1ba129134dfa612db0d96e01644fa7b9f


More information about the ghc-commits mailing list