Skip to content

Interpreted synchronous yield-star replaces incomplete delegated iterator result objects #3665

Open

Description

@nickna

Interpreted synchronous yield* creates a fresh result with a Boolean done field for an incomplete delegated step, rather than exposing the delegate's result object.

const step = { value: 1 };
const iterable = { [Symbol.iterator]() { return { next() { return step; } }; } };
function* run() { yield* iterable; }
const generator = run();
const result = generator.next();
console.log(result.done, result === step);
generator.return();

Node v22.23.2 prints undefined true. SharpTS interpretation with --no-tsconfig --noLib source.ts prints false false.

The pinned Test262 case language/expressions/yield/star-iterable.js fails at its first assertion for an absent delegated done property:

Test262Error: First result `done` flag Expected SameValue(«false», «undefined») to be true

This same failure was verified with both the PR #3663 acquired-iterator review fix (0b44ff4de) and the preserved bindings-worktree core whose interpreter remains unchanged from the pre-review PR head. The preserved core SHA256 is 72FC4FF8E63D14FED2DF3E6FA285B710DA5EB070EDBCD52B15BE8ECDB5A4499E; the worker copy matched it exactly. This records an existing result-shape limitation, not a regression introduced by retaining the acquired iterator.

An incomplete synchronous delegated result should remain observable with its original properties and identity. The interpreter currently reads its value and suspends through the ordinary yield-value path, which builds a new SharpTSIteratorResult with done: false.

Found while broadening the PR review's interpreted Test262 delegation selection. Evidence is retained under .artifacts/issues-3638-3653/interpreter/artifacts/issue-probes/pr3663-star-iterable-baseline.* and pr3663-iterator-test262.*. No baselines were updated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions