Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Parsing error with polymorphic anonymous functions #266

Closed
bodhi opened this issue Mar 4, 2016 · 3 comments
Closed

Parsing error with polymorphic anonymous functions #266

bodhi opened this issue Mar 4, 2016 · 3 comments

Comments

@bodhi
Copy link

bodhi commented Mar 4, 2016

Sorry if this is the wrong repo to post this on!

With this file:

/* @flow */
function a<U>(b: U): U {
    return b
}

const a2 = <U>(b: U): U => {
    return b
}

I get this error running ESLint with Babel-eslint:

a.js
  7:5  error  Parsing error: Unexpected token

Which is the return in the body of a2. With an implicit return, I get a different error:

const a3 = <U>(b: U): U => b

=>  xx:15  error  Parsing error: Unterminated JSX contents

Flow has no problems with any of the declarations.

@bodhi
Copy link
Author

bodhi commented Mar 4, 2016

Oops, forgot to say I saw this with v5.0.0 and v6.0.0-beta.1.

@hzoo
Copy link
Member

hzoo commented Mar 8, 2016

If it's valid in flow, then it will need to be supported in babylon (babel's parser)

@danez
Copy link
Member

danez commented Jun 26, 2016

This is fixed in babylon 6.8.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants