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

Function named constructor breaks linting. #1618

Closed
bijij opened this issue Jul 28, 2021 · 3 comments
Closed

Function named constructor breaks linting. #1618

bijij opened this issue Jul 28, 2021 · 3 comments
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version

Comments

@bijij
Copy link

bijij commented Jul 28, 2021

Having a function named constructor seemingly breaks linting, is pylance thinking this is a keyword?

Environment data

  • Language Server version: 2021.7.6
  • OS and version: Win 11
  • Python version (& distribution if applicable, e.g. Anaconda): N/A but 3.9

Expected behaviour

Nothing would happen.

Actual behaviour

image

Code Snippet / Additional information

def constructor():
    ...
@jakebailey
Copy link
Member

I can reproduce this; might be related to the recent parser change to disallow certain keywords as attribute changes, but those parts of the parser should have been separate.

@jakebailey
Copy link
Member

The fix for keywords in attribute accesses exposed another bug.

microsoft/pyright@d9a66af

The old code disallowed specific keywords, then converted the others to identifiers. Now, it bans all keywords, which revealed that the tokenizer was accessing an object with the string "constructor", which returns the JS object constructor, rather than failing. I'm preparing a fix.

@jakebailey jakebailey added the bug Something isn't working label Jul 28, 2021
@github-actions github-actions bot removed the triage label Jul 28, 2021
@jakebailey jakebailey added fixed in next version (main) A fix has been implemented and will appear in an upcoming version triage labels Jul 28, 2021
@github-actions github-actions bot removed the triage label Jul 28, 2021
@jakebailey
Copy link
Member

We've just released a hotfix (2021.7.7) which should fix this. Thanks for the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 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

2 participants