| ... |
... |
@@ -260,26 +260,26 @@ hscUIC hsc_env = ue_uic (hsc_unit_env hsc_env) |
|
260
|
260
|
|
|
261
|
261
|
-- | Find all rules in modules that are in the transitive closure of the given
|
|
262
|
262
|
-- module.
|
|
263
|
|
-hugRulesBelow :: ModuleGraph -> HomeUnitGraph -> UnitId -> ModuleNameWithIsBoot -> IO RuleBase
|
|
264
|
|
-hugRulesBelow mg hug uid mn = foldr (flip extendRuleBaseList) emptyRuleBase <$>
|
|
265
|
|
- hugSomeThingsBelowUs (md_rules . hm_details) False mg hug uid mn
|
|
|
263
|
+hugRulesBelow :: UnitEnv -> UnitId -> ModuleNameWithIsBoot -> IO RuleBase
|
|
|
264
|
+hugRulesBelow unit_env uid mn = foldr (flip extendRuleBaseList) emptyRuleBase <$>
|
|
|
265
|
+ hugSomeThingsBelowUs (md_rules . hm_details) False unit_env uid mn
|
|
266
|
266
|
|
|
267
|
267
|
-- | Get annotations from all modules "below" this one (in the dependency
|
|
268
|
268
|
-- sense) within the home units. If the module is @Nothing@, returns /all/
|
|
269
|
269
|
-- annotations in the home units.
|
|
270
|
|
-hugAnnsBelow :: ModuleGraph -> HomeUnitGraph -> UnitId -> ModuleNameWithIsBoot -> IO AnnEnv
|
|
271
|
|
-hugAnnsBelow mg hug uid mn = foldr (flip extendAnnEnvList) emptyAnnEnv <$>
|
|
272
|
|
- hugSomeThingsBelowUs (md_anns . hm_details) False mg hug uid mn
|
|
|
270
|
+hugAnnsBelow :: UnitEnv -> UnitId -> ModuleNameWithIsBoot -> IO AnnEnv
|
|
|
271
|
+hugAnnsBelow unit_env uid mn = foldr (flip extendAnnEnvList) emptyAnnEnv <$>
|
|
|
272
|
+ hugSomeThingsBelowUs (md_anns . hm_details) False unit_env uid mn
|
|
273
|
273
|
|
|
274
|
274
|
-- | Find all COMPLETE pragmas in modules that are in the transitive closure of the
|
|
275
|
275
|
-- given module.
|
|
276
|
|
-hugCompleteSigsBelow :: ModuleGraph -> HomeUnitGraph -> UnitId -> ModuleNameWithIsBoot -> IO CompleteMatches
|
|
277
|
|
-hugCompleteSigsBelow mg hug uid mn = foldr (++) [] <$>
|
|
278
|
|
- hugSomeThingsBelowUs (md_complete_matches . hm_details) False mg hug uid mn
|
|
|
276
|
+hugCompleteSigsBelow :: UnitEnv -> UnitId -> ModuleNameWithIsBoot -> IO CompleteMatches
|
|
|
277
|
+hugCompleteSigsBelow unit_env uid mn = foldr (++) [] <$>
|
|
|
278
|
+ hugSomeThingsBelowUs (md_complete_matches . hm_details) False unit_env uid mn
|
|
279
|
279
|
|
|
280
|
280
|
-- | Find instances visible from the given set of imports
|
|
281
|
|
-hugInstancesBelow :: ModuleGraph -> HomeUnitGraph -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [FamInst])
|
|
282
|
|
-hugInstancesBelow mg hug uid mnwib = do
|
|
|
281
|
+hugInstancesBelow :: UnitEnv -> UnitId -> ModuleNameWithIsBoot -> IO (InstEnv, [FamInst])
|
|
|
282
|
+hugInstancesBelow unit_env uid mnwib = do
|
|
283
|
283
|
let mn = mkModule uid (gwib_mod mnwib)
|
|
284
|
284
|
(insts, famInsts) <-
|
|
285
|
285
|
unzip . concat <$>
|
| ... |
... |
@@ -290,8 +290,7 @@ hugInstancesBelow mg hug uid mnwib = do |
|
290
|
290
|
then []
|
|
291
|
291
|
else [(md_insts details, md_fam_insts details)])
|
|
292
|
292
|
True -- Include -hi-boot
|
|
293
|
|
- mg
|
|
294
|
|
- hug
|
|
|
293
|
+ unit_env
|
|
295
|
294
|
uid
|
|
296
|
295
|
mnwib
|
|
297
|
296
|
return (foldl' unionInstEnv emptyInstEnv insts, concat famInsts)
|
| ... |
... |
@@ -299,18 +298,19 @@ hugInstancesBelow mg hug uid mnwib = do |
|
299
|
298
|
-- | Get things from modules in the transitive closure of the given module.
|
|
300
|
299
|
--
|
|
301
|
300
|
-- Note: Don't expose this function. This is a footgun if exposed!
|
|
302
|
|
-hugSomeThingsBelowUs :: (HomeModInfo -> [a]) -> Bool -> ModuleGraph -> HomeUnitGraph -> UnitId -> ModuleNameWithIsBoot -> IO [[a]]
|
|
|
301
|
+hugSomeThingsBelowUs :: (HomeModInfo -> [a]) -> Bool -> UnitEnv -> UnitId -> ModuleNameWithIsBoot -> IO [[a]]
|
|
303
|
302
|
-- An explicit check to see if we are in one-shot mode to avoid poking the ModuleGraph thunk
|
|
304
|
|
--- These things are currently stored in the EPS for home packages. (See #25795 for
|
|
|
303
|
+-- These things are currently stored in the HPT's loader state for home packages. (See #25795 for
|
|
305
|
304
|
-- progress in removing these kind of checks; and making these functions of
|
|
306
|
305
|
-- `UnitEnv` rather than `HscEnv`)
|
|
307
|
306
|
-- See Note [The ModuleGraph]
|
|
308
|
|
-hugSomeThingsBelowUs extract include_hi_boot mg hug uid mn =
|
|
309
|
|
- -- If the first hpt is a one-shot table, we don't recurse into it.
|
|
310
|
|
- -- TODO @fendor: I guess that's nonsense to a certain degree
|
|
311
|
|
- if HPT.isOneShotMode $ homeUnitEnv_hpt $ unitEnv_lookup uid hug
|
|
312
|
|
- then pure []
|
|
313
|
|
- else
|
|
|
307
|
+hugSomeThingsBelowUs extract include_hi_boot unit_env uid mn
|
|
|
308
|
+ | HPT.isOneShotMode (ue_hpt unit_env)
|
|
|
309
|
+ = pure []
|
|
|
310
|
+ | otherwise
|
|
|
311
|
+ = let hug = ue_home_unit_graph unit_env
|
|
|
312
|
+ mg = ue_module_graph unit_env
|
|
|
313
|
+ in
|
|
314
|
314
|
sequence
|
|
315
|
315
|
[ things
|
|
316
|
316
|
-- "Finding each non-hi-boot module below me" maybe could be cached (well,
|
| ... |
... |
@@ -350,7 +350,7 @@ prepareAnnotations hsc_env mb_guts = do |
|
350
|
350
|
-- entries regardless of dependency ordering.
|
|
351
|
351
|
get_mod mg = (moduleUnitId (mg_module mg), GWIB (moduleName (mg_module mg)) NotBoot)
|
|
352
|
352
|
home_pkg_anns <- fromMaybe (hugAllAnns (hsc_unit_env hsc_env))
|
|
353
|
|
- $ uncurry (hugAnnsBelow (hsc_mod_graph hsc_env) (hsc_HUG hsc_env))
|
|
|
353
|
+ $ uncurry (hugAnnsBelow (hsc_unit_env hsc_env))
|
|
354
|
354
|
. get_mod <$> mb_guts
|
|
355
|
355
|
more_home_pkg_anns <- HomePackageTable.hptLoadedAnnEnv $ hsc_HPT hsc_env
|
|
356
|
356
|
let
|