Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,9 @@ def remove_unpack_kwargs(self, defn: FuncDef, typ: CallableType) -> CallableType
overlap.discard(typ.arg_names[-1])
if overlap:
overlapped = ", ".join([f'"{name}"' for name in sorted(filter(None, overlap))])
self.fail(f"Overlap between argument names and ** TypedDict items: {overlapped}", defn)
self.fail(
f"Overlap between parameter names and ** TypedDict items: {overlapped}", defn
)
new_arg_types = typ.arg_types[:-1] + [AnyType(TypeOfAny.from_error)]
return typ.copy_modified(arg_types=new_arg_types)
# OK, everything looks right now, mark the callable type as using unpack.
Expand Down
2 changes: 1 addition & 1 deletion test-data/unit/check-varargs.test
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ from typing_extensions import Unpack
class Person(TypedDict):
name: str
age: int
def foo(name: str, **kwargs: Unpack[Person]) -> None: # E: Overlap between argument names and ** TypedDict items: "name"
def foo(name: str, **kwargs: Unpack[Person]) -> None: # E: Overlap between parameter names and ** TypedDict items: "name"
...
[builtins fixtures/dict.pyi]
[typing fixtures/typing-typeddict.pyi]
Expand Down