Open
Description
Bug Report
Passing an incorrectly named kwarg to an overloaded function results in a misleading error message about types:
from typing import overload
@overload
def foo(bar: int) -> int:
...
@overload
def foo(bar: None) -> None:
...
def foo(bar: int | None) -> int | None:
...
foo(baz=42) # typo: 'baz' should be 'bar'
error: No overload variant of "foo" matches argument type "int" [call-overload]
note: Possible overload variants:
note: def foo(bar: int) -> int
note: def foo(bar: None) -> None
To Reproduce
https://mypy-play.net/?mypy=latest&python=3.10&gist=0c0b7a4699e67b65d38eb182fb75c444
Expected Behavior
A message such as error: Unexpected keyword argument "baz" for "foo" [call-arg]
(which is what you get when the function is not overloaded).
Actual Behavior
error: No overload variant of "foo" matches argument type "int" [call-overload]
Your Environment
- Mypy version used: 1.0.0