[commit: ghc] master: add Template Haskell regression test for #9022. (2f9931e)

git at git.haskell.org git at git.haskell.org
Wed Feb 10 10:19:36 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2f9931e3536caa65e40f63f76be5f0d966180411/ghc

>---------------------------------------------------------------

commit 2f9931e3536caa65e40f63f76be5f0d966180411
Author: Dominik Bollmann <bollmann at seas.upenn.edu>
Date:   Wed Feb 10 10:18:29 2016 +0100

    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


>---------------------------------------------------------------

2f9931e3536caa65e40f63f76be5f0d966180411
 testsuite/tests/th/T9022.hs     | 20 ++++++++++++++++++++
 testsuite/tests/th/T9022.stdout |  2 ++
 testsuite/tests/th/all.T        |  1 +
 3 files changed, 23 insertions(+)

diff --git a/testsuite/tests/th/T9022.hs b/testsuite/tests/th/T9022.hs
new file mode 100644
index 0000000..fc61691
--- /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 0000000..66c6afc
--- /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 3d040b6..c0c975f 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'])



More information about the ghc-commits mailing list