Commit 2f9931e3 authored by bollmann's avatar bollmann Committed by Ben Gamari

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
parent 7953b27c
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
bar arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 arg8 arg9 = do {let {x = 5};
return x}
......@@ -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'])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment