mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
complete/resolve members of 'type' type on definitions of new-style classes (PY-3989)
This commit is contained in:
@@ -175,6 +175,15 @@ public class PyClassType extends UserDataHolderBase implements PyType {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDefinition() && myClass.isNewStyleClass()) {
|
||||
PyClassType typeType = PyBuiltinCache.getInstance(myClass).getObjectType("type");
|
||||
if (typeType != null) {
|
||||
List<? extends RatedResolveResult> typeMembers = typeType.resolveMember(name, location, direction, resolveContext);
|
||||
if (typeMembers != null && !typeMembers.isEmpty()) {
|
||||
return typeMembers;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -238,6 +247,13 @@ public class PyClassType extends UserDataHolderBase implements PyType {
|
||||
|
||||
addInheritedMembers(prefix, location, context, ret);
|
||||
|
||||
if (isDefinition() && myClass.isNewStyleClass()) {
|
||||
PyClassType typeType = PyBuiltinCache.getInstance(myClass).getObjectType("type");
|
||||
if (typeType != null) {
|
||||
Collections.addAll(ret, typeType.getCompletionVariants(prefix, location, context));
|
||||
}
|
||||
}
|
||||
|
||||
return ret.toArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class C(object):
|
||||
pass
|
||||
|
||||
|
||||
C.__mro__
|
||||
@@ -0,0 +1,5 @@
|
||||
class C(object):
|
||||
pass
|
||||
|
||||
|
||||
C.__m<caret>
|
||||
@@ -0,0 +1,3 @@
|
||||
class C(object): pass
|
||||
|
||||
C.__mro__
|
||||
@@ -392,4 +392,8 @@ public class PythonCompletionTest extends PyLightFixtureTestCase {
|
||||
public void testDuplicateColon() { // PY-2652
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMro() { // PY-3989
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -36,6 +36,10 @@ public class PyUnresolvedReferencesInspectionTest extends PyLightFixtureTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMro() { // PY-3989
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testConditionalImports() { // PY-983
|
||||
myFixture.configureByFiles(TEST_DIRECTORY + getTestName(true) + ".py",
|
||||
TEST_DIRECTORY + "lib1.py",
|
||||
|
||||
Reference in New Issue
Block a user