correct resolve to superclass members

This commit is contained in:
Dmitry Jemerov
2008-03-19 18:21:14 +03:00
parent 53bc348cb1
commit c937cfd1eb
3 changed files with 16 additions and 0 deletions
@@ -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);
}
+7
View File
@@ -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/";