@@ -42,6 +42,7 @@ import Lexer
4242import ErrUtils
4343#endif
4444
45+import Finder
4546import qualified GHC
4647import GhcMonad
4748import GhcPlugins as GHC hiding (fst3, (<>))
@@ -212,7 +213,7 @@ upgradeWarningToError (nfp, sh, fd) =
212213hideDiag :: DynFlags -> (WarnReason, FileDiagnostic) -> (WarnReason, FileDiagnostic)
213214hideDiag originalFlags (Reason warning, (nfp, _sh, fd))
214215 | not (wopt warning originalFlags) = (Reason warning, (nfp, HideDiag, fd))
215−hideDiag _originalFlags t = t
216+hideDiag _originalFlags t = t
216217
217218addRelativeImport :: NormalizedFilePath -> ParsedModule -> DynFlags -> DynFlags
218219addRelativeImport fp modu dflags = dflags
@@ -317,18 +318,8 @@ getModSummaryFromBuffer
317318getModSummaryFromBuffer fp contents dflags parsed = do
318319 (modName, imports) <- liftEither $ getImportsParsed dflags parsed
319320
320− let modLoc = ModLocation
321− { ml_hs_file = Just fp
322− , ml_hi_file = derivedFile "hi"
323− , ml_obj_file = derivedFile "o"
324−#if MIN_GHC_API_VERSION(8,8,0)
325− , ml_hie_file = derivedFile "hie"
326−#endif
327− -- This does not consider the dflags configuration
328− -- (-osuf and -hisuf, object and hi dir.s).
329− -- However, we anyway don't want to generate them.
330− }
331− InstalledUnitId unitId = thisInstalledUnitId dflags
321+ modLoc <- liftIO $ mkHomeModLocation dflags modName fp
322+ let InstalledUnitId unitId = thisInstalledUnitId dflags
332323 return $ ModSummary
333324 { ms_mod = mkModule (fsToUnitId unitId) modName
334325 , ms_location = modLoc
@@ -353,11 +344,7 @@ getModSummaryFromBuffer fp contents dflags parsed = do
353344 , ms_parsed_mod = Nothing
354345 }
355346 where
356− (sourceType, derivedFile) =
357− let (stem, ext) = splitExtension fp in
358− if "-boot" `isSuffixOf` ext
359− then (HsBootFile, \newExt -> stem <.> newExt ++ "-boot")
360− else (HsSrcFile , \newExt -> stem <.> newExt)
347+ sourceType = if "-boot" `isSuffixOf` takeExtension fp then HsBootFile else HsSrcFile
361348
362349
363350-- | Given a buffer, flags, file path and module summary, produce a