mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-19723 Fixed: Type hinting of arbitrary argument lists and default argument values
Update PyNamedParameterImpl to return collection types with unknown elements instead of tuple and dict.
This commit is contained in:
@@ -223,10 +223,10 @@ public class PyNamedParameterImpl extends PyBaseElementImpl<PyNamedParameterStub
|
||||
}
|
||||
}
|
||||
if (isKeywordContainer()) {
|
||||
return PyBuiltinCache.getInstance(this).getDictType();
|
||||
return PyTypeUtil.toKeywordContainerType(this, null);
|
||||
}
|
||||
if (isPositionalContainer()) {
|
||||
return PyBuiltinCache.getInstance(this).getTupleType();
|
||||
return PyTypeUtil.toPositionalContainerType(this, null);
|
||||
}
|
||||
if (context.maySwitchToAST(this)) {
|
||||
final PyExpression defaultValue = getDefaultValue();
|
||||
|
||||
@@ -1448,6 +1448,14 @@ public class PyTypeTest extends PyTestCase {
|
||||
" expr = kwargs");
|
||||
}
|
||||
|
||||
// PY-19723
|
||||
public void testIterateOverKeywordArgs() {
|
||||
doTest("str",
|
||||
"def foo(**kwargs):\n" +
|
||||
" for expr in kwargs:\n" +
|
||||
" pass");
|
||||
}
|
||||
|
||||
private static List<TypeEvalContext> getTypeEvalContexts(@NotNull PyExpression element) {
|
||||
return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
|
||||
TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());
|
||||
|
||||
Reference in New Issue
Block a user