-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add support for operators with union operands #5545
Merged
ilevkivskyi
merged 11 commits into
python:master
from
Michael0x2a:double-union-operators
Sep 5, 2018
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b8c84cc
Add support for operators with union operands
Michael0x2a 4fb3e15
Revert left expr propagation
Michael0x2a 54dddc6
Add staggered check
Michael0x2a 49af0ae
Fix lint errors
Michael0x2a 71832fe
Merge branch 'master' into double-union-operators
Michael0x2a a0d906c
Change how we construct the inferred callable type
Michael0x2a ca5e0ac
WIP
Michael0x2a 4a3bda9
Fix failing test
Michael0x2a 7d92e70
Add a little TODO item
ilevkivskyi b124a79
Merge branch 'master' into double-union-operators
ilevkivskyi 73c3e67
Try to fix a careless merge
ilevkivskyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 it be that all these things will be simplified if you use
?
I remember similar situations from union overloads, where an argument expression once gets in type map, and then you see weird errors.
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.
Huh, that's a good point -- it didn't occur to me until you pointed it out that
type_overrides_set
is trying to solve the same problem.I think the overall level of complexity is going to be about the same though -- e.g. if I switch to using
type_overrides_set
, I'd be able to simplify this list comprehension a bit but would need to add the with block to the doubly nested loop below.I decided to keep the code the same for now mostly because I didn't want to have to worry about what would happen if you tried doing union math things on an overloaded operator. But if you think it's worth switching over to the other approach for consistency, LMK.
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.
I think it is OK. It is probably safer because a more robust implementation of
type_overrides_set
should allow "stacking" the overrides. But it is a separate topic, we can do this later if this pattern will be needed elsewhere.