mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correct resolve to superclass members
This commit is contained in:
@@ -29,6 +29,7 @@ import com.jetbrains.python.PyTokenTypes;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.types.PyModuleType;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
import com.jetbrains.python.psi.types.PyClassType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -228,6 +229,9 @@ public class PyReferenceExpressionImpl extends PyElementImpl implements PyRefere
|
||||
if (target instanceof PyFile) {
|
||||
return new PyModuleType((PyFile) target);
|
||||
}
|
||||
if (target instanceof PyClass) {
|
||||
return new PyClassType((PyClass) target);
|
||||
}
|
||||
return getReferenceTypeFromProviders(target);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class A(object):
|
||||
def __init__(self):
|
||||
self.qq = 1
|
||||
|
||||
class B(A):
|
||||
def test(self):
|
||||
print self.q<ref>q
|
||||
@@ -72,6 +72,11 @@ public class PyResolveTest extends ResolveTestCase {
|
||||
assertTrue(targetElement instanceof PyParameter);
|
||||
}
|
||||
|
||||
public void testSuperField() throws Exception {
|
||||
PsiElement targetElement = resolve();
|
||||
assertTrue(targetElement instanceof PyTargetExpression);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PathManager.getHomePath() + "/plugins/python/testData/resolve/";
|
||||
|
||||
Reference in New Issue
Block a user