From 125d15181c7ac8d8fbaa43f799f9e3876dc2f57b Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Fri, 2 Mar 2018 14:17:52 -0500 Subject: [PATCH] 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 --- .../tests/profiling/should_compile/T12790.hs | 48 +++++++++++++++++++ .../tests/profiling/should_compile/all.T | 1 + 2 files changed, 49 insertions(+) create mode 100644 testsuite/tests/profiling/should_compile/T12790.hs diff --git a/testsuite/tests/profiling/should_compile/T12790.hs b/testsuite/tests/profiling/should_compile/T12790.hs new file mode 100644 index 0000000000..3c3f7d487e --- /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 155206ab7b..1ebcb07be4 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']) -- GitLab