summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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