Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing parentheses for ((async) of []); #10777

Closed
fisker opened this issue Apr 27, 2021 · 1 comment · Fixed by #10781
Closed

Missing parentheses for ((async) of []); #10777

fisker opened this issue Apr 27, 2021 · 1 comment · Fixed by #10781
Assignees
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program

Comments

@fisker
Copy link
Sponsor Member

fisker commented Apr 27, 2021

This is valid even in main branch, related babel pr

Prettier 2.2.1
Playground link

--parser babel

Input:

for ((async) of []);

Output:

for (async of []);

Second Output:

SyntaxError: Unexpected token, expected "=>" (1:15)
> 1 | for (async of []);
    |               ^
  2 | 

Expected behavior:

@fisker fisker added the type:bug Issues identifying ugly output, or a defect in the program label Apr 27, 2021
@thorn0 thorn0 added the lang:javascript Issues affecting JS label Apr 27, 2021
@fisker fisker self-assigned this Apr 29, 2021
@thorn0
Copy link
Member

thorn0 commented Apr 29, 2021

The parens are also needed in for ((let) of []); and for ((let.foo.bar) of []);.

See https://tc39.es/ecma262/#sec-for-in-and-for-of-statements

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Aug 5, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:javascript Issues affecting JS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:bug Issues identifying ugly output, or a defect in the program
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants