Skip to content
Closed
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 eval/public/activation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace api {
namespace expr {
namespace runtime {

absl::optional<CelValue> Activation::FindValue(absl::string_view name,
google::protobuf::Arena* arena) const {
std::optional<CelValue> Activation::FindValue(absl::string_view name,
google::protobuf::Arena* arena) const {
auto entry = value_map_.find(name);

// No entry found.
Expand Down
2 changes: 1 addition & 1 deletion eval/public/ast_rewrite_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class RewriterExample : public AstRewriterBase {

private:
absl::Span<const Expr*> path_;
absl::optional<int64_t> target_;
std::optional<int64_t> target_;
};

TEST(AstRewrite, SelectRewriteExample) {
Expand Down
16 changes: 8 additions & 8 deletions eval/public/builtin_func_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ class BuiltinsTest : public ::testing::Test {
BuiltinsTest() {}

// Helper method. Looks up in registry and tests comparison operation.
void PerformRun(absl::string_view operation, absl::optional<CelValue> target,
void PerformRun(absl::string_view operation, std::optional<CelValue> target,
const std::vector<CelValue>& values, CelValue* result) {
PerformRun(operation, target, values, result, options_);
}

// Helper method. Looks up in registry and tests comparison operation.
void PerformRun(absl::string_view operation, absl::optional<CelValue> target,
void PerformRun(absl::string_view operation, std::optional<CelValue> target,
const std::vector<CelValue>& values, CelValue* result,
const InterpreterOptions& options) {
Activation activation;
Expand Down Expand Up @@ -1131,7 +1131,7 @@ class FakeErrorMap : public CelMap {
return absl::InvalidArgumentError("bad key type");
}

absl::optional<CelValue> operator[](CelValue key) const override {
std::optional<CelValue> operator[](CelValue key) const override {
return absl::nullopt;
}

Expand All @@ -1157,7 +1157,7 @@ class FakeMap : public CelMap {

int size() const override { return data_.size(); }

absl::optional<CelValue> operator[](CelValue key) const override {
std::optional<CelValue> operator[](CelValue key) const override {
absl::optional<T> raw_value = get_cel_value_(key);
if (!raw_value) {
return absl::nullopt;
Expand All @@ -1183,7 +1183,7 @@ class FakeBoolMap : public FakeMap<bool> {
public:
explicit FakeBoolMap(const std::map<bool, CelValue>& data)
: FakeMap(data, CelValue::CreateBool,
[](CelValue v) -> absl::optional<bool> {
[](CelValue v) -> std::optional<bool> {
if (!v.IsBool()) {
return absl::nullopt;
}
Expand All @@ -1195,7 +1195,7 @@ class FakeInt64Map : public FakeMap<int64_t> {
public:
explicit FakeInt64Map(const std::map<int64_t, CelValue>& data)
: FakeMap(data, CelValue::CreateInt64,
[](CelValue v) -> absl::optional<int64_t> {
[](CelValue v) -> std::optional<int64_t> {
if (!v.IsInt64()) {
return absl::nullopt;
}
Expand All @@ -1207,7 +1207,7 @@ class FakeUint64Map : public FakeMap<uint64_t> {
public:
explicit FakeUint64Map(const std::map<uint64_t, CelValue>& data)
: FakeMap(data, CelValue::CreateUint64,
[](CelValue v) -> absl::optional<uint64_t> {
[](CelValue v) -> std::optional<uint64_t> {
if (!v.IsUint64()) {
return absl::nullopt;
}
Expand All @@ -1221,7 +1221,7 @@ class FakeStringMap : public FakeMap<CelValue::StringHolder> {
: FakeMap(
data,
[](CelValue::StringHolder v) { return CelValue::CreateString(v); },
[](CelValue v) -> absl::optional<CelValue::StringHolder> {
[](CelValue v) -> std::optional<CelValue::StringHolder> {
if (!v.IsString()) {
return absl::nullopt;
}
Expand Down
2 changes: 1 addition & 1 deletion eval/public/cel_attribute_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using ::testing::SizeIs;

class DummyMap : public CelMap {
public:
absl::optional<CelValue> operator[](CelValue value) const override {
std::optional<CelValue> operator[](CelValue value) const override {
return CelValue::CreateNull();
}
absl::StatusOr<const CelList*> ListKeys() const override {
Expand Down
2 changes: 1 addition & 1 deletion eval/public/cel_number.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace google::api::expr::runtime {

absl::optional<CelNumber> GetNumberFromCelValue(const CelValue& value) {
std::optional<CelNumber> GetNumberFromCelValue(const CelValue& value) {
if (int64_t val; value.GetValue(&val)) {
return CelNumber(val);
} else if (uint64_t val; value.GetValue(&val)) {
Expand Down
2 changes: 1 addition & 1 deletion eval/public/cel_type_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void CelTypeRegistry::RegisterEnum(absl::string_view enum_name,
}

// Find a type's CelValue instance by its fully qualified name.
absl::optional<LegacyTypeAdapter> CelTypeRegistry::FindTypeAdapter(
std::optional<LegacyTypeAdapter> CelTypeRegistry::FindTypeAdapter(
absl::string_view fully_qualified_type_name) const {
auto maybe_adapter =
GetFirstTypeProvider()->ProvideLegacyType(fully_qualified_type_name);
Expand Down
4 changes: 2 additions & 2 deletions eval/public/cel_type_registry_protobuf_reflection_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ TEST(CelTypeRegistryTypeProviderTest, StructTypes) {
google::protobuf::LinkMessageReflection<TestMessage>();
google::protobuf::LinkMessageReflection<Struct>();

ASSERT_OK_AND_ASSIGN(absl::optional<cel::Type> struct_message_type,
ASSERT_OK_AND_ASSIGN(std::optional<cel::Type> struct_message_type,
registry.GetTypeProvider().FindType(
"google.api.expr.runtime.TestMessage"));
ASSERT_TRUE(struct_message_type.has_value());
Expand All @@ -100,7 +100,7 @@ TEST(CelTypeRegistryTypeProviderTest, StructTypes) {

// Can't override builtins.
ASSERT_OK_AND_ASSIGN(
absl::optional<Type> struct_type,
std::optional<Type> struct_type,
registry.GetTypeProvider().FindType("google.protobuf.Struct"));
EXPECT_THAT(struct_type, Optional(TypeNameIs("map")));
}
Expand Down
12 changes: 6 additions & 6 deletions eval/public/cel_type_registry_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TestTypeProvider : public LegacyTypeProvider {

// Return a type adapter for an opaque type
// (no reflection operations supported).
absl::optional<LegacyTypeAdapter> ProvideLegacyType(
std::optional<LegacyTypeAdapter> ProvideLegacyType(
absl::string_view name) const override {
for (const auto& type : types_) {
if (name == type) {
Expand Down Expand Up @@ -105,29 +105,29 @@ TEST(CelTypeRegistryTypeProviderTest, Builtins) {
CelTypeRegistry registry;

// simple
ASSERT_OK_AND_ASSIGN(absl::optional<Type> bool_type,
ASSERT_OK_AND_ASSIGN(std::optional<Type> bool_type,
registry.GetTypeProvider().FindType("bool"));
EXPECT_THAT(bool_type, Optional(TypeNameIs("bool")));
// opaque
ASSERT_OK_AND_ASSIGN(
absl::optional<Type> timestamp_type,
std::optional<Type> timestamp_type,
registry.GetTypeProvider().FindType("google.protobuf.Timestamp"));
EXPECT_THAT(timestamp_type,
Optional(TypeNameIs("google.protobuf.Timestamp")));
// wrapper
ASSERT_OK_AND_ASSIGN(
absl::optional<Type> int_wrapper_type,
std::optional<Type> int_wrapper_type,
registry.GetTypeProvider().FindType("google.protobuf.Int64Value"));
EXPECT_THAT(int_wrapper_type,
Optional(TypeNameIs("google.protobuf.Int64Value")));
// json
ASSERT_OK_AND_ASSIGN(
absl::optional<Type> json_struct_type,
std::optional<Type> json_struct_type,
registry.GetTypeProvider().FindType("google.protobuf.Struct"));
EXPECT_THAT(json_struct_type, Optional(TypeNameIs("map")));
// special
ASSERT_OK_AND_ASSIGN(
absl::optional<Type> any_type,
std::optional<Type> any_type,
registry.GetTypeProvider().FindType("google.protobuf.Any"));
EXPECT_THAT(any_type, Optional(TypeNameIs("google.protobuf.Any")));
}
Expand Down
2 changes: 1 addition & 1 deletion eval/public/cel_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class EmptyCelMap final : public CelMap {
return &*instance;
}

absl::optional<CelValue> operator[](CelValue key) const override {
std::optional<CelValue> operator[](CelValue key) const override {
return absl::nullopt;
}

Expand Down
2 changes: 1 addition & 1 deletion eval/public/cel_value_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using ::testing::NotNull;

class DummyMap : public CelMap {
public:
absl::optional<CelValue> operator[](CelValue value) const override {
std::optional<CelValue> operator[](CelValue value) const override {
return CelValue::CreateNull();
}
absl::StatusOr<const CelList*> ListKeys() const override {
Expand Down