Skip to content
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

Type inference of or and Optional[x] #1733

Closed
JukkaL opened this issue Jun 22, 2016 · 0 comments · Fixed by #1828
Closed

Type inference of or and Optional[x] #1733

JukkaL opened this issue Jun 22, 2016 · 0 comments · Fixed by #1828

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jun 22, 2016

When using --strict-optional, the type of a is incorrectly Union[None, str]:

from typing import Optional

def f(x: Optional[str]) -> None:
    a = x or 'default'
    reveal_type(a)  # should be str

#1698 seems related.

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