-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
is_subtype
function does not work correctly for two overloads
#9147
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
Comments
Ok, looks like I have figured this out. Because we call |
The easiest fix I found for this specific case is this: Line 401 in b363204
elif isinstance(right, Overloaded):
if left == self.right:
return True All the @JelleZijlstra @JukkaL do you think that this is a valid solution? I am asking because it does not really solve the underling problem: it still does not ensure that the local mutable state is syncronized with the nested |
This is for a 3rd party plugin: dry-python/returns#410 - Closes #9147 - Closes #8978
I am reporting a bug.
In mypy
curry
plugin I generate types like this for curried functions:When I try to manipulate this type in other places like:
It raises an error:
Original issue: dry-python/returns#459
So, I have started from here:
mypy/mypy/checkexpr.py
Lines 1470 to 1481 in 358522e
And checked what are the types I am dealing with:
Outputs:
So, it looks like the types are correct, but
is_subtypes
treats equal types incorrectly.So, I have tracked it down to these lines:
mypy/mypy/subtypes.py
Lines 401 to 443 in 358522e
And that's what it produces:
So, the logic seems incorrect here. But, I am not sure what's wrong. I don't understand this part:
I would love to help with this one, I will try to send a PR shortly.
Related dry-python/returns#462
The text was updated successfully, but these errors were encountered: