Skip to content

Do not await iterated value in for-await-of#24474

Merged
rbuckton merged 2 commits into
masterfrom
fix21115.2
May 30, 2018
Merged

Do not await iterated value in for-await-of#24474
rbuckton merged 2 commits into
masterfrom
fix21115.2

Conversation

@rbuckton
Copy link
Copy Markdown
Contributor

This change more closely aligns with the specified for-await-of semantics, per 13.7.5.13, step 6.d-6.h. At no time during those steps is there an Await for nextValue.

Fixes #21115

@rbuckton rbuckton requested review from mhegazy and weswigham May 29, 2018 22:36
Copy link
Copy Markdown
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional tests ❤️

@rbuckton rbuckton merged commit 364fce3 into master May 30, 2018
@rbuckton rbuckton deleted the fix21115.2 branch May 30, 2018 00:54
case 0: return { value: 1, done: false };
case 1: return { value: Promise.resolve(2), done: false };
case 2: return { value: new Promise<number>(resolve => setTimeout(resolve, 100, 3)), done: false };
default: return { value: undefined: done: true };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a typo on this line: undefined: should be undefined,
Same in all other test cases below

ajafff added a commit to ajafff/TypeScript that referenced this pull request Jun 1, 2018
@rbuckton
Copy link
Copy Markdown
Contributor Author

rbuckton commented Jun 7, 2018

@mhegazy do you want this ported to release-2.9 as well?

@mhegazy
Copy link
Copy Markdown
Contributor

mhegazy commented Jun 7, 2018

yes please.

rbuckton pushed a commit that referenced this pull request Jun 7, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using for-await-of should resolve the Promise?

4 participants