Open
Description
Bug Report
Mypy complains when I try to call get on an empty dict.
To Reproduce
x = {}.get("x")
Expected Behavior
No error.
Actual Behavior
a.py:1: error: No overload variant of "get" of "dict" matches argument type "str" [call-overload]
a.py:1: note: Possible overload variants:
a.py:1: note: def get(self, Never, /) -> None
a.py:1: note: def get(self, Never, Never, /) -> Never
a.py:1: note: def [_T] get(self, Never, _T, /) -> _T
Found 1 error in 1 file (checked 1 source file)
Your Environment
- Mypy version used: 1.11.1
- Python version used: 3.12.4