Skip to content

Consider fallback instance promotions in is_overlapping_types() #7358

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

Merged
merged 4 commits into from
Aug 16, 2019

Conversation

ilevkivskyi
Copy link
Member

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).

# 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)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

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...

@ilevkivskyi ilevkivskyi merged commit ef30ba9 into python:master Aug 16, 2019
@ilevkivskyi ilevkivskyi deleted the fallback-promotion-overlap branch August 16, 2019 20:24
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.

2 participants