{"action":"created","comment":{"url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/comments/57557018","id":57557018,"diff_hunk":"@@ -0,0 +1,52 @@\n+package calc\n+\n+import org.scalajs.core.ir\n+import ir.{Trees => irt, Types => irtpe}\n+import ir.Definitions._\n+import collection.immutable.Map\n+\n+sealed abstract class TreeType\n+\n+case object DoubleType extends TreeType\n+\n+case class FunType(numOfArgs: Int) extends TreeType\n+\n+/**\n+  * Created by ivan on 16/3/23.\n+  * A type checker and infer about types\n+  */\n+object TypeChecker {\n+  def typeInfer(tree: Tree, typeEnv: Map[String, TreeType] = Map()): TreeType ={\n+    tree match {\n+      case Literal(value) => DoubleType\n+      case Ident(name) => typeEnv(name)","path":"src/main/scala/calc/TypeChecker.scala","position":22,"original_position":22,"commit_id":"d137084169d9a754fae65d4fb72cb51494ea4950","original_commit_id":"d137084169d9a754fae65d4fb72cb51494ea4950","user":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"body":"This will throw a not-very-nice exception for the developer if the identifier is not in the scope.","created_at":"2016-03-28T09:20:13Z","updated_at":"2016-03-28T09:20:13Z","html_url":"https://github.com/sjrd/scalajsir-calc/pull/2#discussion_r57557018","pull_request_url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/comments/57557018"},"html":{"href":"https://github.com/sjrd/scalajsir-calc/pull/2#discussion_r57557018"},"pull_request":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2","id":63705962,"html_url":"https://github.com/sjrd/scalajsir-calc/pull/2","diff_url":"https://github.com/sjrd/scalajsir-calc/pull/2.diff","patch_url":"https://github.com/sjrd/scalajsir-calc/pull/2.patch","issue_url":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/2","number":2,"state":"open","locked":false,"title":"Mrmiywj","user":{"login":"mrmiywj","id":7459820,"avatar_url":"https://avatars.githubusercontent.com/u/7459820?v=3","gravatar_id":"","url":"https://api.github.com/users/mrmiywj","html_url":"https://github.com/mrmiywj","followers_url":"https://api.github.com/users/mrmiywj/followers","following_url":"https://api.github.com/users/mrmiywj/following{/other_user}","gists_url":"https://api.github.com/users/mrmiywj/gists{/gist_id}","starred_url":"https://api.github.com/users/mrmiywj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrmiywj/subscriptions","organizations_url":"https://api.github.com/users/mrmiywj/orgs","repos_url":"https://api.github.com/users/mrmiywj/repos","events_url":"https://api.github.com/users/mrmiywj/events{/privacy}","received_events_url":"https://api.github.com/users/mrmiywj/received_events","type":"User","site_admin":false},"body":"Some problem with recursive function and closure.","created_at":"2016-03-22T11:36:04Z","updated_at":"2016-03-28T09:20:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d69f82eeb186b45b2492fe81896ae46cf5d4bc6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2/commits","review_comments_url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2/comments","review_comment_url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/2/comments","statuses_url":"https://api.github.com/repos/sjrd/scalajsir-calc/statuses/d137084169d9a754fae65d4fb72cb51494ea4950","head":{"label":"mrmiywj:mrmiywj","ref":"mrmiywj","sha":"d137084169d9a754fae65d4fb72cb51494ea4950","user":{"login":"mrmiywj","id":7459820,"avatar_url":"https://avatars.githubusercontent.com/u/7459820?v=3","gravatar_id":"","url":"https://api.github.com/users/mrmiywj","html_url":"https://github.com/mrmiywj","followers_url":"https://api.github.com/users/mrmiywj/followers","following_url":"https://api.github.com/users/mrmiywj/following{/other_user}","gists_url":"https://api.github.com/users/mrmiywj/gists{/gist_id}","starred_url":"https://api.github.com/users/mrmiywj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrmiywj/subscriptions","organizations_url":"https://api.github.com/users/mrmiywj/orgs","repos_url":"https://api.github.com/users/mrmiywj/repos","events_url":"https://api.github.com/users/mrmiywj/events{/privacy}","received_events_url":"https://api.github.com/users/mrmiywj/received_events","type":"User","site_admin":false},"repo":{"id":54361743,"name":"scalajsir-calc","full_name":"mrmiywj/scalajsir-calc","owner":{"login":"mrmiywj","id":7459820,"avatar_url":"https://avatars.githubusercontent.com/u/7459820?v=3","gravatar_id":"","url":"https://api.github.com/users/mrmiywj","html_url":"https://github.com/mrmiywj","followers_url":"https://api.github.com/users/mrmiywj/followers","following_url":"https://api.github.com/users/mrmiywj/following{/other_user}","gists_url":"https://api.github.com/users/mrmiywj/gists{/gist_id}","starred_url":"https://api.github.com/users/mrmiywj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrmiywj/subscriptions","organizations_url":"https://api.github.com/users/mrmiywj/orgs","repos_url":"https://api.github.com/users/mrmiywj/repos","events_url":"https://api.github.com/users/mrmiywj/events{/privacy}","received_events_url":"https://api.github.com/users/mrmiywj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrmiywj/scalajsir-calc","description":"A toy project to play with the Scala.js IR","fork":true,"url":"https://api.github.com/repos/mrmiywj/scalajsir-calc","forks_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/forks","keys_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/teams","hooks_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/hooks","issue_events_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/issues/events{/number}","events_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/events","assignees_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/assignees{/user}","branches_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/branches{/branch}","tags_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/tags","blobs_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/statuses/{sha}","languages_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/languages","stargazers_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/stargazers","contributors_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/contributors","subscribers_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/subscribers","subscription_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/subscription","commits_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/contents/{+path}","compare_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/merges","archive_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/downloads","issues_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/issues{/number}","pulls_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/pulls{/number}","milestones_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/milestones{/number}","notifications_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/labels{/name}","releases_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/releases{/id}","deployments_url":"https://api.github.com/repos/mrmiywj/scalajsir-calc/deployments","created_at":"2016-03-21T05:17:23Z","updated_at":"2016-03-23T16:57:43Z","pushed_at":"2016-03-27T17:21:06Z","git_url":"git://github.com/mrmiywj/scalajsir-calc.git","ssh_url":"git@github.com:mrmiywj/scalajsir-calc.git","clone_url":"https://github.com/mrmiywj/scalajsir-calc.git","svn_url":"https://github.com/mrmiywj/scalajsir-calc","homepage":null,"size":27,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"sjrd:master","ref":"master","sha":"f60435c1762c67de1a8d299bf10bfb1713753756","user":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"repo":{"id":54316291,"name":"scalajsir-calc","full_name":"sjrd/scalajsir-calc","owner":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sjrd/scalajsir-calc","description":"A toy project to play with the Scala.js IR","fork":false,"url":"https://api.github.com/repos/sjrd/scalajsir-calc","forks_url":"https://api.github.com/repos/sjrd/scalajsir-calc/forks","keys_url":"https://api.github.com/repos/sjrd/scalajsir-calc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sjrd/scalajsir-calc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sjrd/scalajsir-calc/teams","hooks_url":"https://api.github.com/repos/sjrd/scalajsir-calc/hooks","issue_events_url":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/events{/number}","events_url":"https://api.github.com/repos/sjrd/scalajsir-calc/events","assignees_url":"https://api.github.com/repos/sjrd/scalajsir-calc/assignees{/user}","branches_url":"https://api.github.com/repos/sjrd/scalajsir-calc/branches{/branch}","tags_url":"https://api.github.com/repos/sjrd/scalajsir-calc/tags","blobs_url":"https://api.github.com/repos/sjrd/scalajsir-calc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sjrd/scalajsir-calc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sjrd/scalajsir-calc/git/refs{/sha}","trees_url":"https://api.github.com/repos/sjrd/scalajsir-calc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sjrd/scalajsir-calc/statuses/{sha}","languages_url":"https://api.github.com/repos/sjrd/scalajsir-calc/languages","stargazers_url":"https://api.github.com/repos/sjrd/scalajsir-calc/stargazers","contributors_url":"https://api.github.com/repos/sjrd/scalajsir-calc/contributors","subscribers_url":"https://api.github.com/repos/sjrd/scalajsir-calc/subscribers","subscription_url":"https://api.github.com/repos/sjrd/scalajsir-calc/subscription","commits_url":"https://api.github.com/repos/sjrd/scalajsir-calc/commits{/sha}","git_commits_url":"https://api.github.com/repos/sjrd/scalajsir-calc/git/commits{/sha}","comments_url":"https://api.github.com/repos/sjrd/scalajsir-calc/comments{/number}","issue_comment_url":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/comments{/number}","contents_url":"https://api.github.com/repos/sjrd/scalajsir-calc/contents/{+path}","compare_url":"https://api.github.com/repos/sjrd/scalajsir-calc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sjrd/scalajsir-calc/merges","archive_url":"https://api.github.com/repos/sjrd/scalajsir-calc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sjrd/scalajsir-calc/downloads","issues_url":"https://api.github.com/repos/sjrd/scalajsir-calc/issues{/number}","pulls_url":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls{/number}","milestones_url":"https://api.github.com/repos/sjrd/scalajsir-calc/milestones{/number}","notifications_url":"https://api.github.com/repos/sjrd/scalajsir-calc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sjrd/scalajsir-calc/labels{/name}","releases_url":"https://api.github.com/repos/sjrd/scalajsir-calc/releases{/id}","deployments_url":"https://api.github.com/repos/sjrd/scalajsir-calc/deployments","created_at":"2016-03-20T12:27:20Z","updated_at":"2016-03-21T02:32:49Z","pushed_at":"2016-03-27T22:33:31Z","git_url":"git://github.com/sjrd/scalajsir-calc.git","ssh_url":"git@github.com:sjrd/scalajsir-calc.git","clone_url":"https://github.com/sjrd/scalajsir-calc.git","svn_url":"https://github.com/sjrd/scalajsir-calc","homepage":null,"size":19,"stargazers_count":2,"watchers_count":2,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2"},"html":{"href":"https://github.com/sjrd/scalajsir-calc/pull/2"},"issue":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/2"},"comments":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/sjrd/scalajsir-calc/statuses/d137084169d9a754fae65d4fb72cb51494ea4950"}}}}