On this code:
class Obj():
def a(self):
pass
class ObjChild(Obj):
def b(self):
pass
class A:
def __init__(self, obj: Obj):
self.obj = obj
class B(A):
def __init__(self, obj: ObjChild):
super().__init__(obj)
def kuku(self):
self.obj.b()
Pycharm warns me about the last line that:
Unresolved attribute reference 'b' for class 'Obj'
But I type-hinted the obj
that is being passed in the __init__
to be ObjChild
, so it should know statically that self.obj
is a ObjChild
instance, and would have the b
method.
How can I make Pycharm realize that? It messes up my autocompletions in the project.