Skip to content

Commit 7dc7eac

Browse files
CEL Dev Teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 933560360
1 parent 9485d85 commit 7dc7eac

7 files changed

Lines changed: 26 additions & 26 deletions

checker/internal/descriptor_pool_type_introspector.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ FindStructTypeFieldByNameDirectly(
4242
const google::protobuf::Descriptor* absl_nullable descriptor =
4343
descriptor_pool->FindMessageTypeByName(type);
4444
if (descriptor == nullptr) {
45-
return absl::nullopt;
45+
return std::nullopt;
4646
}
4747
const google::protobuf::FieldDescriptor* absl_nullable field =
4848
descriptor->FindFieldByName(name);
@@ -54,7 +54,7 @@ FindStructTypeFieldByNameDirectly(
5454
if (field != nullptr) {
5555
return StructTypeField(MessageTypeField(field));
5656
}
57-
return absl::nullopt;
57+
return std::nullopt;
5858
}
5959

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

7373
std::vector<const google::protobuf::FieldDescriptor*> extensions;
@@ -100,7 +100,7 @@ DescriptorPoolTypeIntrospector::FindTypeImpl(absl::string_view name) const {
100100
if (enum_descriptor != nullptr) {
101101
return Type::Enum(enum_descriptor);
102102
}
103-
return absl::nullopt;
103+
return std::nullopt;
104104
}
105105

106106
absl::StatusOr<std::optional<TypeIntrospector::EnumConstant>>
@@ -112,7 +112,7 @@ DescriptorPoolTypeIntrospector::FindEnumConstantImpl(
112112
const google::protobuf::EnumValueDescriptor* absl_nullable enum_value_descriptor =
113113
enum_descriptor->FindValueByName(value);
114114
if (enum_value_descriptor == nullptr) {
115-
return absl::nullopt;
115+
return std::nullopt;
116116
}
117117
return EnumConstant{
118118
.type = Type::Enum(enum_descriptor),
@@ -121,7 +121,7 @@ DescriptorPoolTypeIntrospector::FindEnumConstantImpl(
121121
.number = enum_value_descriptor->number(),
122122
};
123123
}
124-
return absl::nullopt;
124+
return std::nullopt;
125125
}
126126

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

136136
if (field_table == nullptr) {
137-
return absl::nullopt;
137+
return std::nullopt;
138138
}
139139

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

150-
return absl::nullopt;
150+
return std::nullopt;
151151
}
152152

153153
absl::StatusOr<
@@ -160,7 +160,7 @@ DescriptorPoolTypeIntrospector::ListFieldsForStructTypeImpl(
160160

161161
const FieldTable* field_table = GetFieldTable(type);
162162
if (field_table == nullptr) {
163-
return absl::nullopt;
163+
return std::nullopt;
164164
}
165165
std::vector<TypeIntrospector::StructTypeFieldListing> fields;
166166
fields.reserve(field_table->non_extensions.size());

checker/internal/descriptor_pool_type_introspector_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ TEST(DescriptorPoolTypeIntrospectorTest, FindType) {
4747
"cel.expr.conformance.proto3.TestAllTypes.NestedEnum"),
4848
IsOkAndHolds(Optional(Property(&Type::IsEnum, true))));
4949
EXPECT_THAT(introspector.FindType("non.existent.Type"),
50-
IsOkAndHolds(Eq(absl::nullopt)));
50+
IsOkAndHolds(Eq(std::nullopt)));
5151
}
5252

5353
TEST(DescriptorPoolTypeIntrospectorTest, FindEnumConstant) {
@@ -84,7 +84,7 @@ TEST(DescriptorPoolTypeIntrospectorTest,
8484
auto field = introspector.FindStructTypeFieldByName(
8585
"cel.expr.conformance.proto3.TestAllTypes", "singleInt64");
8686

87-
EXPECT_THAT(field, IsOkAndHolds(Eq(absl::nullopt)));
87+
EXPECT_THAT(field, IsOkAndHolds(Eq(std::nullopt)));
8888
}
8989

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

111-
ASSERT_THAT(field, IsOkAndHolds(Eq(absl::nullopt)));
111+
ASSERT_THAT(field, IsOkAndHolds(Eq(std::nullopt)));
112112
}
113113

114114
TEST(DescriptorPoolTypeIntrospectorTest,
@@ -168,7 +168,7 @@ TEST(DescriptorPoolTypeIntrospectorTest, ListFieldsForStructTypeNotFound) {
168168
internal::GetTestingDescriptorPool());
169169
auto fields = introspector.ListFieldsForStructType(
170170
"cel.expr.conformance.proto3.SomeOtherType");
171-
EXPECT_THAT(fields, IsOkAndHolds(Eq(absl::nullopt)));
171+
EXPECT_THAT(fields, IsOkAndHolds(Eq(std::nullopt)));
172172
}
173173

174174
} // namespace

checker/internal/type_check_env.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ absl::StatusOr<std::optional<Type>> TypeCheckEnv::LookupTypeName(
5858
return type;
5959
}
6060
}
61-
return absl::nullopt;
61+
return std::nullopt;
6262
}
6363

6464
absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupEnumConstant(
@@ -75,7 +75,7 @@ absl::StatusOr<std::optional<VariableDecl>> TypeCheckEnv::LookupEnumConstant(
7575
return decl;
7676
}
7777
}
78-
return absl::nullopt;
78+
return std::nullopt;
7979
}
8080

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

95-
return absl::nullopt;
95+
return std::nullopt;
9696
}
9797

9898
absl::StatusOr<std::optional<StructTypeField>> TypeCheckEnv::LookupStructField(
9999
absl::string_view type_name, absl::string_view field_name) const {
100100
if (proto_type_mask_registry_ != nullptr &&
101101
!proto_type_mask_registry_->FieldIsVisible(type_name, field_name)) {
102-
return absl::nullopt;
102+
return std::nullopt;
103103
}
104104
// Check the type providers in registration order.
105105
// Note: this doesn't allow for shadowing a type with a subset type of the
@@ -113,7 +113,7 @@ absl::StatusOr<std::optional<StructTypeField>> TypeCheckEnv::LookupStructField(
113113
return field;
114114
}
115115
}
116-
return absl::nullopt;
116+
return std::nullopt;
117117
}
118118

119119
const VariableDecl* absl_nullable VariableScope::LookupLocalVariable(

checker/internal/type_checker_builder_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ std::optional<FunctionDecl> FilterDecl(FunctionDecl decl,
198198
}
199199
}
200200
if (filtered.overloads().empty()) {
201-
return absl::nullopt;
201+
return std::nullopt;
202202
}
203203
filtered.set_name(std::move(name));
204204
return filtered;

checker/internal/type_checker_builder_impl_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ TEST(ContextDeclsTest, CustomStructNotSupported) {
349349
if (name == "com.example.MyStruct") {
350350
return common_internal::MakeBasicStructType("com.example.MyStruct");
351351
}
352-
return absl::nullopt;
352+
return std::nullopt;
353353
}
354354
};
355355

@@ -370,7 +370,7 @@ TEST(ContextDeclsWithProtoTypeMaskTest, CustomStructNotSupported) {
370370
if (name == "com.example.MyStruct") {
371371
return common_internal::MakeBasicStructType("com.example.MyStruct");
372372
}
373-
return absl::nullopt;
373+
return std::nullopt;
374374
}
375375
};
376376

checker/internal/type_checker_impl.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,11 +1098,11 @@ std::optional<Type> ResolveVisitor::CheckFieldType(int64_t id,
10981098
auto field_info = env_->LookupStructField(struct_type.name(), field);
10991099
if (!field_info.ok()) {
11001100
status_.Update(field_info.status());
1101-
return absl::nullopt;
1101+
return std::nullopt;
11021102
}
11031103
if (!field_info->has_value()) {
11041104
ReportUndefinedField(id, field, struct_type.name());
1105-
return absl::nullopt;
1105+
return std::nullopt;
11061106
}
11071107
auto type = field_info->value().GetType();
11081108
if (type.kind() == TypeKind::kEnum) {
@@ -1134,7 +1134,7 @@ std::optional<Type> ResolveVisitor::CheckFieldType(int64_t id,
11341134
"expression of type '",
11351135
FormatTypeName(inference_context_->FinalizeType(operand_type)),
11361136
"' cannot be the operand of a select operation")));
1137-
return absl::nullopt;
1137+
return std::nullopt;
11381138
}
11391139

11401140
void ResolveVisitor::ResolveSelectOperation(const Expr& expr,

checker/internal/type_inference_context.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ std::optional<Type> WrapperToPrimitive(const Type& t) {
149149
case TypeKind::kUintWrapper:
150150
return UintType();
151151
default:
152-
return absl::nullopt;
152+
return std::nullopt;
153153
}
154154
}
155155

@@ -579,7 +579,7 @@ TypeInferenceContext::ResolveOverload(const FunctionDecl& decl,
579579
}
580580

581581
if (!result_type.has_value() || matching_overloads.empty()) {
582-
return absl::nullopt;
582+
return std::nullopt;
583583
}
584584
return OverloadResolution{
585585
.result_type = FullySubstitute(*result_type, /*free_to_dyn=*/false),

0 commit comments

Comments
 (0)