fix(runtime): route for-await async generator values#4408
Open
andrewtdiz wants to merge 3 commits into
Open
Conversation
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.
Refs #4405
Summary
ForAwaitToArrayHIR materialization path for untypedfor await...ofreceiversjs_array_from_asynccollector, so async-generator values held in variables or returned from methods use async-iterator/.next()semantics instead of the syncfor...ofarray fallbackfor awaitarray fast path intact, including awaiting array elementsWhy Batched
The variable-held and method-result cases fail for the same reason: after the direct named async-generator call special case is missed, lowering falls through to the untyped
for...ofmaterializer. A single async materializer fixes both without changing the direct named-call path.Non-Goals
Array.fromAsynccollector[Symbol.asyncIterator]shape metadata to Perry async-generator objectsfor awaitstream/timer special pathsValidation
test-parity/node-suite/globals/async-generator-for-await-variable.tsmatched Perry direct outputCARGO_TARGET_DIR=/tmp/perry-async-generator-for-await-check cargo check -p perry-hir -p perry-codegen -p perry-codegen-jspassedcargo build -p perry-runtime -p perry-stdlib -p perry --releasepassedPATH=/root/.npm/_npx/bac97da9607b7ef2/node_modules/node/bin:$PATH PERRY_NO_AUTO_OPTIMIZE=1 PERRY_NO_CACHE=1 ./run_parity_tests.sh --suite node-suite --module globals --filter async-generator-for-await-variablepassed: 1 pass / 0 fail--filter generatorpassed: 6 pass / 0 fail--filter array-from-asyncpassed: 1 pass / 0 failcargo fmt -p perry-hir -p perry-codegen -p perry-codegen-js -- --checkpassedgit diff --check HEADpassedgit diff --cached --checkpassedjq empty test-parity/known_failures.jsonpassed./scripts/check_file_size.shpassed