Skip to content

Commit e0596f3

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
fix error range of wrong namespace in open declaration (#3966)
1 parent ae6f593 commit e0596f3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/fsharp/NameResolution.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,19 +1767,19 @@ let rec ResolveLongIndentAsModuleOrNamespace atMostOne amap m fullyQualified (ne
17671767

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

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

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

17851785
match moduleOrNamespaces.TryFind id.idText with

0 commit comments

Comments
 (0)