[commit: ghc] master: Add regression test for #12790 (125d151)
git at git.haskell.org
git at git.haskell.org
Fri Mar 2 21:07:44 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/125d15181c7ac8d8fbaa43f799f9e3876dc2f57b/ghc
>---------------------------------------------------------------
commit 125d15181c7ac8d8fbaa43f799f9e3876dc2f57b
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date: Fri Mar 2 14:17:52 2018 -0500
Add regression test for #12790
Test Plan: make test TEST=T12790
Reviewers: bgamari, mpickering
Reviewed By: mpickering
Subscribers: mpickering, dfeuer, rwbarton, thomie, carter
GHC Trac Issues: #12790
Differential Revision: https://phabricator.haskell.org/D4412
>---------------------------------------------------------------
125d15181c7ac8d8fbaa43f799f9e3876dc2f57b
testsuite/tests/profiling/should_compile/T12790.hs | 48 ++++++++++++++++++++++
testsuite/tests/profiling/should_compile/all.T | 1 +
2 files changed, 49 insertions(+)
diff --git a/testsuite/tests/profiling/should_compile/T12790.hs b/testsuite/tests/profiling/should_compile/T12790.hs
new file mode 100644
index 0000000..3c3f7d4
--- /dev/null
+++ b/testsuite/tests/profiling/should_compile/T12790.hs
@@ -0,0 +1,48 @@
+module T12790 (list) where
+
+import Data.Foldable (asum)
+import Text.ParserCombinators.Parsec (Parser, sepBy, try)
+
+data Expr
+ = Var Fixity String
+ | App Expr Expr
+
+data Fixity = Pref | Inf
+
+cons, nil :: Expr
+cons = Var Inf ":"
+nil = Var Pref "[]"
+
+brackets :: Parser a -> Parser a
+brackets = undefined
+
+symbol :: String -> Parser String
+symbol = undefined
+
+list :: Parser Expr
+list = asum (map (try . brackets) plist) where
+ plist = [
+ foldr (\e1 e2 -> cons `App` e1 `App` e2) nil `fmap`
+ (myParser False `sepBy` symbol ","),
+ do e <- myParser False
+ _ <- symbol ".."
+ return $ Var Pref "enumFrom" `App` e,
+ do e <- myParser False
+ _ <- symbol ","
+ e' <- myParser False
+ _ <- symbol ".."
+ return $ Var Pref "enumFromThen" `App` e `App` e',
+ do e <- myParser False
+ _ <- symbol ".."
+ e' <- myParser False
+ return $ Var Pref "enumFromTo" `App` e `App` e',
+ do e <- myParser False
+ _ <- symbol ","
+ e' <- myParser False
+ _ <- symbol ".."
+ e'' <- myParser False
+ return $ Var Pref "enumFromThenTo" `App` e `App` e' `App` e''
+ ]
+
+myParser :: Bool -> Parser Expr
+myParser = undefined
diff --git a/testsuite/tests/profiling/should_compile/all.T b/testsuite/tests/profiling/should_compile/all.T
index 155206a..1ebcb07 100644
--- a/testsuite/tests/profiling/should_compile/all.T
+++ b/testsuite/tests/profiling/should_compile/all.T
@@ -5,3 +5,4 @@ test('prof002', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof
test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -fprof-cafs'])
test('T5889', [only_ways(['normal']), req_profiling, extra_files(['T5889/A.hs', 'T5889/B.hs'])], multimod_compile, ['A B', '-O -prof -fno-prof-count-entries -v0'])
+test('T12790', [only_ways(['normal']), req_profiling], compile, ['-O -prof'])
More information about the ghc-commits
mailing list