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
18 changes: 9 additions & 9 deletions checker/internal/descriptor_pool_type_introspector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ FindStructTypeFieldByNameDirectly(
const google::protobuf::Descriptor* absl_nullable descriptor =
descriptor_pool->FindMessageTypeByName(type);
if (descriptor == nullptr) {
return absl::nullopt;
return std::nullopt;
}
const google::protobuf::FieldDescriptor* absl_nullable field =
descriptor->FindFieldByName(name);
Expand All @@ -54,7 +54,7 @@ FindStructTypeFieldByNameDirectly(
if (field != nullptr) {
return StructTypeField(MessageTypeField(field));
}
return absl::nullopt;
return std::nullopt;
}

// Standard implementation for listing fields.
Expand All @@ -67,7 +67,7 @@ ListStructTypeFieldsDirectly(
const google::protobuf::Descriptor* absl_nullable descriptor =
descriptor_pool->FindMessageTypeByName(type);
if (descriptor == nullptr) {
return absl::nullopt;
return std::nullopt;
}

std::vector<const google::protobuf::FieldDescriptor*> extensions;
Expand Down Expand Up @@ -100,7 +100,7 @@ DescriptorPoolTypeIntrospector::FindTypeImpl(absl::string_view name) const {
if (enum_descriptor != nullptr) {
return Type::Enum(enum_descriptor);
}
return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<std::optional<TypeIntrospector::EnumConstant>>
Expand All @@ -112,7 +112,7 @@ DescriptorPoolTypeIntrospector::FindEnumConstantImpl(
const google::protobuf::EnumValueDescriptor* absl_nullable enum_value_descriptor =
enum_descriptor->FindValueByName(value);
if (enum_value_descriptor == nullptr) {
return absl::nullopt;
return std::nullopt;
}
return EnumConstant{
.type = Type::Enum(enum_descriptor),
Expand All @@ -121,7 +121,7 @@ DescriptorPoolTypeIntrospector::FindEnumConstantImpl(
.number = enum_value_descriptor->number(),
};
}
return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<std::optional<StructTypeField>>
Expand All @@ -134,7 +134,7 @@ DescriptorPoolTypeIntrospector::FindStructTypeFieldByNameImpl(
const FieldTable* field_table = GetFieldTable(type);

if (field_table == nullptr) {
return absl::nullopt;
return std::nullopt;
}

if (auto it = field_table->json_name_map.find(name);
Expand All @@ -147,7 +147,7 @@ DescriptorPoolTypeIntrospector::FindStructTypeFieldByNameImpl(
return field_table->fields[it->second].field;
}

return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<
Expand All @@ -160,7 +160,7 @@ DescriptorPoolTypeIntrospector::ListFieldsForStructTypeImpl(

const FieldTable* field_table = GetFieldTable(type);
if (field_table == nullptr) {
return absl::nullopt;
return std::nullopt;
}
std::vector<TypeIntrospector::StructTypeFieldListing> fields;
fields.reserve(field_table->non_extensions.size());
Expand Down
8 changes: 4 additions & 4 deletions checker/internal/descriptor_pool_type_introspector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST(DescriptorPoolTypeIntrospectorTest, FindType) {
"cel.expr.conformance.proto3.TestAllTypes.NestedEnum"),
IsOkAndHolds(Optional(Property(&Type::IsEnum, true))));
EXPECT_THAT(introspector.FindType("non.existent.Type"),
IsOkAndHolds(Eq(absl::nullopt)));
IsOkAndHolds(Eq(std::nullopt)));
}

TEST(DescriptorPoolTypeIntrospectorTest, FindEnumConstant) {
Expand Down Expand Up @@ -84,7 +84,7 @@ TEST(DescriptorPoolTypeIntrospectorTest,
auto field = introspector.FindStructTypeFieldByName(
"cel.expr.conformance.proto3.TestAllTypes", "singleInt64");

EXPECT_THAT(field, IsOkAndHolds(Eq(absl::nullopt)));
EXPECT_THAT(field, IsOkAndHolds(Eq(std::nullopt)));
}

TEST(DescriptorPoolTypeIntrospectorTest, FindExtension) {
Expand All @@ -108,7 +108,7 @@ TEST(DescriptorPoolTypeIntrospectorTest, FindStructTypeFieldByNameWithJsonOpt) {
auto field = introspector.FindStructTypeFieldByName(
"cel.expr.conformance.proto3.TestAllTypes", "single_int64");

ASSERT_THAT(field, IsOkAndHolds(Eq(absl::nullopt)));
ASSERT_THAT(field, IsOkAndHolds(Eq(std::nullopt)));
}

TEST(DescriptorPoolTypeIntrospectorTest,
Expand Down Expand Up @@ -168,7 +168,7 @@ TEST(DescriptorPoolTypeIntrospectorTest, ListFieldsForStructTypeNotFound) {
internal::GetTestingDescriptorPool());
auto fields = introspector.ListFieldsForStructType(
"cel.expr.conformance.proto3.SomeOtherType");
EXPECT_THAT(fields, IsOkAndHolds(Eq(absl::nullopt)));
EXPECT_THAT(fields, IsOkAndHolds(Eq(std::nullopt)));
}

} // namespace
Expand Down
10 changes: 5 additions & 5 deletions checker/internal/type_check_env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ absl::StatusOr<std::optional<Type>> TypeCheckEnv::LookupTypeName(
return type;
}
}
return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupEnumConstant(
Expand All @@ -75,7 +75,7 @@ absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupEnumConstant(
return decl;
}
}
return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupTypeConstant(
Expand All @@ -92,14 +92,14 @@ absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupTypeConstant(
return LookupEnumConstant(enum_name_candidate, value_name_candidate);
}

return absl::nullopt;
return std::nullopt;
}

absl::StatusOr<std::optional<StructTypeField>> TypeCheckEnv::LookupStructField(
absl::string_view type_name, absl::string_view field_name) const {
if (proto_type_mask_registry_ != nullptr &&
!proto_type_mask_registry_->FieldIsVisible(type_name, field_name)) {
return absl::nullopt;
return std::nullopt;
}
// Check the type providers in registration order.
// Note: this doesn't allow for shadowing a type with a subset type of the
Expand All @@ -113,7 +113,7 @@ absl::StatusOr<std::optional<StructTypeField>> TypeCheckEnv::LookupStructField(
return field;
}
}
return absl::nullopt;
return std::nullopt;
}

const VariableDecl* absl_nullable VariableScope::LookupLocalVariable(
Expand Down
2 changes: 1 addition & 1 deletion checker/internal/type_checker_builder_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ std::optional<FunctionDecl> FilterDecl(FunctionDecl decl,
}
}
if (filtered.overloads().empty()) {
return absl::nullopt;
return std::nullopt;
}
filtered.set_name(std::move(name));
return filtered;
Expand Down
4 changes: 2 additions & 2 deletions checker/internal/type_checker_builder_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ TEST(ContextDeclsTest, CustomStructNotSupported) {
if (name == "com.example.MyStruct") {
return common_internal::MakeBasicStructType("com.example.MyStruct");
}
return absl::nullopt;
return std::nullopt;
}
};

Expand All @@ -370,7 +370,7 @@ TEST(ContextDeclsWithProtoTypeMaskTest, CustomStructNotSupported) {
if (name == "com.example.MyStruct") {
return common_internal::MakeBasicStructType("com.example.MyStruct");
}
return absl::nullopt;
return std::nullopt;
}
};

Expand Down
6 changes: 3 additions & 3 deletions checker/internal/type_checker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1098,11 +1098,11 @@ std::optional<Type> ResolveVisitor::CheckFieldType(int64_t id,
auto field_info = env_->LookupStructField(struct_type.name(), field);
if (!field_info.ok()) {
status_.Update(field_info.status());
return absl::nullopt;
return std::nullopt;
}
if (!field_info->has_value()) {
ReportUndefinedField(id, field, struct_type.name());
return absl::nullopt;
return std::nullopt;
}
auto type = field_info->value().GetType();
if (type.kind() == TypeKind::kEnum) {
Expand Down Expand Up @@ -1134,7 +1134,7 @@ std::optional<Type> ResolveVisitor::CheckFieldType(int64_t id,
"expression of type '",
FormatTypeName(inference_context_->FinalizeType(operand_type)),
"' cannot be the operand of a select operation")));
return absl::nullopt;
return std::nullopt;
}

void ResolveVisitor::ResolveSelectOperation(const Expr& expr,
Expand Down
4 changes: 2 additions & 2 deletions checker/internal/type_inference_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ std::optional<Type> WrapperToPrimitive(const Type& t) {
case TypeKind::kUintWrapper:
return UintType();
default:
return absl::nullopt;
return std::nullopt;
}
}

Expand Down Expand Up @@ -579,7 +579,7 @@ TypeInferenceContext::ResolveOverload(const FunctionDecl& decl,
}

if (!result_type.has_value() || matching_overloads.empty()) {
return absl::nullopt;
return std::nullopt;
}
return OverloadResolution{
.result_type = FullySubstitute(*result_type, /*free_to_dyn=*/false),
Expand Down
Loading