Repository navigation
Generator: next(value?: TNext) again (merge after TypeScriptCompiler #984) - #117
Merged
Merged
Conversation
…iler iterates it by an adapter (TypeScriptCompiler #984) 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.
Generator.nextis declarednext: (value?: TNext) => IterateResult<T>again, sog.next(value)type-checks through the library'sGenerator. #116 had to remove this: anIterable'snext()called aGenerator'snext(value?)as it was, and wasm trapped with "function signature mismatch" initeration_types.ts.Merge after TypeScriptCompiler #984. With #984 the compiler wraps a
Generatorpassed as anIterable/Iteratorin a generated generator that callsnext()and re-yields, so the two signatures never meet. TypeScriptCompiler's CI builds this repo's main: merged before #984, this would bring the wasm trap back there.tests/generator_next_return.tsagain coversnext(value), plus aGenerator<number, void, number>passed as anIterable<number>.Checked locally, with the #984 compiler:
tests.ps1release: everything passes under gc (249/250, 1 skipped), rc (244, 6 skipped), none (245, 5 skipped) and own (236, 14 skipped), compiled and JIT.iteration_types.ts.This repo's own CI tests against the newest compiler release (alpha133), which has neither #984 nor #982/#983, so it can't go green until the next release.
For the reviewer (left to you rather than merged automatically):
Generatorpassed as anIterable/Iteratorgoes through the compiler's adapter generator, with one extra layer ofnext()calls. Under-mm=ownthe adapter keeps (@keeps) the generator it's given, so passing a generator local to anIterableparameter becomes a move where it was a borrow: using that local after the call is then an error.Generator<T, R, number>passed as aGenerator<T>is adapted the same way (#984 covers it).next(value)through the adapter doesn't reach the source generator.🤖 Generated with Claude Code