@@ -222,6 +222,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
222
222
, optCheckProject = getCheckProject
223
223
, optCustomDynFlags
224
224
, optExtensions
225
+ , optFakeUid
225
226
} <- getIdeOptions
226
227
227
228
-- populate the knownTargetsVar with all the
@@ -274,7 +275,7 @@ loadSessionWithOptions SessionLoadingOptions{..} dir = do
274
275
new_deps' <- forM new_deps $ \ RawComponentInfo {.. } -> do
275
276
-- Remove all inplace dependencies from package flags for
276
277
-- components in this HscEnv
277
- let (df2, uids) = removeInplacePackages inplace rawComponentDynFlags
278
+ let (df2, uids) = removeInplacePackages optFakeUid inplace rawComponentDynFlags
278
279
let prefix = show rawComponentUnitId
279
280
-- See Note [Avoiding bad interface files]
280
281
let hscComponents = sort $ map show uids
@@ -713,12 +714,15 @@ getDependencyInfo fs = Map.fromList <$> mapM do_one fs
713
714
-- There are several places in GHC (for example the call to hptInstances in
714
715
-- tcRnImports) which assume that all modules in the HPT have the same unit
715
716
-- ID. Therefore we create a fake one and give them all the same unit id.
716
- removeInplacePackages :: [InstalledUnitId ] -> DynFlags -> (DynFlags , [InstalledUnitId ])
717
- removeInplacePackages us df = (df { packageFlags = ps
717
+ removeInplacePackages
718
+ :: InstalledUnitId -- ^ fake uid to use for our internal component
719
+ -> [InstalledUnitId ]
720
+ -> DynFlags
721
+ -> (DynFlags , [InstalledUnitId ])
722
+ removeInplacePackages fake_uid us df = (df { packageFlags = ps
718
723
, thisInstalledUnitId = fake_uid }, uids)
719
724
where
720
725
(uids, ps) = partitionEithers (map go (packageFlags df))
721
- fake_uid = toInstalledUnitId (stringToUnitId " fake_uid" )
722
726
go p@ (ExposePackage _ (UnitIdArg u) _) = if toInstalledUnitId u `elem` us
723
727
then Left (toInstalledUnitId u)
724
728
else Right p
0 commit comments