Fix #10684 by processing deriving clauses with finer grain
authorRyan Scott <ryan.gl.scott@gmail.com>
Tue, 25 Jul 2017 20:14:27 +0000 (16:14 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Tue, 25 Jul 2017 20:14:27 +0000 (16:14 -0400)
commit6bb32ba78580271921e3d5c3c98afac2c1b68de4
tree6ed5c55ec28f127d534d504829ec277b6ec5739b
parent36b270a94e689220c77ab49a863435dda6b60621
Fix #10684 by processing deriving clauses with finer grain

Summary:
Previously, one could experience error cascades with deriving clauses
when one class in a set of many failed to derive, causing the other derived
classes to be skipped entirely and resulting in other errors down the line.
The solution is to process each class in a data type's set of deriving clauses
individually, and engineer it so that failure to derive an individual class
within that set doesn't cancel out the others.

Test Plan: make test TEST="T10684 T12801"

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #10684, #12801

Differential Revision: https://phabricator.haskell.org/D3771
compiler/typecheck/TcDeriv.hs
testsuite/tests/deriving/should_fail/T10684.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T10684.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T12801.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T12801.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/all.T