@@ -1013,13 +1013,15 @@ async def foo(x: int) -> int: ...
10131013
10141014# These are allowed in some cases:
10151015top_level = await foo(1) # E: "await" outside function [top-level-await]
1016- crasher = [await foo(x) for x in [1, 2, 3]] # E: "await" outside function [top-level-await]
1016+ crasher = [await foo(x) for x in [1, 2, 3]] # E: "async for" outside async function [syntax] \
1017+ # E: "await" outside function [top-level-await]
10171018
10181019def bad() -> None:
10191020 # These are always critical / syntax issues:
1020- y = [await foo(x) for x in [1, 2, 3]] # E: "await " outside coroutine (" async def") [await-not-async ]
1021+ y = [await foo(x) for x in [1, 2, 3]] # E: "async for " outside async function [syntax ]
10211022async def good() -> None:
10221023 y = [await foo(x) for x in [1, 2, 3]] # OK
1024+
10231025[builtins fixtures/async_await.pyi]
10241026[typing fixtures/typing-async.pyi]
10251027
@@ -1080,3 +1082,13 @@ class Launcher(P):
10801082
10811083[builtins fixtures/async_await.pyi]
10821084[typing fixtures/typing-async.pyi]
1085+
1086+ [case testAwaitInsideGeneratorExpr]
1087+ def foo():
1088+ yield 0
1089+
1090+ def bar():
1091+ (await x for x in foo())
1092+
1093+ [builtins fixtures/async_await.pyi]
1094+ [typing fixtures/typing-async.pyi]
0 commit comments