Levity polymorphic arguments are thought to be too strict
I don't expect the error
call to be evaluated in this program.
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Exts
import GHC.Int
{-# NOINLINE foo #-}
foo = error "abc"
main = print (I# (reallyUnsafePtrEquality# foo foo))
If we compile and run with optimisations then it produces an error.
[nix-shell:~/ghc-multi-hmi]$ _build/stage1/bin/ghc BoxedRep.hs -O2
[1 of 2] Compiling Main ( BoxedRep.hs, BoxedRep.o ) [Optimisation flags changed]
[2 of 2] Linking BoxedRep [Objects changed]
[nix-shell:~/ghc-multi-hmi]$ ./BoxedRep
BoxedRep: abc
CallStack (from HasCallStack):
error, called at BoxedRep.hs:9:8 in main:Main
@sheaf Already has a more thorough diagnosis but the crux of the matter is in mkArgInfo.add_type_strictness
incorrectly determines that the arguments have strict demand due to isLiftedType_maybe
returning the wrong thing for BoxedRep l
(see #20837 (closed))