-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Labels
Milestone
Description
Describe the Bug
import asyncio
import typing
async def some_async_func(x: int) -> bool:
return x % 2 == 0
async def main() -> None:
generator = (x for x in [1, 2, 3] if await some_async_func(x))
typing.reveal_type(generator)
assert await anext(generator) == 2
# asyncio nonsense to make this work in the sandbox
asyncio.ensure_future(main(), loop=asyncio.get_event_loop())Python: 3.12
In the code snippet above, Pyrefly infers the type of generator to be Generator[int, None, None] rather than AsyncGenerator[int, None].
Sandbox Link
(Only applicable for extension issues) IDE Information
No response