Repository: astral-sh/ruff
File: crates/ty_python_semantic/src/types/call/bind.rs (Rust)

Code before:
                                    .contains(&self.next_positional)
                            {
                                break;
                            }

                            let Ok(tuple_index_i32) = i32::try_from(tuple_index) else {
                                break;
                            };

                            let positional_types = tuple_specs
                                .iter()
                                .filter_map(|tuple| tuple.py_index(db, tuple_index_i32).ok())
                                .collect_vec();

                            if positional_types.is_empty() {
                                break;
                            }

                            let argument_type =
                                UnionType::from_elements_leave_aliases(db, positional_types);

                            self.match_positional(
                                argument_index,
                                argument,
                                Some(argument_type),
                                false,
                            )?;
                            tuple_index += 1;
                        }

                        return Ok(());
                    }
                    _ => VariadicArgumentType::Other(argument_type.iterate(db)),
                },
            },
            None => VariadicArgumentType::None,
        };

        let (argument_types, length, variable_element) = match &variadic_type {
            VariadicArgumentType::ParamSpec(paramspec) => {
                ([].as_slice(), TupleLength::unknown(), Some(*paramspec))
            }
            VariadicArgumentType::Other(tuple) => (
                tuple.all_elements(),
                tuple.len(),
                tuple.variable_element().copied(),
            ),
            VariadicArgumentType::None => ([].as_slice(), TupleLength::unknown(), None),
        };

        let mut argument_types = argument_types.iter().copied();

Review comment (suggestion):
I _think_ it's OK in practice that we always pass `false` here, even if we do have a variable-length element of the union, because this argument only ends up mattering (in `assign_argument`) if the argument and next parameter are both variadic, and we've already verified above that the next positional parameter is not variadic.

But this is a pretty subtle invariant several layers down to rely on -- is there any harm in being more semantically accurate here?
```suggestion
                                any_variable_length,
```

Code after:
                    let callable_description =
                        CallableDescription::new(context.db(), self.signature_type);
                    let matching_overload =
                        function_type_and_kind.map(|(kind, function)| MatchingOverloadLiteral {
                            index: matching_overload_index,
                            kind,
                            function,
                        });
                    self.overloads[matching_overload_index].report_diagnostics(
                        context,
                        node,
                        self.signature_type,
                        callable_description.as_ref(),
                        compound_diag,
                        matching_overload.as_ref(),
                    );
                    return;
                }

                let Some(builder) = context.report_lint(&NO_MATCHING_OVERLOAD, node) else {
                    return;
                };
                let callable_description =
                    CallableDescription::new(context.db(), self.callable_type);
                let mut diag = builder.into_diagnostic(format_args!(
                    "No overload{} matches arguments",
                    if let Some(CallableDescription { kind, name }) = callable_description {
                        format!(" of {kind} `{name}`")
                    } else {
                        String::new()
                    }
                ));

                if let Some(index) =
                    self.overload_call_return_type
                        .and_then(
                            |overload_call_return_type| match overload_call_return_type {
                                OverloadCallReturnType::ArgumentTypeExpansionLimitReached(
                                    index,
                                ) => Some(index),
                                _ => None,
                            },
                        )
                {
                    diag.info(format_args!(
                        "Limit of argument type expansion reached at argument {index}"
                    ));
                }

                if let Some((kind, function)) = function_type_and_kind {
                    let (overloads, implementation) =