Skip to content

Commit 9ea9678

Browse files
CEL Dev Teamcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 974630313
1 parent 04ffade commit 9ea9678

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

checker/internal/type_checker_impl.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,11 @@ void ResolveVisitor::PostVisitMap(const Expr& expr, const MapExpr& map) {
610610
for (const auto& entry : map.entries()) {
611611
const Expr* value = &entry.value();
612612
Type value_type = GetDeducedType(value);
613+
OptionalType opt_value_type;
613614
if (entry.optional()) {
614615
if (value_type.IsOptional()) {
615-
value_type = value_type.GetOptional().GetParameter();
616+
opt_value_type = value_type.GetOptional();
617+
value_type = opt_value_type.GetParameter();
616618
} else {
617619
ReportTypeMismatch(entry.value().id(), OptionalType(arena_, value_type),
618620
value_type);
@@ -648,9 +650,11 @@ void ResolveVisitor::PostVisitList(const Expr& expr, const ListExpr& list) {
648650
for (const auto& element : list.elements()) {
649651
const Expr* value = &element.expr();
650652
Type value_type = GetDeducedType(value);
653+
OptionalType opt_value_type;
651654
if (element.optional()) {
652655
if (value_type.IsOptional()) {
653-
value_type = value_type.GetOptional().GetParameter();
656+
opt_value_type = value_type.GetOptional();
657+
value_type = opt_value_type.GetParameter();
654658
} else {
655659
ReportTypeMismatch(element.expr().id(),
656660
OptionalType(arena_, value_type), value_type);
@@ -1203,8 +1207,10 @@ void ResolveVisitor::HandleOptSelect(const Expr& expr) {
12031207
}
12041208

12051209
Type operand_type = GetDeducedType(operand);
1210+
OptionalType opt_operand_type;
12061211
if (operand_type.IsOptional()) {
1207-
operand_type = operand_type.GetOptional().GetParameter();
1212+
opt_operand_type = operand_type.GetOptional();
1213+
operand_type = opt_operand_type.GetParameter();
12081214
}
12091215

12101216
std::optional<Type> field_type = CheckFieldType(

0 commit comments

Comments
 (0)