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

Error for undefined local variables #12597

Closed
Akuli opened this issue Apr 16, 2022 · 1 comment
Closed

Error for undefined local variables #12597

Akuli opened this issue Apr 16, 2022 · 1 comment
Labels

Comments

@Akuli
Copy link
Contributor

Akuli commented Apr 16, 2022

Feature

Emit error if local var is undefined, example code that currently fails at runtime but passes type check:

def get_lines_to_render() -> list[str] | tuple[list[str], int]:
    return []

lines = get_lines_to_render()
if isinstance(lines, tuple):
    lines, cursor_pos = lines
else:
    cursor_pos
    cursor_pos = len(lines)

Pitch

Would be nice if I wouldn't have to run the code only to find out I had a typo. That's what type checking is all about....

@Akuli Akuli added the feature label Apr 16, 2022
@AlexWaygood
Copy link
Member

Duplicate of #686 ://

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