[commit: testsuite] master: Test Trac #5434 and #5452 (ed6426f)

Simon Peyton Jones simonpj at microsoft.com
Fri Sep 2 10:30:52 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ed6426fd92a57d9648076483e30c54e9f24c4962

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

commit ed6426fd92a57d9648076483e30c54e9f24c4962
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Sep 2 08:52:08 2011 +0100

    Test Trac #5434 and #5452

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

 tests/th/T5434.hs     |   12 ++++++++++++
 tests/th/T5434.stderr |    4 ++++
 tests/th/T5434a.hs    |   18 ++++++++++++++++++
 tests/th/T5452.hs     |   17 +++++++++++++++++
 tests/th/all.T        |    3 +++
 5 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/tests/th/T5434.hs b/tests/th/T5434.hs
new file mode 100644
index 0000000..6304722
--- /dev/null
+++ b/tests/th/T5434.hs
@@ -0,0 +1,12 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T5434 where
+
+import T5434a
+
+$(genShadow1)
+
+v :: Bool
+v = True
+
+$(genShadow2)
diff --git a/tests/th/T5434.stderr b/tests/th/T5434.stderr
new file mode 100644
index 0000000..a13c2b6
--- /dev/null
+++ b/tests/th/T5434.stderr
@@ -0,0 +1,4 @@
+
+T5434.hs:12:3:
+    Warning: This binding for `x' shadows the existing binding
+               bound at T5434.hs:7:3
diff --git a/tests/th/T5434a.hs b/tests/th/T5434a.hs
new file mode 100644
index 0000000..f4d052c
--- /dev/null
+++ b/tests/th/T5434a.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T5434a where
+
+import Language.Haskell.TH
+
+genShadow1 :: Q [Dec]
+genShadow1 = 
+  [d| x :: Char
+      x = 'x'
+    |]
+
+genShadow2 :: Q [Dec]
+genShadow2 =
+  [d| z :: Char
+      z = succ x
+        where x = 'y'
+    |]     
diff --git a/tests/th/T5452.hs b/tests/th/T5452.hs
new file mode 100644
index 0000000..b727df5
--- /dev/null
+++ b/tests/th/T5452.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE TemplateHaskell, KindSignatures, FlexibleInstances #-}
+
+module T5452 where
+import Language.Haskell.TH
+
+class C (f :: * -> *)
+class D (f :: * -> *)
+
+instance C ((,) Int)
+
+$(do { ClassI _ [inst_dec] <- reify ''C
+     ; let InstanceD cxt (AppT _ ty) _ = inst_dec
+     ; return [InstanceD cxt
+                         (foldl AppT (ConT ''D) [ty]) 
+                         []
+              ] })
+
diff --git a/tests/th/all.T b/tests/th/all.T
index 3a64f24..9d588eb 100644
--- a/tests/th/all.T
+++ b/tests/th/all.T
@@ -204,3 +204,6 @@ test('TH_lookupName',
      extra_clean(['TH_lookupName_Lib.hi', 'TH_lookupName_Lib.o']),
      multimod_compile_and_run,
      ['TH_lookupName.hs', ''])
+test('T5452', normal, compile, ['-v0'])
+test('T5434', extra_clean(['T5434a.hi','T5434a.o']), 
+              multimod_compile, ['T5434','-v0 -Wall'])





More information about the Cvs-ghc mailing list