Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions test-data/unit/check-functions.test
Original file line number Diff line number Diff line change
Expand Up @@ -3694,3 +3694,17 @@ 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: ...

foo(*[0, '']) # E: Argument 1 to "foo" has incompatible type "*list[object]"; expected "P"
foo(**{'x': 0, 'y': ''}) # E: Argument 1 to "foo" has incompatible type "**dict[str, object]"; expected "P"
[builtins fixtures/dict.pyi]
Loading