summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-09-23 12:11:14 -0400
committerBen Gamari <ben@smart-cactus.org>2019-10-31 17:03:26 -0400
commit8c44138aab38bbcc3c380391a533797950b57968 (patch)
treeeccfc4449cfd3d2e62da08716945f9a9cf70a3c9
parentfba5b1ffc6d677fe56b3aa569ed75cb3b42bd9b2 (diff)
downloadhaskell-8c44138aab38bbcc3c380391a533797950b57968.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"