Repository navigation
Generator: next() takes no value again (fixes wasm iteration_types trap from #115) - #116
Merged
Merged
Conversation
…s, (value?) => called as () => was another signature (wasm: iteration_types.ts trapped) 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 fixes a bug I introduced in #115. Since it merged, the compiler's CI fails
iteration_types.tsin every wasm DefaultLib leg (all models), with "RuntimeError: null function or function signature mismatch" insum. That breaks every TypeScriptCompiler PR, including #983.Cause: #115 declared
Generator.nextas(value?: TNext) =>, whileIterable.nextis() =>. The compiler's interface-to-interface cast notices the different member type but reports it only when the vtable has to be remapped.nextis the first slot of both interfaces, so the cast went through unchanged, and anIterable'snext()called a function with a different signature. Wasm checks signatures on indirect calls and traps. Natively the generator read a sent value that was never given.Fix:
Generator.nexttakes no value again, as before #115. Kept from #115:return?andthrow?object_dictionary.tsreturn()/throw()/array-as-Iterabletests (thenext(value)part ofgenerator_next_return.tsis removed)Declaring
next(value)through the library'sGeneratorstays open (TSLANG 153). It needs the compiler to adaptnextwhen aGeneratoris given to anIterable.Checked locally:
TNextand withTNext = undefinedpassed as anIterable/Iterator, plusreturn()) runs on wasm32 under own, rc and none, and natively under all four models. With the Generator: next(value?), return?() and throw?(); own object_dictionary lifted; next/return/throw tests #115 declaration it traps on wasm.tests.ps1release, built with the TypeScriptCompiler #983 compiler: everything passes under gc, rc, none and own, compiled and JIT.This repo's CI tests against alpha133, which predates #982 and #983, so it can't go green until the next compiler release.
🤖 Generated with Claude Code