diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2016-11-10 15:22:48 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-11-10 15:25:40 -0500 |
commit | 03e8d26fe0a8f7981a76550118f3c584cad76c47 (patch) | |
tree | 3f42d9e3e50670384fe3271d1942f575107643ad /distrib | |
parent | e8ae4dc8558b5917f6c65ad196859783e90038bd (diff) | |
download | haskell-03e8d26fe0a8f7981a76550118f3c584cad76c47.tar.gz |
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
Diffstat (limited to 'distrib')
0 files changed, 0 insertions, 0 deletions