Repository navigation
yield in finally works as in JavaScript; a[i] = v grows under own; dictionary spread of other values and extending dictionary interfaces (TSLANG 152, 153) - #982
Merged
Conversation
The growth is a call of `.array_grow.<type>` given the array's slot, which -mm=own's passes take as any call given a slot; the guard that kept own out (when the growth was made in place, they read the slot written as a parameter's kept and a field's array read again as a second reference) is gone. The test runs under own again (jit own, wasm and Android own skips removed) and covers a parameter's array, a field's of a parameter and nested arrays. TSLANG 152. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d as a push by the ownership passes Not through a local over a parameter's array (as a push there, it would make the parameter kept). TSLANG 152. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The finally of a try whose finally yields is code of its own after the try, once: the try and catch in a labelled block with a catch-all keeping the exception; each return (and return()'s at a resume point), break and continue out of them records its way out and leaves the block; after the finally the way out is taken. return(v) gives what the finally yields and finishes with v. A let of a nested block hiding one around it in a generator gets a field of its own. Results checked against node. TSLANG 153. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tionary interface is that dictionary; a[i] = v does not grow an array the right side replaced
- { ...d } of a dictionary of other values calls __dictionary_assign_values<T, S>, made from source.
- interface More extends Counts {} of a dictionary interface: type More = Counts.
- a[1] = (a = [5], 9): the store goes into the array the left side read; no growth through the
variable's slot, which holds another array now (under own the unconditional growth grew it).
TSLANG 152.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…methods, untyped generators; own limits as errors - return() while paused in a yield* finishes through the finally (resume checks at its yields; not under own). - -mm=own: a value that owns memory returned through a yielding finally is an error at the return. - Tests: class generator method, untyped for...of, a closure's return in the try (all models); strings and objects returned through it, return() in a yield* (gc, rc); the own error. TSLANG 152, 153. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…NG 153 notes on own iterator interfaces Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…; strings sent by next() stay allowed Under -mm=own the generator over the array owns a copy of it (a borrow for the generator's lifetime can't be said there) and is declared to return the interface. TSLANG 153. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
This PR fixes the remaining TSLANG 152 and 153 items that the compiler can fix alone. The
next(object)part of item 4 follows in one more commit once it is built.yieldinside a generator'sfinallyworks as in JavaScript (TSLANG 153; it was an error since #980)trywhosefinallyyields no longer uses the try's finally region. TryOpLowering copied that region for each way out, and a resume landed in one copy only.return(andreturn()'s at a resume point), or abreak/continueout of the try.return's value is kept in a variable of the generator. Through nested yielding finallys it is handed on in the same variable.return(v): it gives back what the finally yields, then finishes withv.return()while paused in ayield*finishes through the finally too (not under own).return()/throw()paused in the body and in the finally,yield*, a class generator method, an untyped generator infor...of, a closure's ownreturn, and strings and objects returned through the finally.letin a nested block that hides an outer one in a generator shared the outer one's variable.-mm=own(also recorded in TSLANG 153):a[i] = vpast the end grows the array under-mm=owntoo (TSLANG 152)SetLengthOfmarked as only growing. Its lowering keeps the longer length, and own's passes treat it like a push.letover a parameter's array, where a push is refused too.a[1] = (a = [5], 9)).Dictionaries (TSLANG 152)
{ ...d }of a dictionary with a different value type now works, through a helper the compiler makes from source. No default library change is needed.interface More extends Counts {}, a dictionary interface with nothing added, is that dictionary.Tests
00generator_yield_in_finally.ts;00generator_yield_in_finally_values.ts(gc, rc); the own diagnosticgenerator_return_through_yielding_finally_own.ts.00array_write_grows.ts(now also under own),00object_dictionary.ts.Verified so far
Held
next(value?)/return?/throw?declarations, and lifting "not own" inobject_dictionary.ts.🤖 Generated with Claude Code