Error when deriving instances in hs-boot files
authorRyan Scott <ryan.gl.scott@gmail.com>
Thu, 19 Oct 2017 14:21:17 +0000 (10:21 -0400)
committerRyan Scott <ryan.gl.scott@gmail.com>
Thu, 19 Oct 2017 14:21:17 +0000 (10:21 -0400)
commit101a8c770b9d3abd57ff289bffea3d838cf25c80
tree06a8a10674970562d4d07555f3c51653c5270662
parente023e78bc13ffae168f00a52324fc406a146b40f
Error when deriving instances in hs-boot files

Summary:
According to the GHC users' guide, one cannot derive
instances for data types in `.hs-boot` files.
However, GHC was not enforcing this in practice, which led to
#14365.

Fix this by actually throwing an error if a derived instance is
detected in an `.hs-boot` file (and recommend how to fix it in the
error message.)

Test Plan: make test TEST=T14365

Reviewers: ezyang, austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, rwbarton, thomie

GHC Trac Issues: #14365

Differential Revision: https://phabricator.haskell.org/D4102
compiler/typecheck/TcDeriv.hs
testsuite/tests/deriving/should_fail/T14365.stderr [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T14365A.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T14365B.hs [new file with mode: 0644]
testsuite/tests/deriving/should_fail/T14365B.hs-boot [new file with mode: 0644]
testsuite/tests/deriving/should_fail/all.T
testsuite/tests/deriving/should_fail/drvfail016.stderr