Repository navigation
Conversation
…r write trackReference walked a reference up while its parent was any member expression, without checking the reference was the member object. So for obj[rest] = 1 the computed key rest was tested with isAssignedMember, and a <const> rest binding used as a key threw "assigning its members would be lost" even though nothing assigns the rest. Guard the walk so only the member object continues it; a computed key is just read. Adds a rest-computed-member-key fixture that fails to compile without the guard, and removes the matching agent-feedback item. Signed-off-by: NUAAwqy <NUAAwqy@users.noreply.github.com>
🦋 Changeset detectedLatest commit: 1d1606e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
Problem
trackReferencewalks a reference up while its parent is any member expression, without checking thereference is the member's
object, and then asksisAssignedMember. So forobj[rest] = 1the computedkey
restis treated as if its own members were assigned. Whenrestis a<const>rest binding, validcode fails to compile:
The key is only read — nothing assigns
rest. The same missing check also records a needlessaddAssignedPropertyde-optimization for ordinary keys (o[x] = 1,o[x]++,delete o[x]).Fix
Stop the walk unless the reference is the member's
object; a computed key is just a read. One line(+ a two-line comment) in
translator/util/references.ts. Node comparison is direct, per AGENTS.md.Tests
New fixture
rest-computed-member-key(html/dom/ssr/csr, generated snapshots) fails to compile before theguard and passes after. Real member writes still error:
--grep rest= 307 passing, includingerror-assign-to-rest-elementanderror-assign-to-rest-element-member(rest.b = 5). Fullruntime-tags translator suite green, repo-wide
oxlint/oxfmtclean, andbuild:sizesproduces no.sizes/.sizes.jsondelta (translator-only change, zero shipped runtime bytes).Resolves the tracked
agent-feedbackitem for this defect; the item file is deleted in this PR peragent-feedback/README.mdrule 8.