summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-04-27 17:24:45 +0100
committerMatthew Pickering <matthewtpickering@gmail.com>2022-04-29 11:13:26 +0100
commitb99e5b7f2a383238afbc018187b2062a2514f2f8 (patch)
tree43b6d0201f09a561af4c00ad24d90aadddc47380
parenta8b47caddb41a970e9ac4c358127523daa1ff101 (diff)
downloadhaskell-wip/revert-inlining.tar.gz
Add test for T21229wip/revert-inlining
-rw-r--r--testsuite/tests/simplCore/should_run/T21229.hs24
-rw-r--r--testsuite/tests/simplCore/should_run/T21229.stdout1
-rw-r--r--testsuite/tests/simplCore/should_run/all.T1
3 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_run/T21229.hs b/testsuite/tests/simplCore/should_run/T21229.hs
new file mode 100644
index 0000000000..c5e22f6773
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T21229.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeApplications #-}
+{-# LANGUAGE AllowAmbiguousTypes #-}
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE KindSignatures #-}
+module Main where
+
+data B = T | F deriving Show
+
+class Sing (b :: B) where sing :: B
+instance Sing 'T where sing = T
+instance Sing 'F where sing = F
+
+f :: forall a. Sing a => Int -> (Int -> B -> B) -> B
+f 0 g = g 0 (sing @a)
+f n g = f @a (n-1) g
+
+h :: forall a. Sing a => Int -> (Int -> B -> B) -> B
+h = case sing @a of
+ T -> f @'T
+ F -> f @a
+{-# NOINLINE h #-}
+
+main = print $ h @'T 0 (\ _ a -> a)
diff --git a/testsuite/tests/simplCore/should_run/T21229.stdout b/testsuite/tests/simplCore/should_run/T21229.stdout
new file mode 100644
index 0000000000..62a6e3c9df
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T21229.stdout
@@ -0,0 +1 @@
+T
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index 54ec5b8bff..34e7e2e386 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -101,3 +101,4 @@ test('T19569', [only_ways(['optasm']),extra_run_opts('True 1000000')], compile_a
test('T20203', normal, compile, ['-O -dsuppress-all -dsuppress-uniques -dno-typeable-binds -ddump-simpl'])
test('T19313', normal, compile_and_run, [''])
test('UnliftedArgRule', normal, compile_and_run, [''])
+test('T21229', normal, compile_and_run, ['-O'])