facebook / facebook/hermes

Parser: improve error message when await is used in non-async functions or instead of async

Open
#1,230 0 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
11.3k
Forks
859
Avg merge
1h 30m
Merged PRs (30d)
3

Description

From https://x.com/jamonholmgren/status/1741906729477226534?s=20

- Better error message when the programmer accidentally wrote `await () =>` instead of `async() =>`
- Better error message for `await` when the programmer forgot to declare the surrounding function as async. These two errors compound in a funny way.

Contributor guide

Open the contributing guide

Research direction

Start by locating Hermes parser diagnostics for `await` and `async` function declarations, then reproduce the two cases described: `await () =>` and `await` inside a non-async function. Done means each case produces a clearer, specific error message and the relevant parser tests cover both patterns.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.