[commit: ghc] master: Fix subtle bug in TcTyClsDecls.mkGADTVars (3a27e34)

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


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a/ghc

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

commit 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Sat Sep 2 18:13:32 2017 +0100

    Fix subtle bug in TcTyClsDecls.mkGADTVars
    
    This bug was revealed by Trac #14162.  In a GADT-style data-family
    instance we ended up a data constructor whose type mentioned
    an out-of-scope variable.  (This variable was in the kind of
    a variable in the kind of a variable.)
    
    Only Lint complained about this (actually only when the
    data constructor was injected into the bindings by CorePrep).
    So it doesn't matter much -- but it's a solid bug and might
    bite us some day.
    
    It took me quite a while to unravel because the test case was itself
    quite tricky.  But the fix is easy; just add a missing binding to the
    substitution we are building up.  It's in the regrettably-subtle
    mkGADTVars function.


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

3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a
 compiler/typecheck/TcTyClsDecls.hs                 | 82 ++++++++++++++--------
 .../tests/indexed-types/should_compile/T14162.hs   | 41 +++++++++++
 testsuite/tests/indexed-types/should_compile/all.T |  1 +
 3 files changed, 94 insertions(+), 30 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 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a


More information about the ghc-commits mailing list