File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -425,7 +425,7 @@ async def g() -> AsyncGenerator[int, None]:
425
425
reveal_type(value) # E: Revealed type is 'builtins.int*'
426
426
yield value
427
427
428
- yield 'not an int'
428
+ yield 'not an int' # E: Incompatible types in yield (actual type "str", expected type "int")
429
429
# return without a value is fine
430
430
return
431
431
reveal_type(g) # E: Revealed type is 'def () -> typing.AsyncGenerator[builtins.int, void]'
@@ -444,7 +444,7 @@ from typing import AsyncIterator
444
444
async def gen() -> AsyncIterator[int]:
445
445
yield 3
446
446
447
- yield 'not an int'
447
+ yield 'not an int' # E: Incompatible types in yield (actual type "str", expected type "int")
448
448
449
449
async def use_gen() -> None:
450
450
async for item in gen():
@@ -543,18 +543,18 @@ from typing import AsyncGenerator
543
543
544
544
async def return_int() -> AsyncGenerator[int, None]:
545
545
yield 1
546
- return 42 # E: No return value expected
546
+ return 42 # E: ' return' with value in async generator is not allowed
547
547
548
548
async def return_none() -> AsyncGenerator[int, None]:
549
549
yield 1
550
- return None
550
+ return None # E: 'return' with value in async generator is not allowed
551
551
552
552
def f() -> None:
553
553
return
554
554
555
555
async def return_f() -> AsyncGenerator[int, None]:
556
556
yield 1
557
- return f()
557
+ return f() # E: 'return' with value in async generator is not allowed
558
558
559
559
[builtins fixtures/dict.pyi]
560
560
You can’t perform that action at this time.
0 commit comments