-
-
Couldn't load subscription status.
- Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Getting this both with 0.942 as well as latest master:
from typing import AsyncIterator from typing import Sequence class AsyncResultWorking: "a class with two async methods." async def _some_impl(self) -> str: ... async def partitions(self) -> AsyncIterator[str]: ... class AsyncResultBroken: """a class with the identical two async methods as AsyncResultWorking, but the 'partitions' method is now implemented.""" async def _some_impl(self) -> str: ... async def partitions(self) -> AsyncIterator[str]: while True: partition = await self._some_impl() if partition: yield partition else: break class AsyncResultSubclassWorking(AsyncResultWorking): """subclassing the working class is fine""" async def partitions(self) -> AsyncIterator[str]: ... class AsyncResultSubclassBroken(AsyncResultBroken): """subclassing the broken class expresses confusion over the 'partitions' method signature. """ async def partitions(self) -> AsyncIterator[str]: ...error:
test3.py:43: error: Return type "Coroutine[Any, Any, AsyncIterator[str]]" of "partitions" incompatible with return type "AsyncIterator[str]" in supertype "AsyncResultBroken" [override] Found 1 error in 1 file (checked 1 source file) if you remove the implementation from AsyncResultBroken.partitions, then it passes. So, I'm wondering am I not using AsyncIterator correctly? but if I'm not, neither mypy nor pyright are saying anything. Also, even if the method body of partitions were wrong, the signatures match exactly.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong