-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Make Type[T] comparisons work #1806
Merged
Merged
Commits on Jul 5, 2016
-
This commit introduces a workaround to fix the bug discussed in python#1787 Previously, code where you compared two types (eg `int == int`) would cause mypy to incorrectly report a "too few arguments" error.
Configuration menu - View commit details
-
Copy full SHA for b46f970 - Browse repository at this point
Copy the full SHA b46f970View commit details
Commits on Jul 7, 2016
-
This commit introduces a workaround to fix the bug discussed in python#1787 Previously, code where you compared two types (eg `int == int`) would cause mypy to incorrectly report a "too few arguments" error.
Configuration menu - View commit details
-
Copy full SHA for e39d0b4 - Browse repository at this point
Copy the full SHA e39d0b4View commit details -
Configuration menu - View commit details
-
Copy full SHA for c9c70f9 - Browse repository at this point
Copy the full SHA c9c70f9View commit details
Commits on Jul 8, 2016
-
Replace hack with a more principled check
After talking with Guido, I realized Python special-cases literally the operators (==, +, etc), NOT the magic methods themselves. So, that means we need to special-case "a == b", but not "a.__eq__(b)". As a result, checking to see if the method name was a magic method or not was the wrong thing to do -- if the name of the method is "__eq__", there's no way to know if the code was originally "foo == bar" or "foo.__eq__(bar)". So, rather then trying to do something with the operator name, I can instead check and see if the node is an OpExpr or ComparisonExpr node vs a CallExpr node.
Configuration menu - View commit details
-
Copy full SHA for 53e001e - Browse repository at this point
Copy the full SHA 53e001eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e7f87b - Browse repository at this point
Copy the full SHA 0e7f87bView commit details -
Merge branch 'fix-type-comparison' of github.com:Michael0x2a/mypy int…
…o fix-type-comparison
Configuration menu - View commit details
-
Copy full SHA for 9837852 - Browse repository at this point
Copy the full SHA 9837852View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4ca2038 - Browse repository at this point
Copy the full SHA 4ca2038View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2c4db3f - Browse repository at this point
Copy the full SHA 2c4db3fView commit details -
Configuration menu - View commit details
-
Copy full SHA for bf351a4 - Browse repository at this point
Copy the full SHA bf351a4View commit details
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.