Add a test for #2222
authorIan Lynagh <ian@well-typed.com>
Fri, 1 Feb 2013 18:15:40 +0000 (18:15 +0000)
committerIan Lynagh <ian@well-typed.com>
Fri, 1 Feb 2013 18:15:40 +0000 (18:15 +0000)
testsuite/tests/th/T2222.hs [new file with mode: 0644]
testsuite/tests/th/T2222.stderr [new file with mode: 0644]
testsuite/tests/th/all.T

diff --git a/testsuite/tests/th/T2222.hs b/testsuite/tests/th/T2222.hs
new file mode 100644 (file)
index 0000000..9a97c0d
--- /dev/null
@@ -0,0 +1,36 @@
+
+{-# LANGUAGE TemplateHaskell #-}
+module ReifyPlusTypeInferenceBugs where
+
+import Language.Haskell.TH
+import System.IO
+
+a = 1
+
+b = $(do VarI _ t _ _ <- reify 'a
+         runIO $ putStrLn ("inside b: " ++ pprint t)
+         [| undefined |]) 
+
+c = $([| True |])
+
+d = $(do VarI _ t _ _ <- reify 'c
+         runIO $ putStrLn ("inside d: " ++ pprint t)
+         [| undefined |] )
+
+$(do VarI _ t _ _ <- reify 'c
+     runIO $ putStrLn ("type of c: " ++ pprint t)
+     return [] )
+
+e = $([| True |])
+
+f = $(do VarI _ t _ _ <- reify 'e
+         runIO $ putStrLn ("inside f: " ++ pprint t)
+         [| undefined |] )
+
+$(do VarI _ t _ _ <- reify 'e
+     runIO $ putStrLn ("type of e: " ++ pprint t)
+     return [] )
+
+$( runIO $ do hFlush stdout
+              hFlush stderr
+              return [] )
diff --git a/testsuite/tests/th/T2222.stderr b/testsuite/tests/th/T2222.stderr
new file mode 100644 (file)
index 0000000..7d90eb3
--- /dev/null
@@ -0,0 +1,5 @@
+inside d: t_0
+inside b: a_0
+type of c: GHC.Types.Bool
+inside f: GHC.Types.Bool
+type of e: GHC.Types.Bool
index 21464d2..9eedda7 100644 (file)
@@ -267,3 +267,4 @@ test('T7532',
      extra_clean(['T7532a.hi', 'T7532a.o']),
      multimod_compile,
      ['T7532', '-v0'])
+test('T2222', normal, compile, ['-v0'])