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

False error about incompatible override of private(double-underscore) variables #863

Closed
Azureblade3808 opened this issue Jan 22, 2021 · 7 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

@Azureblade3808
Copy link

Environment data

  • Language Server version: Pylance 2021.1.2 / Python 2021.1.502429796
  • OS and version: Windows 7
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.5(Anaconda)

Actual behavior

class Base:
    __value: int = 0

    _ = __value   # To suppress "unused" warning.


class Derived(Base):
    __value: str = ""
    # Error:
    # "__value" overrides symbol of same name in class "Base"
    #   "str" is incompatible with "int"  Pylance(reportIncompatibleVariableOverride)

    _ = __value   # To suppress "unused" warning.

Expected behavior

No error

Reason

Same with #725 , private(double-underscore) variables should not interfere with each others.

@Azureblade3808
Copy link
Author

I think this issue is probably related with the fix of #843 .

@jakebailey
Copy link
Member

jakebailey commented Jan 22, 2021

Yeah, this should be working per #725. Both of those issues were supposed to be fixed in the last release, but I don't think #843 is related.

@erictraut
Copy link
Contributor

This is not the same as #725, which was about the use of Final. This appears to still be an issue. I'll look into it.

@jakebailey
Copy link
Member

Doh. Of course.

@Azureblade3808
Copy link
Author

After reading the changed lines of #843 , I do agree that it is not related.

@erictraut
Copy link
Contributor

This will be fixed in the next release of pylance.

@erictraut erictraut added bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version and removed triage labels Jan 22, 2021
@jakebailey
Copy link
Member

This issue has been fixed in version 2021.1.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#202113-27-january-2021

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

3 participants