Suppress unused warnings for selectors for some derived classes
authorRyan Scott <ryan.gl.scott@gmail.com>
Tue, 11 Jul 2017 15:57:05 +0000 (11:57 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 11 Jul 2017 17:41:55 +0000 (13:41 -0400)
commit15fcd9adb75b95b32fbe08d066a2ada5f298d667
tree8710738f939b8da12c46a673f33367c88b420367
parent6cff2caddd9b329272a7d6965b20432e8078e0d8
Suppress unused warnings for selectors for some derived classes

Although derived `Read`, `Show`, and `Generic` instances technically
don't //use// the record selectors of the data type for which an
instance is being derived, the derived code is affected by the
//presence// of record selectors. As a result, we should suppress
`-Wunused-binds` for those record selectors when deriving these classes.
This is accomplished by threading through more information from
`hasStockDeriving`.

Test Plan: make test TEST=T13919

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13919

Differential Revision: https://phabricator.haskell.org/D3704
compiler/typecheck/TcDeriv.hs
compiler/typecheck/TcDerivUtils.hs
testsuite/tests/deriving/should_compile/T13919.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/T13919.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T