Open
Description
Bug Report
In the snippet below I'd expect the revealed type to be def () -> typing.Awaitable[builtins.dict]
, not def () -> typing.Awaitable[builtins.object]
.
To Reproduce
from typing import *
P = ParamSpec("P")
T = TypeVar("T")
@overload
def ensure_async(f: Callable[P, Awaitable[T]])-> Callable[P, Awaitable[T]]: ...
@overload
def ensure_async(f: Callable[P, T])-> Callable[P, Awaitable[T]]: ...
def ensure_async(f):
...
async def a() -> None:
g: Callable[[], dict] | Callable[[], Awaitable[dict]]
reveal_type(ensure_async(g))
https://mypy-play.net/?mypy=master&python=3.12&gist=f596993883d9235e669e38dbe212909e
Actual Behavior
main.py:18: note: Revealed type is "def () -> typing.Awaitable[builtins.object]"
Your Environment
- Mypy version used: 1.6 or master
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini
(and other config files): - Python version used: 3.12
This may be related to #12385 - closest issue I can find.