X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FHscTypes.lhs;h=8b126e6c518ce2e68f52659aeb5ade60365cfc97;hb=c305b14a2481b4e367a5b70981a0b8b667a95e61;hp=2c0fa6cc911862dcad26ef5aec05347cd93699bd;hpb=a835e9faf19400aa6b7999b6f64e60cb1c7737dd;p=ghc-hetmet.git diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index 2c0fa6c..8b126e6 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -85,7 +85,7 @@ import Id ( Id ) import Type ( TyThing(..) ) import Class ( Class, classSelIds, classATs, classTyCon ) -import TyCon ( TyCon, tyConSelIds, tyConDataCons, isNewTyCon, +import TyCon ( TyCon, tyConSelIds, tyConDataCons, newTyConCo_maybe, tyConFamilyCoercion_maybe ) import DataCon ( DataCon, dataConImplicitIds ) import PrelNames ( gHC_PRIM ) @@ -109,7 +109,7 @@ import FastString ( FastString ) import DATA_IOREF ( IORef, readIORef ) import StringBuffer ( StringBuffer ) -import Maybe ( catMaybes ) +import Maybes ( catMaybes, seqMaybe ) import Time ( ClockTime ) \end{code} @@ -247,12 +247,21 @@ lookupIfaceByModule -> Module -> Maybe ModIface lookupIfaceByModule dflags hpt pit mod - -- in one-shot, we don't use the HPT - | not (isOneShot (ghcMode dflags)) && modulePackageId mod == this_pkg - = fmap hm_iface (lookupUFM hpt (moduleName mod)) - | otherwise - = lookupModuleEnv pit mod - where this_pkg = thisPackage dflags + | modulePackageId mod == thisPackage dflags + = -- The module comes from the home package, so look first + -- in the HPT. If it's not from the home package it's wrong to look + -- in the HPT, because the HPT is indexed by *ModuleName* not Module + fmap hm_iface (lookupUFM hpt (moduleName mod)) + `seqMaybe` lookupModuleEnv pit mod + + | otherwise = lookupModuleEnv pit mod -- Look in PIT only + +-- If the module does come from the home package, why do we look in the PIT as well? +-- (a) In OneShot mode, even home-package modules accumulate in the PIT +-- (b) Even in Batch (--make) mode, there is *one* case where a home-package +-- module is in the PIT, namely GHC.Prim when compiling the base package. +-- We could eliminate (b) if we wanted, by making GHC.Prim belong to a packake +-- of its own, but it doesn't seem worth the bother. \end{code}