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 resolved to Never coloured as a type #254

Closed
ValdezFOmar opened this issue Apr 4, 2024 · 0 comments · Fixed by #390
Closed

Variable resolved to Never coloured as a type #254

ValdezFOmar opened this issue Apr 4, 2024 · 0 comments · Fixed by #390

Comments

@ValdezFOmar
Copy link
Contributor

When a variable that has been resolved to Never is access, it will be coloured as a type (SemanticTokenTypes.type). But this only happens if the variable type is inferred instead of explicitly annotated.

Inferred type:

image

Explicit type:

image

Code snippet:

def inferred():
    value = ''
    if not isinstance(value, str):
        reveal_type(value)

def explicit():
    value: str = ''
    if not isinstance(value, str):
        reveal_type(value)

# Also happens with parameters
def param_inferred(value = 1):
    if not isinstance(value, int):
        reveal_type(value)

def param_explicit(value: int = 1):
    if not isinstance(value, int):
        reveal_type(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants