@@ -18,12 +18,15 @@ reveal_type(f()) # E: Revealed type is 'typing.Awaitable[builtins.int]'
18
18
# options: fast_parser
19
19
async def f() -> int:
20
20
x = await f()
21
+ reveal_type(x) # E: Revealed type is 'builtins.int'
21
22
return x
22
23
[builtins fixtures/async_await.py]
24
+ [out]
25
+ main: note: In function "f":
23
26
24
27
[case testAwaitDefaultContext]
25
28
# options: fast_parser
26
- from typing import Any, TypeVar
29
+ from typing import TypeVar
27
30
T = TypeVar('T')
28
31
async def f(x: T) -> T:
29
32
y = await f(x)
@@ -47,7 +50,7 @@ main:6: error: Revealed type is 'Any'
47
50
48
51
[case testAwaitExplicitContext]
49
52
# options: fast_parser
50
- from typing import Any, TypeVar
53
+ from typing import TypeVar
51
54
T = TypeVar('T')
52
55
async def f(x: T) -> T:
53
56
y = await f(x) # type: int
@@ -57,7 +60,7 @@ main: note: In function "f":
57
60
main:5: error: Argument 1 to "f" has incompatible type "T"; expected "int"
58
61
main:6: error: Revealed type is 'builtins.int'
59
62
60
- [case testAwaitGeneratorError ]
63
+ [case testAwaitIteratorError ]
61
64
# options: fast_parser
62
65
from typing import Any, Iterator
63
66
def g() -> Iterator[Any]:
@@ -83,6 +86,17 @@ main:5: error: Incompatible types in await (actual type "int", expected Awaitabl
83
86
84
87
[case testAwaitResultError]
85
88
# options: fast_parser
89
+ async def g() -> int:
90
+ return 0
91
+ async def f() -> str:
92
+ x = await g() # type: str
93
+ [builtins fixtures/async_await.py]
94
+ [out]
95
+ main: note: In function "f":
96
+ main:5: error: Incompatible types in assignment (expression has type "int", variable has type "str")
97
+
98
+ [case testAwaitReturnError]
99
+ # options: fast_parser
86
100
async def g() -> int:
87
101
return 0
88
102
async def f() -> str:
0 commit comments