logilab-astng #3531 Type inference on factory classmethod [resolved]
Maarten ter Huurne posted
class Super(object): @classmethod def instance(cls): return cls() class Sub(Super): def method(self): print 'method called' Sub.instance().method()
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.
|closed by||<not specified>|
- logilab-astng #3207 filter infered values according to if statement
- pylint #2463 W0631 false positive when we are sure to do at least one iteration
- pylint #4024 W0631 false positive if a "else" clause is defining the loop variable
- pylint #9188 Avoidable W0631
- logilab-astng #3291 failure of inference on overloaded operators