diff --git a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java index c34ac3b46152..24701d45ca4f 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java +++ b/python/src/com/jetbrains/python/psi/impl/PyCallExpressionHelper.java @@ -455,8 +455,10 @@ public class PyCallExpressionHelper { if (n_par.isPositionalContainer()) tuple_par = n_par; else if (n_par.isKeywordContainer()) kwd_par = n_par; else { - slots.put(n_par, null); // regular parameter that may serve as positional - positional_index += 1; + slots.put(n_par, null); // regular parameter that may serve as positional/named + if (tuple_par == null && kwd_par == null) { + positional_index += 1; // only if we're not past *param / **param + } } } else { diff --git a/python/testData/paramInfo/Py3kPastTupleArg.py b/python/testData/paramInfo/Py3kPastTupleArg.py new file mode 100644 index 000000000000..df3e25db2593 --- /dev/null +++ b/python/testData/paramInfo/Py3kPastTupleArg.py @@ -0,0 +1,4 @@ +def foo(*arg, a=1, b=2): + pass + +foo(1, 2, b=10, a=20) diff --git a/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java b/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java index 27069607b972..6bc96293138f 100644 --- a/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java +++ b/python/testSrc/com/jetbrains/python/PyParameterInfoTest.java @@ -356,6 +356,14 @@ public class PyParameterInfoTest extends LightMarkedTestCase { feignCtrlP(marks.get("").getTextOffset()).check("a, b, c=1, d=2, e=3", new String[]{}); // no logical next } + public void testPy3kPastTupleArg() { + Map marks = loadTest(4); + feignCtrlP(marks.get("").getTextOffset()).check("*arg, a=1, b=2", new String[]{"*arg, "}); + feignCtrlP(marks.get("").getTextOffset()).check("*arg, a=1, b=2", new String[]{"*arg, "}); + feignCtrlP(marks.get("").getTextOffset()).check("*arg, a=1, b=2", new String[]{"b=2"}); + feignCtrlP(marks.get("").getTextOffset()).check("*arg, a=1, b=2", new String[]{"a=1, "}); + } + /** * Imitates pressing of Ctrl+P; fails if results are not as expected. * @param offset offset of 'cursor' where ^P is pressed.