Skip to content

Improve unification for redundant unions and multiple inheritance. #1402

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 1 commit into from
Apr 19, 2016

Conversation

gvanrossum
Copy link
Member

There really are two fixes to join.py here:

  • In TypeJoinVisitor.visit_union_type(), call UnionType.make_simplified_union() so that the union is normalized. Without this I can demonstrate unnormalized unions in error messages. case testUnificationRedundantUnion tests this.
  • In join_instances_via_supertype(), previously it would only consider the first base, I now make it consider all bases and pick the result with the longest MRO (breaking ties by using the earlier base). The other tests demonstrate this.

@gvanrossum
Copy link
Member Author

(I ran into this while investigating #1094, but the key issue there is different, and the fix here doesn't change the problem with empty lists. So this is really a separate issue. @JukkaL let me know of you want any changes here.)

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 19, 2016

Looks good to me. One issue though, that we discussed yesterday: I believe that join_types(a, b) may be different from join_types(b, a), which may result in some unpredictability, but let's not worry about it until we encounter a real-world issue caused by this.

@JukkaL JukkaL merged commit bb09a4b into master Apr 19, 2016
@gvanrossum gvanrossum deleted the fix-join-issues branch April 20, 2016 15:22
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