summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-04-04 11:36:56 -0400
committerBen Gamari <ben@smart-cactus.org>2019-04-04 11:40:21 -0400
commit2e916f42ced4ceed8843f1e4bc550cb0bf04e48e (patch)
tree7e486a4acde8cfca5885e458330ed16c2af0d029 /libraries
parent895394c26156993a9405039fe53fde3a6b1414b7 (diff)
downloadhaskell-wip/robustify-closuresize.tar.gz
testsuite: Make closureSize less sensitive to optimisationwip/robustify-closuresize
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghc-heap/tests/closure_size.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/libraries/ghc-heap/tests/closure_size.hs b/libraries/ghc-heap/tests/closure_size.hs
index d77060779e..b04e7a77f9 100644
--- a/libraries/ghc-heap/tests/closure_size.hs
+++ b/libraries/ghc-heap/tests/closure_size.hs
@@ -1,6 +1,7 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE MagicHash #-}
import Control.Monad
import Type.Reflection
@@ -17,12 +18,17 @@ assertSize !x expected = do
putStrLn $ prettyCallStack callStack
{-# NOINLINE assertSize #-}
-pap :: Int -> Char -> Int
+pap :: Int -> Maybe Char -> Int
pap x _ = x
{-# NOINLINE pap #-}
main :: IO ()
main = do
+ -- Ensure that GHC can't turn PAP into a FUN (see #16531)
+ let x :: Int
+ x = 42
+ {-# NOINLINE x #-}
+
assertSize 'a' 2
assertSize (Just ()) 2
assertSize (Nothing :: Maybe ()) 2
@@ -30,5 +36,5 @@ main = do
assertSize ((1,2,3) :: (Int,Int,Int)) 4
assertSize (id :: Int -> Int) 1
assertSize (fst :: (Int,Int) -> Int) 1
- assertSize (pap 1) 2
+ assertSize (pap x) 2