mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
parameter info works for inherited class constructors (PY-256)
This commit is contained in:
@@ -88,7 +88,7 @@ public class PyCallExpressionHelper {
|
||||
if (callee instanceof PyReferenceExpression) {
|
||||
PyReferenceExpression ref = (PyReferenceExpression)callee;
|
||||
PsiElement resolved = ref.followAssignmentsChain();
|
||||
if (resolved instanceof PyClass) resolved = ((PyClass)resolved).findMethodByName(PyNames.INIT, false); // class to constructor call
|
||||
if (resolved instanceof PyClass) resolved = ((PyClass)resolved).findMethodByName(PyNames.INIT, true); // class to constructor call
|
||||
else if (resolved instanceof PyCallExpression) {
|
||||
// is it a case of "foo = classmethod(foo)"?
|
||||
PyCallExpression redefining_call = (PyCallExpression)resolved;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Bar:
|
||||
def __init__(self, a, b):
|
||||
pass
|
||||
|
||||
class Bambr(Bar):
|
||||
pass
|
||||
|
||||
Bambr(<arg1>1, <arg2>2)
|
||||
@@ -239,6 +239,14 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
feignCtrlP(marks.get("<arg2>").getTextOffset()).check("self,a,b", new String[]{"b"}, new String[]{"self,"});
|
||||
}
|
||||
|
||||
public void testInheritedClassInit() throws Exception {
|
||||
Map<String, PsiElement> marks = loadTest();
|
||||
assertEquals("Test data sanity", marks.size(), 2);
|
||||
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("self,a,b", new String[]{"a,"}, new String[]{"self,"});
|
||||
feignCtrlP(marks.get("<arg2>").getTextOffset()).check("self,a,b", new String[]{"b"}, new String[]{"self,"});
|
||||
}
|
||||
|
||||
// TODO: add method tests with decorators when a mock SDK is available
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user