-
-
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
__slots__ and protocols don't work right for issubclass
and typevar bounds
#11884
Labels
bug
mypy got something wrong
Comments
Thanks, added to my backlog. We can treat this one as a regression, so the priority is high 🙂 |
Simplier repro: import typing
@typing.runtime_checkable
class Foo(typing.Protocol):
__slots__ = ()
class Bar:
pass
def foo(f: Foo) -> Foo:
return f
foo(Bar())
# out/ex.py:14: error: Argument 1 to "foo" has incompatible type "Bar"; expected "Foo"
# out/ex.py:14: note: Following member(s) of "Bar" have conflicts:
# out/ex.py:14: note: __slots__: expected "Tuple[]", got "Union[str, Iterable[str]]" |
Related #9314 |
Important question: should we treat Let's see how other type checkers do that 🤔 |
Pyright ignores |
@A5rocks reviews are welcome! 👍 |
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cc @sobolevn since you've been doing stuff here
Bug Report
Slots become part of a interface with protocols, they shouldn't be.
To Reproduce
Expected Behavior
At runtime this prints:
So issubclass is allowed, and I don't see why the TypeVar bounds shouldn't be.
Actual Behavior
Your Environment
mypy playground
The text was updated successfully, but these errors were encountered: