summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-09-02 12:01:27 -0400
committerBen Gamari <ben@smart-cactus.org>2021-09-10 16:16:27 -0400
commit989d92c7d6c5cfb96d8e79327c91a337e19a233b (patch)
tree120acc8ffeddf8b6e77e8f10cb2b03b33c6192b1
parent87d93745fa14344a26ab242fd5db35e654e1da48 (diff)
downloadhaskell-wip/T20324.tar.gz
Ensure that zapFragileUnfolding preseves evaluatednesswip/T20324
As noted in #20324, previously we would drop the fact that an unfolding was evaluated, despite what the documentation claims.
-rw-r--r--compiler/GHC/Types/Id/Info.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/GHC/Types/Id/Info.hs b/compiler/GHC/Types/Id/Info.hs
index 7a6d321042..35d2f61734 100644
--- a/compiler/GHC/Types/Id/Info.hs
+++ b/compiler/GHC/Types/Id/Info.hs
@@ -89,9 +89,7 @@ module GHC.Types.Id.Info (
import GHC.Prelude
-import GHC.Core hiding( hasCoreUnfolding )
-import GHC.Core( hasCoreUnfolding )
-
+import GHC.Core
import GHC.Core.Class
import {-# SOURCE #-} GHC.Builtin.PrimOps (PrimOp)
import GHC.Types.Name
@@ -689,8 +687,10 @@ zapFragileUnfolding :: Unfolding -> Unfolding
-- ^ Zaps any core unfolding, but /preserves/ evaluated-ness,
-- i.e. an unfolding of OtherCon
zapFragileUnfolding unf
- | hasCoreUnfolding unf = noUnfolding
- | otherwise = unf
+ -- N.B. isEvaldUnfolding catches *both* OtherCon [] *and* core unfoldings
+ -- representing values.
+ | isEvaldUnfolding unf = evaldUnfolding
+ | otherwise = noUnfolding
zapUnfolding :: Unfolding -> Unfolding
-- Squash all unfolding info, preserving only evaluated-ness