[commit: ghc] master: Fix test T2497 to avoid infinite loop in RULES (55754ea)

git at git.haskell.org git at git.haskell.org
Tue Jul 21 16:42:59 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/55754ea34bd42ae88121311e9d0f29e90cce8166/ghc

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

commit 55754ea34bd42ae88121311e9d0f29e90cce8166
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Jul 21 14:39:17 2015 +0100

    Fix test T2497 to avoid infinite loop in RULES


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

55754ea34bd42ae88121311e9d0f29e90cce8166
 testsuite/tests/typecheck/should_compile/T2497.hs     | 6 +++++-
 testsuite/tests/typecheck/should_compile/T2497.stderr | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/testsuite/tests/typecheck/should_compile/T2497.hs b/testsuite/tests/typecheck/should_compile/T2497.hs
index 24933e0..87b717d 100644
--- a/testsuite/tests/typecheck/should_compile/T2497.hs
+++ b/testsuite/tests/typecheck/should_compile/T2497.hs
@@ -14,9 +14,13 @@ foo x = x
 -- Trac #2213; eq should not be reported as unused
 
 eq,beq :: Eq a => a -> a -> Bool
+{-# NOINLINE [0] eq #-}
+-- The pragma and [~1] in the RULE are to prevent an infinite loo
+-- in the simplifier, where the RULE fires infinitely in its
+-- own RHS
 eq = (==)    -- Used
 beq = (==)   -- Unused
 
 {-# RULES
-    "rule 1" forall x y. x == y = y `eq` x
+    "rule 1" [~1] forall x y. x == y = y `eq` x
   #-}
diff --git a/testsuite/tests/typecheck/should_compile/T2497.stderr b/testsuite/tests/typecheck/should_compile/T2497.stderr
index cd7ad8b..da730a0 100644
--- a/testsuite/tests/typecheck/should_compile/T2497.stderr
+++ b/testsuite/tests/typecheck/should_compile/T2497.stderr
@@ -1,2 +1,2 @@
 
-T2497.hs:18:1: Warning: Defined but not used: ‘beq’
+T2497.hs:22:1: warning: Defined but not used: ‘beq’



More information about the ghc-commits mailing list