Add a test for Trac #15523
authorKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Wed, 15 Aug 2018 14:49:32 +0000 (16:49 +0200)
committerKrzysztof Gogolewski <krz.gogolewski@gmail.com>
Wed, 15 Aug 2018 14:49:32 +0000 (16:49 +0200)
Summary: Fortunately the bug is not present in master.

Test Plan: make test TEST=T15523

Reviewers: bgamari, RyanGlScott

Reviewed By: RyanGlScott

Subscribers: RyanGlScott, rwbarton, carter

GHC Trac Issues: #15523

Differential Revision: https://phabricator.haskell.org/D5070

testsuite/tests/typecheck/should_fail/T15523.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T15523.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/typecheck/should_fail/T15523.hs b/testsuite/tests/typecheck/should_fail/T15523.hs
new file mode 100644 (file)
index 0000000..89b1bb4
--- /dev/null
@@ -0,0 +1,6 @@
+{-# LANGUAGE StrictData #-}
+
+module T15523 where
+
+newtype Duration = Foo
+data Literal = LitDuration Duration
diff --git a/testsuite/tests/typecheck/should_fail/T15523.stderr b/testsuite/tests/typecheck/should_fail/T15523.stderr
new file mode 100644 (file)
index 0000000..83b7cdb
--- /dev/null
@@ -0,0 +1,6 @@
+
+T15523.hs:5:20: error:
+    • The constructor of a newtype must have exactly one field
+        but ‘Foo’ has none
+    • In the definition of data constructor ‘Foo’
+      In the newtype declaration for ‘Duration’
index 72023d2..962ffb7 100644 (file)
@@ -477,3 +477,4 @@ test('T15067', normal, compile_fail, [''])
 test('T15330', normal, compile_fail, [''])
 test('T15361', normal, compile_fail, [''])
 test('T15438', normal, compile_fail, [''])
+test('T15523', normal, compile_fail, ['-O'])