@@ -959,3 +959,45 @@ async def good() -> None:
959959 y = [await foo(x) for x in [1, 2, 3]] # OK
960960[builtins fixtures/async_await.pyi]
961961[typing fixtures/typing-async.pyi]
962+
963+ [case testNestedAsyncFunctionAndTypeVarAvalues]
964+ from typing import TypeVar
965+
966+ T = TypeVar('T', int, str)
967+
968+ def f(x: T) -> None:
969+ async def g() -> T:
970+ return x
971+ [builtins fixtures/async_await.pyi]
972+ [typing fixtures/typing-async.pyi]
973+
974+ [case testNestedAsyncGeneratorAndTypeVarAvalues]
975+ from typing import AsyncGenerator, TypeVar
976+
977+ T = TypeVar('T', int, str)
978+
979+ def f(x: T) -> None:
980+ async def g() -> AsyncGenerator[T, None]:
981+ yield x
982+ [builtins fixtures/async_await.pyi]
983+ [typing fixtures/typing-async.pyi]
984+
985+ [case testNestedDecoratedCoroutineAndTypeVarValues]
986+ from typing import Generator, TypeVar
987+ from types import coroutine
988+
989+ T = TypeVar('T', int, str)
990+
991+ def f(x: T) -> None:
992+ @coroutine
993+ def inner() -> Generator[T, None, None]:
994+ yield x
995+ reveal_type(inner) # N: Revealed type is "def () -> typing.AwaitableGenerator[builtins.int, None, None, typing.Generator[builtins.int, None, None]]" \
996+ # N: Revealed type is "def () -> typing.AwaitableGenerator[builtins.str, None, None, typing.Generator[builtins.str, None, None]]"
997+
998+ @coroutine
999+ def coro() -> Generator[int, None, None]:
1000+ yield 1
1001+ reveal_type(coro) # N: Revealed type is "def () -> typing.AwaitableGenerator[builtins.int, None, None, typing.Generator[builtins.int, None, None]]"
1002+ [builtins fixtures/async_await.pyi]
1003+ [typing fixtures/typing-async.pyi]
0 commit comments