diff --git a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java index 9c34062d2f08..6ad33d60569e 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyNamedParameterImpl.java @@ -238,6 +238,9 @@ public class PyNamedParameterImpl extends PyPresentableElementImpl 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 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; + } } } } diff --git a/python/testData/inspections/PyTypeCheckerInspection/DefaultTupleParameter.py b/python/testData/inspections/PyTypeCheckerInspection/DefaultTupleParameter.py new file mode 100644 index 000000000000..0e082e8ad506 --- /dev/null +++ b/python/testData/inspections/PyTypeCheckerInspection/DefaultTupleParameter.py @@ -0,0 +1,5 @@ +def f(x=(), y=('foo', 'bar')): + pass + + +f([1, 2, 3], ['foo']) diff --git a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java index 0e09054e3067..0b15d89dfddf 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java @@ -232,4 +232,9 @@ public class PyTypeCheckerInspectionTest extends PyTestCase { public void testMetaClassIteration() { doTest(); } + + // PY-10967 + public void testDefaultTupleParameter() { + doTest(); + } }