Static pointers are not being registered under certain conditions
It seems that only the static pointers in the module export list survive the Simplifier. This is a regression which doesn't seem to affect ghci/runghc only compiled code.
{-# LANGUAGE StaticPointers #-}
import GHC.StaticPtr
staticHello :: StaticPtr String
staticHello = static "hello"
main = do
keys <- staticPtrKeys
if null keys
then error "static ptrs are not being registered"
else putStrLn "Everything is fine"
pepe:~/scratch$ stack --resolver ghc-8.2.1 script --optimize bug-spt.hs
Using resolver: ghc-8.2.1 specified on command line
bug-spt: static ptrs are not being registered
CallStack (from HasCallStack):
error, called at bug-spt.hs:11:10 in main:Main
pepe:~/scratch$ stack --resolver ghc-8.0.2 script --optimize bug-spt.hs
Using resolver: ghc-8.0.2 specified on command line
Everything is fine
Edited by mnislaih