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
Invalid code generation for top-level await with newline (expression duplicated) #39186
This may lead to subtle correctness bugs. This only happens when there's a newline between the await keyword and the awaited expression. This also only happens for top-level await. Enclosing the await in an async function makes the bug disappear.
quick solution: Limit the reparse to the extent of the original expression. This will prevent duplication but would result in an expression expected error following the await. This is undesirable, but is also no worse than the behavior in 3.9.
good solution: When reparsing, if the extent of the new expression is larger than the original expression, we must also reparse the statement that follows starting at the end position of the new expression. This may take some additional time to implement.
I'm investigating the "good solution" currently, and if it looks like it will take more than the rest of the day to implement I would advise we implement the "quick solution" for the 4.0 beta.
Activity
RyanCavanaugh commentedon Jun 22, 2020
Ron Buckton (@rbuckton) big emit bug here
rbuckton commentedon Jun 22, 2020
Hmm. Not an emit bug, but a bug in the reparse for top-level await due to newline handling probably. I'll investigate.
rbuckton commentedon Jun 22, 2020
Ryan Cavanaugh (@RyanCavanaugh):
There's a "quick solution" and a "good solution":
expression expectederror following theawait. This is undesirable, but is also no worse than the behavior in 3.9.I'm investigating the "good solution" currently, and if it looks like it will take more than the rest of the day to implement I would advise we implement the "quick solution" for the 4.0 beta.
RyanCavanaugh commentedon Jun 23, 2020
If we already shipped this in 3.9 then I'm OK waiting for the "good solution"
rbuckton commentedon Jun 23, 2020
This wasn't in 3.9, its is a bug in the change in 4.0 to reparse
awaitin the top-level of a module.