diff --git a/checker/internal/BUILD b/checker/internal/BUILD index 810348aea..a264628d8 100644 --- a/checker/internal/BUILD +++ b/checker/internal/BUILD @@ -202,7 +202,6 @@ cc_test( "//common:ast", "//common:decl", "//common:type", - "//common/ast:expr", "//internal:testing", "//internal:testing_descriptor_pool", "@com_google_absl//absl/status", diff --git a/checker/internal/type_checker_builder_impl_test.cc b/checker/internal/type_checker_builder_impl_test.cc index 83f1e370f..4a3a74965 100644 --- a/checker/internal/type_checker_builder_impl_test.cc +++ b/checker/internal/type_checker_builder_impl_test.cc @@ -28,7 +28,6 @@ #include "checker/type_checker.h" #include "checker/validation_result.h" #include "common/ast.h" -#include "common/ast/expr.h" #include "common/decl.h" #include "common/type.h" #include "common/type_introspector.h" @@ -71,52 +70,42 @@ TEST_P(ContextDeclsFieldsDefinedTest, ContextDeclsFieldsDefined) { INSTANTIATE_TEST_SUITE_P( TestAllTypes, ContextDeclsFieldsDefinedTest, testing::Values( - ContextDeclsTestCase{"single_int64", - TypeSpec(ast_internal::PrimitiveType::kInt64)}, - ContextDeclsTestCase{"single_uint32", - TypeSpec(ast_internal::PrimitiveType::kUint64)}, - ContextDeclsTestCase{"single_double", - TypeSpec(ast_internal::PrimitiveType::kDouble)}, - ContextDeclsTestCase{"single_string", - TypeSpec(ast_internal::PrimitiveType::kString)}, - ContextDeclsTestCase{"single_any", - TypeSpec(ast_internal::WellKnownType::kAny)}, + ContextDeclsTestCase{"single_int64", TypeSpec(PrimitiveType::kInt64)}, + ContextDeclsTestCase{"single_uint32", TypeSpec(PrimitiveType::kUint64)}, + ContextDeclsTestCase{"single_double", TypeSpec(PrimitiveType::kDouble)}, + ContextDeclsTestCase{"single_string", TypeSpec(PrimitiveType::kString)}, + ContextDeclsTestCase{"single_any", TypeSpec(WellKnownTypeSpec::kAny)}, ContextDeclsTestCase{"single_duration", - TypeSpec(ast_internal::WellKnownType::kDuration)}, - ContextDeclsTestCase{"single_bool_wrapper", - TypeSpec(ast_internal::PrimitiveTypeWrapper( - ast_internal::PrimitiveType::kBool))}, + TypeSpec(WellKnownTypeSpec::kDuration)}, + ContextDeclsTestCase{ + "single_bool_wrapper", + TypeSpec(PrimitiveTypeWrapper(PrimitiveType::kBool))}, ContextDeclsTestCase{ "list_value", - TypeSpec(ast_internal::ListType( - std::make_unique(ast_internal::DynamicType())))}, + TypeSpec(ListTypeSpec(std::make_unique(DynTypeSpec())))}, ContextDeclsTestCase{ "standalone_message", - TypeSpec(ast_internal::MessageType( + TypeSpec(MessageTypeSpec( "cel.expr.conformance.proto3.TestAllTypes.NestedMessage"))}, ContextDeclsTestCase{"standalone_enum", - TypeSpec(ast_internal::PrimitiveType::kInt64)}, - ContextDeclsTestCase{ - "repeated_bytes", - TypeSpec(ast_internal::ListType(std::make_unique( - ast_internal::PrimitiveType::kBytes)))}, + TypeSpec(PrimitiveType::kInt64)}, + ContextDeclsTestCase{"repeated_bytes", + TypeSpec(ListTypeSpec(std::make_unique( + PrimitiveType::kBytes)))}, ContextDeclsTestCase{ "repeated_nested_message", - TypeSpec(ast_internal::ListType(std::make_unique< - TypeSpec>(ast_internal::MessageType( + TypeSpec(ListTypeSpec(std::make_unique(MessageTypeSpec( "cel.expr.conformance.proto3.TestAllTypes.NestedMessage"))))}, ContextDeclsTestCase{ "map_int32_timestamp", - TypeSpec(ast_internal::MapType( - std::make_unique(ast_internal::PrimitiveType::kInt64), - std::make_unique( - ast_internal::WellKnownType::kTimestamp)))}, + TypeSpec(MapTypeSpec( + std::make_unique(PrimitiveType::kInt64), + std::make_unique(WellKnownTypeSpec::kTimestamp)))}, ContextDeclsTestCase{ "single_struct", - TypeSpec(ast_internal::MapType( - std::make_unique( - ast_internal::PrimitiveType::kString), - std::make_unique(ast_internal::DynamicType())))})); + TypeSpec( + MapTypeSpec(std::make_unique(PrimitiveType::kString), + std::make_unique(DynTypeSpec())))})); TEST(ContextDeclsTest, ErrorOnDuplicateContextDeclaration) { TypeCheckerBuilderImpl builder(internal::GetSharedTestingDescriptorPool(), @@ -323,8 +312,7 @@ TEST(TypeCheckerBuilderImplTest, ReplaceVariable) { const auto& checked_ast = *result.GetAst(); - EXPECT_EQ(checked_ast.GetReturnType(), - TypeSpec(ast_internal::PrimitiveType::kString)); + EXPECT_EQ(checked_ast.GetReturnType(), TypeSpec(PrimitiveType::kString)); } } // namespace diff --git a/common/ast/BUILD b/common/ast/BUILD index 644ee1b36..410d38c65 100644 --- a/common/ast/BUILD +++ b/common/ast/BUILD @@ -73,16 +73,6 @@ cc_test( ], ) -cc_library( - name = "expr", - hdrs = [ - "expr.h", - ], - deps = [ - ":metadata", - ], -) - cc_library( name = "source_info_proto", srcs = ["source_info_proto.cc"], diff --git a/common/ast/expr.h b/common/ast/expr.h deleted file mode 100644 index 1e5ac45e5..000000000 --- a/common/ast/expr.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Type definitions for internal AST representation. -// CEL users should not directly depend on the definitions here. -#ifndef THIRD_PARTY_CEL_CPP_BASE_AST_INTERNAL_EXPR_H_ -#define THIRD_PARTY_CEL_CPP_BASE_AST_INTERNAL_EXPR_H_ - -#include "common/ast/metadata.h" - -namespace cel::ast_internal { - -// Temporary aliases to allow for moving the metadata types. -using TypeKind = cel::TypeSpecKind; -using Type = cel::TypeSpec; -using Extension = cel::ExtensionSpec; -using ListType = cel::ListTypeSpec; -using MapType = cel::MapTypeSpec; -using FunctionType = cel::FunctionTypeSpec; -using AbstractType = cel::AbstractType; -using PrimitiveType = cel::PrimitiveType; -using PrimitiveTypeWrapper = cel::PrimitiveTypeWrapper; -using WellKnownType = cel::WellKnownTypeSpec; -using MessageType = cel::MessageTypeSpec; -using ParamType = cel::ParamTypeSpec; -using SourceInfo = cel::SourceInfo; -using ErrorType = cel::ErrorTypeSpec; -using DynamicType = cel::DynTypeSpec; -using NullType = cel::NullTypeSpec; -using Reference = cel::Reference; -using UnspecifiedType = cel::UnsetTypeSpec; - -} // namespace cel::ast_internal - -#endif // THIRD_PARTY_CEL_CPP_BASE_EXPR_H_ diff --git a/parser/BUILD b/parser/BUILD index 13caa3bf6..554b6ac98 100644 --- a/parser/BUILD +++ b/parser/BUILD @@ -39,7 +39,6 @@ cc_library( ":source_factory", "//common:ast", "//common:constant", - "//common:expr", "//common:expr_factory", "//common:operators", "//common:source", diff --git a/parser/parser.cc b/parser/parser.cc index af0803341..d430e3169 100644 --- a/parser/parser.cc +++ b/parser/parser.cc @@ -57,7 +57,6 @@ #include "common/ast/expr_proto.h" #include "common/ast/source_info_proto.h" #include "common/constant.h" -#include "common/expr.h" #include "common/expr_factory.h" #include "common/operators.h" #include "common/source.h"