Add a refactoring between reference and struct anonymous records - #20549
Open
xperiandri wants to merge 8 commits into
Open
xperiandri wants to merge 8 commits into
xperiandri wants to merge 8 commits into
Conversation
Ctrl+. on a tuple expression, pattern or annotated tuple type converts it to the other kind and follows the value through the solution: annotations of values, parameters, record fields and function results it flows through, tuple patterns taking it apart, and the arguments and values flowing into it. Uses that cannot be followed (fst, snd, generic collections) are left for the compiler to report. CreateWithCodeAndDependency now tells FCS about both files, so the second file can be type-checked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adding the second document to a single-file solution left Find All References unable to see either file, so a chain through a function's call sites stopped at the first file. The synthetic project gives both files to the checker the way AddReturnTypeTests and FindReferencesTests set up theirs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The synthetic project's checker reads the other file from disk, so checking the refactored document saw the old definition; a struct tuple pattern happens to accept a reference tuple, which hid that. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Ctrl+. inside an anonymous record expression or an annotated anonymous
record type converts it between {| ... |} and struct {| ... |}, following
the value through the solution like the tuple refactoring. A
copy-and-update has its own form and converts independently of its
source.
The propagation engine becomes independent of the kind of node:
StructConversion holds the shared caret search and the StructKind
description, TupleConversion and AnonymousRecordConversion are the two
kinds, and StructPropagation (was TuplePropagation) takes a kind and
registers the code action for both providers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
❗ Release notes requiredYou can open this PR in browser to add release notes: open in github.dev
|
…ents with their calls The only argument of a member or constructor is its parameter list, not a tuple, so it is no longer offered. A tuple that is a whole curried argument of a function or member now converts the matching argument at every call, and `struct` no longer runs into a name the parenthesis follows (`f(a, b)`). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ents with their calls The only argument of a member or constructor is its parameter list, not a tuple, so it is no longer offered. A tuple that is a whole curried argument of a function or member now converts the matching argument at every call, and `struct` no longer runs into a name the parenthesis follows (`f(a, b)`). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…s-record-struct-refactoring # Conflicts: # vsintegration/src/FSharp.Editor/Refactor/StructPropagation.fs # vsintegration/src/FSharp.Editor/Refactor/TupleConversion.fs
…e of its section Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 14, 2026
xperiandri
marked this pull request as ready for review
September 14, 2026 19:40
Contributor
|
🔍 Tooling Safety Check — Affects-Design-Time
|
Contributor
Author
Covered casesConverts
Not offered
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #20548.
Offers
Ctrl+.to switch between{| … |}andstruct {| … |}, following the value the same way as the tuple refactoring. A copy-and-update{| r with … |}has its own form, so it converts independently ofr.🤖 Generated with Claude Code