Repository navigation
fix(all): copy mutable struct records by value - #5270
Merged
Merged
Conversation
Contributor
Python Type Checking Results (Pyright)
Excluded files with errors (4 files)These files have known type errors and are excluded from CI. Remove from
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Caching the source before update expressions run can copy stale unchanged fields when a mutable struct is reassigned during an update, requiring deferred dereferencing and a regression test.
1 open issue
What changed in this PR
This PR addresses #5253, where copy-and-update expressions on mutable struct records lose unchanged fields. It adjusts the shared F# transformation stage and adds regression tests across five targets.
Changes:
- Unwrap addresses for compiler-generated record-copy bindings and field reads on non-Rust targets.
- Test preservation of unchanged fields when copying mutable struct locals.
- Add mutable-field and module-level source coverage in selected target suites.
| File | Description |
|---|---|
tests/Rust/tests/src/RecordTests.fs |
Adds mutable struct copy-and-update coverage. |
tests/Python/TestRecordType.fs |
Tests local, mutable-field, and module-level cases. |
tests/Js/Main/RecordTypeTests.fs |
Tests local, mutable-field, and module-level cases. |
tests/Dart/src/RecordTests.fs |
Tests mutable locals and records with mutable fields. |
tests/Beam/RecordTests.fs |
Tests mutable locals and records with mutable fields. |
src/Fable.Transforms/FSharp2Fable.fs |
Changes address handling for record-copy bindings and field reads. |
Review effort: Balanced
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.

Fixes #5253.