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

Don't simplify out ErasedType from unions during type inference #8095

Merged
merged 2 commits into from Dec 5, 2019

Conversation

@ilevkivskyi
Copy link
Collaborator

ilevkivskyi commented Dec 5, 2019

Fixes #8093

The fix is kind of simple, we really need to keep all ErasedTypes intact to preserve the existing type inference logic, but it is also long because I need to thread the flag down like dozen function calls.

The issue itself btw highlight how fragile is current type inference logic (note that expand_type() implicitly calls make_simplified_union() too, but I think that one doesn't need to be updated because it shouldn't be called with any erased components).

@ilevkivskyi ilevkivskyi requested a review from JukkaL Dec 5, 2019
@JukkaL
JukkaL approved these changes Dec 5, 2019
Copy link
Collaborator

JukkaL left a comment

Looks good, just one comment. I agree that the type inference implementation is pretty fragile and unprincipled. Maybe we can do something about it next year.


x: Optional[str]

pagelets = filter(None, [x])

This comment has been minimized.

Copy link
@JukkaL

JukkaL Dec 5, 2019

Collaborator

Test that the type of pagelets is List[str]?

@ilevkivskyi ilevkivskyi merged commit 5680f5c into python:master Dec 5, 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:fix-the-fix branch Dec 5, 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.