PY-13159 Fixed: "Type checker" failed to determine property type

Support abc.abstractproperty while processing class decorated properties
This commit is contained in:
Semyon Proshev
2017-02-14 19:19:47 +03:00
committed by Semyon Proshev
parent 392798f3c9
commit e5b4db9357
2 changed files with 13 additions and 1 deletions
@@ -764,7 +764,8 @@ public class PyClassImpl extends PyBaseElementImpl<PyClassStub> implements PyCla
decoName = knownName;
}
}
if (PyNames.PROPERTY.equals(decoName)) {
if (PyNames.PROPERTY.equals(decoName) ||
qname.equals(PyKnownDecoratorUtil.KnownDecorator.ABC_ABSTRACTPROPERTY.getQualifiedName())) {
getter = new Maybe<>(method);
}
else if (useAdvancedSyntax && qname.matches(decoratorName, PyNames.GETTER)) {
@@ -1461,6 +1461,17 @@ public class PyTypeTest extends PyTestCase {
"expr = float.fromhex(\"0.5\")");
}
// PY-13159
public void testAbsAbstractProperty() {
doTest("str",
"import abc\n" +
"class D:\n" +
" @abc.abstractproperty\n" +
" def foo(self):\n" +
" return 'foo'\n" +
"expr = D().foo");
}
// PY-20409
public void testGetFromDictWithDefaultNoneValue() {
doTest("Any",