[commit: ghc] master: Fix TcLevel manipulation in TcDerivInfer.simplifyDeriv (261dd83)

git at git.haskell.org git at git.haskell.org
Tue Jun 26 11:09:53 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/261dd83cacec71edd551e9c581d05285c9ea3226/ghc

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

commit 261dd83cacec71edd551e9c581d05285c9ea3226
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.


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

261dd83cacec71edd551e9c581d05285c9ea3226
 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 261dd83cacec71edd551e9c581d05285c9ea3226


More information about the ghc-commits mailing list