-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
False positive for overload parameters overlapping with specific recursive types #9514
Comments
This comment has been minimized.
This comment has been minimized.
Thanks for the bug report. I agree that this should not be considered a fully-overlapping override, but perhaps not for the reason you think. It has nothing to do with recursive types. It's because Here's a code sample that demonstrates how a callback function with keyword parameters would not be accepted by the first overload but would be accepted by the second. from typing import Any, Callable, Protocol
class CB(Protocol):
def __call__(self, *args: Any) -> Any: ...
def overload1(func: CB) -> None: ...
def overload2(func: Callable[..., Any]) -> None: ...
def cb(*, x: int) -> None: ...
overload1(cb) # Error
overload2(cb) |
Thank you. |
…n the overload accepts a `Callable[..., T]` form. This addresses #9514.
This is addressed in pyright 1.1.390. |
Describe the bug
There seems to be a false positive for overload parameters overlapping, happening specifically with some recursive types.
I couldn't point out the exact issue, so here's an example:
Code or Screenshots
It is not really a minimal example, but I tried to keep some context. In particular, the protocol
CallableArbitraryNbArgs
was originally generic, but the false positive happens in both generic and non-generic cases.The false positive happens when using
NestedMapping
which is a recursive type that involvesNestedMappingNode
, but not when usingNestedMapping2
, that doesn't.If I'm not mistaking, the overload parameters don't overlap in either case.
VS Code extension or command-line
Both extension and command line, Pylance and Pyright version
1.1.389
The text was updated successfully, but these errors were encountered: