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

Thread line/col for lambda parameter to error about covariant typevar #4275

Merged
merged 3 commits into from Nov 22, 2017

Conversation

Projects
None yet
2 participants
@gvanrossum
Member

gvanrossum commented Nov 21, 2017

Fixes #4270

@gvanrossum

This comment has been minimized.

Show comment
Hide comment
@gvanrossum

gvanrossum Nov 21, 2017

Member

@ilevkivskyi Do you think this is the right solution? I spiked on just this error, not sure how many others are similar.

Member

gvanrossum commented Nov 21, 2017

@ilevkivskyi Do you think this is the right solution? I spiked on just this error, not sure how many others are similar.

@ilevkivskyi

ilevkivskyi approved these changes Nov 21, 2017 edited

This is an old problem. There are few open similar issues still (for example #4231), but I think most of things are fixed now. The situation with column numbers is worse however. I think we need more tests for columns, or we can just update existing tests, I will now open an issue for this.

@@ -725,7 +725,10 @@ def check_func_def(self, defn: FuncItem, typ: CallableType, name: Optional[str])
arg_type.variance == COVARIANT and
defn.name() not in ('__init__', '__new__')
):
self.fail(messages.FUNCTION_PARAMETER_CANNOT_BE_COVARIANT, arg_type)
ctx = arg_type # type: Context

This comment has been minimized.

@ilevkivskyi

ilevkivskyi Nov 21, 2017

Collaborator

I would add a test where problematic argument appears on a separate line.

@ilevkivskyi

ilevkivskyi Nov 21, 2017

Collaborator

I would add a test where problematic argument appears on a separate line.

@gvanrossum gvanrossum merged commit cdbc7db into python:master Nov 22, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@gvanrossum gvanrossum deleted the gvanrossum:covarfix branch Nov 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment