-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
"SupportsInt" doesn't work with Union types #2330
Comments
In particular, you can repro this for Python 2 with: from typing import Union
x = 0 # type: Union[int, unicode]
int(x) |
I would guess it is another example of #2128 and the general overloading/Union problem. |
FYI this is still an issue in Python 3.6:
|
Yes, this is an issue in mypy's union deduction checks, and is independent of Python version. |
This issue is now fixed (example correctly passes). |
The following shouldn't be an error:
error: Argument 1 to "int" has incompatible type "Union[unicode, int]"; expected "SupportsInt"
The text was updated successfully, but these errors were encountered: