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

F# Quick Action "Name can be simplified" breaks logic #6227

Closed
Tracked by #15408
vsfeedback opened this issue Feb 11, 2019 · 3 comments
Closed
Tracked by #15408

F# Quick Action "Name can be simplified" breaks logic #6227

vsfeedback opened this issue Feb 11, 2019 · 3 comments
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Bug Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@vsfeedback
Copy link

See screenshot.

The quick action suggests that "bar2." be removed, breaking the code logic.

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/448919/f-quick-action-name-can-be-simplified-breaks-logic.html
VSTS ticketId: 789046

These are the original issue comments:
(no comments)
These are the original issue solutions:
(no solutions)

@cartermp
Copy link
Contributor

Confirmed on Preview 2
image

@charlesroddie
Copy link
Contributor

charlesroddie commented Apr 19, 2019

Similar but subtly different issue, found on VS 16.0.1:

If Y is a constructor, living inside a class or module A, and A is open, and Y has a different binding, then the expression A.Y gets the incorrect message "name can be simplified".

image

@cartermp cartermp modified the milestones: 16.1, 16.2 Apr 23, 2019
@cartermp cartermp modified the milestones: 16.2, Backlog Apr 30, 2019
@dsyme dsyme added the Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. label Aug 26, 2020
@dsyme dsyme added Area-LangService-CodeFixes Code fixes associated with diagnostics and removed Area-LangService-API labels Apr 5, 2022
@vzarytovskii vzarytovskii moved this to Not Planned in F# Compiler and Tooling Jun 17, 2022
@psfinaki
Copy link
Member

Currently doesn't reproduce for any of the above:

image

Code:

type Foo = { myInt: int }
type Bar1 = { test: Foo }
type Bar2 = { foo: Foo }

let test (foo: Foo) (bar1: Bar1) (bar2: Bar2) = 
    if bar1.test.myInt = foo.myInt then ()
    if bar2.foo.myInt = foo.myInt then ()
    ()

image

Code:

module B

module A = 
    let X() = ()
    type Y() = class end

open A

let X = 0
let Y = 0
let AX = A.X
let AY = A.Y

type DU =
    | X
    | Y

    member t.AX = A.X
    member t.AY = A.Y

Hence closing, please reopen if this still somehow applies.

@github-project-automation github-project-automation bot moved this from Not Planned to Done in F# Compiler and Tooling Jun 15, 2023
@psfinaki psfinaki mentioned this issue Jun 15, 2023
85 tasks
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-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Archived in project
Development

No branches or pull requests

5 participants