summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorJakob Bruenker <jakob.bruenker@gmail.com>2022-03-29 20:06:31 +0200
committerJakob Bruenker <jakob.bruenker@gmail.com>2022-04-01 20:33:05 +0200
commit3596684e704fb4edc453ba0ae0c6c296c2812fbf (patch)
tree4d12443e49424a8a8cd16872955cfbc01cb638b3 /testsuite/tests
parentc6f77f3912a9178cf839a14c3d6ed590820d18ed (diff)
downloadhaskell-3596684e704fb4edc453ba0ae0c6c296c2812fbf.tar.gz
Fix error when using empty case in arrow notation
It was previously not possible to use -XEmptyCase in Arrow notation, since GHC would print "Exception: foldb of empty list". This is now fixed. Closes #21301
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/arrows/should_compile/T21301.hs10
-rw-r--r--testsuite/tests/arrows/should_compile/T21301.stderr1
-rw-r--r--testsuite/tests/arrows/should_compile/all.T1
3 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/arrows/should_compile/T21301.hs b/testsuite/tests/arrows/should_compile/T21301.hs
new file mode 100644
index 0000000000..52e1e5ae13
--- /dev/null
+++ b/testsuite/tests/arrows/should_compile/T21301.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE Arrows, EmptyCase #-}
+
+import Control.Arrow
+
+main = print $ baz (Just 43)
+
+baz :: ArrowChoice p => p (Maybe Int) String
+baz = proc x ->
+ (| id (case () of)
+ |) x
diff --git a/testsuite/tests/arrows/should_compile/T21301.stderr b/testsuite/tests/arrows/should_compile/T21301.stderr
new file mode 100644
index 0000000000..ac9dc11858
--- /dev/null
+++ b/testsuite/tests/arrows/should_compile/T21301.stderr
@@ -0,0 +1 @@
+T21301: T21301.hs:(8,7)-(10,6): Non-exhaustive patterns in case
diff --git a/testsuite/tests/arrows/should_compile/all.T b/testsuite/tests/arrows/should_compile/all.T
index 6d7e1b4102..781a26953b 100644
--- a/testsuite/tests/arrows/should_compile/all.T
+++ b/testsuite/tests/arrows/should_compile/all.T
@@ -18,3 +18,4 @@ test('T5283', normal, compile, [''])
test('T5333', normal, compile, [''])
test('T18950', normal, compile, [''])
test('T15175', normal, compile, [''])
+test('T21301', [exit_code(1)], compile_and_run, [''])