Fix table properties being inferred as readonly with compound assignment - #2724
Open
Companion wants to merge 2 commits into
Open
Fix table properties being inferred as readonly with compound assignment#2724Companion wants to merge 2 commits into
Companion wants to merge 2 commits into
Conversation
Companion
force-pushed
the
fix/compound-assignment-property-inference
branch
from
August 30, 2026 01:07
323a28a to
bbe0826
Compare
aatxe
reviewed
Sep 2, 2026
Inline compound assignment property check Co-authored-by: ariel <aweiss@hey.com>
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.
Problem
Compound assignment does not record that its target property is being written to during constraint generation.
For example:
incorrectly reports:
The equivalent ordinary assignment,
x.h = x.h + 1, succeeds and infers the property as read write.Change
Record property writes performed by compound assignments allowing inferred properties to become read write in the same way as ordinary assignments.
The change is limited to property and index expression targets. Locals and globals remain excluded because compound assignment must not update their typestate.
Because a compound assignment uses the same AST expression for both reading and writing its target the existing read type is preserved while the write constraint is recorded. Genuine read only and write only property violations continue to be reported.
Fixes #2603.
Testing
Added coverage for:
The positive regression tests were verified to be load bearing by temporarily neutralizing only the new write recording path.