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
@@ -169,7 +169,7 @@ async def f() -> None:
169169[builtins fixtures/async_await.pyi]
170170
171171[case testAsyncWith]
172- # flags: --fast-parser
172+
173173class C:
174174 async def __aenter__(self) -> int: pass
175175 async def __aexit__(self, x, y, z) -> None: pass
@@ -180,7 +180,7 @@ async def f() -> None:
180180
181181
182182[case testAsyncWithError]
183- # flags: --fast-parser
183+
184184class C:
185185 def __enter__(self) -> int: pass
186186 def __exit__(self, x, y, z) -> None: pass
@@ -193,7 +193,7 @@ main:6: error: "C" has no attribute "__aenter__"; maybe "__enter__"?
193193main:6: error: "C" has no attribute "__aexit__"; maybe "__exit__"?
194194
195195[case testAsyncWithErrorBadAenter]
196- # flags: --fast-parser
196+
197197class C:
198198 def __aenter__(self) -> int: pass
199199 async def __aexit__(self, x, y, z) -> None: pass
@@ -204,7 +204,7 @@ async def f() -> None:
204204[out]
205205
206206[case testAsyncWithErrorBadAenter2]
207- # flags: --fast-parser
207+
208208class C:
209209 def __aenter__(self) -> None: pass
210210 async def __aexit__(self, x, y, z) -> None: pass
@@ -215,7 +215,7 @@ async def f() -> None:
215215[out]
216216
217217[case testAsyncWithErrorBadAexit]
218- # flags: --fast-parser
218+
219219class C:
220220 async def __aenter__(self) -> int: pass
221221 def __aexit__(self, x, y, z) -> int: pass
@@ -226,7 +226,7 @@ async def f() -> None:
226226[out]
227227
228228[case testAsyncWithErrorBadAexit2]
229- # flags: --fast-parser
229+
230230class C:
231231 async def __aenter__(self) -> int: pass
232232 def __aexit__(self, x, y, z) -> None: pass
@@ -237,7 +237,7 @@ async def f() -> None:
237237[out]
238238
239239[case testAsyncWithTypeComments]
240- # flags: --fast-parser
240+
241241class C:
242242 async def __aenter__(self) -> int: pass
243243 async def __aexit__(self, x, y, z) -> None: pass
@@ -253,7 +253,7 @@ async def f() -> None:
253253[builtins fixtures/async_await.pyi]
254254
255255[case testNoYieldInAsyncDef]
256- # flags: --fast-parser
256+
257257async def f():
258258 yield None
259259async def g():
@@ -267,7 +267,7 @@ main:5: error: 'yield' in async function
267267main:7: error: 'yield' in async function
268268
269269[case testNoYieldFromInAsyncDef]
270- # flags: --fast-parser
270+
271271async def f():
272272 yield from []
273273async def g():
@@ -278,12 +278,12 @@ main:3: error: 'yield from' in async function
278278main:5: error: 'yield from' in async function
279279
280280[case testNoAsyncDefInPY2_python2]
281- # flags: --fast-parser
281+
282282async def f(): # E: invalid syntax
283283 pass
284284
285285[case testYieldFromNoAwaitable]
286- # flags: --fast-parser
286+
287287from typing import Any, Generator
288288async def f() -> str:
289289 return ''
@@ -295,7 +295,7 @@ def g() -> Generator[Any, None, str]:
295295main:6: error: "yield from" can't be applied to Awaitable[str]
296296
297297[case testAwaitableSubclass]
298- # flags: --fast-parser
298+
299299from typing import Any, AsyncIterator, Awaitable, Generator
300300class A(Awaitable[int]):
301301 def __await__(self) -> Generator[Any, None, int]:
@@ -322,7 +322,7 @@ async def main() -> None:
322322[out]
323323
324324[case testYieldTypeCheckInDecoratedCoroutine]
325- # flags: --fast-parser
325+
326326from typing import Generator
327327from types import coroutine
328328@coroutine
@@ -342,7 +342,7 @@ def f() -> Generator[int, str, int]:
342342-- ------------------------------------------
343343
344344[case testFullCoroutineMatrix]
345- # flags: --fast-parser
345+
346346from typing import Any, AsyncIterator, Awaitable, Generator, Iterator
347347from types import coroutine
348348
0 commit comments