mypy
mypy copied to clipboard
(🐞) Bad error message when invoking an overload with a bad call
This sample produces two error messages, the second is completely valid, but the first makes no sense.
from typing import overload
@overload
def foo(a: list[int]): ...
@overload
def foo(a: list[object]): ...
def foo(a): ...
foo(dict[str, list[object]]()[1])
# Argument 1 to "foo" has incompatible type "list[object]"; expected "list[int]"
# Invalid index type "int" for "dict[str, list[object]]"; expected type "str"