diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2022-03-21 11:24:37 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-24 06:11:19 -0400 |
commit | 21680fb05df18f4da855e1ca66e895b82cfd1e96 (patch) | |
tree | 8fba3aed6e0c7f9c98796e12fff048e078fc1fe0 /testsuite | |
parent | c58d008c13391454ad565932593d5a46d5aeadf3 (diff) | |
download | haskell-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.hs | 15 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/all.T | 1 |
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, ['']) |