[commit: ghc] ghc-8.6: Fix TcLevel manipulation in TcDerivInfer.simplifyDeriv (145f7c6)

git at git.haskell.org git at git.haskell.org
Wed Jun 27 21:09:39 UTC 2018


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

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/145f7c663e6df4ecfa848c0e2e478454cf9fb1d9/ghc

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

commit 145f7c663e6df4ecfa848c0e2e478454cf9fb1d9
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jun 25 17:42:57 2018 +0100

    Fix TcLevel manipulation in TcDerivInfer.simplifyDeriv
    
    The level numbers we were getting simply didn't obey the
    invariant (ImplicInv) in TcType
       Note [TcLevel and untouchable type variables]
    
    That leads to chaos. Easy to fix.  I improved the documentation.
    
    I also added an assertion in TcSimplify that checks that
    level numbers go up by 1 as we dive inside implications, so
    that we catch the problem at source rather than than through
    its obscure consequences.
    
    That in turn showed up that TcRules was also generating
    constraints that didn't obey (ImplicInv), so I fixed that too.
    I have no idea what consequences were lurking behing that
    bug, but anyway now it's fixed.  Hooray.
    
    (cherry picked from commit 261dd83cacec71edd551e9c581d05285c9ea3226)


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

145f7c663e6df4ecfa848c0e2e478454cf9fb1d9
 compiler/typecheck/TcDerivInfer.hs                 | 73 ++++++++++---------
 compiler/typecheck/TcRules.hs                      | 81 +++++++++++++---------
 compiler/typecheck/TcSimplify.hs                   | 11 +++
 testsuite/tests/quantified-constraints/T15290b.hs  | 28 ++++++++
 .../tests/quantified-constraints/T15290b.stderr    | 14 ++++
 testsuite/tests/quantified-constraints/all.T       |  1 +
 6 files changed, 144 insertions(+), 64 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 145f7c663e6df4ecfa848c0e2e478454cf9fb1d9


More information about the ghc-commits mailing list