@@ -5323,7 +5323,6 @@ x = register(Foo)
5323
5323
reveal_type(x) # N: Revealed type is "builtins.int"
5324
5324
[builtins fixtures/dict.pyi]
5325
5325
5326
-
5327
5326
[case testOverloadWithObjectDecorator]
5328
5327
from typing import Any, Callable, Union, overload
5329
5328
@@ -6693,3 +6692,24 @@ class B:
6693
6692
def f(self, *args, **kwargs):
6694
6693
pass
6695
6694
[builtins fixtures/tuple.pyi]
6695
+
6696
+ [case testOverloadKeywordArgsAndKwargs]
6697
+ from typing import Optional, overload
6698
+
6699
+ @overload
6700
+ def f(x: int = 0, **kwargs: str) -> None:
6701
+ ...
6702
+ @overload
6703
+ def f(x: int = 0, *, y: int, **kwargs: str) -> str:
6704
+ ...
6705
+ def f(x: int = 0, *, y: Optional[int] = None, **kwargs: str) -> Optional[str]:
6706
+ ...
6707
+
6708
+ reveal_type(f(0)) # N: Revealed type is "None"
6709
+ reveal_type(f(1, foo='bar')) # N: Revealed type is "None"
6710
+ reveal_type(f(1, y=2, foo='bar')) # N: Revealed type is "builtins.str"
6711
+ f(1, **{'y': 0, 'z': 'a'}) # E: No overload variant of "f" matches argument types "int", "Dict[str, object]" \
6712
+ # N: Possible overload variants: \
6713
+ # N: def f(x: int = ..., **kwargs: str) -> None \
6714
+ # N: def f(x: int = ..., *, y: int, **kwargs: str) -> str
6715
+ [builtins fixtures/dict.pyi]
0 commit comments