@@ -85,12 +85,21 @@ let rec processStateEntry (queryTrie: QueryTrie) (state: FileContentQueryState)
8585 ||> Seq.fold ( fun acc openNS -> processOpenPath queryTrie [ yield ! openNS; yield ! path ] acc)
8686
8787 | FileContentEntry.PrefixedIdentifier path ->
88- // process the name was if it were a FQN
89- let stateAfterFullIdentifier = processIdentifier queryTrie path state
90-
91- // Process the name in combination with the existing open namespaces
92- ( stateAfterFullIdentifier, state.OpenNamespaces)
93- ||> Seq.fold ( fun acc openNS -> processIdentifier queryTrie [ yield ! openNS; yield ! path ] acc)
88+ match path with
89+ | [] ->
90+ // should not be possible though
91+ state
92+ | _ ->
93+ // path could consist out of multiple segments
94+ ( state, [| 1 .. path.Length |])
95+ ||> Seq.fold ( fun state takeParts ->
96+ let path = List.take takeParts path
97+ // process the name was if it were a FQN
98+ let stateAfterFullIdentifier = processIdentifier queryTrie path state
99+
100+ // Process the name in combination with the existing open namespaces
101+ ( stateAfterFullIdentifier, state.OpenNamespaces)
102+ ||> Seq.fold ( fun acc openNS -> processIdentifier queryTrie [ yield ! openNS; yield ! path ] acc))
94103
95104 | FileContentEntry.NestedModule ( nestedContent = nestedContent) ->
96105 // We don't want our current state to be affect by any open statements in the nested module
@@ -139,7 +148,7 @@ let mkGraph (files: FileWithAST array) =
139148 let result =
140149 Seq.fold ( processStateEntry queryTrie) ( FileContentQueryState.Create file.File knownFiles) fileContent
141150
142- file.File , Set.toArray result.FoundDependencies)
151+ file, Set.toArray result.FoundDependencies)
143152 files
144153
145154// =============================================================================================================
@@ -164,9 +173,9 @@ let mkGraphAndReport files =
164173 let depString = String.concat " \n " deps
165174
166175 if deps.Length = 0 then
167- printfn $" %s {fileName}: []"
176+ printfn $" %s {fileName.File }: []"
168177 else
169- printfn $" %s {fileName}:\n {depString}"
178+ printfn $" %s {fileName.File }:\n {depString}"
170179
171180[<Test>]
172181let ``Fantomas.Core for realzies`` () =
@@ -525,9 +534,6 @@ let ``FCS for debugging`` () =
525534 })
526535
527536 let contents =
528- Array.map
529- ( fun ( file : FileWithAST ) ->
530- FileContentMapping.mkFileContent file)
531- filesWithAST
537+ Array.map ( fun ( file : FileWithAST ) -> FileContentMapping.mkFileContent file) filesWithAST
532538
533539 ignore contents
0 commit comments