pyrefly icon indicating copy to clipboard operation
pyrefly copied to clipboard

Awaiting an `Awaitable[Any]` should not produce a `Var`

Open grievejia opened this issue 10 months ago • 0 comments

Describe the Bug

Minimal repro:

from typing import Any

async def foo() -> Any: ...
def bar(x: int, y: str) -> None: ...

async def test() -> None:
    z = await foo()  # Pyrefly currently produces a `Var` here, which gets affected by downstream code. This is wrong -- it should be Any
    bar(z, z)

Expected: No error Actual: Argument int is not assignable to parameter y with type str in function bar

Sandbox Link

https://pyrefly.org/sandbox/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoCCKcAUCQIYDOcKAxlACYCmwUwYYAFAJRQC0APkLEAXFAB0kks1YAjciE4APMahgAaKHDGUYIXoKgA5MCiZjJ4slRr0ZsJrp78hJsyJJQvUAF5QAvFDkAO7kSPjsXNye3vKKPpo+3EA

(Only applicable for extension issues) IDE Information

No response

grievejia avatar May 18 '25 20:05 grievejia