mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-4082: correctly map things like (*args, a=... b=...) in Py3k.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
def foo(*arg, a=1, b=2):
|
||||
pass
|
||||
|
||||
foo(<arg1>1, <arg2>2, <arg3>b=10, <arg4>a=20)
|
||||
@@ -356,6 +356,14 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
|
||||
feignCtrlP(marks.get("<arg2>").getTextOffset()).check("a, b, c=1, d=2, e=3", new String[]{}); // no logical next
|
||||
}
|
||||
|
||||
public void testPy3kPastTupleArg() {
|
||||
Map<String, PsiElement> marks = loadTest(4);
|
||||
feignCtrlP(marks.get("<arg1>").getTextOffset()).check("*arg, a=1, b=2", new String[]{"*arg, "});
|
||||
feignCtrlP(marks.get("<arg2>").getTextOffset()).check("*arg, a=1, b=2", new String[]{"*arg, "});
|
||||
feignCtrlP(marks.get("<arg3>").getTextOffset()).check("*arg, a=1, b=2", new String[]{"b=2"});
|
||||
feignCtrlP(marks.get("<arg4>").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.
|
||||
|
||||
Reference in New Issue
Block a user