-
-
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
Fixes corner case for comparing nested overloads #9259
Conversation
We have this really nasty bug in `returns` with our `@curry` plugin: - Closes #9147 - Closes #8978 So, this little fix solves the problem for us with very little effort. In the ideal world, I would have to rewrite the whole thing to make the nested structures work. Current problem is that we have a local state in `matched_overloads` and `possible_invalid_overloads` variables that is not syncronyzed with the nested calls. I can also add a `TODO` note for later.
Testing that this solves our issue: from returns.curry import curry
from returns.io import IO
@curry
def test(a: int, b: int, c: int) -> int:
...
reveal_type(test) # works
reveal_type(IO(1).apply(IO(test))) # fails Without this fix:
With this fix:
It works! 🎉 |
This failure does not seem related:
|
Let me close and reopen the issue to see if re-running the tests fares better. |
mypy/subtypes.py
Outdated
# This was originally introduced as a fix / hack for: | ||
# https://github.com/python/mypy/issues/9147 |
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.
There is no need to add a comment in the source referring to the bug (people can find that information using git blame
).
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.
👍
LGTM. Would it be feasible to add a unit test? |
@gvanrossum I don't know how to easily replicate this. Because creating a nested I can write one if that's required. But, if you ask me I would probably leave this as-is. |
Okay, that's fine then. |
@gvanrossum thanks a lot! 👍 |
We have this really nasty bug in
returns
with our@curry
plugin:is_subtype
function does not work correctly for two overloads #9147So, this little fix solves the problem for us with very little effort.
In the ideal world, I would have to rewrite the whole thing to make the nested structures work.
Current problem is that we have a local state in
matched_overloads
andpossible_invalid_overloads
variables that is not syncronyzed with the nested calls.I can also add a
TODO
note for later.Refs dry-python/returns#410