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

Variable annotation with None doesn't warn #71

Closed
jasonkuhrt opened this issue Jun 23, 2018 · 2 comments
Closed

Variable annotation with None doesn't warn #71

jasonkuhrt opened this issue Jun 23, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@jasonkuhrt
Copy link

❯ pyre check
 ƛ Found 1 type error!
test.py:5:4 Incompatible return type [7]: Expected `str` but got `None`.
❯ cat test.py
a: int = None


def foobar() -> str:
    return None

Why is a:int = None valid?

@dark
Copy link
Contributor

dark commented Jun 24, 2018

Thanks for the report.
Turns out an appropriate error is generated, but suppressed because the assignment is at the toplevel. I will push a patch to fix this.

@dark dark self-assigned this Jun 24, 2018
@dark dark added the bug label Jun 24, 2018
@dark dark added this to the 0.0.10 milestone Jul 12, 2018
@dark
Copy link
Contributor

dark commented Jul 12, 2018

This was fixed by @dkgi in 5e3ea2c. I will add an extra test that covers the specific condition.

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

2 participants