Commit 5592baae authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add tests for Trac #2597

parent e1481671
{-# LANGUAGE TemplateHaskell #-}
-- Test Trac #2597 (first bug)
module ShouldCompile where
import T2597a_Lib
bug = $mkBug
{-# LANGUAGE TemplateHaskell #-}
-- Library module for T2597a
module T2597a_Lib where
import Language.Haskell.TH
mkBug :: ExpQ
mkBug = return $ CompE [BindS (VarP $ mkName "p") (ListE []), NoBindS
(VarE $ mkName "p")]
{-# LANGUAGE TemplateHaskell #-}
-- Test Trac #2597 (second bug)
module ShouldCompile where
import T2597b_Lib
bug2 = $mkBug2
T2597b.hs:8:7:
Empty stmt list in do-block
When splicing generated code into the program
When splicing TH expression: DoE []
In the expression: $mkBug2
In the definition of `bug2': bug2 = $mkBug2
{-# LANGUAGE TemplateHaskell #-}
-- Library module for T2597b
module T2597b_Lib where
import Language.Haskell.TH
mkBug2 :: ExpQ
mkBug2 = return $ DoE []
......@@ -66,6 +66,16 @@ test('TH_spliceDecl4',
multimod_compile,
['TH_spliceDecl4', '-v0'])
test('T2597a',
extra_clean(['T2597a_Lib.hi', 'T2597a_Lib.o']),
multimod_compile,
['T2597a', '-v0'])
test('T2597b',
extra_clean(['T2597b_Lib.hi', 'T2597b_Lib.o']),
multimod_compile_fail,
['T2597b', '-v0'])
test('TH_spliceE1', normal, compile_and_run, [''])
test('TH_spliceExpr1', normal, compile, ['-v0'])
test('TH_spliceE3', normal, compile, ['-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