Skip to content

reveal_locals is hella inconsistent / top level variables not listed / narrowed type inconsistent with reveal_type #11956

@KotlinIsland

Description

@KotlinIsland
a: int
b = 1
if isinstance(a, bool):
    reveal_locals()  # "b: int", I would expect "a: bool, b: int"
    reveal_type(a)  # "a: bool" ✔
    
def foo(a: int) -> None:
    b: int
    reveal_locals()  # "a: int, b: int", this is correct, but inconsistent with top level
    reveal_type(a)
a: int = 1
reveal_locals() # nothing 😥

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-reveal-typereveal_type() and reveal_locals()

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions