summaryrefslogtreecommitdiff
path: root/compiler/GHC/Unit/Module/ModSummary.hs
diff options
context:
space:
mode:
authorFendor <power.walross@gmail.com>2021-02-03 19:12:02 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-03-28 17:26:37 -0400
commit29d758631c0d9124485aafc89cddc4ec5a668653 (patch)
tree72efc6ad23ddc052cecd01b493384b8fbc74daab /compiler/GHC/Unit/Module/ModSummary.hs
parentb02c8ef768df33ef4845da2f15583cf143a4d0e2 (diff)
downloadhaskell-29d758631c0d9124485aafc89cddc4ec5a668653.tar.gz
Add UnitId to Target record
In the future, we want `HscEnv` to support multiple home units at the same time. This means, that there will be 'Target's that do not belong to the current 'HomeUnit'. This is an API change without changing behaviour. Update haddock submodule to incorporate API changes.
Diffstat (limited to 'compiler/GHC/Unit/Module/ModSummary.hs')
-rw-r--r--compiler/GHC/Unit/Module/ModSummary.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/GHC/Unit/Module/ModSummary.hs b/compiler/GHC/Unit/Module/ModSummary.hs
index e9106d44eb..324cca33a3 100644
--- a/compiler/GHC/Unit/Module/ModSummary.hs
+++ b/compiler/GHC/Unit/Module/ModSummary.hs
@@ -6,6 +6,7 @@ module GHC.Unit.Module.ModSummary
( ExtendedModSummary (..)
, extendModSummaryNoDeps
, ModSummary (..)
+ , ms_unitid
, ms_installed_mod
, ms_mod_name
, ms_imps
@@ -98,6 +99,9 @@ data ModSummary
-- ^ The actual preprocessed source, if we have it
}
+ms_unitid :: ModSummary -> UnitId
+ms_unitid = toUnitId . moduleUnit . ms_mod
+
ms_installed_mod :: ModSummary -> InstalledModule
ms_installed_mod = fst . getModuleInstantiation . ms_mod
@@ -172,11 +176,11 @@ findTarget ms ts =
[] -> Nothing
(t:_) -> Just t
where
- summary `matches` Target (TargetModule m) _ _
- = ms_mod_name summary == m
- summary `matches` Target (TargetFile f _) _ _
+ summary `matches` Target { targetId = TargetModule m, targetUnitId = unitId }
+ = ms_mod_name summary == m && ms_unitid summary == unitId
+ summary `matches` Target { targetId = TargetFile f _, targetUnitId = unitid }
| Just f' <- ml_hs_file (ms_location summary)
- = f == f'
+ = f == f' && ms_unitid summary == unitid
_ `matches` _
= False