{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/43055255","id":43055255,"diff_hunk":"@@ -1922,20 +2000,25 @@ namespace ts {\n         // TYPES\r\n \r\n         function parseTypeReferenceOrTypePredicate(): TypeReferenceNode | TypePredicateNode {\r\n-            let typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);\r\n+            contextualError.callback = invalidTypeReferenceOrTypePredicate;\r\n+\r\n+            let typeName = parseEntityName(/*allowReservedWords*/ false);\r\n             if (typeName.kind === SyntaxKind.Identifier && token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {\r\n                 nextToken();\r\n-                let node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typeName.pos);\r\n-                node.parameterName = <Identifier>typeName;\r\n-                node.type = parseType();\r\n-                return finishNode(node);\r\n+                let predicateNode = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typeName.pos);\r\n+                predicateNode.parameterName = <Identifier>typeName;\r\n+                predicateNode.type = parseType();\r\n+                return finishNodeContextualError(predicateNode);\r\n             }\r\n+\r\n             let node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference, typeName.pos);\r\n             node.typeName = typeName;\r\n-            if (!scanner.hasPrecedingLineBreak() && token === SyntaxKind.LessThanToken) {\r\n-                node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);\r\n+            if ((typeName.flags & NodeFlags.Missing) === 0) {\r","path":"src/compiler/parser.ts","position":188,"original_position":188,"commit_id":"57e0b1c7612c570655097e8a6268112160c1594d","original_commit_id":"57e0b1c7612c570655097e8a6268112160c1594d","user":{"login":"DanielRosenwasser","id":972891,"avatar_url":"https://avatars.githubusercontent.com/u/972891?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielRosenwasser","html_url":"https://github.com/DanielRosenwasser","followers_url":"https://api.github.com/users/DanielRosenwasser/followers","following_url":"https://api.github.com/users/DanielRosenwasser/following{/other_user}","gists_url":"https://api.github.com/users/DanielRosenwasser/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielRosenwasser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielRosenwasser/subscriptions","organizations_url":"https://api.github.com/users/DanielRosenwasser/orgs","repos_url":"https://api.github.com/users/DanielRosenwasser/repos","events_url":"https://api.github.com/users/DanielRosenwasser/events{/privacy}","received_events_url":"https://api.github.com/users/DanielRosenwasser/received_events","type":"User","site_admin":false},"body":"As @CyrusNajmabadi mentioned, we already had a way of checking if something was missing, so we shouldn't introduce another.","created_at":"2015-10-26T21:23:47Z","updated_at":"2015-10-26T21:23:47Z","html_url":"https://github.com/Microsoft/TypeScript/pull/4878#discussion_r43055255","pull_request_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments/43055255"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/4878#discussion_r43055255"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878","id":45487318,"html_url":"https://github.com/Microsoft/TypeScript/pull/4878","diff_url":"https://github.com/Microsoft/TypeScript/pull/4878.diff","patch_url":"https://github.com/Microsoft/TypeScript/pull/4878.patch","issue_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4878","number":4878,"state":"open","locked":false,"title":"Parser error type identifier","user":{"login":"jbondc","id":199519,"avatar_url":"https://avatars.githubusercontent.com/u/199519?v=3","gravatar_id":"","url":"https://api.github.com/users/jbondc","html_url":"https://github.com/jbondc","followers_url":"https://api.github.com/users/jbondc/followers","following_url":"https://api.github.com/users/jbondc/following{/other_user}","gists_url":"https://api.github.com/users/jbondc/gists{/gist_id}","starred_url":"https://api.github.com/users/jbondc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbondc/subscriptions","organizations_url":"https://api.github.com/users/jbondc/orgs","repos_url":"https://api.github.com/users/jbondc/repos","events_url":"https://api.github.com/users/jbondc/events{/privacy}","received_events_url":"https://api.github.com/users/jbondc/received_events","type":"User","site_admin":false},"body":"This improves parsing an invalid type identifier #4067\r\n```\r\nlet d: string | new () => void | number; // Invalid type. To avoid ambiguity, add parentheses: '(new () => void | number)'\r\nlet g: x.void; // Identifier expected, reserved word 'void' not allowed here.\r\n```\r\nWas tricky, added a ```ParserContextFlags.NoError``` flag to disable errors on parsing, then check for missing node(s) to improve the error(s).\r\n","created_at":"2015-09-20T00:41:24Z","updated_at":"2015-10-26T21:23:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1b5b265e737757de3da79238467dad63fdb9a9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878/commits","review_comments_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878/comments","review_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/4878/comments","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/57e0b1c7612c570655097e8a6268112160c1594d","head":{"label":"jbondc:parser-error-type-identifier","ref":"parser-error-type-identifier","sha":"57e0b1c7612c570655097e8a6268112160c1594d","user":{"login":"jbondc","id":199519,"avatar_url":"https://avatars.githubusercontent.com/u/199519?v=3","gravatar_id":"","url":"https://api.github.com/users/jbondc","html_url":"https://github.com/jbondc","followers_url":"https://api.github.com/users/jbondc/followers","following_url":"https://api.github.com/users/jbondc/following{/other_user}","gists_url":"https://api.github.com/users/jbondc/gists{/gist_id}","starred_url":"https://api.github.com/users/jbondc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbondc/subscriptions","organizations_url":"https://api.github.com/users/jbondc/orgs","repos_url":"https://api.github.com/users/jbondc/repos","events_url":"https://api.github.com/users/jbondc/events{/privacy}","received_events_url":"https://api.github.com/users/jbondc/received_events","type":"User","site_admin":false},"repo":{"id":24433361,"name":"TypeScript","full_name":"jbondc/TypeScript","owner":{"login":"jbondc","id":199519,"avatar_url":"https://avatars.githubusercontent.com/u/199519?v=3","gravatar_id":"","url":"https://api.github.com/users/jbondc","html_url":"https://github.com/jbondc","followers_url":"https://api.github.com/users/jbondc/followers","following_url":"https://api.github.com/users/jbondc/following{/other_user}","gists_url":"https://api.github.com/users/jbondc/gists{/gist_id}","starred_url":"https://api.github.com/users/jbondc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbondc/subscriptions","organizations_url":"https://api.github.com/users/jbondc/orgs","repos_url":"https://api.github.com/users/jbondc/repos","events_url":"https://api.github.com/users/jbondc/events{/privacy}","received_events_url":"https://api.github.com/users/jbondc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbondc/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":true,"url":"https://api.github.com/repos/jbondc/TypeScript","forks_url":"https://api.github.com/repos/jbondc/TypeScript/forks","keys_url":"https://api.github.com/repos/jbondc/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbondc/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbondc/TypeScript/teams","hooks_url":"https://api.github.com/repos/jbondc/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/jbondc/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/jbondc/TypeScript/events","assignees_url":"https://api.github.com/repos/jbondc/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/jbondc/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/jbondc/TypeScript/tags","blobs_url":"https://api.github.com/repos/jbondc/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbondc/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbondc/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbondc/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbondc/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/jbondc/TypeScript/languages","stargazers_url":"https://api.github.com/repos/jbondc/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/jbondc/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/jbondc/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/jbondc/TypeScript/subscription","commits_url":"https://api.github.com/repos/jbondc/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbondc/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbondc/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbondc/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbondc/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/jbondc/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbondc/TypeScript/merges","archive_url":"https://api.github.com/repos/jbondc/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbondc/TypeScript/downloads","issues_url":"https://api.github.com/repos/jbondc/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/jbondc/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/jbondc/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/jbondc/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbondc/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/jbondc/TypeScript/releases{/id}","created_at":"2014-09-24T21:29:04Z","updated_at":"2015-08-28T20:35:54Z","pushed_at":"2015-10-26T16:22:19Z","git_url":"git://github.com/jbondc/TypeScript.git","ssh_url":"git@github.com:jbondc/TypeScript.git","clone_url":"https://github.com/jbondc/TypeScript.git","svn_url":"https://github.com/jbondc/TypeScript","homepage":"http://www.typescriptlang.org","size":192582,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"ed5dc5536d2f47ab51cdee98f1ffe8f8ded195bd","user":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":20929025,"name":"TypeScript","full_name":"Microsoft/TypeScript","owner":{"login":"Microsoft","id":6154722,"avatar_url":"https://avatars.githubusercontent.com/u/6154722?v=3","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/TypeScript","description":"TypeScript is a superset of JavaScript that compiles to clean JavaScript output.","fork":false,"url":"https://api.github.com/repos/Microsoft/TypeScript","forks_url":"https://api.github.com/repos/Microsoft/TypeScript/forks","keys_url":"https://api.github.com/repos/Microsoft/TypeScript/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/TypeScript/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/TypeScript/teams","hooks_url":"https://api.github.com/repos/Microsoft/TypeScript/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/TypeScript/events","assignees_url":"https://api.github.com/repos/Microsoft/TypeScript/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/TypeScript/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/TypeScript/tags","blobs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/TypeScript/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/TypeScript/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/TypeScript/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/TypeScript/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/TypeScript/languages","stargazers_url":"https://api.github.com/repos/Microsoft/TypeScript/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/TypeScript/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/TypeScript/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/TypeScript/subscription","commits_url":"https://api.github.com/repos/Microsoft/TypeScript/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/TypeScript/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/TypeScript/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/TypeScript/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/TypeScript/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/TypeScript/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/TypeScript/merges","archive_url":"https://api.github.com/repos/Microsoft/TypeScript/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/TypeScript/downloads","issues_url":"https://api.github.com/repos/Microsoft/TypeScript/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/TypeScript/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/TypeScript/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/TypeScript/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/TypeScript/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/TypeScript/releases{/id}","created_at":"2014-06-17T15:28:39Z","updated_at":"2015-10-26T19:29:40Z","pushed_at":"2015-10-26T21:20:39Z","git_url":"git://github.com/Microsoft/TypeScript.git","ssh_url":"git@github.com:Microsoft/TypeScript.git","clone_url":"https://github.com/Microsoft/TypeScript.git","svn_url":"https://github.com/Microsoft/TypeScript","homepage":"http://www.typescriptlang.org","size":1152613,"stargazers_count":7205,"watchers_count":7205,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":824,"mirror_url":null,"open_issues_count":924,"forks":824,"open_issues":924,"watchers":7205,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878"},"html":{"href":"https://github.com/Microsoft/TypeScript/pull/4878"},"issue":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/4878"},"comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/issues/4878/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/TypeScript/pulls/4878/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/TypeScript/statuses/57e0b1c7612c570655097e8a6268112160c1594d"}}}}