Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/fsharp/NameResolution.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1767,19 +1767,19 @@ let rec ResolveLongIndentAsModuleOrNamespace atMostOne amap m fullyQualified (ne

UndefinedName(0,FSComp.SR.undefinedNameNamespaceOrModule,id,suggestModulesAndNamespaces))

let moduleNotFoundErrorCache = ref None
let moduleNotFound (modref: ModuleOrNamespaceRef) (mty:ModuleOrNamespaceType) id depth =
match !moduleNotFoundErrorCache with
| Some error -> error
| None ->
let mutable moduleNotFoundErrorCache = None
let moduleNotFound (modref: ModuleOrNamespaceRef) (mty:ModuleOrNamespaceType) (id:Ident) depth =
match moduleNotFoundErrorCache with
| Some (oldId, error) when oldId = id.idRange -> error
| _ ->
let suggestNames() =
mty.ModulesAndNamespacesByDemangledName
|> Seq.filter (fun kv -> IsEntityAccessible amap m ad (modref.NestedTyconRef kv.Value))
|> Seq.collect (fun e -> [e.Value.DisplayName; e.Value.DemangledModuleOrNamespaceName])
|> HashSet

let error = raze (UndefinedName(depth,FSComp.SR.undefinedNameNamespace,id,suggestNames))
moduleNotFoundErrorCache := Some error
moduleNotFoundErrorCache <- Some(id.idRange, error)
error

match moduleOrNamespaces.TryFind id.idText with
Expand Down