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) # error
Here 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.
Mypy generates a confusing error for this program:
Here is the output:
The actual error is the missing argument name in the type of
y, but the error message gives no hint about this.