{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babylon/issues/58","repository_url":"https://api.github.com/repos/babel/babylon","labels_url":"https://api.github.com/repos/babel/babylon/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/babel/babylon/issues/58/comments","events_url":"https://api.github.com/repos/babel/babylon/issues/58/events","html_url":"https://github.com/babel/babylon/issues/58","id":162392462,"number":58,"title":"Significant but hard-to-find bug in parsing arrow functions","user":{"login":"Lucretiel","id":1823405,"avatar_url":"https://avatars.githubusercontent.com/u/1823405?v=3","gravatar_id":"","url":"https://api.github.com/users/Lucretiel","html_url":"https://github.com/Lucretiel","followers_url":"https://api.github.com/users/Lucretiel/followers","following_url":"https://api.github.com/users/Lucretiel/following{/other_user}","gists_url":"https://api.github.com/users/Lucretiel/gists{/gist_id}","starred_url":"https://api.github.com/users/Lucretiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lucretiel/subscriptions","organizations_url":"https://api.github.com/users/Lucretiel/orgs","repos_url":"https://api.github.com/users/Lucretiel/repos","events_url":"https://api.github.com/users/Lucretiel/events{/privacy}","received_events_url":"https://api.github.com/users/Lucretiel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-27T07:49:17Z","updated_at":"2016-06-28T12:54:50Z","closed_at":null,"body":"As of a recent release (Don't know when, exactly, but this issue broke code that was working fine around June 4), babylon's parsing of arrow functions has broken in a very peculiar way. When babylon encounters the following pattern:\r\n\r\n```\r\n<some expression> :\r\n    <a parenthesized arrow expression> ?\r\n    <an unparenthesized arrow expression>\r\n```\r\n\r\nIt reports an error parsing the parenthesized arrow expression:\r\n\r\n```\r\nModule build failed: SyntaxError: <path to file>: Assigning to rvalue (23:3)\r\n```\r\n\r\nFor example:\r\n\r\n```\r\nlet x = foo() ?\r\n    (value => true) :\r\n    value => false\r\n```\r\n\r\nThe contents of the condition don't seem to matter, nor does parenthesizing the entire conditional expression. However, if the parenthesis around the first arrow function are removed, or parenthesis are added to the second arrow function, or either arrow function is something other than an arrow function, it is parsed fine. This specific pattern is the only one that triggers the error.\r\n\r\nFor what it's worth, I'm running babylon via babel via webpack, but the stack trace I get is entirely from babylon.\r\n\r\nThis seems implausible, I know, so I've created a git repo which reproduces the error, available here:\r\n\r\nhttps://github.com/Lucretiel/babylon-error\r\n\r\nThe specific file I'm trying to pack is [index.js](https://github.com/Lucretiel/babylon-error/blob/master/index.jsx) with no dependencies or requires. The raw output from `webpack` is in [build_result](https://github.com/Lucretiel/babylon-error/blob/master/build_result)."},"comment":{"url":"https://api.github.com/repos/babel/babylon/issues/comments/229040236","html_url":"https://github.com/babel/babylon/issues/58#issuecomment-229040236","issue_url":"https://api.github.com/repos/babel/babylon/issues/58","id":229040236,"user":{"login":"danez","id":231804,"avatar_url":"https://avatars.githubusercontent.com/u/231804?v=3","gravatar_id":"","url":"https://api.github.com/users/danez","html_url":"https://github.com/danez","followers_url":"https://api.github.com/users/danez/followers","following_url":"https://api.github.com/users/danez/following{/other_user}","gists_url":"https://api.github.com/users/danez/gists{/gist_id}","starred_url":"https://api.github.com/users/danez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danez/subscriptions","organizations_url":"https://api.github.com/users/danez/orgs","repos_url":"https://api.github.com/users/danez/repos","events_url":"https://api.github.com/users/danez/events{/privacy}","received_events_url":"https://api.github.com/users/danez/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T12:54:50Z","updated_at":"2016-06-28T12:54:50Z","body":"After digging around I also found this case which is not working anymore:\r\n```\r\na ? (b): c => d\r\n```\r\n\r\nBecause babylon with flow now sees the \"valid-looking\" arrow function `(b): c => d`.\r\n\r\nThinking about reverting my change and then reopening the other bug and redoing the fix."}}
{"actor":{"display_login":"danez"}}