From 9fb8e1068781eeb988cf5fcd33aaa05a0c8356b6 Mon Sep 17 00:00:00 2001 From: CEL Dev Team Date: Wed, 27 May 2026 12:56:46 -0700 Subject: [PATCH] Return the first match from `ResolveStatic()` PiperOrigin-RevId: 922297232 --- eval/eval/function_step.cc | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/eval/eval/function_step.cc b/eval/eval/function_step.cc index 2a10e9674..fcf429378 100644 --- a/eval/eval/function_step.cc +++ b/eval/eval/function_step.cc @@ -286,20 +286,12 @@ absl::Status AbstractFunctionStep::Evaluate(ExecutionFrame* frame) const { absl::StatusOr ResolveStatic( absl::Span input_args, absl::Span overloads) { - ResolveResult result = absl::nullopt; - for (const auto& overload : overloads) { if (ArgumentKindsMatch(overload.descriptor, input_args)) { - // More than one overload matches our arguments. - if (result.has_value()) { - return absl::Status(absl::StatusCode::kInternal, - "Cannot resolve overloads"); - } - - result.emplace(overload); + return overload; } } - return result; + return absl::nullopt; } absl::StatusOr ResolveLazy( @@ -315,7 +307,7 @@ absl::StatusOr ResolveLazy( input_args.begin(), input_args.end(), arg_types.begin(), [](const cel::Value& value) { return ValueKindToKind(value->kind()); }); - cel::FunctionDescriptor matcher{name, receiver_style, arg_types}; + cel::FunctionDescriptor matcher{name, receiver_style, std::move(arg_types)}; const cel::ActivationInterface& activation = frame.activation(); for (auto provider : providers) {