Skip to content

[mypyc] Simplify union types#14363

Merged
JukkaL merged 2 commits intomasterfrom
mypyc-simplify-union
Dec 28, 2022
Merged

[mypyc] Simplify union types#14363
JukkaL merged 2 commits intomasterfrom
mypyc-simplify-union

Conversation

@JukkaL
Copy link
Copy Markdown
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