From 04d01c61fcecb0f426c42fe5b1554609e49d1d8a Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Tue, 8 Feb 2022 11:16:51 +0000 Subject: driver: Filter out our own boot module in hptSomeThingsBelow hptSomeThingsBelow would return a list of modules which contain the .hs-boot file for a particular module. This caused some problems because we would try and find the module in the HPT (but it's not there when we're compiling the module itself). Fixes #21058 --- compiler/GHC/Driver/Env.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/GHC/Driver/Env.hs b/compiler/GHC/Driver/Env.hs index 242cd3c39a..8bc1f516bf 100644 --- a/compiler/GHC/Driver/Env.hs +++ b/compiler/GHC/Driver/Env.hs @@ -299,7 +299,7 @@ hptSomeThingsBelowUs extract include_hi_boot hsc_env uid mn [ thing | -- Find each non-hi-boot module below me - (ModNodeKeyWithUid (GWIB { gwib_mod = mod, gwib_isBoot = is_boot }) uid) <- Set.toList (hptModulesBelow hsc_env uid mn) + (ModNodeKeyWithUid (GWIB { gwib_mod = mod, gwib_isBoot = is_boot }) mod_uid) <- Set.toList (hptModulesBelow hsc_env uid mn) , include_hi_boot || (is_boot == NotBoot) -- unsavoury: when compiling the base package with --make, we @@ -307,12 +307,15 @@ hptSomeThingsBelowUs extract include_hi_boot hsc_env uid mn -- be in the HPT, because we never compile it; it's in the EPT -- instead. ToDo: clean up, and remove this slightly bogus filter: , mod /= moduleName gHC_PRIM + , not (mod == gwib_mod mn && uid == mod_uid) -- Look it up in the HPT - , let things = case lookupHug hug uid mod of + , let things = case lookupHug hug mod_uid mod of Just info -> extract info Nothing -> pprTrace "WARNING in hptSomeThingsBelowUs" msg mempty msg = vcat [text "missing module" <+> ppr mod, + text "When starting from" <+> ppr mn, + text "below:" <+> ppr (hptModulesBelow hsc_env uid mn), text "Probable cause: out-of-date interface files"] -- This really shouldn't happen, but see #962 , thing <- things -- cgit v1.2.1