-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Show name of type variable in "Cannot infer type argument" message #19290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
967be77
e061414
bb84384
4937bf0
eb70fa7
ac46c84
7215551
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1370,11 +1370,14 @@ def incompatible_type_application( | |||||
self.fail(f"Type application has too few types ({s})", context) | ||||||
|
||||||
def could_not_infer_type_arguments( | ||||||
self, callee_type: CallableType, n: int, context: Context | ||||||
self, callee_type: CallableType, tv: TypeVarLikeType, context: Context | ||||||
) -> None: | ||||||
callee_name = callable_name(callee_type) | ||||||
if callee_name is not None and n > 0: | ||||||
self.fail(f"Cannot infer type argument {n} of {callee_name}", context) | ||||||
if callee_name is not None: | ||||||
self.fail( | ||||||
f"Cannot infer type argument to type parameter {format_type(tv, self.options)} of {callee_name}", | ||||||
|
f"Cannot infer type argument to type parameter {format_type(tv, self.options)} of {callee_name}", | |
f"Cannot infer type argument {format_type(tv, self.options)} of {callee_name}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with this being verbose. Cannot infer type argument "T"
originally sounded off to me since T
isn't a type argument, it's the type parameter whose argument mypy is trying to infer.
Maybe Cannot infer value of type parameter "T" of "f"
? I'm also fine with the suggested wording if that's your preference.
Uh oh!
There was an error while loading. Please reload this page.