summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_fail
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@gmail.com>2022-03-13 16:10:21 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-19 09:07:05 -0400
commitc1f81b38625a5fea7fb8160a3a62ae6be078a7b1 (patch)
tree7c151bc71e83e587df97265fd58c7a1b45574f8d /testsuite/tests/parser/should_fail
parent7574659452a864e762fa812cb38cf15f70d85617 (diff)
downloadhaskell-c1f81b38625a5fea7fb8160a3a62ae6be078a7b1.tar.gz
Scrub partiality about `NewOrData`.
Rather than a list of constructors and a `NewOrData` flag, we define `data DataDefnCons a = NewTypeCon a | DataTypeCons [a]`, which enforces a newtype to have exactly one constructor. Closes #22070. Bump haddock submodule.
Diffstat (limited to 'testsuite/tests/parser/should_fail')
-rw-r--r--testsuite/tests/parser/should_fail/T22070.hs3
-rw-r--r--testsuite/tests/parser/should_fail/T22070.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/all.T1
3 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_fail/T22070.hs b/testsuite/tests/parser/should_fail/T22070.hs
new file mode 100644
index 0000000000..3d03eeca53
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T22070.hs
@@ -0,0 +1,3 @@
+module T22070 where
+
+newtype FooBar = Foo | Bar
diff --git a/testsuite/tests/parser/should_fail/T22070.stderr b/testsuite/tests/parser/should_fail/T22070.stderr
new file mode 100644
index 0000000000..71ff16e7b3
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/T22070.stderr
@@ -0,0 +1,4 @@
+
+T22070.hs:3:1: error: [GHC-05380]
+ A newtype must have exactly one constructor, but ‘FooBar’ has two
+ In the newtype declaration for ‘FooBar’
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index 4d70833bed..8713d91f2b 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -208,3 +208,4 @@ test('OpaqueParseFail4', normal, compile_fail, [''])
test('T20385A', normal, compile_fail, [''])
test('T20385B', normal, compile_fail, [''])
test('T16999', normal, compile_fail, [''])
+test('T22070', normal, compile_fail, [''])