[commit: ghc] master: Prevent GND from inferring an instance context for method-less classes (03e8d26)

git at git.haskell.org git at git.haskell.org
Fri Nov 11 04:50:55 UTC 2016


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

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

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

commit 03e8d26fe0a8f7981a76550118f3c584cad76c47
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Nov 10 15:22:48 2016 -0500

    Prevent GND from inferring an instance context for method-less classes
    
    When `GeneralizedNewtypeDeriving` is used with a type class that has no
    methods, it will generate a redundant context, and as a result, it can
    trigger warnings when compiled with `-Wredundant-constraints`. This is a
    simple change in behavior to check beforehand if a class has methods
    when deriving it with GND, and if it has no methods, avoid inferring the
    redundant context.
    
    Beware that the test for #6088, which used to be expected to fail, now
    compiles without issue since it doesn't infer a problematic instance
    context.
    
    Thanks to Simon Peyton Jones for doing the necessary refactoring in
    f05d685ae05ec293083f2fa7ec7ba057fbe64869.
    
    Fixes #12814.
    
    Test Plan: ./validate
    
    Reviewers: goldfire, rwbarton, simonpj, austin, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2692
    
    GHC Trac Issues: #12814


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

03e8d26fe0a8f7981a76550118f3c584cad76c47
 compiler/typecheck/TcDeriv.hs                      |  8 ++++----
 docs/users_guide/8.2.1-notes.rst                   | 22 ++++++++++++++++++++++
 docs/users_guide/glasgow_exts.rst                  | 13 +++++++++++--
 .../T8165_fail2.hs => should_compile/T12814.hs}    |  4 ++--
 testsuite/tests/deriving/should_compile/all.T      |  1 +
 testsuite/tests/deriving/should_fail/T3621.hs      |  1 +
 testsuite/tests/deriving/should_fail/T3621.stderr  | 15 ++++++++-------
 .../{should_fail => should_compile}/T6088.hs       |  2 +-
 testsuite/tests/indexed-types/should_compile/all.T |  1 +
 .../tests/indexed-types/should_fail/T6088.stderr   |  5 -----
 testsuite/tests/indexed-types/should_fail/all.T    |  1 -
 11 files changed, 51 insertions(+), 22 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 03e8d26fe0a8f7981a76550118f3c584cad76c47


More information about the ghc-commits mailing list