KEMBAR78
Fix type of conditional statement to Union and not Join. (#3487) by MentalMegalodon · Pull Request #5041 · python/mypy · GitHub
Skip to content

Conversation

@MentalMegalodon
Copy link
Contributor

No description provided.

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


[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]'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@msullivan msullivan merged commit 532f3fb into python:master May 14, 2018
JukkaL added a commit that referenced this pull request May 22, 2018
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 pushed a commit that referenced this pull request May 24, 2018
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants