[commit: testsuite] master: Test Trac #7064 (106fec1)
Simon Peyton Jones
simonpj at microsoft.com
Wed Aug 15 15:48:19 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/106fec10204d00b59d25eaa8fed474150c1b2dd4
>---------------------------------------------------------------
commit 106fec10204d00b59d25eaa8fed474150c1b2dd4
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Aug 15 14:44:09 2012 +0100
Test Trac #7064
>---------------------------------------------------------------
tests/{driver/recomp009/Main.hs => th/T7064.hs} | 9 +++++-
tests/th/T7064.stdout | 26 ++++++++++++++++++++
tests/th/T7064a.hs | 29 +++++++++++++++++++++++
tests/th/all.T | 4 +++
4 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/tests/driver/recomp009/Main.hs b/tests/th/T7064.hs
similarity index 55%
copy from tests/driver/recomp009/Main.hs
copy to tests/th/T7064.hs
index b5e5424..2ce08c1 100644
--- a/tests/driver/recomp009/Main.hs
+++ b/tests/th/T7064.hs
@@ -1,4 +1,9 @@
{-# LANGUAGE TemplateHaskell #-}
+
module Main where
-import Sub
-main = print $x
+
+import T7064a
+
+$(decls)
+
+main = hsToTh
diff --git a/tests/th/T7064.stdout b/tests/th/T7064.stdout
new file mode 100644
index 0000000..1231861
--- /dev/null
+++ b/tests/th/T7064.stdout
@@ -0,0 +1,26 @@
+f1_0 x_1 = 1
+f2_0 x_1 = 2
+f3_0 x_1 = 3
+{-# INLINE f1_0 #-}
+{-# INLINE [2] f2_0 #-}
+{-# INLINE CONLIKE [~2] f3_0 #-}
+g1_0 x_1 = 1
+g2_0 x_1 = 2
+g3_0 x_1 = 3
+{-# SPECIALISE g1_0 :: GHC.Types.Int -> GHC.Types.Int #-}
+{-# SPECIALISE [2] g2_0 :: GHC.Types.Int -> GHC.Types.Int #-}
+{-# SPECIALISE INLINE [~2] g3_0 ::
+ GHC.Types.Int -> GHC.Types.Int #-}
+data T_0 a_1 = T_2 a_1
+instance GHC.Classes.Eq a_0 => GHC.Classes.Eq (T_1 a_0)
+ where GHC.Classes.== (T_2 x_3) (T_2 y_4) = x_3 GHC.Classes.== y_4
+ {-# SPECIALISE instance GHC.Classes.Eq (T_1 GHC.Types.Int) #-}
+{-# RULES "rule1"
+ GHC.Real.fromIntegral
+ = GHC.Base.id :: forall a_0 . a_0 -> a_0 #-}
+{-# RULES "rule2" [1]
+ forall (x_1627391611 :: a_1627391612) . GHC.Real.fromIntegral x_1627391611
+ = x_1627391611 #-}
+{-# RULES "rule3" [~1]
+ forall (x_1627391609 :: a_1627391610) . GHC.Real.fromIntegral x_1627391609
+ = x_1627391609 #-}
diff --git a/tests/th/T7064a.hs b/tests/th/T7064a.hs
new file mode 100644
index 0000000..a61201d
--- /dev/null
+++ b/tests/th/T7064a.hs
@@ -0,0 +1,29 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module T7064a (decls, hsToTh) where
+
+import Language.Haskell.TH
+
+decls = [d|
+ f1 x = 1; f2 x = 2; f3 x = 3
+ {-# INLINE f1 #-}
+ {-# INLINE [2] f2 #-}
+ {-# INLINE CONLIKE [~2] f3 #-}
+ g1 x = 1; g2 x = 2; g3 x = 3
+ {-# SPECIALISE g1 :: Int -> Int #-}
+ {-# SPECIALISE [2] g2 :: Int -> Int #-}
+ {-# SPECIALISE INLINE [~2] g3 :: Int -> Int #-}
+ data T a = T a
+ instance Eq a => Eq (T a) where
+ {-# SPECIALISE instance Eq (T Int) #-}
+ (T x) == (T y) = x == y
+ {-# RULES
+ "rule1" fromIntegral = id :: a -> a ;
+ "rule2" [1] forall (x :: a) . fromIntegral x = x ;
+ "rule3" [~1] forall (x :: a) . fromIntegral x = x
+ #-}
+ |]
+
+hsToTh = do
+ decls' <- runQ decls
+ mapM (print . ppr) decls'
diff --git a/tests/th/all.T b/tests/th/all.T
index 76b8041..1f0dee0 100644
--- a/tests/th/all.T
+++ b/tests/th/all.T
@@ -246,3 +246,7 @@ test('T6005a', normal, compile, ['-v0'])
test('T5737', normal, compile, ['-v0'])
test('T6114', normal, compile_fail, ['-v0 -dsuppress-uniques'])
test('TH_StringPrimL', normal, compile_and_run, [''])
+test('T7064',
+ extra_clean(['T7064a.hi', 'T7064a.o']),
+ multimod_compile_and_run,
+ ['T7064.hs', '-v0'])
More information about the Cvs-ghc
mailing list