[Repo Assist] feat: add GenerateAnonRecordStub code fix for FS3578 (closes #455)#1510
Draft
github-actions[bot] wants to merge 3 commits intomainfrom
Draft
[Repo Assist] feat: add GenerateAnonRecordStub code fix for FS3578 (closes #455)#1510github-actions[bot] wants to merge 3 commits intomainfrom
github-actions[bot] wants to merge 3 commits intomainfrom
Conversation
When an anonymous record literal is missing fields required by its
expected type, offer a code action that inserts stub bindings
`fieldName = failwith "Not Implemented"` for each missing field before
the closing `|}`.
The fix is triggered by FS3578 ('Two anonymous record types have
mismatched sets of field names'). It parses the two field-name lists
from the diagnostic message, finds the anonymous record expression in
the parse tree, and computes which fields are absent.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
/repo-assist CI is failing |
Contributor
Author
|
✅ Repo Assist completed successfully! |
…r message formats
The code fix was using diagnostic code 3578 with an old message format
('Two anonymous record types have mismatched sets of field names ["A"; "B"] and ["A"]')
that the current F# compiler no longer produces.
Current F# compiler (>= 8) emits FS0001 for anonymous record field mismatches
with these message formats:
- "This anonymous record is missing field 'B'."
- "This anonymous record is missing fields 'B', 'C'."
- "This anonymous record does not exactly match the expected shape.
Add the missing fields [B; C] and remove the extra fields [D; E]."
Updated the code fix to:
1. Trigger on FS0001 with a message guard for 'anonymous record' + 'missing'
2. Parse missing field names from the three new message formats
3. Preserve the existing AST-based insertion logic
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 Repo Assist here — I've pushed a fix for the CI failures. Root cause: The code fix was triggering on diagnostic code
Fix applied:
The code fix should now correctly trigger and insert the missing field stubs.
|
13 tasks
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.
🤖 This is an automated pull request from Repo Assist.
Closes #455.
What
Adds a new
GenerateAnonRecordStubcode fix triggered by FS3578 ("Two anonymous record types have mismatched sets of field names").When you write an anonymous record literal that is missing fields required by its expected type, the fix inserts stub bindings
fieldName = failwith "Not Implemented"for each absent field before the closing|}.Before:
After applying the fix:
Full test suite was not run (requires a live FSAC server and several minutes). The new test cases follow the same pattern as
IntroduceMissingBindingTestsandGenerateRecordStubtests.