{"action":"created","comment":{"url":"https://api.github.com/repos/python/mypy/pulls/comments/62060637","id":62060637,"diff_hunk":"@@ -327,7 +327,20 @@ def infer_arg_types_in_context2(\n         for i, actuals in enumerate(formal_to_actual):\n             for ai in actuals:\n                 if arg_kinds[ai] not in (nodes.ARG_STAR, nodes.ARG_STAR2):\n-                    res[ai] = self.accept(args[ai], callee.arg_types[i])\n+                    callee_arg_type = callee.arg_types[i]\n+                    arg_type = self.accept(args[ai], callee_arg_type)\n+                    if (isinstance(arg_type, CallableType) and","path":"mypy/checkexpr.py","position":16,"original_position":16,"commit_id":"262193f71e2687cfedc365e5755dc94860c21c79","original_commit_id":"262193f71e2687cfedc365e5755dc94860c21c79","user":{"login":"JukkaL","id":1107911,"avatar_url":"https://avatars.githubusercontent.com/u/1107911?v=3","gravatar_id":"","url":"https://api.github.com/users/JukkaL","html_url":"https://github.com/JukkaL","followers_url":"https://api.github.com/users/JukkaL/followers","following_url":"https://api.github.com/users/JukkaL/following{/other_user}","gists_url":"https://api.github.com/users/JukkaL/gists{/gist_id}","starred_url":"https://api.github.com/users/JukkaL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JukkaL/subscriptions","organizations_url":"https://api.github.com/users/JukkaL/orgs","repos_url":"https://api.github.com/users/JukkaL/repos","events_url":"https://api.github.com/users/JukkaL/events{/privacy}","received_events_url":"https://api.github.com/users/JukkaL/received_events","type":"User","site_admin":false},"body":"This doesn't seem to fix this for more general argument types. For example, what if the formal argument type is `List[Callable[...]]`? We could look into the types recursively, but not sure if that's the right thing to do (and it might be inefficient). I thought about this for a bit and this is far from clear to me.","created_at":"2016-05-04T15:29:34Z","updated_at":"2016-05-04T15:29:34Z","html_url":"https://github.com/python/mypy/pull/1471#discussion_r62060637","pull_request_url":"https://api.github.com/repos/python/mypy/pulls/1471","_links":{"self":{"href":"https://api.github.com/repos/python/mypy/pulls/comments/62060637"},"html":{"href":"https://github.com/python/mypy/pull/1471#discussion_r62060637"},"pull_request":{"href":"https://api.github.com/repos/python/mypy/pulls/1471"}}},"pull_request":{"url":"https://api.github.com/repos/python/mypy/pulls/1471","id":68747612,"html_url":"https://github.com/python/mypy/pull/1471","diff_url":"https://github.com/python/mypy/pull/1471.diff","patch_url":"https://github.com/python/mypy/pull/1471.patch","issue_url":"https://api.github.com/repos/python/mypy/issues/1471","number":1471,"state":"open","locked":false,"title":"Specialize type variables of generic functions that are arguments","user":{"login":"rwbarton","id":22628,"avatar_url":"https://avatars.githubusercontent.com/u/22628?v=3","gravatar_id":"","url":"https://api.github.com/users/rwbarton","html_url":"https://github.com/rwbarton","followers_url":"https://api.github.com/users/rwbarton/followers","following_url":"https://api.github.com/users/rwbarton/following{/other_user}","gists_url":"https://api.github.com/users/rwbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/rwbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwbarton/subscriptions","organizations_url":"https://api.github.com/users/rwbarton/orgs","repos_url":"https://api.github.com/users/rwbarton/repos","events_url":"https://api.github.com/users/rwbarton/events{/privacy}","received_events_url":"https://api.github.com/users/rwbarton/received_events","type":"User","site_admin":false},"body":"This kind of situation appears in `pytokenize.py`:\r\n```\r\ntokenprog, pseudoprog, single3prog, double3prog = map(\r\n    re.compile, (Token, PseudoToken, Single3, Double3))\r\n```\r\nThe inferred types of `tokenprog`, ... are currently `Pattern[AnyStr]`, which is very wrong.\r\n(Not enough of this file is annotated for that to cause other mypy errors yet, though.)","created_at":"2016-05-03T17:57:19Z","updated_at":"2016-05-04T15:29:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e8387b3a3f5e97bcda0d46bc3302496dac307ca0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/python/mypy/pulls/1471/commits","review_comments_url":"https://api.github.com/repos/python/mypy/pulls/1471/comments","review_comment_url":"https://api.github.com/repos/python/mypy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/python/mypy/issues/1471/comments","statuses_url":"https://api.github.com/repos/python/mypy/statuses/262193f71e2687cfedc365e5755dc94860c21c79","head":{"label":"rwbarton:rwbarton-generic-arg","ref":"rwbarton-generic-arg","sha":"262193f71e2687cfedc365e5755dc94860c21c79","user":{"login":"rwbarton","id":22628,"avatar_url":"https://avatars.githubusercontent.com/u/22628?v=3","gravatar_id":"","url":"https://api.github.com/users/rwbarton","html_url":"https://github.com/rwbarton","followers_url":"https://api.github.com/users/rwbarton/followers","following_url":"https://api.github.com/users/rwbarton/following{/other_user}","gists_url":"https://api.github.com/users/rwbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/rwbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwbarton/subscriptions","organizations_url":"https://api.github.com/users/rwbarton/orgs","repos_url":"https://api.github.com/users/rwbarton/repos","events_url":"https://api.github.com/users/rwbarton/events{/privacy}","received_events_url":"https://api.github.com/users/rwbarton/received_events","type":"User","site_admin":false},"repo":{"id":55577784,"name":"mypy","full_name":"rwbarton/mypy","owner":{"login":"rwbarton","id":22628,"avatar_url":"https://avatars.githubusercontent.com/u/22628?v=3","gravatar_id":"","url":"https://api.github.com/users/rwbarton","html_url":"https://github.com/rwbarton","followers_url":"https://api.github.com/users/rwbarton/followers","following_url":"https://api.github.com/users/rwbarton/following{/other_user}","gists_url":"https://api.github.com/users/rwbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/rwbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwbarton/subscriptions","organizations_url":"https://api.github.com/users/rwbarton/orgs","repos_url":"https://api.github.com/users/rwbarton/repos","events_url":"https://api.github.com/users/rwbarton/events{/privacy}","received_events_url":"https://api.github.com/users/rwbarton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rwbarton/mypy","description":"Optional static typing for Python","fork":true,"url":"https://api.github.com/repos/rwbarton/mypy","forks_url":"https://api.github.com/repos/rwbarton/mypy/forks","keys_url":"https://api.github.com/repos/rwbarton/mypy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rwbarton/mypy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rwbarton/mypy/teams","hooks_url":"https://api.github.com/repos/rwbarton/mypy/hooks","issue_events_url":"https://api.github.com/repos/rwbarton/mypy/issues/events{/number}","events_url":"https://api.github.com/repos/rwbarton/mypy/events","assignees_url":"https://api.github.com/repos/rwbarton/mypy/assignees{/user}","branches_url":"https://api.github.com/repos/rwbarton/mypy/branches{/branch}","tags_url":"https://api.github.com/repos/rwbarton/mypy/tags","blobs_url":"https://api.github.com/repos/rwbarton/mypy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rwbarton/mypy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rwbarton/mypy/git/refs{/sha}","trees_url":"https://api.github.com/repos/rwbarton/mypy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rwbarton/mypy/statuses/{sha}","languages_url":"https://api.github.com/repos/rwbarton/mypy/languages","stargazers_url":"https://api.github.com/repos/rwbarton/mypy/stargazers","contributors_url":"https://api.github.com/repos/rwbarton/mypy/contributors","subscribers_url":"https://api.github.com/repos/rwbarton/mypy/subscribers","subscription_url":"https://api.github.com/repos/rwbarton/mypy/subscription","commits_url":"https://api.github.com/repos/rwbarton/mypy/commits{/sha}","git_commits_url":"https://api.github.com/repos/rwbarton/mypy/git/commits{/sha}","comments_url":"https://api.github.com/repos/rwbarton/mypy/comments{/number}","issue_comment_url":"https://api.github.com/repos/rwbarton/mypy/issues/comments{/number}","contents_url":"https://api.github.com/repos/rwbarton/mypy/contents/{+path}","compare_url":"https://api.github.com/repos/rwbarton/mypy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rwbarton/mypy/merges","archive_url":"https://api.github.com/repos/rwbarton/mypy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rwbarton/mypy/downloads","issues_url":"https://api.github.com/repos/rwbarton/mypy/issues{/number}","pulls_url":"https://api.github.com/repos/rwbarton/mypy/pulls{/number}","milestones_url":"https://api.github.com/repos/rwbarton/mypy/milestones{/number}","notifications_url":"https://api.github.com/repos/rwbarton/mypy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rwbarton/mypy/labels{/name}","releases_url":"https://api.github.com/repos/rwbarton/mypy/releases{/id}","deployments_url":"https://api.github.com/repos/rwbarton/mypy/deployments","created_at":"2016-04-06T05:18:54Z","updated_at":"2016-04-06T05:18:56Z","pushed_at":"2016-05-03T17:47:13Z","git_url":"git://github.com/rwbarton/mypy.git","ssh_url":"git@github.com:rwbarton/mypy.git","clone_url":"https://github.com/rwbarton/mypy.git","svn_url":"https://github.com/rwbarton/mypy","homepage":"http://www.mypy-lang.org/","size":12863,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"python:master","ref":"master","sha":"a62caad372de5d2810b1072e4ca23e527f721228","user":{"login":"python","id":1525981,"avatar_url":"https://avatars.githubusercontent.com/u/1525981?v=3","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,"name":"mypy","full_name":"python/mypy","owner":{"login":"python","id":1525981,"avatar_url":"https://avatars.githubusercontent.com/u/1525981?v=3","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","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":"2016-05-04T02:22:51Z","pushed_at":"2016-05-04T14:23:09Z","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":14604,"stargazers_count":1256,"watchers_count":1256,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":148,"mirror_url":null,"open_issues_count":342,"forks":148,"open_issues":342,"watchers":1256,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python/mypy/pulls/1471"},"html":{"href":"https://github.com/python/mypy/pull/1471"},"issue":{"href":"https://api.github.com/repos/python/mypy/issues/1471"},"comments":{"href":"https://api.github.com/repos/python/mypy/issues/1471/comments"},"review_comments":{"href":"https://api.github.com/repos/python/mypy/pulls/1471/comments"},"review_comment":{"href":"https://api.github.com/repos/python/mypy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/python/mypy/pulls/1471/commits"},"statuses":{"href":"https://api.github.com/repos/python/mypy/statuses/262193f71e2687cfedc365e5755dc94860c21c79"}}}}