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

Fix binding of self-types on unions #7152

Merged
merged 2 commits into from Jul 5, 2019

Conversation

@ilevkivskyi
Copy link
Collaborator

commented Jul 4, 2019

Fixes #7149

The fix is quite straightforward, self-types should be bound to each individual component, so I just added only basic tests. Please let me know if you want better test coverage (properties, class-methods) etc.

Ivan Levkivskyi

@ilevkivskyi ilevkivskyi requested a review from JukkaL Jul 4, 2019

@JukkaL

JukkaL approved these changes Jul 5, 2019

Copy link
Collaborator

left a comment

I like how this is a clean fix, and fixes a more general issue than what I reported. Just one comment about tests.

def same(self: T) -> T: ...

x: Union[A, C]
reveal_type(x.same) # N: Revealed type is 'Union[builtins.int, def () -> __main__.C*]'

This comment has been minimized.

Copy link
@JukkaL

JukkaL Jul 5, 2019

Collaborator

Maybe add a test for class method with a self type?

Ivan Levkivskyi

@ilevkivskyi ilevkivskyi merged commit dab5b29 into python:master Jul 5, 2019

2 checks passed

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

@ilevkivskyi ilevkivskyi deleted the ilevkivskyi:fix-typeddict-plugin branch Jul 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.