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

Local variable "p" has inferred type None; add an annotation #1030

Open
hauntsaninja opened this issue Nov 1, 2023 · 0 comments
Open

Local variable "p" has inferred type None; add an annotation #1030

hauntsaninja opened this issue Nov 1, 2023 · 0 comments

Comments

@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Nov 1, 2023

It's unclear to me mypyc thinks it needs an explicit annotation here

def bar() -> str | None:
    return "asdf"

def foo() -> None:
    p = bar()
    if p is None:
        print(f"{p}")

Came up in psf/black#4015

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

No branches or pull requests

1 participant