summaryrefslogtreecommitdiff
path: root/testsuite/tests/ado
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-02-20 07:23:37 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-02-20 08:53:20 +0000
commit3259bf658662e7052ae91de2fa27baae8c84b7fa (patch)
tree787a7119b192dbe7e7c82e06efbb5cb20088f885 /testsuite/tests/ado
parent6cec90584deca4b09538e89804648435b284cff0 (diff)
downloadhaskell-3259bf658662e7052ae91de2fa27baae8c84b7fa.tar.gz
Fix a bug in ApplicativeDo (#11612)
In some cases ApplicativeDo would miss some opportunities, due to a wrong calculation of free variables in RnExpr.segments.
Diffstat (limited to 'testsuite/tests/ado')
-rw-r--r--testsuite/tests/ado/ado001.hs12
-rw-r--r--testsuite/tests/ado/ado001.stdout1
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/ado/ado001.hs b/testsuite/tests/ado/ado001.hs
index 9f8f8da752..e452cdd1f3 100644
--- a/testsuite/tests/ado/ado001.hs
+++ b/testsuite/tests/ado/ado001.hs
@@ -109,6 +109,17 @@ test10 = do
x5 <- e
return (const () (x3,x4,x5))
+-- (a | b)
+-- This demonstrated a bug in RnExpr.segments (#11612)
+test11 :: M ()
+test11 = do
+ x1 <- a
+ let x2 = x1
+ x3 <- b
+ let x4 = c
+ x5 = x4
+ return (const () (x1,x2,x3,x4))
+
main = mapM_ run
[ test1
, test2
@@ -120,6 +131,7 @@ main = mapM_ run
, test8
, test9
, test10
+ , test11
]
-- Testing code, prints out the structure of a monad/applicative expression
diff --git a/testsuite/tests/ado/ado001.stdout b/testsuite/tests/ado/ado001.stdout
index 93e300cb42..f7c48ca152 100644
--- a/testsuite/tests/ado/ado001.stdout
+++ b/testsuite/tests/ado/ado001.stdout
@@ -8,3 +8,4 @@ a; (b | (c; (d; (e | (f; g)))))
a; ((b | c) | d)
((a | (b; c)) | d) | e
((a | b); (c | d)) | e
+a | b