summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-23 12:11:14 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-01 15:48:37 -0400
commitc751082ca0946f8686453fa2a775809fd027c9c7 (patch)
tree6f2ca8e4f891fae2c6b36cc82d9e2a8519b54322
parent51067194e03849eb0c04e1dbaf829972ea64be53 (diff)
downloadhaskell-c751082ca0946f8686453fa2a775809fd027c9c7.tar.gz
testsuite: Make ExplicitForAllRules1 more robust
Previously the test relied on `id` not inlining. Fix this.
-rw-r--r--testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs14
-rw-r--r--testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr12
2 files changed, 15 insertions, 11 deletions
diff --git a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs
index 7862468d17..bf3fab4efb 100644
--- a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs
+++ b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.hs
@@ -14,20 +14,24 @@ import Data.Kind
{-# RULES
"example" forall a b. forall. map @a @b f = f
-"example2" forall a. forall (x :: a). id x = x
+"example2" forall a. forall (x :: a). id' x = x
#-}
{-# NOINLINE f #-}
f :: a -> b
f = undefined
+id' :: a -> a
+id' x = x
+{-# NOINLINE id' #-}
+
-- More tests
{-# RULES
"example3" forall (a :: Type -> Type) (b :: a Int) c. forall x y. g @(Proxy b) @(Proxy c) x y = ()
-"example4" forall (a :: Bool) (b :: Proxy a). forall x. g @(Proxy b) @() x = id @()
-"example5" forall (a :: Type). forall. h @a = id @a
-"example5" forall k (c :: k). forall (x :: Proxy c). id @(Proxy c) x = x
+"example4" forall (a :: Bool) (b :: Proxy a). forall x. g @(Proxy b) @() x = id' @()
+"example5" forall (a :: Type). forall. h @a = id' @a
+"example5" forall k (c :: k). forall (x :: Proxy c). id' @(Proxy c) x = x
#-}
{-# NOINLINE g #-}
@@ -42,4 +46,4 @@ h x = x
{-# RULES "example6" forall a forall. g a forall = () #-}
-- Should generate a warning
-{-# RULES "example7" forall a b. forall (x :: a). id x = x #-}
+{-# RULES "example7" forall a b. forall (x :: a). id' x = x #-}
diff --git a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
index f5c06a654a..5dfdb4a570 100644
--- a/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
+++ b/testsuite/tests/rename/should_compile/ExplicitForAllRules1.stderr
@@ -1,14 +1,14 @@
-ExplicitForAllRules1.hs:45:11: warning:
+ExplicitForAllRules1.hs:49:11: warning:
Forall'd type variable ‘k’ is not bound in RULE lhs
Orig bndrs: [k, a, b, x]
- Orig lhs: id @ a x
- optimised lhs: id @ a x
+ Orig lhs: id' @ a x
+ optimised lhs: id' @ a x
Forall'd type variable ‘b’ is not bound in RULE lhs
Orig bndrs: [k, a, b, x]
- Orig lhs: id @ a x
- optimised lhs: id @ a x
+ Orig lhs: id' @ a x
+ optimised lhs: id' @ a x
-ExplicitForAllRules1.hs:45:31: warning: [-Wunused-foralls (in -Wextra)]
+ExplicitForAllRules1.hs:49:31: warning: [-Wunused-foralls (in -Wextra)]
Unused quantified type variable ‘b’
in the rule "example7"