Skip to content

Commit 97ca5e6

Browse files
jckingcopybara-github
authored andcommitted
Simplify ShouldAcceptOverload in the function step implementation
PiperOrigin-RevId: 1004937626
1 parent 9c562a3 commit 97ca5e6

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎eval/eval/function_step.cc‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ using ::cel::runtime_internal::CreateNoMatchingOverloadError;
4646
// errors or unknown sets must be allowed as a non-strict function.
4747
bool ShouldAcceptOverload(const cel::FunctionDescriptor& descriptor,
4848
absl::Span<const cel::Value> arguments) {
49-
for (size_t i = 0; i < arguments.size(); i++) {
50-
if (arguments[i]->Is<cel::UnknownValue>() ||
51-
arguments[i]->Is<cel::ErrorValue>()) {
52-
return !descriptor.is_strict();
49+
if (descriptor.is_strict()) {
50+
for (const auto& argument : arguments) {
51+
if (argument.IsError() || argument.IsUnknown()) {
52+
return false;
53+
}
5354
}
5455
}
5556
return true;

0 commit comments

Comments
 (0)