summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-09-02 12:01:27 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-11 08:56:55 -0400
commitc3776542920e539468060774cc3d19b94300b38a (patch)
treeb3e8f3532ff684f1d0cd7726e9c3cc9c47d1c5f6 /compiler/GHC/Types
parent88f871ef89c5dd1acb32104fd6d1266264920592 (diff)
downloadhaskell-c3776542920e539468060774cc3d19b94300b38a.tar.gz
Ensure that zapFragileUnfolding preseves evaluatedness
As noted in #20324, previously we would drop the fact that an unfolding was evaluated, despite what the documentation claims.
Diffstat (limited to 'compiler/GHC/Types')
-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