Skip to content

Inconsistent types for variable with partial type #4484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JukkaL opened this issue Jan 18, 2018 · 0 comments
Open

Inconsistent types for variable with partial type #4484

JukkaL opened this issue Jan 18, 2018 · 0 comments
Labels

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jan 18, 2018

In the example below the variable seemingly has two types (None and x) which is wrong. This also results in an inconsistency with fine-grained incremental mode.

x = None

def f() -> None:
    reveal_type(x)  # None
    if x:
        1()  # No error, considered as not reachable
        y = 1
    else:
        y = ''  # No error

x = 1
reveal_type(x)  # int

The expected behavior is for x to always have the type int and for every line in the example to be considered reachable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant