From 97ca5e675f4a5657cfc0b35d7008c8b641eb1486 Mon Sep 17 00:00:00 2001 From: Justin King Date: Thu, 22 Oct 2026 11:47:11 -0700 Subject: [PATCH] Simplify `ShouldAcceptOverload` in the function step implementation PiperOrigin-RevId: 1004937626 --- eval/eval/function_step.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eval/eval/function_step.cc b/eval/eval/function_step.cc index 0cbf11bc7..782239a89 100644 --- a/eval/eval/function_step.cc +++ b/eval/eval/function_step.cc @@ -46,10 +46,11 @@ using ::cel::runtime_internal::CreateNoMatchingOverloadError; // errors or unknown sets must be allowed as a non-strict function. bool ShouldAcceptOverload(const cel::FunctionDescriptor& descriptor, absl::Span arguments) { - for (size_t i = 0; i < arguments.size(); i++) { - if (arguments[i]->Is() || - arguments[i]->Is()) { - return !descriptor.is_strict(); + if (descriptor.is_strict()) { + for (const auto& argument : arguments) { + if (argument.IsError() || argument.IsUnknown()) { + return false; + } } } return true;