We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Given this code:
from typing import Iterable, Iterator, List, Type class EM(type, Iterable[int]): def __iter__(self) -> Iterator[int]: return iter(range(5)) class E(metaclass=EM): pass def passes_typecheck(e: EM) -> List[int]: return list(e) def fails_typecheck(e: Type[E]) -> List[int]: return list(e) print(passes_typecheck(E)) print(fails_typecheck(E))
mypy fails type checking for the fails_typecheck call with the following error:
fails_typecheck
bug.py:14: error: No overload variant of "list" matches argument types [Type[bug.E]]
Given that metaclasses are sometimes an implementation detail, I think this should be supported, however this could just be ignorance on my part.
The text was updated successfully, but these errors were encountered:
This looks like a bug.
#3326 is related but probably a separate issue.
Sorry, something went wrong.
This is a problem in the treatment of overload resolution.
I suggest changing the title of the bug to something like Overload resolution fails for Type[T] and metaclass.
Overload resolution fails for Type[T] and metaclass
Fix overload resolution for metaclass (#3511)
53c6e58
Fix #3452.
No branches or pull requests
Given this code:
mypy fails type checking for the
fails_typecheck
call with the following error:Given that metaclasses are sometimes an implementation detail, I think this should be supported, however this could just be ignorance on my part.
The text was updated successfully, but these errors were encountered: