Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conformance/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ _TESTS_TO_SKIP_LEGACY_DASHBOARD = [
]

# Generates a bunch of `cc_test` whose names follow the pattern
# `conformance_(...)_{pratt|antlr}_{optimized|unoptimized}_{recursive|iterative}`.
# `conformance_(...)_{pratt|antlr}_{optimized|unoptimized}`.
gen_conformance_tests(
name = "conformance_parse_only",
data = _ALL_TESTS,
Expand Down Expand Up @@ -315,7 +315,7 @@ gen_conformance_tests(
)

# Generates a bunch of `cc_test` whose names follow the pattern
# `conformance_dashboard_..._{pratt|antlr}_{optimized|unoptimized}_{recursive|iterative}`.
# `conformance_dashboard_..._{pratt|antlr}_{optimized|unoptimized}`.
gen_conformance_tests(
name = "conformance_dashboard_parse_only",
dashboard = True,
Expand Down
45 changes: 20 additions & 25 deletions conformance/run.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,23 @@ def _expand_tests_to_skip(tests_to_skip):
result.append(test_to_skip[0:slash] + part)
return result

def _conformance_test_name(name, pratt, optimize, recursive):
def _conformance_test_name(name, pratt, optimize):
return "_".join(
[
name,
"pratt" if pratt else "antlr",
"optimized" if optimize else "unoptimized",
"recursive" if recursive else "iterative",
],
)

def _conformance_test_args(modern, optimize, recursive, select_opt, skip_check, dashboard, enable_variadic_logical_operators, pratt):
def _conformance_test_args(modern, optimize, select_opt, skip_check, dashboard, enable_variadic_logical_operators, pratt):
args = []
if modern:
args.append("--modern")
if optimize:
args.append("--opt")
if select_opt:
args.append("--select_optimization")
if recursive:
args.append("--recursive")
if skip_check:
args.append("--skip_check")
else:
Expand All @@ -81,10 +78,10 @@ def _conformance_test_args(modern, optimize, recursive, select_opt, skip_check,
args.append("--noenable_pratt_parser")
return args

def _conformance_test(name, data, modern, optimize, recursive, select_opt, skip_check, skip_tests, tags, dashboard, enable_variadic_logical_operators, pratt):
def _conformance_test(name, data, modern, optimize, select_opt, skip_check, skip_tests, tags, dashboard, enable_variadic_logical_operators, pratt):
cc_test(
name = _conformance_test_name(name, pratt, optimize, recursive),
args = _conformance_test_args(modern, optimize, recursive, select_opt, skip_check, dashboard, enable_variadic_logical_operators, pratt) + ["$(rlocationpath {})".format(test) for test in data],
name = _conformance_test_name(name, pratt, optimize),
args = _conformance_test_args(modern, optimize, select_opt, skip_check, dashboard, enable_variadic_logical_operators, pratt) + ["$(rlocationpath {})".format(test) for test in data],
env = select(
{
"@platforms//os:windows": {"CEL_SKIP_TESTS": ",".join(skip_tests + _TESTS_TO_SKIP_WINDOWS)},
Expand Down Expand Up @@ -115,23 +112,21 @@ def gen_conformance_tests(name, data, modern = False, checked = False, select_op
tests = []
for pratt in (True, False):
for optimize in (True, False):
for recursive in (True, False):
test_name = _conformance_test_name(name, pratt, optimize, recursive)
tests.append(test_name)
_conformance_test(
name,
data,
modern = modern,
optimize = optimize,
recursive = recursive,
select_opt = select_opt,
skip_check = skip_check,
skip_tests = _expand_tests_to_skip(skip_tests),
tags = tags,
dashboard = dashboard,
enable_variadic_logical_operators = enable_variadic_logical_operators,
pratt = pratt,
)
test_name = _conformance_test_name(name, pratt, optimize)
tests.append(test_name)
_conformance_test(
name,
data,
modern = modern,
optimize = optimize,
select_opt = select_opt,
skip_check = skip_check,
skip_tests = _expand_tests_to_skip(skip_tests),
tags = tags,
dashboard = dashboard,
enable_variadic_logical_operators = enable_variadic_logical_operators,
pratt = pratt,
)
native.test_suite(
name = name,
tests = tests,
Expand Down
4 changes: 0 additions & 4 deletions conformance/run.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ ABSL_FLAG(bool, opt, false, "Enable optimizations (constant folding)");
ABSL_FLAG(
bool, modern, false,
"Use modern cel::Value APIs implementation of the conformance service.");
ABSL_FLAG(bool, recursive, false,
"Enable recursive plans. Depth limited to slightly more than the "
"default nesting limit.");
ABSL_FLAG(std::vector<std::string>, skip_tests, {}, "Tests to skip");
ABSL_FLAG(bool, dashboard, false, "Dashboard mode, ignore test failures");
ABSL_FLAG(bool, skip_check, true, "Skip type checking the expressions");
Expand Down Expand Up @@ -264,7 +261,6 @@ NewConformanceServiceFromFlags() {
cel_conformance::ConformanceServiceOptions{
.optimize = absl::GetFlag(FLAGS_opt),
.modern = absl::GetFlag(FLAGS_modern),
.recursive = absl::GetFlag(FLAGS_recursive),
.select_optimization = absl::GetFlag(FLAGS_select_optimization),
.enable_variadic_logical_operators =
absl::GetFlag(FLAGS_enable_variadic_logical_operators),
Expand Down
33 changes: 1 addition & 32 deletions eval/compiler/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ cc_library(
"//base:ast",
"//base:data",
"//common:expr",
"//common:native_type",
"//common:value",
"//eval/eval:direct_expression_step",
"//eval/eval:evaluator_core",
"//eval/eval:expression_step_logic",
"//eval/eval:trace_step",
"//internal:casts",
"//runtime:runtime_options",
"//runtime/internal:issue_collector",
"//runtime/internal:runtime_env",
Expand All @@ -51,7 +47,6 @@ cc_library(
"@com_google_absl//absl/memory",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/types:optional",
"@com_google_absl//absl/types:variant",
"@com_google_protobuf//:protobuf",
],
Expand All @@ -64,13 +59,8 @@ cc_test(
":flat_expr_builder_extensions",
":resolver",
"//common:expr",
"//common:native_type",
"//common:value",
"//eval/eval:const_value_step",
"//eval/eval:direct_expression_step",
"//eval/eval:evaluator_core",
"//eval/eval:function_step",
"//internal:status_macros",
"//eval/eval:expression_step_logic",
"//internal:testing",
"//runtime:function_registry",
"//runtime:runtime_issue",
Expand Down Expand Up @@ -102,7 +92,6 @@ cc_library(
"//base:ast",
"//base:builtins",
"//base:data",
"//common:allocator",
"//common:ast",
"//common:ast_traverse",
"//common:ast_visitor",
Expand All @@ -112,22 +101,16 @@ cc_library(
"//common:type",
"//common:type_spec_resolver",
"//common:value",
"//eval/eval:const_value_step",
"//eval/eval:container_access_step",
"//eval/eval:create_list_step",
"//eval/eval:create_map_step",
"//eval/eval:create_struct_step",
"//eval/eval:direct_expression_step",
"//eval/eval:equality_steps",
"//eval/eval:evaluator_core",
"//eval/eval:expression_step_logic",
"//eval/eval:function_step",
"//eval/eval:ident_step",
"//eval/eval:optional_or_step",
"//eval/eval:select_step",
"//eval/eval:shadowable_value_step",
"//eval/eval:ternary_step",
"//eval/eval:trace_step",
"//internal:status_macros",
"//runtime:function_registry",
"//runtime:runtime_issue",
Expand All @@ -137,7 +120,6 @@ cc_library(
"//runtime/internal:issue_collector",
"//runtime/internal:runtime_env",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:nullability",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
Expand Down Expand Up @@ -171,7 +153,6 @@ cc_test(
"//eval/public:activation",
"//eval/public:builtin_func_registrar",
"//eval/public:cel_attribute",
"//eval/public:cel_builtins",
"//eval/public:cel_expr_builder_factory",
"//eval/public:cel_expression",
"//eval/public:cel_function",
Expand All @@ -197,7 +178,6 @@ cc_test(
"//runtime:runtime_options",
"//runtime:standard_functions",
"//runtime/internal:runtime_env_testing",
"@com_google_absl//absl/base:nullability",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log:absl_check",
"@com_google_absl//absl/status",
Expand Down Expand Up @@ -255,9 +235,7 @@ cc_library(
deps = [
":flat_expr_builder",
"//base:ast",
"//common:native_type",
"//eval/eval:cel_expression_flat_impl",
"//eval/eval:direct_expression_step",
"//eval/eval:evaluator_core",
"//eval/public:cel_expression",
"//eval/public:cel_function_registry",
Expand Down Expand Up @@ -286,9 +264,6 @@ cc_test(
],
deps = [
":cel_expression_builder_flat_impl",
":constant_folding",
":regex_precompilation_optimization",
"//eval/eval:cel_expression_flat_impl",
"//eval/public:activation",
"//eval/public:builtin_func_registrar",
"//eval/public:cel_expression",
Expand All @@ -297,7 +272,6 @@ cc_test(
"//eval/public:portable_cel_function_adapter",
"//eval/public/containers:container_backed_map_impl",
"//eval/public/structs:cel_proto_wrapper",
"//eval/public/structs:protobuf_descriptor_type_provider",
"//eval/public/testing:matchers",
"//extensions:bindings_ext",
"//internal:status_macros",
Expand Down Expand Up @@ -334,12 +308,10 @@ cc_library(
"//common:constant",
"//common:expr",
"//common:value",
"//eval/eval:const_value_step",
"//eval/eval:evaluator_core",
"//internal:status_macros",
"//runtime:activation",
"//runtime/internal:convert_constant",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:nullability",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
Expand Down Expand Up @@ -407,7 +379,6 @@ cc_library(
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:optional",
],
)

Expand Down Expand Up @@ -547,8 +518,6 @@ cc_library(
"//common:expr",
"//common:native_type",
"//common:value",
"//eval/eval:compiler_constant_step",
"//eval/eval:direct_expression_step",
"//eval/eval:evaluator_core",
"//eval/eval:regex_match_step",
"//internal:re2_options",
Expand Down
15 changes: 0 additions & 15 deletions eval/compiler/cel_expression_builder_flat_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "base/ast.h"
#include "common/native_type.h"
#include "eval/eval/cel_expression_flat_impl.h"
#include "eval/eval/direct_expression_step.h"
#include "eval/eval/evaluator_core.h"
#include "eval/public/cel_expression.h"
#include "extensions/protobuf/ast_converters.h"
Expand Down Expand Up @@ -96,19 +94,6 @@ CelExpressionBuilderFlatImpl::CreateExpressionImpl(
warnings->push_back(issue.ToStatus());
}
}
if (flat_expr_builder_.options().max_recursion_depth != 0 &&
!impl.subexpressions().empty() &&
// mainline expression is exactly one recursive step.
impl.subexpressions().front().size() == 1 &&
impl.subexpressions().front().front().IsGenericStep() &&
impl.subexpressions()
.front()
.front()
.GetGenericStep()
->GetNativeTypeId() ==
cel::NativeTypeId::For<WrappedDirectStep>()) {
return CelExpressionRecursiveImpl::Create(env_, std::move(impl));
}

return std::make_unique<CelExpressionFlatImpl>(env_, std::move(impl));
}
Expand Down
Loading
Loading