summaryrefslogtreecommitdiff
path: root/testsuite/tests/deriving/should_fail
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-11-02 11:52:50 -0400
committerBen Gamari <ben@smart-cactus.org>2017-11-02 11:56:26 -0400
commit1317ba625d40fbd51cb0538b3fde28f412f30c01 (patch)
tree6f891bba014ae2fc3e9a94c6ecdfabb021a0bbf2 /testsuite/tests/deriving/should_fail
parent29ae83374647e227d76acd896b89590fc15590d6 (diff)
downloadhaskell-1317ba625d40fbd51cb0538b3fde28f412f30c01.tar.gz
Implement the EmptyDataDeriving proposal
This implements the `EmptyDataDeriving` proposal put forth in https://github.com/ghc-proposals/ghc-proposals/blob/dbf51608/proposals/0006-deriving-empty.rst. This has two major changes: * The introduction of an `EmptyDataDeriving` extension, which permits directly deriving `Eq`, `Ord`, `Read`, and `Show` instances for empty data types. * An overhaul in the code that is emitted in derived instances for empty data types. To see an overview of the changes brought forth, refer to the changes to the 8.4.1 release notes. Test Plan: ./validate Reviewers: bgamari, dfeuer, austin, hvr, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #7401, #10577, #13117 Differential Revision: https://phabricator.haskell.org/D4047
Diffstat (limited to 'testsuite/tests/deriving/should_fail')
-rw-r--r--testsuite/tests/deriving/should_fail/T7401_fail.hs3
-rw-r--r--testsuite/tests/deriving/should_fail/T7401_fail.stderr6
-rw-r--r--testsuite/tests/deriving/should_fail/all.T1
3 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/deriving/should_fail/T7401_fail.hs b/testsuite/tests/deriving/should_fail/T7401_fail.hs
new file mode 100644
index 0000000000..730223f179
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T7401_fail.hs
@@ -0,0 +1,3 @@
+module T7401_fail where
+
+data D deriving Eq
diff --git a/testsuite/tests/deriving/should_fail/T7401_fail.stderr b/testsuite/tests/deriving/should_fail/T7401_fail.stderr
new file mode 100644
index 0000000000..feb841f962
--- /dev/null
+++ b/testsuite/tests/deriving/should_fail/T7401_fail.stderr
@@ -0,0 +1,6 @@
+
+T7401_fail.hs:3:17: error:
+ • Can't make a derived instance of ‘Eq D’:
+ ‘D’ must have at least one data constructor
+ Use EmptyDataDeriving to enable deriving for empty data types
+ • In the data declaration for ‘D’
diff --git a/testsuite/tests/deriving/should_fail/all.T b/testsuite/tests/deriving/should_fail/all.T
index 1861e6dd0a..c9b8469c3c 100644
--- a/testsuite/tests/deriving/should_fail/all.T
+++ b/testsuite/tests/deriving/should_fail/all.T
@@ -44,6 +44,7 @@ test('T7148a', normal, compile_fail, [''])
# T7800 was removed as it was out of date re: fixing #9858
test('T5498', normal, compile_fail, [''])
test('T6147', normal, compile_fail, [''])
+test('T7401_fail', normal, compile_fail, [''])
test('T8165_fail1', normal, compile_fail, [''])
test('T8165_fail2', normal, compile_fail, [''])
test('T8851', normal, compile_fail, [''])