summaryrefslogtreecommitdiff
path: root/testsuite/tests/codeGen
diff options
context:
space:
mode:
authorFacundo Domínguez <facundo.dominguez@tweag.io>2017-01-02 19:42:20 -0300
committerFacundo Domínguez <facundo.dominguez@tweag.io>2017-01-06 14:15:27 -0300
commite5d1ed9c8910839e109da59820ca793642961284 (patch)
treec155bdae247d53c73ca1007e69d2da0d9a3655e7 /testsuite/tests/codeGen
parentf3c7cf9b89cad7f326682b23d9f3908ebf0f8f9d (diff)
downloadhaskell-e5d1ed9c8910839e109da59820ca793642961284.tar.gz
Have addModFinalizer expose the local type environment.
Summary: Kind inference in ghci was interfered when renaming of type splices introduced the HsSpliced data constructor. This patch has kind inference skip over it. Test Plan: ./validate Reviewers: simonpj, rrnewton, austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: thomie, mboes Differential Revision: https://phabricator.haskell.org/D2886 GHC Trac Issues: #12985
Diffstat (limited to 'testsuite/tests/codeGen')
-rw-r--r--testsuite/tests/codeGen/should_run/T12622.hs19
-rw-r--r--testsuite/tests/codeGen/should_run/T12622.stdout1
-rw-r--r--testsuite/tests/codeGen/should_run/T12622_A.hs15
-rw-r--r--testsuite/tests/codeGen/should_run/all.T1
4 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T12622.hs b/testsuite/tests/codeGen/should_run/T12622.hs
new file mode 100644
index 0000000000..81e5b04fa3
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T12622.hs
@@ -0,0 +1,19 @@
+-- Test that static pointers still work when the users try
+-- to unpack StaticPtr fields.
+{-# LANGUAGE StaticPointers #-}
+{-# LANGUAGE LambdaCase #-}
+
+import GHC.StaticPtr
+import T12622_A
+
+g = True
+
+main :: IO ()
+main = do
+ let T s = sg :: T (Bool -> Bool)
+ lookupKey s >>= \f -> print (f True)
+
+lookupKey :: StaticPtr a -> IO a
+lookupKey p = unsafeLookupStaticPtr (staticKey p) >>= \case
+ Just p -> return $ deRefStaticPtr p
+ Nothing -> error $ "couldn't find " ++ show (staticPtrInfo p)
diff --git a/testsuite/tests/codeGen/should_run/T12622.stdout b/testsuite/tests/codeGen/should_run/T12622.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T12622.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/codeGen/should_run/T12622_A.hs b/testsuite/tests/codeGen/should_run/T12622_A.hs
new file mode 100644
index 0000000000..6c85cc53e9
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T12622_A.hs
@@ -0,0 +1,15 @@
+-- A.hs
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE StaticPointers #-}
+module T12622_A where
+
+import Data.Typeable
+import GHC.StaticPtr
+
+g :: a -> Bool
+g _ = True
+
+data T a = T {-# UNPACK #-} !(StaticPtr a)
+
+sg :: Typeable a => T (a -> Bool)
+sg = T (static g)
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 3b025790f8..5059cb4483 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -146,6 +146,7 @@ test('PopCnt', omit_ways(['ghci']), multi_compile_and_run,
['PopCnt', [('PopCnt_cmm.cmm', '')], ''])
test('T12059', normal, compile_and_run, [''])
test('T12433', normal, compile_and_run, [''])
+test('T12622', normal, multimod_compile_and_run, ['T12622', '-O'])
test('T12757', normal, compile_and_run, [''])
test('T12855', normal, compile_and_run, [''])
test('T9577', [ unless(arch('x86_64') or arch('i386'),skip),