diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-07-19 11:54:14 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-07-19 11:54:48 +0100 |
commit | ef05a363e13927ddb40f621856626e9bf2ab476e (patch) | |
tree | db5c40ed542e43ec7639e19ccfcdf21f887398a2 | |
parent | 238705797518f9e0b0314e16bc77b86405b5a9e9 (diff) | |
download | haskell-wip/spt-coreprep.tar.gz |
Add test for t16981wip/spt-coreprep
-rw-r--r-- | testsuite/tests/codeGen/should_run/T16981.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/T16981.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/T16981A.hs | 30 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/all.T | 5 |
4 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T16981.hs b/testsuite/tests/codeGen/should_run/T16981.hs new file mode 100644 index 0000000000..8f7dfb7825 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T16981.hs @@ -0,0 +1,7 @@ +module Main where + +import T16981A + +main :: IO () +main = print splitInjectedAsWindowed + diff --git a/testsuite/tests/codeGen/should_run/T16981.stdout b/testsuite/tests/codeGen/should_run/T16981.stdout new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T16981.stdout @@ -0,0 +1 @@ +1 diff --git a/testsuite/tests/codeGen/should_run/T16981A.hs b/testsuite/tests/codeGen/should_run/T16981A.hs new file mode 100644 index 0000000000..a61a42bd7d --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T16981A.hs @@ -0,0 +1,30 @@ +-- Lib.hs +{-# LANGUAGE StaticPointers #-} + +module T16981A where + +import GHC.StaticPtr + +class UniqueHash a where + hash :: a -> String + +{-# NOINLINE unCacheable #-} +unCacheable :: Cacheable a -> a +unCacheable (CExplicit _ a) = a + +data Cacheable a = CExplicit String a + +instance UniqueHash (StaticPtr a) where + hash ptr = show $ staticKey ptr + +instance IsStatic Cacheable where + fromStaticPtr ptr = CExplicit h a where + h = hash ptr + a = deRefStaticPtr ptr + +k = static 1 + +{-# NOINLINE splitInjectedAsWindowed #-} +splitInjectedAsWindowed :: Int +-- WindowedDataset +splitInjectedAsWindowed = unCacheable $ k diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 4ea31f9011..48ecbe5971 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -216,3 +216,8 @@ test('CallConv', [when(unregisterised(), skip), when(arch('x86_64'), extra_hc_opts('CallConv_x86_64.s')), when(arch('aarch64'), extra_hc_opts('CallConv_aarch64.s'))], compile_and_run, ['']) + +test('T16981', + [ omit_ways(['ghci'])], + multimod_compile_and_run, + ['T16981', '']) |