[Git][ghc/ghc][master] testsuite: Add tests for T22347

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon Nov 14 21:48:25 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d91db679 by Matthew Pickering at 2022-11-14T16:48:10-05:00
testsuite: Add tests for T22347

These are fixed in recent versions but might as well add regression
tests.

See #22347

- - - - -


3 changed files:

- + testsuite/tests/simplCore/should_compile/T22347.hs
- + testsuite/tests/simplCore/should_compile/T22347a.hs
- testsuite/tests/simplCore/should_compile/all.T


Changes:

=====================================
testsuite/tests/simplCore/should_compile/T22347.hs
=====================================
@@ -0,0 +1,20 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module M where
+
+import Control.Monad.ST
+import Data.Array.ST
+import Data.Array.Unboxed
+
+bfs :: Array Int [Int] -> ST s (STArray s Int ())
+bfs g = do
+    vis :: STArray s Int () <- newArray (bounds g) ()
+    ch :: STArray s Int () <- newArray (bounds g) ()
+    let go [] = pure () :: ST s ()
+        go q = do
+            flip mapM_ q $ \u -> do
+                readArray vis (head (g!u))
+                readArray ch u
+                writeArray ch u ()
+            go []
+    go []
+    pure ch


=====================================
testsuite/tests/simplCore/should_compile/T22347a.hs
=====================================
@@ -0,0 +1,20 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module M where
+
+import Control.Monad.ST
+import Data.Array.ST
+import Data.Array.Unboxed
+
+bfs :: Array Int [Int] -> ST s (STArray s Int ())
+bfs g = do
+    vis :: STArray s Int () <- newArray (bounds g) ()
+    ch :: STArray s Int () <- newArray (bounds g) ()
+    let go [] = pure () :: ST s ()
+        go q = do
+            flip mapM_ q $ \u -> do
+                readArray vis (head (g!u))
+                readArray ch u
+                writeArray ch u ()
+            go []
+    go []
+    pure ch


=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -437,6 +437,8 @@ test('T22097', [grep_errmsg(r'case.*wgoEven') ], multimod_compile, ['T22097', '-
 
 test('T13873',  [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-rules'])
 test('T22357',  normal, compile, ['-O'])
+test('T22347',  normal, compile, ['-O -fno-full-laziness'])
+test('T22347a', normal, compile, ['-O2 -fno-full-laziness'])
 
 # T17366: expecting to see a rule
 #    Rule fired: SPEC/T17366 f @(Tagged tag) @_ (T17366)



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d91db67928d1478589d98e349954800dc9a04a34

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d91db67928d1478589d98e349954800dc9a04a34
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221114/48559511/attachment-0001.html>


More information about the ghc-commits mailing list