Skip to content
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

Merged
merged 14 commits into from Sep 10, 2019

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Sep 5, 2019

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 be
updated.

I had to update the output of many test cases, mostly because line
ordering was changed.

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.
Copy link
Member

@ilevkivskyi ilevkivskyi left a 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],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying black? :-)

@@ -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)
Copy link
Member

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.

@ilevkivskyi
Copy link
Member

It looks like you also need to update the --pretty test.

@ilevkivskyi
Copy link
Member

Also note that on Python 3.8 # type: ignore spans expression, i.e. a # type: ignore on a line between ctx.line and ctx.end_line suppresses the error for given ctx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants