{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/flow/pulls/comments/39805737","id":39805737,"diff_hunk":"@@ -330,6 +330,8 @@ type Iterable<T> = $Iterable<T,void,void>;\n interface Generator<Yield,Return,Next> {\n     @@iterator(): $Iterator<Yield,Return,Next>;\n     next(value?: Next): IteratorResult<Yield,Return>;\n+    return(value: Return): IteratorResult<Yield,Return>;","path":"lib/core.js","position":4,"original_position":4,"commit_id":"3f7e049b499c5520e65c6448667e2c940ca9275d","original_commit_id":"3f7e049b499c5520e65c6448667e2c940ca9275d","user":{"login":"samwgoldman","id":254842,"avatar_url":"https://avatars.githubusercontent.com/u/254842?v=3","gravatar_id":"","url":"https://api.github.com/users/samwgoldman","html_url":"https://github.com/samwgoldman","followers_url":"https://api.github.com/users/samwgoldman/followers","following_url":"https://api.github.com/users/samwgoldman/following{/other_user}","gists_url":"https://api.github.com/users/samwgoldman/gists{/gist_id}","starred_url":"https://api.github.com/users/samwgoldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwgoldman/subscriptions","organizations_url":"https://api.github.com/users/samwgoldman/orgs","repos_url":"https://api.github.com/users/samwgoldman/repos","events_url":"https://api.github.com/users/samwgoldman/events{/privacy}","received_events_url":"https://api.github.com/users/samwgoldman/received_events","type":"User","site_admin":false},"body":"Smart.","created_at":"2015-09-17T22:14:46Z","updated_at":"2015-09-17T22:14:46Z","html_url":"https://github.com/facebook/flow/pull/797#discussion_r39805737","pull_request_url":"https://api.github.com/repos/facebook/flow/pulls/797","_links":{"self":{"href":"https://api.github.com/repos/facebook/flow/pulls/comments/39805737"},"html":{"href":"https://github.com/facebook/flow/pull/797#discussion_r39805737"},"pull_request":{"href":"https://api.github.com/repos/facebook/flow/pulls/797"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/flow/pulls/797","id":44890248,"html_url":"https://github.com/facebook/flow/pull/797","diff_url":"https://github.com/facebook/flow/pull/797.diff","patch_url":"https://github.com/facebook/flow/pull/797.patch","issue_url":"https://api.github.com/repos/facebook/flow/issues/797","number":797,"state":"open","locked":false,"title":"Support `return` and `throw` generator methods","user":{"login":"samwgoldman","id":254842,"avatar_url":"https://avatars.githubusercontent.com/u/254842?v=3","gravatar_id":"","url":"https://api.github.com/users/samwgoldman","html_url":"https://github.com/samwgoldman","followers_url":"https://api.github.com/users/samwgoldman/followers","following_url":"https://api.github.com/users/samwgoldman/following{/other_user}","gists_url":"https://api.github.com/users/samwgoldman/gists{/gist_id}","starred_url":"https://api.github.com/users/samwgoldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwgoldman/subscriptions","organizations_url":"https://api.github.com/users/samwgoldman/orgs","repos_url":"https://api.github.com/users/samwgoldman/repos","events_url":"https://api.github.com/users/samwgoldman/events{/privacy}","received_events_url":"https://api.github.com/users/samwgoldman/received_events","type":"User","site_admin":false},"body":"Per the spec[1], generator objects have two methods which I neglected to\r\nimplement on the first go 'round.\r\n\r\n`return` is somewhat special, because it means the return type can be\r\nwidened outside the generator function declaration itself. The argument\r\npassed to `return` becomes the completion value of the generator itself,\r\nand return value is the iterator result with `done:true` and the\r\nprovided value.\r\n\r\n`throw` is more straightforward, but led me to a (perhaps controversial)\r\nchange: I think the type of the catch parameter should be `mixed`,\r\ninstead of an open tvar. In a perfect world, Flow would know exactly\r\nwhat type was thrown, but barring that, we should be pessimistic and\r\nrequire the user to do a dynamic type test (`invariant()` is useful for\r\nthis).\r\n\r\nThis change is unrelated to generators, but I think the throw API\r\ninvites people to pass values into a generator, and I don't want Flow to\r\nignore potential runtime errors caused by that use.\r\n\r\n1. http://www.ecma-international.org/ecma-262/6.0/#sec-generator-objects","created_at":"2015-09-14T03:33:21Z","updated_at":"2015-09-17T22:14:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1aca00f4c93613aa38359511b38f4dd1c7385a00","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/flow/pulls/797/commits","review_comments_url":"https://api.github.com/repos/facebook/flow/pulls/797/comments","review_comment_url":"https://api.github.com/repos/facebook/flow/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/flow/issues/797/comments","statuses_url":"https://api.github.com/repos/facebook/flow/statuses/3f7e049b499c5520e65c6448667e2c940ca9275d","head":{"label":"samwgoldman:generator-return-throw","ref":"generator-return-throw","sha":"3f7e049b499c5520e65c6448667e2c940ca9275d","user":{"login":"samwgoldman","id":254842,"avatar_url":"https://avatars.githubusercontent.com/u/254842?v=3","gravatar_id":"","url":"https://api.github.com/users/samwgoldman","html_url":"https://github.com/samwgoldman","followers_url":"https://api.github.com/users/samwgoldman/followers","following_url":"https://api.github.com/users/samwgoldman/following{/other_user}","gists_url":"https://api.github.com/users/samwgoldman/gists{/gist_id}","starred_url":"https://api.github.com/users/samwgoldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwgoldman/subscriptions","organizations_url":"https://api.github.com/users/samwgoldman/orgs","repos_url":"https://api.github.com/users/samwgoldman/repos","events_url":"https://api.github.com/users/samwgoldman/events{/privacy}","received_events_url":"https://api.github.com/users/samwgoldman/received_events","type":"User","site_admin":false},"repo":{"id":31458997,"name":"flow","full_name":"samwgoldman/flow","owner":{"login":"samwgoldman","id":254842,"avatar_url":"https://avatars.githubusercontent.com/u/254842?v=3","gravatar_id":"","url":"https://api.github.com/users/samwgoldman","html_url":"https://github.com/samwgoldman","followers_url":"https://api.github.com/users/samwgoldman/followers","following_url":"https://api.github.com/users/samwgoldman/following{/other_user}","gists_url":"https://api.github.com/users/samwgoldman/gists{/gist_id}","starred_url":"https://api.github.com/users/samwgoldman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samwgoldman/subscriptions","organizations_url":"https://api.github.com/users/samwgoldman/orgs","repos_url":"https://api.github.com/users/samwgoldman/repos","events_url":"https://api.github.com/users/samwgoldman/events{/privacy}","received_events_url":"https://api.github.com/users/samwgoldman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samwgoldman/flow","description":"Adds static typing to JavaScript to improve developer productivity and code quality.","fork":true,"url":"https://api.github.com/repos/samwgoldman/flow","forks_url":"https://api.github.com/repos/samwgoldman/flow/forks","keys_url":"https://api.github.com/repos/samwgoldman/flow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samwgoldman/flow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samwgoldman/flow/teams","hooks_url":"https://api.github.com/repos/samwgoldman/flow/hooks","issue_events_url":"https://api.github.com/repos/samwgoldman/flow/issues/events{/number}","events_url":"https://api.github.com/repos/samwgoldman/flow/events","assignees_url":"https://api.github.com/repos/samwgoldman/flow/assignees{/user}","branches_url":"https://api.github.com/repos/samwgoldman/flow/branches{/branch}","tags_url":"https://api.github.com/repos/samwgoldman/flow/tags","blobs_url":"https://api.github.com/repos/samwgoldman/flow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samwgoldman/flow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samwgoldman/flow/git/refs{/sha}","trees_url":"https://api.github.com/repos/samwgoldman/flow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samwgoldman/flow/statuses/{sha}","languages_url":"https://api.github.com/repos/samwgoldman/flow/languages","stargazers_url":"https://api.github.com/repos/samwgoldman/flow/stargazers","contributors_url":"https://api.github.com/repos/samwgoldman/flow/contributors","subscribers_url":"https://api.github.com/repos/samwgoldman/flow/subscribers","subscription_url":"https://api.github.com/repos/samwgoldman/flow/subscription","commits_url":"https://api.github.com/repos/samwgoldman/flow/commits{/sha}","git_commits_url":"https://api.github.com/repos/samwgoldman/flow/git/commits{/sha}","comments_url":"https://api.github.com/repos/samwgoldman/flow/comments{/number}","issue_comment_url":"https://api.github.com/repos/samwgoldman/flow/issues/comments{/number}","contents_url":"https://api.github.com/repos/samwgoldman/flow/contents/{+path}","compare_url":"https://api.github.com/repos/samwgoldman/flow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samwgoldman/flow/merges","archive_url":"https://api.github.com/repos/samwgoldman/flow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samwgoldman/flow/downloads","issues_url":"https://api.github.com/repos/samwgoldman/flow/issues{/number}","pulls_url":"https://api.github.com/repos/samwgoldman/flow/pulls{/number}","milestones_url":"https://api.github.com/repos/samwgoldman/flow/milestones{/number}","notifications_url":"https://api.github.com/repos/samwgoldman/flow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samwgoldman/flow/labels{/name}","releases_url":"https://api.github.com/repos/samwgoldman/flow/releases{/id}","created_at":"2015-02-28T10:12:19Z","updated_at":"2015-05-07T21:57:52Z","pushed_at":"2015-09-14T03:33:07Z","git_url":"git://github.com/samwgoldman/flow.git","ssh_url":"git@github.com:samwgoldman/flow.git","clone_url":"https://github.com/samwgoldman/flow.git","svn_url":"https://github.com/samwgoldman/flow","homepage":"http://flowtype.org/","size":68220,"stargazers_count":0,"watchers_count":0,"language":"OCaml","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"e966f83864329db5ab73dbafe5413f056ae3591b","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":25880891,"name":"flow","full_name":"facebook/flow","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/flow","description":"Adds static typing to JavaScript to improve developer productivity and code quality.","fork":false,"url":"https://api.github.com/repos/facebook/flow","forks_url":"https://api.github.com/repos/facebook/flow/forks","keys_url":"https://api.github.com/repos/facebook/flow/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/flow/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/flow/teams","hooks_url":"https://api.github.com/repos/facebook/flow/hooks","issue_events_url":"https://api.github.com/repos/facebook/flow/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/flow/events","assignees_url":"https://api.github.com/repos/facebook/flow/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/flow/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/flow/tags","blobs_url":"https://api.github.com/repos/facebook/flow/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/flow/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/flow/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/flow/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/flow/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/flow/languages","stargazers_url":"https://api.github.com/repos/facebook/flow/stargazers","contributors_url":"https://api.github.com/repos/facebook/flow/contributors","subscribers_url":"https://api.github.com/repos/facebook/flow/subscribers","subscription_url":"https://api.github.com/repos/facebook/flow/subscription","commits_url":"https://api.github.com/repos/facebook/flow/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/flow/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/flow/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/flow/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/flow/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/flow/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/flow/merges","archive_url":"https://api.github.com/repos/facebook/flow/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/flow/downloads","issues_url":"https://api.github.com/repos/facebook/flow/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/flow/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/flow/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/flow/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/flow/labels{/name}","releases_url":"https://api.github.com/repos/facebook/flow/releases{/id}","created_at":"2014-10-28T17:17:45Z","updated_at":"2015-09-17T21:28:27Z","pushed_at":"2015-09-17T21:55:26Z","git_url":"git://github.com/facebook/flow.git","ssh_url":"git@github.com:facebook/flow.git","clone_url":"https://github.com/facebook/flow.git","svn_url":"https://github.com/facebook/flow","homepage":"http://flowtype.org/","size":117653,"stargazers_count":5319,"watchers_count":5319,"language":"OCaml","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":297,"mirror_url":null,"open_issues_count":258,"forks":297,"open_issues":258,"watchers":5319,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/flow/pulls/797"},"html":{"href":"https://github.com/facebook/flow/pull/797"},"issue":{"href":"https://api.github.com/repos/facebook/flow/issues/797"},"comments":{"href":"https://api.github.com/repos/facebook/flow/issues/797/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/flow/pulls/797/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/flow/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/flow/pulls/797/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/flow/statuses/3f7e049b499c5520e65c6448667e2c940ca9275d"}}}}