Repository navigation
-mm=own: for-of over a field of this in a generator reads the field at each step (TSLANG 182) - #1019
Merged
Merged
Conversation
…t each step (TSLANG 182) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASDAlexander77
force-pushed
the
tslang-182
branch
from
November 24, 2026 13:46
f5d5fe0 to
04f22b6
Compare
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.
TSLANG 182, item 158 under your ruling of 2026-11-24 (own only). This PR is stacked on #1018; once #1018 merges, its base becomes main.
Fixed
for (const s of this.items) yield sin a generator method: "a value that borrows a field cannot be stored, returned or captured". The loop kept the field's array in the generator's state across its yields.for...ofin a generator over an array field reached fromthis(this.items,this.inner.words) now reads the field again at each step:for (let .i = 0; .i < this.items.length; .i++) { const s = this.items[.i]; ... }.break,continue, a destructuring element and a loop variable declared before the loop work as before.Still open
for (const o of this.objs) yield o.n) is still refused, as it already is when the loop is written with an index. A generator's local lives in its state, and it can't hold a borrow of an element.Verified
00own_generator_for_of_this_field.tspasses under gc, rc, own and none.a1under own anda1b2c3under gc.🤖 Generated with Claude Code