summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2022-11-17 15:15:55 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-11-19 03:23:24 -0500
commit4b6251ab421add0f2ac476673e5e7f6291d1539f (patch)
tree19bf100245c270f3bd2bed0a353a53b6f6da5a5c /testsuite
parent9fd11585eb475a45267a86256a239b9b42eebd4e (diff)
downloadhaskell-4b6251ab421add0f2ac476673e5e7f6291d1539f.tar.gz
Be more careful when reporting unbound RULE binders
See Note [Variables unbound on the LHS] in GHC.HsToCore.Binds. Fixes #22471.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/T22471.hs13
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T22471.hs b/testsuite/tests/simplCore/should_compile/T22471.hs
new file mode 100644
index 0000000000..8da285a4c6
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T22471.hs
@@ -0,0 +1,13 @@
+{-# OPTIONS_GHC -Wno-inline-rule-shadowing #-}
+-- Otherwise we get stuff about (+) may inline, which is
+-- true enough, but not the point of this test
+
+module T22471 where
+
+foo :: (forall a. [a] -> Int) -> Int
+foo len = len [1,2,3] + len "abc"
+
+{-# RULES "foo" forall (f :: forall a. [a] -> Int).
+ foo (\xs -> 1 + f xs) = 2 + foo f #-}
+
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 583acbc47d..1c169d7d6e 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -437,6 +437,7 @@ test('T22097', [grep_errmsg(r'case.*wgoEven') ], multimod_compile, ['T22097', '-
test('T13873', [ grep_errmsg(r'SPEC') ], compile, ['-O -ddump-rules'])
test('T22357', normal, compile, ['-O'])
+test('T22471', normal, compile, ['-O'])
test('T22347', normal, compile, ['-O -fno-full-laziness'])
test('T22347a', normal, compile, ['-O2 -fno-full-laziness'])