Skip to content

FindReferencesInFile misses references to type when a module with the same name exists #14411

@0101

Description

@0101

Repro steps

Code sample 1

module Foo

type MyType =
    static member Two = 1

let x = MyType.Two

let y = MyType.Two

Code sample 2

module Foo

type MyType =
    static member Two = 1

let x = MyType.Two

module MyType = do () // <-- Extra module with the same name as the type

let y = MyType.Two
  1. Find All References on type MyType

Expected behavior

In both code samples we get the same results - 2 references to MyType type.

Actual behavior

In code sample 2 the second reference (y) is missing.

Known workarounds

None

Related information

The second occurrence is incorrectly stored in ItemKeyStore as Item.ModuleOrNamespaces instead of Item.Types. This happens probably because in name resolution we find the identifier in modules, which are searched first.

moduleSearch ad () +++ tyconSearch ad +++ envSearch

Metadata

Metadata

Assignees

Labels

Area-LangService-FindAllReferencesFind all references across projects and solutionsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions