{"action":"created","comment":{"url":"https://api.github.com/repos/python/mypy/pulls/comments/195877222","pull_request_review_id":129335262,"id":195877222,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTg3NzIyMg==","diff_hunk":"@@ -677,94 +738,92 @@ def g(x: int) -> int: ...\n \n     # Every argument in R must have a corresponding argument in L, and every\n     # required argument in L must have a corresponding argument in R.\n-    done_with_positional = False\n-    for i in range(len(right.arg_types)):\n-        right_kind = right.arg_kinds[i]\n-        if right_kind in (ARG_STAR, ARG_STAR2, ARG_NAMED, ARG_NAMED_OPT):\n-            done_with_positional = True\n-        right_required = right_kind in (ARG_POS, ARG_NAMED)\n-        right_pos = None if done_with_positional else i\n-\n-        right_arg = FormalArgument(\n-            right.arg_names[i],\n-            right_pos,\n-            right.arg_types[i],\n-            right_required)\n-\n-        if right_kind == ARG_STAR:\n-            right_star_type = right_arg.typ\n-            # Right has an infinite series of optional positional arguments\n-            # here.  Get all further positional arguments of left, and make sure\n-            # they're more general than their corresponding member in this\n-            # series.  Also make sure left has its own infinite series of\n-            # optional positional arguments.\n-            if not left.is_var_arg:\n-                return False\n-            j = i\n-            while j < len(left.arg_kinds) and left.arg_kinds[j] in (ARG_POS, ARG_OPT):\n-                left_by_position = left.argument_by_position(j)\n-                assert left_by_position is not None\n-                # This fetches the synthetic argument that's from the *args\n-                right_by_position = right.argument_by_position(j)\n-                assert right_by_position is not None\n-                if not are_args_compatible(left_by_position, right_by_position,\n-                                           ignore_pos_arg_names, is_compat):\n-                    return False\n-                j += 1\n-            continue\n-\n-        if right_kind == ARG_STAR2:\n-            right_star2_type = right_arg.typ\n-            # Right has an infinite set of optional named arguments here.  Get\n-            # all further named arguments of left and make sure they're more\n-            # general than their corresponding member in this set.  Also make\n-            # sure left has its own infinite set of optional named arguments.\n-            if not left.is_kw_arg:\n-                return False\n-            left_names = {name for name in left.arg_names if name is not None}\n-            right_names = {name for name in right.arg_names if name is not None}\n-            left_only_names = left_names - right_names\n-            for name in left_only_names:\n-                left_by_name = left.argument_by_name(name)\n-                assert left_by_name is not None\n-                # This fetches the synthetic argument that's from the **kwargs\n-                right_by_name = right.argument_by_name(name)\n-                assert right_by_name is not None\n-                if not are_args_compatible(left_by_name, right_by_name,\n-                                           ignore_pos_arg_names, is_compat):\n-                    return False\n-            continue\n \n-        # Left must have some kind of corresponding argument.\n+    # Phase 1: Confirm every argument in R has a corresponding argument in L.\n+\n+    # Phase 1a: If right and right can both accept an infinite number of args,","path":"mypy/subtypes.py","position":179,"original_position":179,"commit_id":"4db35c1a1501b26c6ae7bd1da866fef45ac42676","original_commit_id":"4db35c1a1501b26c6ae7bd1da866fef45ac42676","user":{"login":"ilevkivskyi","id":12005495,"node_id":"MDQ6VXNlcjEyMDA1NDk1","avatar_url":"https://avatars1.githubusercontent.com/u/12005495?v=4","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false},"body":"\"right and right\" -> \"left and right\"","created_at":"2018-06-15T22:37:17Z","updated_at":"2018-06-15T22:48:22Z","html_url":"https://github.com/python/mypy/pull/5163#discussion_r195877222","pull_request_url":"https://api.github.com/repos/python/mypy/pulls/5163","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/python/mypy/pulls/comments/195877222"},"html":{"href":"https://github.com/python/mypy/pull/5163#discussion_r195877222"},"pull_request":{"href":"https://api.github.com/repos/python/mypy/pulls/5163"}}},"pull_request":{"url":"https://api.github.com/repos/python/mypy/pulls/5163","id":193149632,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMTQ5NjMy","html_url":"https://github.com/python/mypy/pull/5163","diff_url":"https://github.com/python/mypy/pull/5163.diff","patch_url":"https://github.com/python/mypy/pull/5163.patch","issue_url":"https://api.github.com/repos/python/mypy/issues/5163","number":5163,"state":"open","locked":false,"title":"Add support for detecting overloads with overlapping arities","user":{"login":"Michael0x2a","id":1424628,"node_id":"MDQ6VXNlcjE0MjQ2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/1424628?v=4","gravatar_id":"","url":"https://api.github.com/users/Michael0x2a","html_url":"https://github.com/Michael0x2a","followers_url":"https://api.github.com/users/Michael0x2a/followers","following_url":"https://api.github.com/users/Michael0x2a/following{/other_user}","gists_url":"https://api.github.com/users/Michael0x2a/gists{/gist_id}","starred_url":"https://api.github.com/users/Michael0x2a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Michael0x2a/subscriptions","organizations_url":"https://api.github.com/users/Michael0x2a/orgs","repos_url":"https://api.github.com/users/Michael0x2a/repos","events_url":"https://api.github.com/users/Michael0x2a/events{/privacy}","received_events_url":"https://api.github.com/users/Michael0x2a/received_events","type":"User","site_admin":false},"body":"This commit addresses TODO 2 from https://github.com/python/mypy/issues/5119 by adding support for detecting overloads with partially overlapping arities.\r\n\r\nIt also refactors the `is_callable_compatible` method. Specifically, this pull request...\r\n\r\n1. Pulls out a lot of the logic for iterating over formal arguments into a helper method in CallableType.\r\n\r\n2. Pulls out logic for handling varargs and kwargs outside of loops.\r\n\r\n3. Rearranges some of the logic so we can return earlier slightly more frequently.","created_at":"2018-06-06T21:45:10Z","updated_at":"2018-06-15T22:48:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f41c31444b58844c2cf9d20a7ce2191fd307bf7","assignee":{"login":"ilevkivskyi","id":12005495,"node_id":"MDQ6VXNlcjEyMDA1NDk1","avatar_url":"https://avatars1.githubusercontent.com/u/12005495?v=4","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false},"assignees":[{"login":"ilevkivskyi","id":12005495,"node_id":"MDQ6VXNlcjEyMDA1NDk1","avatar_url":"https://avatars1.githubusercontent.com/u/12005495?v=4","gravatar_id":"","url":"https://api.github.com/users/ilevkivskyi","html_url":"https://github.com/ilevkivskyi","followers_url":"https://api.github.com/users/ilevkivskyi/followers","following_url":"https://api.github.com/users/ilevkivskyi/following{/other_user}","gists_url":"https://api.github.com/users/ilevkivskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/ilevkivskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilevkivskyi/subscriptions","organizations_url":"https://api.github.com/users/ilevkivskyi/orgs","repos_url":"https://api.github.com/users/ilevkivskyi/repos","events_url":"https://api.github.com/users/ilevkivskyi/events{/privacy}","received_events_url":"https://api.github.com/users/ilevkivskyi/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/python/mypy/pulls/5163/commits","review_comments_url":"https://api.github.com/repos/python/mypy/pulls/5163/comments","review_comment_url":"https://api.github.com/repos/python/mypy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/python/mypy/issues/5163/comments","statuses_url":"https://api.github.com/repos/python/mypy/statuses/4db35c1a1501b26c6ae7bd1da866fef45ac42676","head":{"label":"Michael0x2a:overloads-partially-overlapping-arities","ref":"overloads-partially-overlapping-arities","sha":"4db35c1a1501b26c6ae7bd1da866fef45ac42676","user":{"login":"Michael0x2a","id":1424628,"node_id":"MDQ6VXNlcjE0MjQ2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/1424628?v=4","gravatar_id":"","url":"https://api.github.com/users/Michael0x2a","html_url":"https://github.com/Michael0x2a","followers_url":"https://api.github.com/users/Michael0x2a/followers","following_url":"https://api.github.com/users/Michael0x2a/following{/other_user}","gists_url":"https://api.github.com/users/Michael0x2a/gists{/gist_id}","starred_url":"https://api.github.com/users/Michael0x2a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Michael0x2a/subscriptions","organizations_url":"https://api.github.com/users/Michael0x2a/orgs","repos_url":"https://api.github.com/users/Michael0x2a/repos","events_url":"https://api.github.com/users/Michael0x2a/events{/privacy}","received_events_url":"https://api.github.com/users/Michael0x2a/received_events","type":"User","site_admin":false},"repo":{"id":62247533,"node_id":"MDEwOlJlcG9zaXRvcnk2MjI0NzUzMw==","name":"mypy","full_name":"Michael0x2a/mypy","owner":{"login":"Michael0x2a","id":1424628,"node_id":"MDQ6VXNlcjE0MjQ2Mjg=","avatar_url":"https://avatars1.githubusercontent.com/u/1424628?v=4","gravatar_id":"","url":"https://api.github.com/users/Michael0x2a","html_url":"https://github.com/Michael0x2a","followers_url":"https://api.github.com/users/Michael0x2a/followers","following_url":"https://api.github.com/users/Michael0x2a/following{/other_user}","gists_url":"https://api.github.com/users/Michael0x2a/gists{/gist_id}","starred_url":"https://api.github.com/users/Michael0x2a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Michael0x2a/subscriptions","organizations_url":"https://api.github.com/users/Michael0x2a/orgs","repos_url":"https://api.github.com/users/Michael0x2a/repos","events_url":"https://api.github.com/users/Michael0x2a/events{/privacy}","received_events_url":"https://api.github.com/users/Michael0x2a/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Michael0x2a/mypy","description":"Optional static typing for Python 2 and 3 (PEP484)","fork":true,"url":"https://api.github.com/repos/Michael0x2a/mypy","forks_url":"https://api.github.com/repos/Michael0x2a/mypy/forks","keys_url":"https://api.github.com/repos/Michael0x2a/mypy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Michael0x2a/mypy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Michael0x2a/mypy/teams","hooks_url":"https://api.github.com/repos/Michael0x2a/mypy/hooks","issue_events_url":"https://api.github.com/repos/Michael0x2a/mypy/issues/events{/number}","events_url":"https://api.github.com/repos/Michael0x2a/mypy/events","assignees_url":"https://api.github.com/repos/Michael0x2a/mypy/assignees{/user}","branches_url":"https://api.github.com/repos/Michael0x2a/mypy/branches{/branch}","tags_url":"https://api.github.com/repos/Michael0x2a/mypy/tags","blobs_url":"https://api.github.com/repos/Michael0x2a/mypy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Michael0x2a/mypy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Michael0x2a/mypy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Michael0x2a/mypy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Michael0x2a/mypy/statuses/{sha}","languages_url":"https://api.github.com/repos/Michael0x2a/mypy/languages","stargazers_url":"https://api.github.com/repos/Michael0x2a/mypy/stargazers","contributors_url":"https://api.github.com/repos/Michael0x2a/mypy/contributors","subscribers_url":"https://api.github.com/repos/Michael0x2a/mypy/subscribers","subscription_url":"https://api.github.com/repos/Michael0x2a/mypy/subscription","commits_url":"https://api.github.com/repos/Michael0x2a/mypy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Michael0x2a/mypy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Michael0x2a/mypy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Michael0x2a/mypy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Michael0x2a/mypy/contents/{+path}","compare_url":"https://api.github.com/repos/Michael0x2a/mypy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Michael0x2a/mypy/merges","archive_url":"https://api.github.com/repos/Michael0x2a/mypy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Michael0x2a/mypy/downloads","issues_url":"https://api.github.com/repos/Michael0x2a/mypy/issues{/number}","pulls_url":"https://api.github.com/repos/Michael0x2a/mypy/pulls{/number}","milestones_url":"https://api.github.com/repos/Michael0x2a/mypy/milestones{/number}","notifications_url":"https://api.github.com/repos/Michael0x2a/mypy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Michael0x2a/mypy/labels{/name}","releases_url":"https://api.github.com/repos/Michael0x2a/mypy/releases{/id}","deployments_url":"https://api.github.com/repos/Michael0x2a/mypy/deployments","created_at":"2016-06-29T18:12:20Z","updated_at":"2018-06-14T17:17:51Z","pushed_at":"2018-06-15T20:33:38Z","git_url":"git://github.com/Michael0x2a/mypy.git","ssh_url":"git@github.com:Michael0x2a/mypy.git","clone_url":"https://github.com/Michael0x2a/mypy.git","svn_url":"https://github.com/Michael0x2a/mypy","homepage":"http://www.mypy-lang.org/","size":26464,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"python:master","ref":"master","sha":"5959e1aa3d141dd0b90164db2769232a4a3b3b08","user":{"login":"python","id":1525981,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MjU5ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/1525981?v=4","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"repo":{"id":7053637,"node_id":"MDEwOlJlcG9zaXRvcnk3MDUzNjM3","name":"mypy","full_name":"python/mypy","owner":{"login":"python","id":1525981,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE1MjU5ODE=","avatar_url":"https://avatars3.githubusercontent.com/u/1525981?v=4","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/python/mypy","description":"Optional static typing for Python 2 and 3 (PEP484)","fork":false,"url":"https://api.github.com/repos/python/mypy","forks_url":"https://api.github.com/repos/python/mypy/forks","keys_url":"https://api.github.com/repos/python/mypy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/python/mypy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/python/mypy/teams","hooks_url":"https://api.github.com/repos/python/mypy/hooks","issue_events_url":"https://api.github.com/repos/python/mypy/issues/events{/number}","events_url":"https://api.github.com/repos/python/mypy/events","assignees_url":"https://api.github.com/repos/python/mypy/assignees{/user}","branches_url":"https://api.github.com/repos/python/mypy/branches{/branch}","tags_url":"https://api.github.com/repos/python/mypy/tags","blobs_url":"https://api.github.com/repos/python/mypy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/python/mypy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/python/mypy/git/refs{/sha}","trees_url":"https://api.github.com/repos/python/mypy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/python/mypy/statuses/{sha}","languages_url":"https://api.github.com/repos/python/mypy/languages","stargazers_url":"https://api.github.com/repos/python/mypy/stargazers","contributors_url":"https://api.github.com/repos/python/mypy/contributors","subscribers_url":"https://api.github.com/repos/python/mypy/subscribers","subscription_url":"https://api.github.com/repos/python/mypy/subscription","commits_url":"https://api.github.com/repos/python/mypy/commits{/sha}","git_commits_url":"https://api.github.com/repos/python/mypy/git/commits{/sha}","comments_url":"https://api.github.com/repos/python/mypy/comments{/number}","issue_comment_url":"https://api.github.com/repos/python/mypy/issues/comments{/number}","contents_url":"https://api.github.com/repos/python/mypy/contents/{+path}","compare_url":"https://api.github.com/repos/python/mypy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/python/mypy/merges","archive_url":"https://api.github.com/repos/python/mypy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/python/mypy/downloads","issues_url":"https://api.github.com/repos/python/mypy/issues{/number}","pulls_url":"https://api.github.com/repos/python/mypy/pulls{/number}","milestones_url":"https://api.github.com/repos/python/mypy/milestones{/number}","notifications_url":"https://api.github.com/repos/python/mypy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/python/mypy/labels{/name}","releases_url":"https://api.github.com/repos/python/mypy/releases{/id}","deployments_url":"https://api.github.com/repos/python/mypy/deployments","created_at":"2012-12-07T13:30:23Z","updated_at":"2018-06-15T21:55:53Z","pushed_at":"2018-06-15T21:55:48Z","git_url":"git://github.com/python/mypy.git","ssh_url":"git@github.com:python/mypy.git","clone_url":"https://github.com/python/mypy.git","svn_url":"https://github.com/python/mypy","homepage":"http://www.mypy-lang.org/","size":26393,"stargazers_count":4064,"watchers_count":4064,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":547,"mirror_url":null,"archived":false,"open_issues_count":846,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":547,"open_issues":846,"watchers":4064,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python/mypy/pulls/5163"},"html":{"href":"https://github.com/python/mypy/pull/5163"},"issue":{"href":"https://api.github.com/repos/python/mypy/issues/5163"},"comments":{"href":"https://api.github.com/repos/python/mypy/issues/5163/comments"},"review_comments":{"href":"https://api.github.com/repos/python/mypy/pulls/5163/comments"},"review_comment":{"href":"https://api.github.com/repos/python/mypy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/python/mypy/pulls/5163/commits"},"statuses":{"href":"https://api.github.com/repos/python/mypy/statuses/4db35c1a1501b26c6ae7bd1da866fef45ac42676"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ilevkivskyi"}}