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

Fix parsing type casted generic flow arrow exprs #11955

Merged
merged 3 commits into from
Aug 19, 2020
Merged

Conversation

existentialism
Copy link
Member

@existentialism existentialism commented Aug 12, 2020

Q                       A
Fixed Issues? Fixes #11716
Patch: Bug Fix? Y
License MIT

@existentialism existentialism added PR: Bug Fix 🐛 A type of pull request used for our changelog categories area: flow labels Aug 12, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 12, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 501ebd0:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

JLHwung
JLHwung previously approved these changes Aug 12, 2020
Copy link
Contributor

@JLHwung JLHwung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While reviewing this PR, I realize there are two invalid cases related to how we handle parenItem and generic arrow:

<T> async () => {}

should throw but it is passed because we didn't validate arrowExpression.async.

(<T>() => {}?:any);

should throw but ? is incorrectly eaten in parseParenItem.

packages/babel-parser/src/plugins/flow.js Outdated Show resolved Hide resolved
@JLHwung JLHwung dismissed their stale review August 12, 2020 20:36

A regression was introduced.

@babel-bot
Copy link
Collaborator

babel-bot commented Aug 12, 2020

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/27618/

Copy link
Member

@nicolo-ribaudo nicolo-ribaudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the same tests but with enableParenthesizedExpressions?

@existentialism existentialism merged commit 96cc829 into main Aug 19, 2020
@existentialism existentialism deleted the flow-typecast branch August 19, 2020 19:15
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 19, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: flow outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flow arrow expression with type params inside type cast reported as parse error
5 participants