logilab-astng #3531 Type inference on factory classmethod [resolved]

Maarten ter Huurne posted

class Super(object):
      def instance(cls):
              return cls()

class Sub(Super):
      def method(self):
              print 'method called'


It prints:

E1101: 10: Instance of 'Super' has no 'method' member

The return type of "Sub.instance()" is "Sub", not "Super", so the method call is valid, as you can see when you run this program.

So it seems that ASTNG infers the wrong type: "cls" is the class on which the class method is called, which is not necessarily the class in which it is defined.

done in0.17.0
load left0.000
closed by<not specified>