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

[mypyc] Simplify union types #14363

Merged
merged 2 commits into from
Dec 28, 2022
Merged

[mypyc] Simplify union types #14363

merged 2 commits into from
Dec 28, 2022

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Dec 28, 2022

We can sometimes simplify a mypyc RType union, even if the mypy union couldn't be simplified. A typical example is list[x] | list[y] which can be simplified to just list. Previously this would generate a redundant union union[list, list].

We can sometimes simplify an RType union, even if the mypy union
couldn't be simplified. A typical example is `list[x] | list[y]`
which can be simplified to just `list`. Previously this would
generate a redundant union `union[list, list]`.
@JukkaL JukkaL merged commit 86dad8a into master Dec 28, 2022
@JukkaL JukkaL deleted the mypyc-simplify-union branch December 28, 2022 15:41
JukkaL added a commit that referenced this pull request Dec 28, 2022
Fix crash related to unions in loops. The crash was introduced in #14363.

Flatten nested unions before simplifying unions.
JukkaL added a commit that referenced this pull request Dec 29, 2022
Flatten nested unions before simplifying unions.

Simplify item type unions in loops. This fixes a crash introduced in
#14363.
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