Skip to content

Commit 69c0587

Browse files
committed
Actually force usages
In 00f4e61 we attempted to share the filepaths in GHC's usage field. Unfortunately the `mi_usages` field is lazy and so these turned out to not actually be shared because the thunk responsible for sharing was never evaluated. Add the right strictness annotations to ensure these are actually shared
1 parent 27f46d7 commit 69c0587

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module Development.IDE.Core.Compile
3636
, TypecheckHelpers(..)
3737
, sourceTypecheck
3838
, sourceParser
39+
, shareUsages
3940
) where
4041

4142
import Control.Monad.IO.Class
@@ -469,7 +470,7 @@ filterUsages = id
469470

470471
-- | Mitigation for https://gitlab.haskell.org/ghc/ghc/-/issues/22744
471472
shareUsages :: ModIface -> ModIface
472-
shareUsages iface = iface {mi_usages = usages}
473+
shareUsages iface = rnf usages `seq` iface {mi_usages = usages}
473474
where usages = map go (mi_usages iface)
474475
go usg@UsageFile{} = usg {usg_file_path = fp}
475476
where !fp = shareFilePath (usg_file_path usg)

ghcide/src/Development/IDE/GHC/Orphans.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,7 @@ instance NFData (HsExpr (GhcPass 'Renamed)) where
242242

243243
instance NFData Extension where
244244
rnf = rwhnf
245+
246+
instance NFData Usage where
247+
rnf (UsageFile a b c) = rnf a `seq` rnf b `seq` rnf c
248+
rnf x = ()

0 commit comments

Comments
 (0)