basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

type-guards that include `Any` don't narrow properly

Open KotlinIsland opened this issue 1 year ago • 0 comments

def g(x: object) -> "x is list[Any]":
    return True

async def f(t: list[int] | int):
    if g(t):
        return
    reveal_type(t)  # list[int] | int, expected int

KotlinIsland avatar Jan 18 '24 00:01 KotlinIsland