Skip to content

Binder isn't cleared correctly with --scripts-are-modules #2523

Closed
@rwbarton

Description

@rwbarton

Consider these two files:

# sam1.py
f = 'a'
f = 'b'

# sam2.py
f = 1
reveal_type(f)

Running python3 -m mypy --scripts-are-modules sam2.py sam1.py (note the order; it seems mypy processes the files in reverse order) produces

sam2.py:2: error: Revealed type is 'builtins.None'

I'm pretty sure this is due to old typestate left in the binder, because deleting the second assignment in sam1.py makes the problem go away. (And we don't populate the binder on the initial assignment to a variable: #2008.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions