From 2f9931e3536caa65e40f63f76be5f0d966180411 Mon Sep 17 00:00:00 2001 From: Dominik Bollmann Date: Wed, 10 Feb 2016 10:18:29 +0100 Subject: [PATCH] add Template Haskell regression test for #9022. The bug itself has already been fixed in #10734, so this only adds another regression test (as given in the ticket). Test Plan: ./validate Reviewers: goldfire, austin, thomie, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1898 GHC Trac Issues: #9022 --- testsuite/tests/th/T9022.hs | 20 ++++++++++++++++++++ testsuite/tests/th/T9022.stdout | 2 ++ testsuite/tests/th/all.T | 1 + 3 files changed, 23 insertions(+) create mode 100644 testsuite/tests/th/T9022.hs create mode 100644 testsuite/tests/th/T9022.stdout diff --git a/testsuite/tests/th/T9022.hs b/testsuite/tests/th/T9022.hs new file mode 100644 index 0000000000..fc61691da1 --- /dev/null +++ b/testsuite/tests/th/T9022.hs @@ -0,0 +1,20 @@ +module Main where + +import Language.Haskell.TH + +main = putStrLn $ pprint foo + +foo :: Dec +foo = barD + where + barD = FunD ( mkName "bar" ) + [ Clause manyArgs (NormalB barBody) [] ] + + barBody = DoE [letxStmt, retxStmt] + letxStmt = LetS [ ValD (VarP xName) (NormalB $ LitE $ IntegerL 5) [] ] + retxStmt = NoBindS $ AppE returnVarE xVarE + xName = mkName "x" + returnVarE = VarE $ mkName "return" + xVarE = VarE xName + manyArgs = map argP [0..9] + argP n = VarP $ mkName $ "arg" ++ show n diff --git a/testsuite/tests/th/T9022.stdout b/testsuite/tests/th/T9022.stdout new file mode 100644 index 0000000000..66c6afc9f0 --- /dev/null +++ b/testsuite/tests/th/T9022.stdout @@ -0,0 +1,2 @@ +bar arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 = do {let {x = 5}; + return x} diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3d040b6e52..c0c975fd5c 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -399,3 +399,4 @@ test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) +test('T9022', normal, compile_and_run, ['-v0']) -- GitLab