mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-16968 Consider variadic keyword arguments mapped to keyword-only parameters
We already to it for regular (positional/keyword) parameters even though (**kwargs) is not strictly compatible with (arg1, arg2, ...). Now we do it for (*, kwarg1, kwarg2, ...). We don't know much about **kwargs so it's better not to show any warnings here.
This commit is contained in:
@@ -921,6 +921,7 @@ public class PyCallExpressionHelper {
|
||||
}
|
||||
else {
|
||||
parametersMappedToVariadicKeywordArguments.add(parameter);
|
||||
mappedVariadicArgumentsToParameters = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
def f1(arg):
|
||||
return 2
|
||||
|
||||
def f2(*, arg):
|
||||
return 2
|
||||
|
||||
|
||||
def test(**kwargs):
|
||||
f1(**kwargs)
|
||||
f2(**kwargs)
|
||||
@@ -322,6 +322,11 @@ public class PyArgumentListInspectionTest extends PyTestCase {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON35, this::doTest);
|
||||
}
|
||||
|
||||
// PY-16968
|
||||
public void testKwargsAgainstKeywordOnly() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
|
||||
private void doMultiFileTest() {
|
||||
final String folderPath = "inspections/PyArgumentListInspection/" + getTestName(false) + "/";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user