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

Pylance(reportUnknownVariableType) when enumerate() is used with parameter start #2127

Closed
hflamme opened this issue Dec 1, 2021 · 3 comments
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@hflamme
Copy link

hflamme commented Dec 1, 2021

Environment data

  • Language Server version: 2021.11.2
  • OS and version: Ubuntu 20.04.3 LTS
  • Python 3.9.5

Expected behaviour

Within the following code

a: list[int] = [1, 2, 3, 4]
b = [c for i, c in enumerate(a, start=1)]

the type of b should be inferred as list[int].
This is the case when removing the start argument, i.e. for

a: list[int] = [1, 2, 3, 4]
b = [c for i, c in enumerate(a)]
print(b)

types are asserted just fine,

Actual behaviour

Pylance(reportUnknownVariableType) for variable b and c (see below).

Logs

grafik

@github-actions github-actions bot added the triage label Dec 1, 2021
@erictraut
Copy link
Contributor

Thanks for reporting the problem. I think this has been fixed since the last release of pylance. I'm able to repro it with the last released version, but I'm no longer able to repro it with the latest code. A new version of pylance will be released within the next day or two, and that should address the problem.

@hflamme
Copy link
Author

hflamme commented Dec 1, 2021

Perfect, thanks

@bschnurr bschnurr added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Dec 1, 2021
@github-actions github-actions bot removed the triage label Dec 1, 2021
@bschnurr
Copy link
Member

bschnurr commented Dec 2, 2021

This issue has been fixed in version 2021.12.0, which we've just released. You can find the changelog here: CHANGELOG.md

@bschnurr bschnurr closed this as completed Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in next version (main) A fix has been implemented and will appear in an upcoming version
Projects
None yet
Development

No branches or pull requests

3 participants