Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive Open declaration can be removed when having records with the same name #16226

Open
Tracked by #15408
BoundedChenn31 opened this issue Nov 3, 2023 · 1 comment
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@BoundedChenn31
Copy link
Contributor

Repro steps

Consider this code

namespace Case2

module RecordA =
    type Record = { Foo: string }

module RecordB =
    type Record = { Bar: string }

module Use =
    open RecordB // actually not required
    open RecordA
    open RecordB // TODO: false positive
    
    let convertBToA (recordB: Record) =
        { Foo = recordB.Bar }

VS marks second open RecordB as unnecessary. Removal of it breaks compilation because we actually need RecordB.Record and open RecordA shadows it.

2023-11-03_224641

Expected behavior

Suggested refactorings do not break compilation and highlight correct targets for change

Actual behavior

Suggested refactoring breaks compilation.

Known workarounds
.

Provide any related information (optional):

.NET SDK: 7.0.403
Visual Studio 17.7.6

@github-actions github-actions bot added this to the Backlog milestone Nov 3, 2023
@psfinaki psfinaki added the Area-LangService-CodeFixes Code fixes associated with diagnostics label Nov 7, 2023
@psfinaki psfinaki mentioned this issue Nov 7, 2023
85 tasks
@psfinaki
Copy link
Member

psfinaki commented Nov 7, 2023

Good one. Thanks for the nice repro. Tracking under code fixes.

@0101 0101 added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. and removed Needs-Triage labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
None yet
Development

No branches or pull requests

3 participants