Python version (and distribution if applicable, e.g. Anaconda): 3.10
python.analysis.indexing: true
python.analysis.typeCheckingMode: basic
Actual behavior
class A:
def __init__(self, a):
self.a = a
class B(A):
def __init__(self, a):
self.a = a
In this code, self.a in class A and self.a in class B are recognized as different variables.
This causes incorrect behavior of find references or rename variable. Especially the behavior of rename variable easily can break the code.
If you have any type hint of the self.a in the superclass, this does not happen, even if the type hint is undefined.
class A:
def __init__(self, a):
self.a: foo = a
class B(A):
def __init__(self, a):
self.a = a
Environment data
Actual behavior
In this code, self.a in class A and self.a in class B are recognized as different variables. This causes incorrect behavior of find references or rename variable. Especially the behavior of rename variable easily can break the code.
If you have any type hint of the self.a in the superclass, this does not happen, even if the type hint is undefined.