summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-07-21 14:39:17 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2015-07-21 15:57:11 +0100
commit55754ea34bd42ae88121311e9d0f29e90cce8166 (patch)
tree5454d71143cba5a8923b58a93b8fdd03dd9cfbdc
parent7a6ed665dc08721cf36a39eb5c35559f7919d185 (diff)
downloadhaskell-55754ea34bd42ae88121311e9d0f29e90cce8166.tar.gz
Fix test T2497 to avoid infinite loop in RULES
-rw-r--r--testsuite/tests/typecheck/should_compile/T2497.hs6
-rw-r--r--testsuite/tests/typecheck/should_compile/T2497.stderr2
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 24933e086f..87b717ddbe 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 cd7ad8bc20..da730a05aa 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’