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
Point error to incompatible argument instead of call expression #7470
Conversation
Previously we just pointed to the beginning of the call expression, which is not great if there are multiple arguments. Also point to incompatible list/dict/set item instead of the beginning of a list/dict/set expression. Note that this may require some `# type: ignore` comments to be updated.
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.
Nice! The new error locations look much better.
CallableType, | ||
Context, | ||
Context, | ||
MessageBuilder], |
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.
Are you trying black? :-)
mypy/checkexpr.py
Outdated
@@ -1169,7 +1178,8 @@ def check_argument_count(self, | |||
if messages: | |||
assert context, "Internal error: messages given without context" | |||
elif context is None: | |||
context = TempNode(AnyType(TypeOfAny.special_form)) # Avoid "is None" checks | |||
# Avoid "is None" checks | |||
context = TempNode(AnyType(TypeOfAny.special_form), context=context) |
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.
context=context
is redundant since it is anyway None
.
It looks like you also need to update the |
Also note that on Python 3.8 |
Previously we pointed to the beginning of the call expression if there
was an incompatible argument, which is not great, particularly if there
are multiple arguments.
Also point to incompatible list/dict/set item instead of the beginning
of a list/dict/set expression.
Note that this may require some
# type: ignore
comments to beupdated.
I had to update the output of many test cases, mostly because line
ordering was changed.