[commit: ghc] master: Fix nasty bug in the type free-var finder, at last (503514b)

git at git.haskell.org git at git.haskell.org
Fri Oct 26 13:05:05 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/503514b94f8dc7bd9eab5392206649aee45f140b/ghc

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

commit 503514b94f8dc7bd9eab5392206649aee45f140b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Oct 26 11:54:20 2018 +0100

    Fix nasty bug in the type free-var finder, at last
    
    Consider the type
      forall k. b -> k
    where
      b :: k -> Type
    
    Here the 'k' in b's kind must be a different 'k' to the forall k,
    because 'b' is free in the expression.  So we must return 'k'
    among the free vars returned from tyCoVarsOfType applied that
    type.  But we weren't.
    
    This is an outright bug, although we don't have a program that
    fails because of it.
    
    It's easy to fix, too: see TyCoRep
      Note [Closing over free variable kinds]
    
    This fix has been in the pipeline for ages because it fell into
    the Trac #14880 swamp.  But this patch nails it.


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

503514b94f8dc7bd9eab5392206649aee45f140b
 compiler/types/TyCoRep.hs                          | 106 ++++++++++++++++++---
 .../partial-sigs/should_compile/T12844.stderr      |   2 +-
 .../partial-sigs/should_compile/T15039a.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039b.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039c.stderr     |   2 +-
 .../partial-sigs/should_compile/T15039d.stderr     |   2 +-
 .../tests/partial-sigs/should_run/T15415.stderr    |   8 +-
 testsuite/tests/polykinds/T14265.stderr            |   2 +-
 8 files changed, 104 insertions(+), 22 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 503514b94f8dc7bd9eab5392206649aee45f140b


More information about the ghc-commits mailing list