Add a test for orElse bug
authorSimon Marlow <marlowsd@gmail.com>
Mon, 10 Dec 2012 12:18:33 +0000 (12:18 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Mon, 10 Dec 2012 12:18:33 +0000 (12:18 +0000)
Fixed in GHC commit f184d9caffa09750ef6a374a7987b9213d6db28e, see that
for more details.

tests/stm064.hs [new file with mode: 0644]
tests/stm064.stdout [new file with mode: 0644]

diff --git a/tests/stm064.hs b/tests/stm064.hs
new file mode 100644 (file)
index 0000000..a8ff170
--- /dev/null
@@ -0,0 +1,8 @@
+import Control.Concurrent.STM
+main = do
+  x <- atomically $ do
+         t <- newTVar 1
+         writeTVar t 2
+         ((readTVar t >> retry) `orElse` return ()) `orElse` return ()
+         readTVar t
+  print x
diff --git a/tests/stm064.stdout b/tests/stm064.stdout
new file mode 100644 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2