mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'python-fixes'
This commit is contained in:
@@ -238,6 +238,9 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl<PyNamedParame
|
||||
if (defaultValue != null) {
|
||||
final PyType type = context.getType(defaultValue);
|
||||
if (type != null && !(type instanceof PyNoneType)) {
|
||||
if (type instanceof PyTupleType) {
|
||||
return PyTypeParser.getTypeByName(this, "collections.Iterable");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -249,15 +252,18 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl<PyNamedParame
|
||||
@Override
|
||||
public boolean process(@NotNull PyCallExpression call) {
|
||||
final PyResolveContext resolveContext = PyResolveContext.noImplicits().withTypeEvalContext(context);
|
||||
final CallArgumentsMapping mapping = call.getArgumentList().analyzeCall(resolveContext);
|
||||
for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.getPlainMappedParams().entrySet()) {
|
||||
if (entry.getValue() == PyNamedParameterImpl.this) {
|
||||
final PyExpression argument = entry.getKey();
|
||||
if (argument != null) {
|
||||
final PyType type = context.getType(argument);
|
||||
if (type != null) {
|
||||
types.add(type);
|
||||
return true;
|
||||
final PyArgumentList argumentList = call.getArgumentList();
|
||||
if (argumentList != null) {
|
||||
final CallArgumentsMapping mapping = argumentList.analyzeCall(resolveContext);
|
||||
for (Map.Entry<PyExpression, PyNamedParameter> entry : mapping.getPlainMappedParams().entrySet()) {
|
||||
if (entry.getValue() == PyNamedParameterImpl.this) {
|
||||
final PyExpression argument = entry.getKey();
|
||||
if (argument != null) {
|
||||
final PyType type = context.getType(argument);
|
||||
if (type != null) {
|
||||
types.add(type);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
def f(x=(), y=('foo', 'bar')):
|
||||
pass
|
||||
|
||||
|
||||
f([1, 2, 3], ['foo'])
|
||||
@@ -232,4 +232,9 @@ public class PyTypeCheckerInspectionTest extends PyTestCase {
|
||||
public void testMetaClassIteration() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-10967
|
||||
public void testDefaultTupleParameter() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user