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

Consider fallback instance promotions in is_overlapping_types() #7358

Merged
merged 4 commits into from Aug 16, 2019

Conversation

@ilevkivskyi
Copy link
Collaborator

commented Aug 16, 2019

Using this opportunity I also made a tiny refactoring to avoid code duplication (that would grow even bigger if I would also add logic for promotions).

@ilevkivskyi ilevkivskyi requested a review from Michael0x2a Aug 16, 2019
# First we need to handle promotions and structural compatibility for instances
# that came as fallbacks, so simply call is_subtype() to avoid code duplication.
if (is_subtype(left, right, ignore_promotions=ignore_promotions)
or is_subtype(right, left, ignore_promotions=ignore_promotions)):

This comment has been minimized.

Copy link
@Michael0x2a

Michael0x2a Aug 16, 2019

Collaborator

It's somewhat unfortunate we end up needing to perform a subtype check again here (we already call is_proper_subtype earlier in the method).

But as you said, it doesn't seem like there's a clean way of working around this without repeating some of the promotion logic anyways...

test-data/unit/check-expressions.test Show resolved Hide resolved
Ivan Levkivskyi
@ilevkivskyi ilevkivskyi merged commit ef30ba9 into python:master Aug 16, 2019
2 checks passed
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:fallback-promotion-overlap branch Aug 16, 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.