@@ -42,6 +42,7 @@ import Lexer
42
42
import ErrUtils
43
43
#endif
44
44
45
+ import Finder
45
46
import qualified GHC
46
47
import GhcMonad
47
48
import GhcPlugins as GHC hiding (fst3 , (<>) )
@@ -212,7 +213,7 @@ upgradeWarningToError (nfp, sh, fd) =
212
213
hideDiag :: DynFlags -> (WarnReason , FileDiagnostic ) -> (WarnReason , FileDiagnostic )
213
214
hideDiag originalFlags (Reason warning, (nfp, _sh, fd))
214
215
| not (wopt warning originalFlags) = (Reason warning, (nfp, HideDiag , fd))
215
- hideDiag _originalFlags t = t
216
+ hideDiag _originalFlags t = t
216
217
217
218
addRelativeImport :: NormalizedFilePath -> ParsedModule -> DynFlags -> DynFlags
218
219
addRelativeImport fp modu dflags = dflags
@@ -317,18 +318,8 @@ getModSummaryFromBuffer
317
318
getModSummaryFromBuffer fp contents dflags parsed = do
318
319
(modName, imports) <- liftEither $ getImportsParsed dflags parsed
319
320
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
332
323
return $ ModSummary
333
324
{ ms_mod = mkModule (fsToUnitId unitId) modName
334
325
, ms_location = modLoc
@@ -353,11 +344,7 @@ getModSummaryFromBuffer fp contents dflags parsed = do
353
344
, ms_parsed_mod = Nothing
354
345
}
355
346
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
361
348
362
349
363
350
-- | Given a buffer, flags, file path and module summary, produce a
0 commit comments