summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2022-03-21 11:24:37 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-24 06:11:19 -0400
commit21680fb05df18f4da855e1ca66e895b82cfd1e96 (patch)
tree8fba3aed6e0c7f9c98796e12fff048e078fc1fe0 /testsuite
parentc58d008c13391454ad565932593d5a46d5aeadf3 (diff)
downloadhaskell-21680fb05df18f4da855e1ca66e895b82cfd1e96.tar.gz
WorkWrap: Handle partial FUN apps in `isRecDataCon` (#21265)
Partial FUN apps like `(->) Bool` aren't detected by `splitFunTy_maybe`. A silly oversight that is easily fixed by replacing `splitFunTy_maybe` with a guard in the `splitTyConApp_maybe` case. But fortunately, Simon nudged me into rewriting the whole `isRecDataCon` function in a way that makes it much shorter and hence clearer which DataCons are actually considered as recursive. Fixes #21265.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/stranal/should_compile/T21265.hs15
-rw-r--r--testsuite/tests/stranal/should_compile/all.T1
2 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_compile/T21265.hs b/testsuite/tests/stranal/should_compile/T21265.hs
new file mode 100644
index 0000000000..d1a7c5a0b8
--- /dev/null
+++ b/testsuite/tests/stranal/should_compile/T21265.hs
@@ -0,0 +1,15 @@
+{-# LANGUAGE RankNTypes #-}
+
+module T21265 (extractorProduct') where
+
+class GSerialiseProduct f where
+ dummy :: f x -> ()
+ productExtractor :: TransFusion [] ((->) Bool) (f Int)
+
+extractorProduct' :: GSerialiseProduct f => Maybe (f Int)
+extractorProduct' = unTransFusion productExtractor go
+
+go :: f x -> Maybe (g x)
+go _ = Nothing
+
+newtype TransFusion f g a = TransFusion { unTransFusion :: forall h. Applicative h => (forall x. f x -> h (g x)) -> h a }
diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T
index 2698a3a851..47d2130346 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -83,3 +83,4 @@ test('T20817', [ grep_errmsg(r'Str') ], compile, ['-dsuppress-uniques -ddump-str
test('T21150', [ grep_errmsg(r'( t\d? :: Int)') ], compile, ['-dsuppress-uniques -ddump-exitify'])
# T21128: Check that y is not reboxed in $wtheresCrud
test('T21128', [ grep_errmsg(r'let { y = I\#') ], multimod_compile, ['T21128', '-v0 -dsuppress-uniques -dsuppress-all -ddump-simpl'])
+test('T21265', normal, compile, [''])