diff --git a/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java b/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java
index f6c2df5f8923..c66bd88780e7 100644
--- a/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java
+++ b/python/src/com/jetbrains/python/pyi/PyiTypeProvider.java
@@ -29,8 +29,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
-import static com.jetbrains.python.psi.PyUtil.as;
-
/**
* @author vlan
*/
@@ -212,10 +210,10 @@ public class PyiTypeProvider extends PyTypeProviderBase {
final PyCallExpressionHelper.ArgumentMappingResults mapping =
PyCallExpressionHelper.mapArguments(callSite, function, parameters, context);
- final PyCallExpression callExpr = as(callSite, PyCallExpression.class);
- if (callExpr != null && callExpr.getArguments().length != mapping.getMappedParameters().size()) {
+ if (!mapping.getUnmappedArguments().isEmpty() || !mapping.getUnmappedParameters().isEmpty()) {
return null;
}
+
return mapping;
}
}
diff --git a/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py b/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py
index d1dccf7e5b61..30e2ab7ddda1 100644
--- a/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py
+++ b/python/testData/inspections/PyTypeCheckerInspection/UnionReturnTypes.py
@@ -22,4 +22,4 @@ def test(c):
f2(x1.count(''))
f3(x1.count(''))
f2(x1.strip())
- f3(x1.strip())
+ f3(x1.strip())
diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java
index f75e723a94d9..82fa720aaf9c 100644
--- a/python/testSrc/com/jetbrains/python/PyTypeTest.java
+++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java
@@ -1677,6 +1677,32 @@ public class PyTypeTest extends PyTestCase {
" return get_class()");
}
+ // PY-22919
+ public void testMaxListKnownElements() {
+ doTest("int",
+ "expr = max([1, 2, 3])");
+ }
+
+ // PY-22919
+ public void testMaxListUnknownElements() {
+ doTest("Any",
+ "l = []\n" +
+ "expr = max(l)");
+ }
+
+ // PY-23634
+ public void testMinListKnownElements() {
+ doTest("int",
+ "expr = min([1, 2, 3])");
+ }
+
+ // PY-23634
+ public void testMinListUnknownElements() {
+ doTest("Any",
+ "l = []\n" +
+ "expr = min(l)");
+ }
+
private static List getTypeEvalContexts(@NotNull PyExpression element) {
return ImmutableList.of(TypeEvalContext.codeAnalysis(element.getProject(), element.getContainingFile()).withTracing(),
TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile()).withTracing());