Skip to content
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

@overloads are not checked to be the same as body: sync or async #16166

Closed
sobolevn opened this issue Sep 23, 2023 · 0 comments
Closed

@overloads are not checked to be the same as body: sync or async #16166

sobolevn opened this issue Sep 23, 2023 · 0 comments
Assignees
Labels
bug mypy got something wrong topic-async async, await, asyncio topic-overloads

Comments

@sobolevn
Copy link
Member

This code type-checks correctly with 1.5.1:

from typing import overload

@overload
def iter_data(s: str) -> list[str]: ...
@overload
def iter_data(s: int) -> int: ...

async def iter_data(s): ...

And this one too:

from typing import overload

@overload
async def iter_data(s: str) -> list[str]: ...
@overload
async def iter_data(s: int) -> int: ...

def iter_data(s): ...

Correct one also type-checks:

from typing import overload

@overload
async def iter_data(s: str) -> list[str]: ...
@overload
async def iter_data(s: int) -> int: ...

async def iter_data(s): ...

I have a fix ready.

@sobolevn sobolevn added bug mypy got something wrong topic-overloads topic-async async, await, asyncio labels Sep 23, 2023
@sobolevn sobolevn self-assigned this Sep 23, 2023
@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-async async, await, asyncio topic-overloads
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants