[python] Introduce PyArgumentsMapping.isComplete

(cherry picked from commit 64dca74e18a2ae8c4a64f6730093e59dbef6b671)

IJ-CR-146869

GitOrigin-RevId: 42cc87410c38c09a65b38d2ca9389474f17ae8b6
This commit is contained in:
Mikhail Golubev
2024-10-14 16:04:00 +03:00
committed by intellij-monorepo-bot
parent e31c88a59e
commit 09fa8a0611
4 changed files with 10 additions and 5 deletions

View File

@@ -286,7 +286,7 @@ public class PyTypeCheckerInspection extends PyInspection {
private void checkCallSite(@NotNull PyCallSiteExpression callSite) {
final List<AnalyzeCalleeResults> calleesResults = StreamEx
.of(mapArguments(callSite, getResolveContext()))
.filter(mapping -> mapping.getUnmappedArguments().isEmpty() && mapping.getUnmappedParameters().isEmpty())
.filter(mapping -> mapping.isComplete())
.map(mapping -> analyzeCallee(callSite, mapping))
.nonNull()
.toList();

View File

@@ -399,7 +399,7 @@ class PyTypeHintsInspection : PyInspection() {
val resolveContext = PyResolveContext.defaultContext(myTypeEvalContext)
call
.multiMapArguments(resolveContext)
.firstOrNull { it.unmappedArguments.isEmpty() && it.unmappedParameters.isEmpty() }
.firstOrNull { it.isComplete }
?.let { mapping ->
mapping.mappedParameters.entries.forEach {
val name = it.value.name

View File

@@ -1243,9 +1243,7 @@ public final class PyCallExpressionHelper {
@NotNull PyCallSiteExpression callSite,
@NotNull TypeEvalContext context) {
final PyCallExpression.PyArgumentsMapping fullMapping = mapArguments(callSite, callable, context);
if (!fullMapping.getUnmappedArguments().isEmpty() || !fullMapping.getUnmappedParameters().isEmpty()) {
return false;
}
if (!fullMapping.isComplete()) return false;
// TODO properly handle bidirectional operator methods, such as __eq__ and __neq__.
// Based only on its name, it's impossible to which operand is the receiver and which one is the argument.