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

Make reported line and column numbers more precise #7578

Merged
merged 7 commits into from Oct 7, 2019
Merged

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Sep 27, 2019

Most notably, report more precise error locations for incompatible
return value types and incompatible default argument values.

Also add some tests.

Work towards #7053.

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.

Thanks looks good, just have one question about syntax error in type comment location.

if int():
x = 0 # type: x y
[out]
main:2:9: error: syntax error in type comment 'x y'
Copy link
Member

Choose a reason for hiding this comment

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

It is not clear what is 9th column here? Maybe keep the intent as 4, otherwise there are two 8-column offsets, the indent itself and also the length of # type: .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A good point, updated.

@@ -133,9 +133,11 @@ def foobar(): pass

[builtins fixtures/module.pyi]

[case testColumnUnexpectedKeywordArg]
[case testColumnUnexpectedOrMissingKeywordArg]
def f(): pass
(f(x=1)) # E:2: Unexpected keyword argument "x" for "f"
Copy link
Member

Choose a reason for hiding this comment

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

In future we might want to point to x here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, added a TODO. I don't think that we can easily find the location of x currently.

@JukkaL JukkaL merged commit cef7a63 into master Oct 7, 2019
@JelleZijlstra JelleZijlstra deleted the columns-5-misc branch October 7, 2019 23:09
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