-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
featurepriority-1-normaltopic-error-reportingHow we report errorsHow we report errorstopic-usability
Description
When typechecking this:
def foo(x: int, y: str) -> None: pass
t = ('hi', 12)
foo(*t)
mypy reports
bad_starargs.py:3: error: Argument 1 to "foo" has incompatible type "*Tuple[str, int]"; expected "int"
bad_starargs.py:3: error: Argument 1 to "foo" has incompatible type "*Tuple[str, int]"; expected "str"
This is not great, since Tuple[str, int]
isn't being compared to something, and while it appears in argument position 1, the type mismatches don't necessarily.
A better error message might be something like:
bad_starargs.py:3: error: Argument 1 to "foo" has incompatible type "str"; expected "int"
bad_starargs.py:3: note: while unpacking "*Tuple[str, int]"
bad_starargs.py:3: error: Argument 2 to "foo" has incompatible type "int"; expected "str"
bad_starargs.py:3: note: while unpacking "*Tuple[str, int]"
brycepg
Metadata
Metadata
Assignees
Labels
featurepriority-1-normaltopic-error-reportingHow we report errorsHow we report errorstopic-usability