Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Add hint for AsyncIterator incompatible return type#15883
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1021,3 +1021,19 @@ def coro() -> Generator[int, None, None]: | ||
| reveal_type(coro) # N: Revealed type is "def () -> typing.AwaitableGenerator[builtins.int, None, None, typing.Generator[builtins.int, None, None]]" | ||
| [builtins fixtures/async_await.pyi] | ||
| [typing fixtures/typing-async.pyi] | ||
| [case asyncIteratorInProtocol] | ||
| from typing import AsyncIterator, Protocol | ||
| class P(Protocol): | ||
| async def launch(self) -> AsyncIterator[int]: | ||
| raise BaseException | ||
| class Launcher(P): | ||
| def launch(self) -> AsyncIterator[int]: # E: Return type "AsyncIterator[int]" of "launch" incompatible with return type "Coroutine[Any, Any, AsyncIterator[int]]" in supertype "P" \ | ||
| # N: Consider declaring "launch" in supertype "P" without "async" \ | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Shouldn't it instead say: "consider adding Because in my experience, AsyncIterators are way more common with ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Ehh, this is confusing :| The 'problem' here should really be reported on this line: but we don't put notices proactively on declarations that smell funny, or do we? The error on the derived | ||
| # N: See https://mypy.readthedocs.io/en/stable/more_types.html#asynchronous-iterators | ||
| raise BaseException | ||
| [builtins fixtures/async_await.pyi] | ||
| [typing fixtures/typing-async.pyi] | ||