-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
bugmypy got something wrongmypy got something wrongpriority-1-normaltopic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-error-reportingHow we report errorsHow we report errorstopic-usability
Description
Mypy generates a confusing error for this program:
from typing import Callable, Union
from mypy_extensions import Arg
def f(x: Callable[[Arg(int, 'x')], None]) -> None: pass
y: Callable[[Union[int, str]], None]
f(y) # errorHere is the output:
t.py:7: error: Argument 1 to "f" has incompatible type "Callable[[Union[int, str]], None]"; expected "Callable[[int], None]"
The actual error is the missing argument name in the type of y, but the error message gives no hint about this.
NickCrews
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpriority-1-normaltopic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-error-reportingHow we report errorsHow we report errorstopic-usability