Skip to content

Parse arrows with params annotations in conditional expressions#10669

Merged
nicolo-ribaudo merged 1 commit intobabel:masterfrom
nicolo-ribaudo:flow-arrow-conditional-regression
Nov 6, 2019
Merged

Parse arrows with params annotations in conditional expressions#10669
nicolo-ribaudo merged 1 commit intobabel:masterfrom
nicolo-ribaudo:flow-arrow-conditional-regression

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
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
Copy Markdown

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]

@@ -0,0 +1,2 @@
test
? (x: T): U => y
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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