You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Switch guard calling a function named async fails to parse #8933
Syntax error!
4 │ | Some(x) if async(x) => 1
5 │ | _ => 0
Did you forget a `=>` here?
Cause: to tell an async arrow (async (x) => …) apart from a call (async(x)), the parser looks ahead for a => after the parentheses (is_es6_arrow_expression in compiler/syntax/src/res_core.ml). In a guard, the case's own => always follows the guard, so async(x) => is taken as the start of an async arrow.
Expected: a function is never a valid guard (guards are bool), so the arrow lookahead should not apply when parsing a guard (the WhenExpr context).
Nobody names a function async, so this rarely matters today. It will matter if gen becomes a contextual prefix for generator functions in the same way, because gen is a common function name.
Activity