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
Conversation
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.
Thanks looks good, just have one question about syntax error in type comment location.
test-data/unit/check-columns.test
Outdated
if int(): | ||
x = 0 # type: x y | ||
[out] | ||
main:2:9: error: syntax error in type comment 'x y' |
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.
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:
.
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.
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" |
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.
In future we might want to point to x
here.
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, added a TODO. I don't think that we can easily find the location of x
currently.
Most notably, report more precise error locations for incompatible
return value types and incompatible default argument values.
Also add some tests.
Work towards #7053.