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 from type checker is different to the type displayed on hover #7466

Closed
DetachHead opened this issue Mar 12, 2024 · 2 comments
Closed

type from type checker is different to the type displayed on hover #7466

DetachHead opened this issue Mar 12, 2024 · 2 comments
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working

Comments

@DetachHead
Copy link

Describe the bug
i have no idea what's going on here, i tried to minify it as best as i can. it seems that the type displayed in pyright's errors/notes here is different to the type that normally appears when you hover over the variable, even though they're both coming from pyright's language server.

Code or Screenshots

foo = None
bar = False
for _ in []:
    if not bar:
        continue
    if foo:
        reveal_type(foo) # reveal_type says int, vscode says Never
    baz = int(foo)
    foo = baz
    baz.asdf()

image

VS Code extension or command-line
pyright vscode extension v1.1.353

i've disabled pylance and do not have any other extensions for python type checking installed, so this hover type is definitely coming from pyright as far as i'm aware

@DetachHead DetachHead added the bug Something isn't working label Mar 12, 2024
@erictraut
Copy link
Collaborator

I'm able to repro the problem, and I agree it's a bug. Type should be the same regardless of evaluation order, but there appears to be a bug that causes evaluation-order-dependent results in this case. I'll investigate further.

erictraut added a commit that referenced this issue May 17, 2024
…aluation in certain cases involving codependent variables in a loop. This addresses #7466.
erictraut added a commit that referenced this issue May 17, 2024
…aluation in certain cases involving codependent variables in a loop. This addresses #7466. (#7945)
@erictraut erictraut added the addressed in next version Issue is fixed and will appear in next published version label May 17, 2024
@erictraut
Copy link
Collaborator

This is addressed in pyright 1.1.364.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addressed in next version Issue is fixed and will appear in next published version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants