[commit: ghc] master: Fix two more bugs in partial signatures (1577908)

git at git.haskell.org git at git.haskell.org
Wed Jan 10 08:20:58 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1577908f2a9db0fcf6f749d40dd75481015f5497/ghc

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

commit 1577908f2a9db0fcf6f749d40dd75481015f5497
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jan 9 16:20:46 2018 +0000

    Fix two more bugs in partial signatures
    
    These were shown up by Trac #14643
    
    Bug 1: if we had a single partial signature for
    two functions
       f, g :: forall a. _ -> a
    then we made two different SigTvs but with the sane Name.
    This was jolly confusing and ultimately led to deeply bogus
    results with Any's appearing in the resulting program. Yikes.
    Fix: clone the quantified variables in TcSigs.tcInstSig (as
    indeed its name suggests).
    
    Bug 2: we were not eliminating duplicate/superclass constraints
    in the partial signatures of a mutually recursive group.
    
    Easy to fix: we are already doing dup/superclass elim in
    TcSimplify.decideQuantification.  So we move the partial-sig
    constraints there too.


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

1577908f2a9db0fcf6f749d40dd75481015f5497
 compiler/typecheck/TcHsType.hs                     | 10 ++---
 compiler/typecheck/TcMType.hs                      | 34 +++++++++-------
 compiler/typecheck/TcSigs.hs                       | 24 ++++++++++--
 compiler/typecheck/TcSimplify.hs                   | 45 +++++++++++++---------
 .../tests/partial-sigs/should_compile/T14643.hs    |  9 +++++
 .../partial-sigs/should_compile/T14643.stderr      |  8 ++++
 .../tests/partial-sigs/should_compile/T14643a.hs   |  9 +++++
 .../partial-sigs/should_compile/T14643a.stderr     |  8 ++++
 testsuite/tests/partial-sigs/should_compile/all.T  |  7 +++-
 .../tests/partial-sigs/should_fail/T14040a.stderr  |  2 +-
 testsuite/tests/partial-sigs/should_fail/all.T     |  2 +-
 11 files changed, 113 insertions(+), 45 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 1577908f2a9db0fcf6f749d40dd75481015f5497


More information about the ghc-commits mailing list