-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix type of conditional statement to Union and not Join. (#3487) #5041
Conversation
There was a problem hiding this 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.
@@ -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]' |
There was a problem hiding this comment.
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
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
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.
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.
No description provided.