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

await an expression with surrogate characters raises a SyntaxError #39929

Closed
Mesteery opened this issue Aug 29, 2021 · 4 comments
Closed

await an expression with surrogate characters raises a SyntaxError #39929

Mesteery opened this issue Aug 29, 2021 · 4 comments
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@Mesteery
Copy link
Contributor

Mesteery commented Aug 29, 2021

Version

16.8.0

Platform

No response

Subsystem

repl

What steps will reproduce the bug?

$ node
Welcome to Node.js v16.8.0.
Type ".help" for more information.
> await '😀😀😀' // or
> await '😀😀😀'; // or
> await '😀😀😀';;

How often does it reproduce? Is there a required condition?

All the time, as long as there is a top level await with one or more surrogate chars with a semicolon, or at least 3 surrogate chars.

What is the expected behavior?

> await '😀😀😀'
'😀😀😀'

What do you see instead?

> await '😀😀😀'
 }))()
 ^

Uncaught SyntaxError: Unexpected token '}'

> await '😀😀😀';
(async () => { return (await '😀😀😀';
                                     ^

Uncaught SyntaxError: Unexpected token ';'

> await '😀😀😀';;
undefined

Additional information

This is obviously reproducible with a more complex expression (for example await new buffer.Blob(['aaa', Buffer.from('èèee😁😁😁aaa')]).text().

@Mesteery Mesteery added the repl Issues and PRs related to the REPL subsystem. label Aug 29, 2021
@targos targos added the confirmed-bug Issues with confirmed bugs. label Aug 29, 2021
@targos
Copy link
Member

targos commented Aug 29, 2021

@nodejs/repl

@Mesteery
Copy link
Contributor Author

By the way there is another unrelated bug: await <any>;; != <any>;;. I don't know if this is intentional. Should I do another issue?

> await 1;;
undefined
> 1;;
1

@Ayase-252
Copy link
Member

Ayase-252 commented Aug 29, 2021

@Mesteery I think it is a seperate issue. it would be worth to open a new issue. 🤔

Output from chrome dev tool
Screen Shot 2021-08-29 at 22 15 42

@devsnek
Copy link
Member

devsnek commented Aug 29, 2021

the infinite stream of bugs for fake tla is even better than I thought it would be

@Mesteery Mesteery changed the title await an expression with at least 3 surrogate characters raises a SyntaxError await an expression with surrogate characters raises a SyntaxError Aug 29, 2021
Mesteery added a commit to Mesteery/node that referenced this issue Aug 29, 2021
@targos targos closed this as completed in addb30f Sep 8, 2021
BethGriggs pushed a commit that referenced this issue Sep 21, 2021
Fixes: #39929

PR-URL: #39931
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Shingo Inoue <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants