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

Parse arrows with params annotations in conditional expressions #10669

Conversation

nicolo-ribaudo
Copy link
Member

Q                       A
Fixed Issues? Fixes #10651
Patch: Bug Fix? Yes
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories area: flow pkg: parser i: regression labels Nov 6, 2019
@buildsize
Copy link

buildsize bot commented Nov 6, 2019

File name Previous Size New Size Change
babel-preset-env.js 2.78 MB 2.78 MB 36 bytes (0%)
babel-preset-env.min.js 1.67 MB 1.67 MB 41 bytes (0%)
babel.js 2.96 MB 2.96 MB -24 bytes (0%)
babel.min.js 1.63 MB 1.63 MB 24 bytes (0%)
test262.tap 4.84 MB [deleted]

packages/babel-parser/src/plugins/flow.js Show resolved Hide resolved
@@ -0,0 +1,2 @@
test
? (x: T): U => y
Copy link
Contributor

Choose a reason for hiding this comment

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

U => y must be parenthesized, otherwise flow could not parse it.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is a known bug with flow, because it also rejects this valid JS code:

test ? (x) : I => y

facebook/flow#2006

Copy link
Member Author

Choose a reason for hiding this comment

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

For context, here is one of my first PRs 😛
babel/babylon#573

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: flow i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser 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.

@babel/parser -> Flow Type Error when
2 participants