This repository has been archived by the owner. It is now read-only.

Fix accidental fall-through in Flow type parsing. #82

Merged
merged 1 commit into from Jul 28, 2016

Conversation

Projects
None yet
3 participants
@xiemaisi
Copy link
Contributor

xiemaisi commented Jul 26, 2016

When parsing a primary type, > would erroneously be treated like (. For example, >x:int) => string was parsed the same as (x:int) => string.

@@ -505,6 +505,8 @@ pp.flowParsePrimaryType = function () {
node.returnType = this.flowParseType();

return this.finishNode(node, "FunctionTypeAnnotation");
} else {
this.unexpected();

This comment has been minimized.

@danez

danez Jul 26, 2016

Member

This is just minor and makes not a big difference, but maybe adding here just a break and then it would call this.unexpected() on line 395

This comment has been minimized.

@xiemaisi

xiemaisi Jul 26, 2016

Author Contributor

Sure, that works, too. I've amended the commit.

@danez

This comment has been minimized.

Copy link
Member

danez commented Jul 26, 2016

Good catch. I wonder if we have the same problem with tt.plusMin

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Jul 26, 2016

Current coverage is 96.91% (diff: 100%)

Merging #82 into master will increase coverage by <.01%

@@             master        #82   diff @@
==========================================
  Files            19         19          
  Lines          2913       2914     +1   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           2823       2824     +1   
  Misses           90         90          
  Partials          0          0          

Powered by Codecov. Last update 88d7e20...39cee24

@xiemaisi

This comment has been minimized.

Copy link
Contributor Author

xiemaisi commented Jul 26, 2016

That certainly also looks suspicious, but I wasn't immediately able to construct an example (I'm new to Babylon).

Fix accidental fall-through in Flow type parsing.
When parsing a primary type, `>` would erroneously be treated like `(`.

@xiemaisi xiemaisi force-pushed the xiemaisi:fix-accidental-fallthrough branch from 820f474 to 2bebe36 Jul 26, 2016

@danez

This comment has been minimized.

Copy link
Member

danez commented Jul 26, 2016

Yes I also couldn't figure out an example.
Thanks

@danez danez added the Tag: Bug Fix label Jul 28, 2016

@danez danez merged commit fd18d89 into babel:master Jul 28, 2016

3 checks passed

codecov/patch 100% of diff hit (target 96.91%)
Details
codecov/project 96.91% (+<.01%) compared to 88d7e20
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.