Skip to content

Commit 5f57614

Browse files
committed
Record dependencies between boot files and non-boot files
1 parent bc5c49a commit 5f57614

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ghcide/src/Development/IDE/Core/Rules.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ type RawDepM a = StateT (RawDependencyInformation, IntMap ArtifactsLocation) Act
376376
execRawDepM :: Monad m => StateT (RawDependencyInformation, IntMap a1) m a2 -> m (RawDependencyInformation, IntMap a1)
377377
execRawDepM act =
378378
execStateT act
379-
( RawDependencyInformation IntMap.empty emptyPathIdMap IntMap.empty
379+
( RawDependencyInformation IntMap.empty emptyPathIdMap IntMap.empty IntMap.empty
380380
, IntMap.empty
381381
)
382382

@@ -403,6 +403,11 @@ rawDependencyInformation fs = do
403403
let al = modSummaryToArtifactsLocation f msum
404404
-- Get a fresh FilePathId for the new file
405405
fId <- getFreshFid al
406+
-- Record this module and its location
407+
whenJust msum $ \ms ->
408+
modifyRawDepInfo (\rd -> rd { rawModuleNameMap = IntMap.insert (coerce fId)
409+
(coerce (moduleName $ ms_mod ms))
410+
(rawModuleNameMap rd)})
406411
-- Adding an edge to the bootmap so we can make sure to
407412
-- insert boot nodes before the real files.
408413
addBootMap al fId

ghcide/src/Development/IDE/Import/DependencyInformation.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ data RawDependencyInformation = RawDependencyInformation
129129
-- need to add edges between .hs-boot and .hs so that the .hs files
130130
-- appear later in the sort.
131131
, rawBootMap :: !BootIdMap
132+
, rawModuleNameMap :: (FilePathIdMap ShowableModuleName)
132133
} deriving Show
133134

134135
data DependencyInformation =
@@ -220,15 +221,12 @@ processDependencyInformation RawDependencyInformation{..} =
220221
{ depErrorNodes = IntMap.fromList errorNodes
221222
, depModuleDeps = moduleDeps
222223
, depReverseModuleDeps = reverseModuleDeps
223-
, depModuleNames = IntMap.fromList $ coerce moduleNames
224+
, depModuleNames = rawModuleNameMap
224225
, depPathIdMap = rawPathIdMap
225226
, depBootMap = rawBootMap
226227
}
227228
where resultGraph = buildResultGraph rawImports
228229
(errorNodes, successNodes) = partitionNodeResults $ IntMap.toList resultGraph
229-
moduleNames :: [(FilePathId, ModuleName)]
230-
moduleNames =
231-
[ (fId, modName) | (_, imports) <- successNodes, (L _ modName, fId) <- imports]
232230
successEdges :: [(FilePathId, [FilePathId])]
233231
successEdges =
234232
map

0 commit comments

Comments
 (0)