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

Unexpected SyntaxError while compiling await (() => 42) #27808

Open
Corei13 opened this issue Jan 24, 2025 · 2 comments
Open

Unexpected SyntaxError while compiling await (() => 42) #27808

Corei13 opened this issue Jan 24, 2025 · 2 comments
Labels
repl related to the Read-Eval-Print-Loop functionality of Deno

Comments

@Corei13
Copy link

Corei13 commented Jan 24, 2025

Version: Deno 2.1.7

> () => 42
[Function (anonymous)]
> await (() => 42)
Uncaught SyntaxError: Malformed arrow function parameter list
> await [() => 42]
[ [Function (anonymous)] ]
> const f = () => 42; await f
[Function: f]
> await function() { return 42 }
[Function (anonymous)]

await (() => 42) should be treated as a valid syntax.

@marvinhagemeister marvinhagemeister added the repl related to the Read-Eval-Print-Loop functionality of Deno label Jan 24, 2025
@marvinhagemeister
Copy link
Contributor

Can confirm. It doesn't reproduce in SWC and seems to only happens in repl.

@HasanAlrimawi
Copy link
Contributor

This is caused by repl session fn evaluate_expression in deno\cli\tools\repl\session.rs .
If you check the value at the end of the function you'll find the error, while if you check parsed_source.diagnostics() you will get empty vector.

Which means that it's related to deno and most probably deno_core has something to do with it -> fn post_message of LocalInspectorSession in deno_core\core\inspector.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl related to the Read-Eval-Print-Loop functionality of Deno
Projects
None yet
Development

No branches or pull requests

3 participants