[commit: ghc] ghc-8.2: Fix subtle bug in TcTyClsDecls.mkGADTVars (8fda8ad)

git at git.haskell.org git at git.haskell.org
Tue Sep 19 21:10:38 UTC 2017


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

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/8fda8aded0d2194bddbaaed43256d0e3d0632fe2/ghc

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

commit 8fda8aded0d2194bddbaaed43256d0e3d0632fe2
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.
    
    (cherry picked from commit 3a27e34f7a59a30f91fad9dd2ca194acdb1bcb1a)


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

8fda8aded0d2194bddbaaed43256d0e3d0632fe2
 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 8fda8aded0d2194bddbaaed43256d0e3d0632fe2


More information about the ghc-commits mailing list