Description
Moving discussion started in pylint-dev/pylint#7464 to astroid repo.
Steps to reproduce
import astroid
result1, result2 = astroid.extract_node("""
class Base:
def return_type(self):
return type(self)()
class A(Base):
def method(self):
return self.return_type()
class B(Base):
def method(self):
return self.return_type()
A().method() #@
B().method() #@
""")
print(next(result1.infer()))
print(next(result2.infer()))
Current behavior
Instance of .A
Instance of .A
Expected behavior
Instance of .A
Instance of .B
Workaround
Modify inference_tip.py to disable cache in _inference_tip_cached function.
python -c "from astroid import __pkginfo__; print(__pkginfo__.version)"
output
2.13.0-dev0