{"action":"created","comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/94590389","pull_request_review_id":15118563,"id":94590389,"diff_hunk":"@@ -77,6 +77,23 @@ module Crystal\n     def_equals_and_hash type\n   end\n \n+  # Fictitious node to represent a type restriction\n+  #\n+  # It is used for type restrection of method arguments.\n+  class TypeRestrict < ASTNode\n+    getter value","path":"src/compiler/crystal/semantic/ast.cr","position":null,"original_position":8,"commit_id":"5de29d230dd31be2cc1170a2ba034c6f616d519e","original_commit_id":"247407f01d722b6c2b71f9c36f78c04a6760a87b","user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"body":"Sounds good 👍 ","created_at":"2017-01-04T14:22:27Z","updated_at":"2017-01-04T14:22:28Z","html_url":"https://github.com/crystal-lang/crystal/pull/3834#discussion_r94590389","pull_request_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834","_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/94590389"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/3834#discussion_r94590389"},"pull_request":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834"}}},"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834","id":100095186,"html_url":"https://github.com/crystal-lang/crystal/pull/3834","diff_url":"https://github.com/crystal-lang/crystal/pull/3834.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/3834.patch","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3834","number":3834,"state":"open","locked":false,"title":"Restrict arguments having a default value","user":{"login":"MakeNowJust","id":6679325,"avatar_url":"https://avatars.githubusercontent.com/u/6679325?v=3","gravatar_id":"","url":"https://api.github.com/users/MakeNowJust","html_url":"https://github.com/MakeNowJust","followers_url":"https://api.github.com/users/MakeNowJust/followers","following_url":"https://api.github.com/users/MakeNowJust/following{/other_user}","gists_url":"https://api.github.com/users/MakeNowJust/gists{/gist_id}","starred_url":"https://api.github.com/users/MakeNowJust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MakeNowJust/subscriptions","organizations_url":"https://api.github.com/users/MakeNowJust/orgs","repos_url":"https://api.github.com/users/MakeNowJust/repos","events_url":"https://api.github.com/users/MakeNowJust/events{/privacy}","received_events_url":"https://api.github.com/users/MakeNowJust/received_events","type":"User","site_admin":false},"body":"For example:\r\n\r\n```crystal\r\ndef foo(x : String = 1)\r\n  x\r\nend\r\n\r\nfoo\r\n```\r\n\r\nI think above code is invalid, but current compiler accepts it.\r\nThis pull request fixes it.\r\n\r\nAnother effect, below code works fine now:\r\n\r\n```crystal\r\ndef foo(x : T.class = String) forall T\r\n  {{ T }}\r\nend\r\n\r\nfoo # => String\r\n```\r\n\r\n(Before, we got \"undefined constant T\" error.)\r\n\r\nImplementation point is introducing `TypeRestrict` fictitious node and applying it when instantiate a method with arguments having a default value.","created_at":"2017-01-04T10:48:32Z","updated_at":"2017-01-04T14:22:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"debe316f49db48096acdc45cf1fb8afb0f79c5f1","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834/commits","review_comments_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834/comments","review_comment_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3834/comments","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/5de29d230dd31be2cc1170a2ba034c6f616d519e","head":{"label":"MakeNowJust:fix/crystal/type-restrict-default","ref":"fix/crystal/type-restrict-default","sha":"5de29d230dd31be2cc1170a2ba034c6f616d519e","user":{"login":"MakeNowJust","id":6679325,"avatar_url":"https://avatars.githubusercontent.com/u/6679325?v=3","gravatar_id":"","url":"https://api.github.com/users/MakeNowJust","html_url":"https://github.com/MakeNowJust","followers_url":"https://api.github.com/users/MakeNowJust/followers","following_url":"https://api.github.com/users/MakeNowJust/following{/other_user}","gists_url":"https://api.github.com/users/MakeNowJust/gists{/gist_id}","starred_url":"https://api.github.com/users/MakeNowJust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MakeNowJust/subscriptions","organizations_url":"https://api.github.com/users/MakeNowJust/orgs","repos_url":"https://api.github.com/users/MakeNowJust/repos","events_url":"https://api.github.com/users/MakeNowJust/events{/privacy}","received_events_url":"https://api.github.com/users/MakeNowJust/received_events","type":"User","site_admin":false},"repo":{"id":38912767,"name":"crystal","full_name":"MakeNowJust/crystal","owner":{"login":"MakeNowJust","id":6679325,"avatar_url":"https://avatars.githubusercontent.com/u/6679325?v=3","gravatar_id":"","url":"https://api.github.com/users/MakeNowJust","html_url":"https://github.com/MakeNowJust","followers_url":"https://api.github.com/users/MakeNowJust/followers","following_url":"https://api.github.com/users/MakeNowJust/following{/other_user}","gists_url":"https://api.github.com/users/MakeNowJust/gists{/gist_id}","starred_url":"https://api.github.com/users/MakeNowJust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MakeNowJust/subscriptions","organizations_url":"https://api.github.com/users/MakeNowJust/orgs","repos_url":"https://api.github.com/users/MakeNowJust/repos","events_url":"https://api.github.com/users/MakeNowJust/events{/privacy}","received_events_url":"https://api.github.com/users/MakeNowJust/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MakeNowJust/crystal","description":"The Crystal Programming Language","fork":true,"url":"https://api.github.com/repos/MakeNowJust/crystal","forks_url":"https://api.github.com/repos/MakeNowJust/crystal/forks","keys_url":"https://api.github.com/repos/MakeNowJust/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MakeNowJust/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MakeNowJust/crystal/teams","hooks_url":"https://api.github.com/repos/MakeNowJust/crystal/hooks","issue_events_url":"https://api.github.com/repos/MakeNowJust/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/MakeNowJust/crystal/events","assignees_url":"https://api.github.com/repos/MakeNowJust/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/MakeNowJust/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/MakeNowJust/crystal/tags","blobs_url":"https://api.github.com/repos/MakeNowJust/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MakeNowJust/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MakeNowJust/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/MakeNowJust/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MakeNowJust/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/MakeNowJust/crystal/languages","stargazers_url":"https://api.github.com/repos/MakeNowJust/crystal/stargazers","contributors_url":"https://api.github.com/repos/MakeNowJust/crystal/contributors","subscribers_url":"https://api.github.com/repos/MakeNowJust/crystal/subscribers","subscription_url":"https://api.github.com/repos/MakeNowJust/crystal/subscription","commits_url":"https://api.github.com/repos/MakeNowJust/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/MakeNowJust/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/MakeNowJust/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/MakeNowJust/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/MakeNowJust/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/MakeNowJust/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MakeNowJust/crystal/merges","archive_url":"https://api.github.com/repos/MakeNowJust/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MakeNowJust/crystal/downloads","issues_url":"https://api.github.com/repos/MakeNowJust/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/MakeNowJust/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/MakeNowJust/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/MakeNowJust/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MakeNowJust/crystal/labels{/name}","releases_url":"https://api.github.com/repos/MakeNowJust/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/MakeNowJust/crystal/deployments","created_at":"2015-07-11T03:48:50Z","updated_at":"2016-01-13T09:13:15Z","pushed_at":"2017-01-04T14:15:34Z","git_url":"git://github.com/MakeNowJust/crystal.git","ssh_url":"git@github.com:MakeNowJust/crystal.git","clone_url":"https://github.com/MakeNowJust/crystal.git","svn_url":"https://github.com/MakeNowJust/crystal","homepage":"http://crystal-lang.org","size":40122,"stargazers_count":0,"watchers_count":0,"language":"Crystal","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":"crystal-lang:master","ref":"master","sha":"8aff8af0dea864b93b9323d2a9ca9666ae3eeb26","user":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":6887813,"name":"crystal","full_name":"crystal-lang/crystal","owner":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crystal-lang/crystal","description":"The Crystal Programming Language","fork":false,"url":"https://api.github.com/repos/crystal-lang/crystal","forks_url":"https://api.github.com/repos/crystal-lang/crystal/forks","keys_url":"https://api.github.com/repos/crystal-lang/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crystal-lang/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crystal-lang/crystal/teams","hooks_url":"https://api.github.com/repos/crystal-lang/crystal/hooks","issue_events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/crystal-lang/crystal/events","assignees_url":"https://api.github.com/repos/crystal-lang/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/crystal-lang/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/crystal-lang/crystal/tags","blobs_url":"https://api.github.com/repos/crystal-lang/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crystal-lang/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crystal-lang/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/crystal-lang/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/crystal-lang/crystal/languages","stargazers_url":"https://api.github.com/repos/crystal-lang/crystal/stargazers","contributors_url":"https://api.github.com/repos/crystal-lang/crystal/contributors","subscribers_url":"https://api.github.com/repos/crystal-lang/crystal/subscribers","subscription_url":"https://api.github.com/repos/crystal-lang/crystal/subscription","commits_url":"https://api.github.com/repos/crystal-lang/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/crystal-lang/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/crystal-lang/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/crystal-lang/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crystal-lang/crystal/merges","archive_url":"https://api.github.com/repos/crystal-lang/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crystal-lang/crystal/downloads","issues_url":"https://api.github.com/repos/crystal-lang/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/crystal-lang/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/crystal-lang/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/crystal-lang/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crystal-lang/crystal/labels{/name}","releases_url":"https://api.github.com/repos/crystal-lang/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/crystal-lang/crystal/deployments","created_at":"2012-11-27T17:32:32Z","updated_at":"2017-01-04T14:07:28Z","pushed_at":"2017-01-04T14:15:35Z","git_url":"git://github.com/crystal-lang/crystal.git","ssh_url":"git@github.com:crystal-lang/crystal.git","clone_url":"https://github.com/crystal-lang/crystal.git","svn_url":"https://github.com/crystal-lang/crystal","homepage":"http://crystal-lang.org","size":32299,"stargazers_count":7196,"watchers_count":7196,"language":"Crystal","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":577,"mirror_url":null,"open_issues_count":368,"forks":577,"open_issues":368,"watchers":7196,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/3834"},"issue":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/3834"},"comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/3834/comments"},"review_comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834/comments"},"review_comment":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3834/commits"},"statuses":{"href":"https://api.github.com/repos/crystal-lang/crystal/statuses/5de29d230dd31be2cc1170a2ba034c6f616d519e"}}}}
{"actor":{"display_login":"asterite"}}