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

Wrap arg in parens when needed when adding new keyword #18179

Merged
merged 6 commits into from
Jan 6, 2025

Conversation

brianrourkeboll
Copy link
Contributor

@brianrourkeboll brianrourkeboll commented Dec 28, 2024

Description

This change incidentally also prevents the code fix from suggesting a "fix" that would be invalid in various scenarios,1 e.g.:

(Disposable) arg // Formerly suggested `(new Disposable) arg`, now suggests nothing.
xs |> List.map Disposable // Formerly suggested `xs |> List.map new Disposable`, now suggests nothing.

Checklist

  • Test cases added.
  • Release notes entry updated.

Footnotes

  1. We could in theory update the code fix to suggest new (Disposable)(arg) (or even new Disposable(arg)), xs |> List.map (fun x -> new Disposable(x)), etc., for such scenarios, but I considered that out of scope for this PR—and perhaps altogether, since transformations like xs |> List.map (fun x -> new Disposable(x)) also may not be valid, depending on the type of the constructor argument! For example, if xs is a unit list, then transforming xs |> List.map Disposable to xs |> List.map (fun x -> new Disposable(x)) is not valid.

Copy link
Contributor

github-actions bot commented Dec 28, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
vsintegration/src docs/release-notes/.VisualStudio/17.13.md

@brianrourkeboll brianrourkeboll marked this pull request as ready for review December 28, 2024 20:52
@brianrourkeboll brianrourkeboll requested a review from a team as a code owner December 28, 2024 20:52
@T-Gro T-Gro enabled auto-merge (squash) January 2, 2025 13:10
Copy link
Contributor

@edgarfgp edgarfgp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, Brian, this was annoying. The fix is not trivial anymore so thanks for solid testing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants