add Template Haskell regression test for #9022.
authorDominik Bollmann <bollmann@seas.upenn.edu>
Wed, 10 Feb 2016 09:18:29 +0000 (10:18 +0100)
committerBen Gamari <ben@smart-cactus.org>
Wed, 10 Feb 2016 10:09:47 +0000 (11:09 +0100)
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 [new file with mode: 0644]
testsuite/tests/th/T9022.stdout [new file with mode: 0644]
testsuite/tests/th/all.T

diff --git a/testsuite/tests/th/T9022.hs b/testsuite/tests/th/T9022.hs
new file mode 100644 (file)
index 0000000..fc61691
--- /dev/null
@@ -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 (file)
index 0000000..66c6afc
--- /dev/null
@@ -0,0 +1,2 @@
+bar arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 = do {let {x = 5};
+                                                            return x}
index 3d040b6..c0c975f 100644 (file)
@@ -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'])