[commit: ghc] master: Fix #14045 by omitting an unnecessary check (d1ef223)

git at git.haskell.org git at git.haskell.org
Sat Jul 29 15:32:20 UTC 2017


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

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

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

commit d1ef223cfebd23c25489a4b0c67fbaa2f91c1ec6
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Fri Jul 28 21:43:38 2017 -0400

    Fix #14045 by omitting an unnecessary check
    
    Previously, we checked the number of patterns in a data instances
    for all data families whose kind did not end in a kind variable.
    But, of course, undersaturating instances can happen even without
    the kind ending in a kind variable. So I've omitted the arity check.
    Data families aren't as particular about their arity as type families
    are (because data families can be undersaturated). Still, this change
    degrades error messages when instances don't have the right arity;
    now, instead of reporting a simple mismatch in the number of patterns,
    GHC reports kind errors. The new errors are fully accurate, but perhaps
    not as easy to work with. Still, with the new flexibility of allowing
    data family instances with varying numbers of patterns, I don't see
    a better way.
    
    This commit also improves source fidelity in some error messages,
    requiring more changes than really are necessary. But without these
    changes, error messages around mismatched associated instance heads
    were poor.
    
    test cases: indexed-types/should_compile/T14045,
                indexed-types/should_fail/T14045a


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

d1ef223cfebd23c25489a4b0c67fbaa2f91c1ec6
 compiler/hsSyn/HsDecls.hs                          | 22 ++++---
 compiler/typecheck/TcGenDeriv.hs                   |  3 +-
 compiler/typecheck/TcHsType.hs                     | 11 ++--
 compiler/typecheck/TcInstDcls.hs                   | 12 ++--
 compiler/typecheck/TcTyClsDecls.hs                 | 76 ++++++++++++----------
 compiler/typecheck/TcValidity.hs                   | 20 +++---
 .../tests/indexed-types/should_compile/T14045.hs   | 10 +++
 testsuite/tests/indexed-types/should_compile/all.T |  1 +
 .../indexed-types/should_fail/SimpleFail1a.stderr  |  3 +-
 .../indexed-types/should_fail/SimpleFail1b.stderr  |  2 +-
 .../indexed-types/should_fail/SimpleFail2a.stderr  |  2 +-
 .../tests/indexed-types/should_fail/T14045a.hs     | 13 ++++
 .../tests/indexed-types/should_fail/T14045a.stderr |  7 ++
 testsuite/tests/indexed-types/should_fail/all.T    |  1 +
 14 files changed, 116 insertions(+), 67 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 d1ef223cfebd23c25489a4b0c67fbaa2f91c1ec6


More information about the ghc-commits mailing list