Test Trac #7092
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 28 Aug 2012 12:31:57 +0000 (13:31 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 28 Aug 2012 12:31:57 +0000 (13:31 +0100)
testsuite/tests/th/T7092.hs [new file with mode: 0644]
testsuite/tests/th/T7092a.hs [new file with mode: 0644]
testsuite/tests/th/all.T

diff --git a/testsuite/tests/th/T7092.hs b/testsuite/tests/th/T7092.hs
new file mode 100644 (file)
index 0000000..78c4a78
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -fwarn-name-shadowing #-}
+
+-- Should not produce a name-shadowing warning (GHC 7.4 did)
+
+module T7092 where
+
+import T7092a
+
+blah = $(code)
diff --git a/testsuite/tests/th/T7092a.hs b/testsuite/tests/th/T7092a.hs
new file mode 100644 (file)
index 0000000..abe7931
--- /dev/null
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T7092a where
+
+import Language.Haskell.TH
+
+code :: Q Exp
+code = do
+  n1 <- newName "foo"
+  n2 <- newName "foo"
+  letE [valD (varP n1) (normalB [| (1 :: Int) |]) []] 
+       $ letE [valD (varP n2) (normalB [| (2 :: Int) |]) []] 
+       $ appE (appE [| ((+) :: Int -> Int -> Int)|] (varE n1)) (varE n2)
index 1f0dee0..46cdc59 100644 (file)
@@ -250,3 +250,5 @@ test('T7064',
      extra_clean(['T7064a.hi', 'T7064a.o']),
      multimod_compile_and_run,
      ['T7064.hs', '-v0'])
+test('T7092', extra_clean(['T7092a.hi','T7092a.o']),
+              multimod_compile, ['T7092','-v0'])