Skip to content

Pyrefly should not allow forward reference variable names in function scope #248

@grievejia

Description

@grievejia

Describe the Bug

Minmal repro:

def test() -> None:
    x = y
    y = 1
    reveal_type(x)

Expected: Error on first assignment. Revealed Any
Actual: No error on first assignment. Revealed Literal[1]

Sandbox Link

https://pyrefly.org/sandbox/?code=CYUwZgBALiDOUAoCUEC0A+CA5A9gOxAC4AoCMiADwgF4IBPU8umiARkbIGIIAnEANxABDADYB9KHQAOIBBSRA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions