diff --git a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java index 67c631aa089a..458fa4969277 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java +++ b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java @@ -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; diff --git a/python/testData/paramInfo/InheritedClassInit.py b/python/testData/paramInfo/InheritedClassInit.py new file mode 100644 index 000000000000..60f7e4dfba34 --- /dev/null +++ b/python/testData/paramInfo/InheritedClassInit.py @@ -0,0 +1,8 @@ +class Bar: + def __init__(self, a, b): + pass + +class Bambr(Bar): + pass + +Bambr(1, 2) diff --git a/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java b/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java index f0423d74b741..d0b6e96a3102 100644 --- a/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java +++ b/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java @@ -239,6 +239,14 @@ public class PyParameterInfoTest extends LightMarkedTestCase { feignCtrlP(marks.get("").getTextOffset()).check("self,a,b", new String[]{"b"}, new String[]{"self,"}); } + public void testInheritedClassInit() throws Exception { + Map marks = loadTest(); + assertEquals("Test data sanity", marks.size(), 2); + + feignCtrlP(marks.get("").getTextOffset()).check("self,a,b", new String[]{"a,"}, new String[]{"self,"}); + feignCtrlP(marks.get("").getTextOffset()).check("self,a,b", new String[]{"b"}, new String[]{"self,"}); + } + // TODO: add method tests with decorators when a mock SDK is available /**