{"action":"created","comment":{"url":"https://api.github.com/repos/pallene-lang/pallene/pulls/comments/219648814","pull_request_review_id":157878705,"id":219648814,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxOTY0ODgxNA==","diff_hunk":"@@ -93,11 +100,67 @@ local function coerce_numeric_exp_to_float(exp)\n     end\n end\n \n+-- Does this statement always call \"return\"?\n+--\n+-- In the future I would like to get rid of the function, and make it a part of\n+-- live-variable analysis. (A possibly-uninitialized \"return variable\" signifies\n+-- a missing return statement.)\n+local function stat_always_returns(stat)\n+    local tag = stat._tag\n+    if     tag  == ast.Stat.Decl then\n+        return false\n+    elseif tag == ast.Stat.Block then\n+        for _, inner_stat in ipairs(stat.stats) do\n+            if stat_always_returns(inner_stat) then\n+                return true\n+            end\n+        end\n+        return false\n+    elseif tag == ast.Stat.While then\n+        return false\n+    elseif tag == ast.Stat.Repeat then\n+        return false\n+    elseif tag == ast.Stat.For then\n+        return false\n+    elseif tag == ast.Stat.Assign then\n+        return false\n+    elseif tag == ast.Stat.Call  then\n+        return false\n+    elseif tag == ast.Stat.Return then\n+        return true\n+    elseif tag == ast.Stat.If then\n+        for _, thn in ipairs(stat.thens) do\n+            if not stat_always_returns(thn.block) then\n+                return false\n+            end\n+        end\n+        if not stat.elsestat or not stat_always_returns(stat.elsestat) then\n+            return false\n+        end\n+        return true\n+    else\n+        error(\"impossible\")\n+    end\n+end\n+\n --\n -- check\n --\n \n-check_program = function(prog, errors)\n+typecheck = function(prog)\n+    local ok, err = xpcall(check_program, debug.traceback, prog)\n+    if ok then\n+        return prog, {} -- TODO:  no {}\n+    else\n+        if getmetatable(err) == TypeError then\n+            return false, { err.msg } -- TODO  no {}\n+        else\n+            error(err)","path":"titan-compiler/checker.lua","position":132,"original_position":132,"commit_id":"dd4bc23f7b6fccd8b8e6c03a676217889fd60dc0","original_commit_id":"dd4bc23f7b6fccd8b8e6c03a676217889fd60dc0","user":{"login":"gligneul","id":8294320,"node_id":"MDQ6VXNlcjgyOTQzMjA=","avatar_url":"https://avatars0.githubusercontent.com/u/8294320?v=4","gravatar_id":"","url":"https://api.github.com/users/gligneul","html_url":"https://github.com/gligneul","followers_url":"https://api.github.com/users/gligneul/followers","following_url":"https://api.github.com/users/gligneul/following{/other_user}","gists_url":"https://api.github.com/users/gligneul/gists{/gist_id}","starred_url":"https://api.github.com/users/gligneul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gligneul/subscriptions","organizations_url":"https://api.github.com/users/gligneul/orgs","repos_url":"https://api.github.com/users/gligneul/repos","events_url":"https://api.github.com/users/gligneul/events{/privacy}","received_events_url":"https://api.github.com/users/gligneul/received_events","type":"User","site_admin":false},"body":"If we call error here it will print two stack traces. We probably should do:\r\n```\r\nio.stderr:write(err, '\\n')\r\nos.exit(1)\r\n```","created_at":"2018-09-21T23:19:10Z","updated_at":"2018-09-21T23:44:15Z","html_url":"https://github.com/pallene-lang/pallene/pull/5#discussion_r219648814","pull_request_url":"https://api.github.com/repos/pallene-lang/pallene/pulls/5","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/comments/219648814"},"html":{"href":"https://github.com/pallene-lang/pallene/pull/5#discussion_r219648814"},"pull_request":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/pallene-lang/pallene/pulls/5","id":214444338,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0NDQ0MzM4","html_url":"https://github.com/pallene-lang/pallene/pull/5","diff_url":"https://github.com/pallene-lang/pallene/pull/5.diff","patch_url":"https://github.com/pallene-lang/pallene/pull/5.patch","issue_url":"https://api.github.com/repos/pallene-lang/pallene/issues/5","number":5,"state":"open","locked":false,"title":"Stop on first type error","user":{"login":"hugomg","id":1452192,"node_id":"MDQ6VXNlcjE0NTIxOTI=","avatar_url":"https://avatars3.githubusercontent.com/u/1452192?v=4","gravatar_id":"","url":"https://api.github.com/users/hugomg","html_url":"https://github.com/hugomg","followers_url":"https://api.github.com/users/hugomg/followers","following_url":"https://api.github.com/users/hugomg/following{/other_user}","gists_url":"https://api.github.com/users/hugomg/gists{/gist_id}","starred_url":"https://api.github.com/users/hugomg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugomg/subscriptions","organizations_url":"https://api.github.com/users/hugomg/orgs","repos_url":"https://api.github.com/users/hugomg/repos","events_url":"https://api.github.com/users/hugomg/events{/privacy}","received_events_url":"https://api.github.com/users/hugomg/received_events","type":"User","site_admin":false},"body":"Simplify the type checker by stopping after the first type error.","created_at":"2018-09-10T21:06:45Z","updated_at":"2018-09-21T23:44:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b91aca697f520b56d2859425d43092cc4833378e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pallene-lang/pallene/pulls/5/commits","review_comments_url":"https://api.github.com/repos/pallene-lang/pallene/pulls/5/comments","review_comment_url":"https://api.github.com/repos/pallene-lang/pallene/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pallene-lang/pallene/issues/5/comments","statuses_url":"https://api.github.com/repos/pallene-lang/pallene/statuses/dd4bc23f7b6fccd8b8e6c03a676217889fd60dc0","head":{"label":"pallene-lang:stop-on-first-type-error","ref":"stop-on-first-type-error","sha":"dd4bc23f7b6fccd8b8e6c03a676217889fd60dc0","user":{"login":"pallene-lang","id":39778642,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc4NjQy","avatar_url":"https://avatars0.githubusercontent.com/u/39778642?v=4","gravatar_id":"","url":"https://api.github.com/users/pallene-lang","html_url":"https://github.com/pallene-lang","followers_url":"https://api.github.com/users/pallene-lang/followers","following_url":"https://api.github.com/users/pallene-lang/following{/other_user}","gists_url":"https://api.github.com/users/pallene-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/pallene-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pallene-lang/subscriptions","organizations_url":"https://api.github.com/users/pallene-lang/orgs","repos_url":"https://api.github.com/users/pallene-lang/repos","events_url":"https://api.github.com/users/pallene-lang/events{/privacy}","received_events_url":"https://api.github.com/users/pallene-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":135494297,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU0OTQyOTc=","name":"pallene","full_name":"pallene-lang/pallene","private":false,"owner":{"login":"pallene-lang","id":39778642,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc4NjQy","avatar_url":"https://avatars0.githubusercontent.com/u/39778642?v=4","gravatar_id":"","url":"https://api.github.com/users/pallene-lang","html_url":"https://github.com/pallene-lang","followers_url":"https://api.github.com/users/pallene-lang/followers","following_url":"https://api.github.com/users/pallene-lang/following{/other_user}","gists_url":"https://api.github.com/users/pallene-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/pallene-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pallene-lang/subscriptions","organizations_url":"https://api.github.com/users/pallene-lang/orgs","repos_url":"https://api.github.com/users/pallene-lang/repos","events_url":"https://api.github.com/users/pallene-lang/events{/privacy}","received_events_url":"https://api.github.com/users/pallene-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pallene-lang/pallene","description":"Pallene Compiler","fork":false,"url":"https://api.github.com/repos/pallene-lang/pallene","forks_url":"https://api.github.com/repos/pallene-lang/pallene/forks","keys_url":"https://api.github.com/repos/pallene-lang/pallene/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pallene-lang/pallene/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pallene-lang/pallene/teams","hooks_url":"https://api.github.com/repos/pallene-lang/pallene/hooks","issue_events_url":"https://api.github.com/repos/pallene-lang/pallene/issues/events{/number}","events_url":"https://api.github.com/repos/pallene-lang/pallene/events","assignees_url":"https://api.github.com/repos/pallene-lang/pallene/assignees{/user}","branches_url":"https://api.github.com/repos/pallene-lang/pallene/branches{/branch}","tags_url":"https://api.github.com/repos/pallene-lang/pallene/tags","blobs_url":"https://api.github.com/repos/pallene-lang/pallene/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pallene-lang/pallene/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pallene-lang/pallene/git/refs{/sha}","trees_url":"https://api.github.com/repos/pallene-lang/pallene/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pallene-lang/pallene/statuses/{sha}","languages_url":"https://api.github.com/repos/pallene-lang/pallene/languages","stargazers_url":"https://api.github.com/repos/pallene-lang/pallene/stargazers","contributors_url":"https://api.github.com/repos/pallene-lang/pallene/contributors","subscribers_url":"https://api.github.com/repos/pallene-lang/pallene/subscribers","subscription_url":"https://api.github.com/repos/pallene-lang/pallene/subscription","commits_url":"https://api.github.com/repos/pallene-lang/pallene/commits{/sha}","git_commits_url":"https://api.github.com/repos/pallene-lang/pallene/git/commits{/sha}","comments_url":"https://api.github.com/repos/pallene-lang/pallene/comments{/number}","issue_comment_url":"https://api.github.com/repos/pallene-lang/pallene/issues/comments{/number}","contents_url":"https://api.github.com/repos/pallene-lang/pallene/contents/{+path}","compare_url":"https://api.github.com/repos/pallene-lang/pallene/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pallene-lang/pallene/merges","archive_url":"https://api.github.com/repos/pallene-lang/pallene/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pallene-lang/pallene/downloads","issues_url":"https://api.github.com/repos/pallene-lang/pallene/issues{/number}","pulls_url":"https://api.github.com/repos/pallene-lang/pallene/pulls{/number}","milestones_url":"https://api.github.com/repos/pallene-lang/pallene/milestones{/number}","notifications_url":"https://api.github.com/repos/pallene-lang/pallene/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pallene-lang/pallene/labels{/name}","releases_url":"https://api.github.com/repos/pallene-lang/pallene/releases{/id}","deployments_url":"https://api.github.com/repos/pallene-lang/pallene/deployments","created_at":"2018-05-30T20:29:23Z","updated_at":"2018-09-21T23:26:39Z","pushed_at":"2018-09-20T22:35:36Z","git_url":"git://github.com/pallene-lang/pallene.git","ssh_url":"git@github.com:pallene-lang/pallene.git","clone_url":"https://github.com/pallene-lang/pallene.git","svn_url":"https://github.com/pallene-lang/pallene","homepage":null,"size":1358,"stargazers_count":22,"watchers_count":22,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":22,"default_branch":"master"}},"base":{"label":"pallene-lang:master","ref":"master","sha":"6786a9836397c5b18f5e89d415dbd259f21d49c4","user":{"login":"pallene-lang","id":39778642,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc4NjQy","avatar_url":"https://avatars0.githubusercontent.com/u/39778642?v=4","gravatar_id":"","url":"https://api.github.com/users/pallene-lang","html_url":"https://github.com/pallene-lang","followers_url":"https://api.github.com/users/pallene-lang/followers","following_url":"https://api.github.com/users/pallene-lang/following{/other_user}","gists_url":"https://api.github.com/users/pallene-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/pallene-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pallene-lang/subscriptions","organizations_url":"https://api.github.com/users/pallene-lang/orgs","repos_url":"https://api.github.com/users/pallene-lang/repos","events_url":"https://api.github.com/users/pallene-lang/events{/privacy}","received_events_url":"https://api.github.com/users/pallene-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":135494297,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU0OTQyOTc=","name":"pallene","full_name":"pallene-lang/pallene","private":false,"owner":{"login":"pallene-lang","id":39778642,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzc4NjQy","avatar_url":"https://avatars0.githubusercontent.com/u/39778642?v=4","gravatar_id":"","url":"https://api.github.com/users/pallene-lang","html_url":"https://github.com/pallene-lang","followers_url":"https://api.github.com/users/pallene-lang/followers","following_url":"https://api.github.com/users/pallene-lang/following{/other_user}","gists_url":"https://api.github.com/users/pallene-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/pallene-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pallene-lang/subscriptions","organizations_url":"https://api.github.com/users/pallene-lang/orgs","repos_url":"https://api.github.com/users/pallene-lang/repos","events_url":"https://api.github.com/users/pallene-lang/events{/privacy}","received_events_url":"https://api.github.com/users/pallene-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pallene-lang/pallene","description":"Pallene Compiler","fork":false,"url":"https://api.github.com/repos/pallene-lang/pallene","forks_url":"https://api.github.com/repos/pallene-lang/pallene/forks","keys_url":"https://api.github.com/repos/pallene-lang/pallene/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pallene-lang/pallene/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pallene-lang/pallene/teams","hooks_url":"https://api.github.com/repos/pallene-lang/pallene/hooks","issue_events_url":"https://api.github.com/repos/pallene-lang/pallene/issues/events{/number}","events_url":"https://api.github.com/repos/pallene-lang/pallene/events","assignees_url":"https://api.github.com/repos/pallene-lang/pallene/assignees{/user}","branches_url":"https://api.github.com/repos/pallene-lang/pallene/branches{/branch}","tags_url":"https://api.github.com/repos/pallene-lang/pallene/tags","blobs_url":"https://api.github.com/repos/pallene-lang/pallene/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pallene-lang/pallene/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pallene-lang/pallene/git/refs{/sha}","trees_url":"https://api.github.com/repos/pallene-lang/pallene/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pallene-lang/pallene/statuses/{sha}","languages_url":"https://api.github.com/repos/pallene-lang/pallene/languages","stargazers_url":"https://api.github.com/repos/pallene-lang/pallene/stargazers","contributors_url":"https://api.github.com/repos/pallene-lang/pallene/contributors","subscribers_url":"https://api.github.com/repos/pallene-lang/pallene/subscribers","subscription_url":"https://api.github.com/repos/pallene-lang/pallene/subscription","commits_url":"https://api.github.com/repos/pallene-lang/pallene/commits{/sha}","git_commits_url":"https://api.github.com/repos/pallene-lang/pallene/git/commits{/sha}","comments_url":"https://api.github.com/repos/pallene-lang/pallene/comments{/number}","issue_comment_url":"https://api.github.com/repos/pallene-lang/pallene/issues/comments{/number}","contents_url":"https://api.github.com/repos/pallene-lang/pallene/contents/{+path}","compare_url":"https://api.github.com/repos/pallene-lang/pallene/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pallene-lang/pallene/merges","archive_url":"https://api.github.com/repos/pallene-lang/pallene/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pallene-lang/pallene/downloads","issues_url":"https://api.github.com/repos/pallene-lang/pallene/issues{/number}","pulls_url":"https://api.github.com/repos/pallene-lang/pallene/pulls{/number}","milestones_url":"https://api.github.com/repos/pallene-lang/pallene/milestones{/number}","notifications_url":"https://api.github.com/repos/pallene-lang/pallene/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pallene-lang/pallene/labels{/name}","releases_url":"https://api.github.com/repos/pallene-lang/pallene/releases{/id}","deployments_url":"https://api.github.com/repos/pallene-lang/pallene/deployments","created_at":"2018-05-30T20:29:23Z","updated_at":"2018-09-21T23:26:39Z","pushed_at":"2018-09-20T22:35:36Z","git_url":"git://github.com/pallene-lang/pallene.git","ssh_url":"git@github.com:pallene-lang/pallene.git","clone_url":"https://github.com/pallene-lang/pallene.git","svn_url":"https://github.com/pallene-lang/pallene","homepage":null,"size":1358,"stargazers_count":22,"watchers_count":22,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/5"},"html":{"href":"https://github.com/pallene-lang/pallene/pull/5"},"issue":{"href":"https://api.github.com/repos/pallene-lang/pallene/issues/5"},"comments":{"href":"https://api.github.com/repos/pallene-lang/pallene/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pallene-lang/pallene/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/pallene-lang/pallene/statuses/dd4bc23f7b6fccd8b8e6c03a676217889fd60dc0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"gligneul"}}