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

Allow comparisons to refine Optional types without strict-optional #4523

Merged
merged 7 commits into from Sep 21, 2018

Conversation

Projects
None yet
3 participants
@msullivan
Collaborator

msullivan commented Jan 30, 2018

Fixes #4520.

@msullivan msullivan requested review from gvanrossum and ilevkivskyi Jan 30, 2018

@gvanrossum

This comment has been minimized.

Member

gvanrossum commented Jan 30, 2018

(Let's hold off on this a bit, we've discovered some problems with it in our own codebase.)

@ilevkivskyi

This comment has been minimized.

Collaborator

ilevkivskyi commented Feb 3, 2018

(Let's hold off on this a bit, we've discovered some problems with it in our own codebase.)

Please let me know when the problems are solved, so that I can proceed with a review.

@gvanrossum

This comment has been minimized.

Member

gvanrossum commented Feb 3, 2018

IIUC that's in @msullivan's court.

@msullivan

This comment has been minimized.

Collaborator

msullivan commented Feb 6, 2018

Before this can land, we need to fix #3526, since this change exposes a bunch of instances of it.

@msullivan

This comment has been minimized.

Collaborator

msullivan commented Sep 17, 2018

The bad news is that I went and fixed #3526 and it turns out that wasn't actually what was causing trouble internally.
The good news is I also have a fix for the problem which I'll put up shortly.

@msullivan

This comment has been minimized.

Collaborator

msullivan commented Sep 21, 2018

@ilevkivskyi this is ready for review now

@ilevkivskyi

Looks good to me! I have one unrelated suggestion.

@@ -271,11 +271,10 @@ def assign_type(self, expr: Expression,
and not restrict_any):

This comment has been minimized.

@ilevkivskyi

ilevkivskyi Sep 21, 2018

Collaborator

This doesn't need to be on a separate line.

@ilevkivskyi

This comment has been minimized.

Collaborator

ilevkivskyi commented on mypy/binder.py in 63fe0af Sep 21, 2018

And parentheses are redundant, sorry about these style nits.

@msullivan

This comment has been minimized.

Collaborator

msullivan commented Sep 21, 2018

This causes a small handful of errors in internal codebases that will be easy to fix. A couple were weird second-order effects in which doing the refinement meant that a type was no longer a Union and so behaved differently when computing types in a ternary expression. Sigh.

@msullivan msullivan merged commit fed00ef into master Sep 21, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@msullivan msullivan deleted the optional_refine branch Sep 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment