mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-28562: Add implicit object super when class has new style metaclass
This commit is contained in:
committed by
Andrey Vlasovskikh
parent
910854f617
commit
5be8da029a
@@ -1420,7 +1420,7 @@ public class PyClassImpl extends PyBaseElementImpl<PyClassStub> implements PyCla
|
||||
return null;
|
||||
}
|
||||
|
||||
if (LanguageLevel.forElement(this).isPython2() && getMetaClassQName() == null) {
|
||||
if (LanguageLevel.forElement(this).isPython2() && getMetaClassQName() == null && !hasNewStyleMetaClass(this)) {
|
||||
final QualifiedName typesInstanceTypeQName = QualifiedName.fromDottedString(PyNames.TYPES_INSTANCE_TYPE);
|
||||
final PsiElement typesInstanceType = resolveTopLevelMember(typesInstanceTypeQName, fromFoothold(this));
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
__metaclass__ = type
|
||||
|
||||
class A:
|
||||
def foo(self):
|
||||
print "foo"
|
||||
|
||||
class B(A):
|
||||
def foo(self):
|
||||
super(B, self).foo()
|
||||
|
||||
|
||||
B().__getattribute__
|
||||
# <ref>
|
||||
@@ -376,6 +376,12 @@ public class PyResolveTest extends PyResolveTestCase {
|
||||
assertResolvesTo(PyFunction.class, "foo");
|
||||
}
|
||||
|
||||
//PY-28562
|
||||
public void testSuperMetaClassInheritsObject() {
|
||||
assertResolvesTo(PyFunction.class, "__getattribute__");
|
||||
}
|
||||
|
||||
|
||||
public void testSuperDunderClass() { // PY-1190
|
||||
assertResolvesTo(PyFunction.class, "foo");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user