summaryrefslogtreecommitdiff
path: root/testsuite/tests/linear/should_fail/Linear17.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/linear/should_fail/Linear17.hs')
-rw-r--r--testsuite/tests/linear/should_fail/Linear17.hs34
1 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/linear/should_fail/Linear17.hs b/testsuite/tests/linear/should_fail/Linear17.hs
new file mode 100644
index 0000000000..1d8abfdb09
--- /dev/null
+++ b/testsuite/tests/linear/should_fail/Linear17.hs
@@ -0,0 +1,34 @@
+{-# LANGUAGE LinearTypes #-}
+{-# LANGUAGE UnicodeSyntax #-}
+{-# LANGUAGE RebindableSyntax #-}
+module Linear17 where
+
+-- Rebindable do notation
+
+(>>=) :: a ⊸ (a ⊸ b) ⊸ b
+(>>=) x f = f x
+
+-- `fail` is needed due to pattern matching on ();
+-- ideally, it shouldn't be there.
+fail :: a
+fail = fail
+
+incorrectDo1 = do
+ x <- ()
+ (y,z) <- ((),())
+ () <- y
+ () <- z
+ ()
+
+incorrectDo2 = do
+ x <- ()
+ (y,z) <- ((),x)
+ () <- y
+ ()
+
+incorrectDo3 = do
+ x <- ()
+ (y,z) <- (x,x)
+ () <- y
+ () <- z
+ ()