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

Fix type of conditional statement to Union and not Join. (#3487) #5041

Merged
merged 2 commits into from May 14, 2018

Conversation

Projects
None yet
3 participants
@MentalMegalodon
Contributor

MentalMegalodon commented May 14, 2018

No description provided.

@ilevkivskyi

Thanks! Look good, I have just one small comment.

@@ -385,7 +385,7 @@ def lookup_field(name, obj):
attr = None
[case testTernaryWithNone]
reveal_type(None if bool() else 0) # E: Revealed type is 'Union[builtins.int, builtins.None]'
reveal_type(None if bool() else 0) # E: Revealed type is 'Union[builtins.None, builtins.int]'

This comment has been minimized.

@ilevkivskyi

ilevkivskyi May 14, 2018

Collaborator

Could you please add few dedicated tests? (Probably not in this test but in check-unions)

@ilevkivskyi

Great, thanks!

@msullivan msullivan merged commit 532f3fb into python:master May 14, 2018

2 checks passed

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

JukkaL added a commit that referenced this pull request May 22, 2018

Don't always infer unions for conditional expressions
Use a join for type of a conditional expression unless the type context
is a union type.

A recent change (#5041) modified the type to always use a union, but this
caused many problems in internal Dropbox repos that we aren't ready to
fix yet.

msullivan added a commit that referenced this pull request May 24, 2018

Don't always infer unions for conditional expressions (#5095)
Use a join for type of a conditional expression unless the type context
is a union type.

A recent change (#5041) modified the type to always use a union, but this
caused many problems in internal Dropbox repos that we aren't ready to
fix yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment