Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support type inference for defaultdict() #8167

Merged
merged 6 commits into from
Dec 18, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update test case
  • Loading branch information
JukkaL committed Dec 18, 2019
commit 481190d96991bcbb2ac3155b30c727610df4667c
6 changes: 3 additions & 3 deletions test-data/unit/python2eval.test
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,11 @@ if MYPY:
x = b'abc'
[out]

[case testNestedGenericFailedInference]
[case testDefaultDictInference]
from collections import defaultdict
def foo() -> None:
x = defaultdict(list) # type: ignore
x = defaultdict(list)
x['lol'].append(10)
reveal_type(x)
[out]
_testNestedGenericFailedInference.py:5: note: Revealed type is 'collections.defaultdict[Any, builtins.list[Any]]'
_testDefaultDictInference.py:5: note: Revealed type is 'collections.defaultdict[builtins.str, builtins.list[builtins.int]]'