22-- ---------------------------------------
33
44[case testAsyncDefPass]
5- # flags: --fast-parser
5+
66async def f() -> int:
77 pass
88[builtins fixtures/async_await.pyi]
99
1010[case testAsyncDefReturn]
11- # flags: --fast-parser
11+
1212async def f() -> int:
1313 return 0
1414reveal_type(f()) # E: Revealed type is 'typing.Awaitable[builtins.int]'
1515[builtins fixtures/async_await.pyi]
1616
1717[case testAsyncDefMissingReturn]
18- # flags: --fast-parser -- warn-no-return
18+ # flags: --warn-no-return
1919async def f() -> int:
2020 make_this_not_trivial = 1
2121[builtins fixtures/async_await.pyi]
2222[out]
2323main:2: error: Missing return statement
2424
2525[case testAsyncDefReturnWithoutValue]
26- # flags: --fast-parser
26+
2727async def f() -> int:
2828 make_this_not_trivial = 1
2929 return
@@ -32,7 +32,7 @@ async def f() -> int:
3232main:4: error: Return value expected
3333
3434[case testAwaitCoroutine]
35- # flags: --fast-parser
35+
3636async def f() -> int:
3737 x = await f()
3838 reveal_type(x) # E: Revealed type is 'builtins.int*'
@@ -41,7 +41,7 @@ async def f() -> int:
4141[out]
4242
4343[case testAwaitDefaultContext]
44- # flags: --fast-parser
44+
4545from typing import TypeVar
4646T = TypeVar('T')
4747async def f(x: T) -> T:
@@ -52,7 +52,7 @@ async def f(x: T) -> T:
5252main:6: error: Revealed type is 'T`-1'
5353
5454[case testAwaitAnyContext]
55- # flags: --fast-parser
55+
5656from typing import Any, TypeVar
5757T = TypeVar('T')
5858async def f(x: T) -> T:
@@ -63,7 +63,7 @@ async def f(x: T) -> T:
6363main:6: error: Revealed type is 'Any'
6464
6565[case testAwaitExplicitContext]
66- # flags: --fast-parser
66+
6767from typing import TypeVar
6868T = TypeVar('T')
6969async def f(x: T) -> T:
@@ -75,7 +75,7 @@ main:5: error: Argument 1 to "f" has incompatible type "T"; expected "int"
7575main:6: error: Revealed type is 'builtins.int'
7676
7777[case testAwaitGeneratorError]
78- # flags: --fast-parser
78+
7979from typing import Any, Generator
8080def g() -> Generator[int, None, str]:
8181 yield 0
@@ -87,7 +87,7 @@ async def f() -> int:
8787main:7: error: Incompatible types in await (actual type Generator[int, None, str], expected type "Awaitable")
8888
8989[case testAwaitIteratorError]
90- # flags: --fast-parser
90+
9191from typing import Any, Iterator
9292def g() -> Iterator[Any]:
9393 yield
@@ -98,7 +98,7 @@ async def f() -> int:
9898main:6: error: Incompatible types in await (actual type Iterator[Any], expected type "Awaitable")
9999
100100[case testAwaitArgumentError]
101- # flags: --fast-parser
101+
102102def g() -> int:
103103 return 0
104104async def f() -> int:
@@ -109,7 +109,7 @@ async def f() -> int:
109109main:5: error: Incompatible types in await (actual type "int", expected type "Awaitable")
110110
111111[case testAwaitResultError]
112- # flags: --fast-parser
112+
113113async def g() -> int:
114114 return 0
115115async def f() -> str:
@@ -120,7 +120,7 @@ async def f() -> str:
120120main:5: error: Incompatible types in assignment (expression has type "int", variable has type "str")
121121
122122[case testAwaitReturnError]
123- # flags: --fast-parser
123+
124124async def g() -> int:
125125 return 0
126126async def f() -> str:
@@ -131,7 +131,7 @@ async def f() -> str:
131131main:6: error: Incompatible return value type (got "int", expected "str")
132132
133133[case testAsyncFor]
134- # flags: --fast-parser
134+
135135from typing import AsyncIterator
136136class C(AsyncIterator[int]):
137137 async def __anext__(self) -> int: return 0
@@ -142,7 +142,7 @@ async def f() -> None:
142142[out]
143143
144144[case testAsyncForError]
145- # flags: --fast-parser
145+
146146from typing import AsyncIterator
147147async def f() -> None:
148148 async for x in [1]:
@@ -153,7 +153,7 @@ main:4: error: AsyncIterable expected
153153main:4: error: List[int] has no attribute "__aiter__"
154154
155155[case testAsyncForTypeComments]
156- # flags: --fast-parser
156+
157157from typing import AsyncIterator, Union
158158class C(AsyncIterator[int]):
159159 async def __anext__(self) -> int: return 0
@@ -242,7 +242,7 @@ main:21: error: asyncify[int] has no attribute "__iter__"; maybe "__aiter__"?
242242[builtins fixtures/async_await.pyi]
243243
244244[case testAsyncWith]
245- # flags: --fast-parser
245+
246246class C:
247247 async def __aenter__(self) -> int: pass
248248 async def __aexit__(self, x, y, z) -> None: pass
@@ -253,7 +253,7 @@ async def f() -> None:
253253
254254
255255[case testAsyncWithError]
256- # flags: --fast-parser
256+
257257class C:
258258 def __enter__(self) -> int: pass
259259 def __exit__(self, x, y, z) -> None: pass
@@ -266,7 +266,7 @@ main:6: error: "C" has no attribute "__aenter__"; maybe "__enter__"?
266266main:6: error: "C" has no attribute "__aexit__"; maybe "__exit__"?
267267
268268[case testAsyncWithErrorBadAenter]
269- # flags: --fast-parser
269+
270270class C:
271271 def __aenter__(self) -> int: pass
272272 async def __aexit__(self, x, y, z) -> None: pass
@@ -277,7 +277,7 @@ async def f() -> None:
277277[out]
278278
279279[case testAsyncWithErrorBadAenter2]
280- # flags: --fast-parser
280+
281281class C:
282282 def __aenter__(self) -> None: pass
283283 async def __aexit__(self, x, y, z) -> None: pass
@@ -288,7 +288,7 @@ async def f() -> None:
288288[out]
289289
290290[case testAsyncWithErrorBadAexit]
291- # flags: --fast-parser
291+
292292class C:
293293 async def __aenter__(self) -> int: pass
294294 def __aexit__(self, x, y, z) -> int: pass
@@ -299,7 +299,7 @@ async def f() -> None:
299299[out]
300300
301301[case testAsyncWithErrorBadAexit2]
302- # flags: --fast-parser
302+
303303class C:
304304 async def __aenter__(self) -> int: pass
305305 def __aexit__(self, x, y, z) -> None: pass
@@ -310,7 +310,7 @@ async def f() -> None:
310310[out]
311311
312312[case testAsyncWithTypeComments]
313- # flags: --fast-parser
313+
314314class C:
315315 async def __aenter__(self) -> int: pass
316316 async def __aexit__(self, x, y, z) -> None: pass
@@ -326,7 +326,7 @@ async def f() -> None:
326326[builtins fixtures/async_await.pyi]
327327
328328[case testNoYieldInAsyncDef]
329- # flags: --fast-parser
329+
330330async def f():
331331 yield None
332332async def g():
@@ -340,7 +340,7 @@ main:5: error: 'yield' in async function
340340main:7: error: 'yield' in async function
341341
342342[case testNoYieldFromInAsyncDef]
343- # flags: --fast-parser
343+
344344async def f():
345345 yield from []
346346async def g():
@@ -351,12 +351,12 @@ main:3: error: 'yield from' in async function
351351main:5: error: 'yield from' in async function
352352
353353[case testNoAsyncDefInPY2_python2]
354- # flags: --fast-parser
354+
355355async def f(): # E: invalid syntax
356356 pass
357357
358358[case testYieldFromNoAwaitable]
359- # flags: --fast-parser
359+
360360from typing import Any, Generator
361361async def f() -> str:
362362 return ''
@@ -368,7 +368,7 @@ def g() -> Generator[Any, None, str]:
368368main:6: error: "yield from" can't be applied to Awaitable[str]
369369
370370[case testAwaitableSubclass]
371- # flags: --fast-parser
371+
372372from typing import Any, AsyncIterator, Awaitable, Generator
373373class A(Awaitable[int]):
374374 def __await__(self) -> Generator[Any, None, int]:
@@ -395,7 +395,7 @@ async def main() -> None:
395395[out]
396396
397397[case testYieldTypeCheckInDecoratedCoroutine]
398- # flags: --fast-parser
398+
399399from typing import Generator
400400from types import coroutine
401401@coroutine
@@ -415,7 +415,7 @@ def f() -> Generator[int, str, int]:
415415-- ------------------------------------------
416416
417417[case testFullCoroutineMatrix]
418- # flags: --fast-parser
418+
419419from typing import Any, AsyncIterator, Awaitable, Generator, Iterator
420420from types import coroutine
421421
0 commit comments