Closed
Description
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:
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.