summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-07-04 12:10:50 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-07-06 13:51:03 -0400
commit665fa5a73e385bdfce13180048701a179ec3f36a (patch)
treef21ab5b09ac3a84af6752249fe32df952ec2599f /compiler/GHC/Unit
parentc5415bc5c428df72f3943fd9bf117355ae746fdb (diff)
downloadhaskell-665fa5a73e385bdfce13180048701a179ec3f36a.tar.gz
driver: Fix issue with module loops and multiple home units
We were attempting to rehydrate all dependencies of a particular module, but we actually only needed to rehydrate those of the current package (as those are the ones participating in the loop). This fixes loading GHC into a multi-unit session. Fixes #21814
Diffstat (limited to 'compiler/GHC/Unit')
-rw-r--r--compiler/GHC/Unit/Module/Graph.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/GHC/Unit/Module/Graph.hs b/compiler/GHC/Unit/Module/Graph.hs
index c09d778086..29d2356a75 100644
--- a/compiler/GHC/Unit/Module/Graph.hs
+++ b/compiler/GHC/Unit/Module/Graph.hs
@@ -28,6 +28,7 @@ module GHC.Unit.Module.Graph
, summaryNodeSummary
, NodeKey(..)
+ , nodeKeyUnitId
, ModNodeKey
, mkNodeKey
, msKey
@@ -121,6 +122,11 @@ pprNodeKey (NodeKey_Unit iu) = ppr iu
pprNodeKey (NodeKey_Module mk) = ppr mk
pprNodeKey (NodeKey_Link uid) = ppr uid
+nodeKeyUnitId :: NodeKey -> UnitId
+nodeKeyUnitId (NodeKey_Unit iu) = instUnitInstanceOf iu
+nodeKeyUnitId (NodeKey_Module mk) = mnkUnitId mk
+nodeKeyUnitId (NodeKey_Link uid) = uid
+
data ModNodeKeyWithUid = ModNodeKeyWithUid { mnkModuleName :: ModuleNameWithIsBoot
, mnkUnitId :: UnitId } deriving (Eq, Ord)