Browse files

Add test for the new magic treatment of 'seq' in RULES

  • Loading branch information...
1 parent 7944b1f commit f2cdca1ff7a883e9d87d1ff342ef2b1d54ae0830 @simonpj simonpj committed Jun 25, 2009
View
16 tests/ghc-regress/simplCore/should_run/SeqRule.hs
@@ -0,0 +1,16 @@
+
+-- This test checks that the magic treatment of RULES
+-- for 'seq' works right.
+--
+-- See Note [RULES for seq] in MkId for more details
+
+module Main where
+
+{-# NOINLINE f #-}
+f x = not x
+
+{-# RULES
+ "f/seq" forall n e. seq (f n) e = True
+ #-}
+
+main = print (seq (f True) False)
View
1 tests/ghc-regress/simplCore/should_run/SeqRule.stdout
@@ -0,0 +1 @@
+True
View
2 tests/ghc-regress/simplCore/should_run/all.T
@@ -27,3 +27,5 @@ test('simplrun010', composes([extra_run_opts('24 16 8'),
# the output of -ddump-rules can be compared
test('T2486', normal, compile, [''])
test('T2756', normal, compile_and_run, [''])
+
+test('SeqRule', only_ways(['optc','optasm']), compile_and_run, [''])

0 comments on commit f2cdca1

Please sign in to comment.