Skip to content
Merged
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
9 changes: 6 additions & 3 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2684,9 +2684,12 @@ def check_arg(
context=context,
outer_context=outer_context,
)
self.msg.incompatible_argument_note(
original_caller_type, callee_type, context, parent_error=error
)
if not caller_kind.is_star():
# For *args and **kwargs this note would be incorrect - we're comparing
# iterable/mapping type with union of relevant arg types.
self.msg.incompatible_argument_note(
original_caller_type, callee_type, context, parent_error=error
)
if not self.msg.prefer_simple_messages():
self.chk.check_possible_missing_await(
caller_type, callee_type, context, error.code
Expand Down
16 changes: 16 additions & 0 deletions test-data/unit/check-functions.test
Original file line number Diff line number Diff line change
Expand Up @@ -3694,3 +3694,19 @@ def defer() -> int: ...
[out]
main: note: In function "a":
main:6: error: Unsupported operand types for + ("int" and "str")

[case testNoExtraNoteForUnpacking]
from typing import Protocol

class P(Protocol):
arg: int
# Something that list and dict also have
def __contains__(self, item: object) -> bool: ...

def foo(x: P, y: P) -> None: ...

args: list[object]
foo(*args) # E: Argument 1 to "foo" has incompatible type "*list[object]"; expected "P"
kwargs: dict[str, object]
foo(**kwargs) # E: Argument 1 to "foo" has incompatible type "**dict[str, object]"; expected "P"
[builtins fixtures/dict.pyi]