@@ -325,49 +325,49 @@ private enum RewriteTestCase {
325325 // Map selects
326326 MAP_STRING_STRING (
327327 "msg.map_string_string" ,
328- "cel.@attribute(msg, [[61, \" map_string_string\" , -1 , [9, 9]]], {\" \" : \" \" })" ),
328+ "cel.@attribute(msg, [[61, \" map_string_string\" , -10 , [9, 9]]], {\" \" : \" \" })" ),
329329 MAP_BOOL_STRING (
330330 "msg.map_bool_string" ,
331- "cel.@attribute(msg, [[64, \" map_bool_string\" , -1 , [8, 9]]], {false: \" \" })" ),
331+ "cel.@attribute(msg, [[64, \" map_bool_string\" , -10 , [8, 9]]], {false: \" \" })" ),
332332 MAP_UINT32_DOUBLE (
333333 "msg.map_uint32_double" ,
334- "cel.@attribute(msg, [[204, \" map_uint32_double\" , -1 , [13, 1]]], {0u: 0.0})" ),
334+ "cel.@attribute(msg, [[204, \" map_uint32_double\" , -10 , [13, 1]]], {0u: 0.0})" ),
335335 MAP_INT64_ENUM (
336336 "msg.map_int64_enum" ,
337- "cel.@attribute(msg, [[94, \" map_int64_enum\" , -1 , [3, 14]]], {0: 0})" ),
337+ "cel.@attribute(msg, [[94, \" map_int64_enum\" , -10 , [3, 14]]], {0: 0})" ),
338338 MAP_STRING_DURATION (
339339 "msg.map_string_duration" ,
340- "cel.@attribute(msg, [[243, \" map_string_duration\" , -1 , [9, 11]]],"
340+ "cel.@attribute(msg, [[243, \" map_string_duration\" , -10 , [9, 11]]],"
341341 + " {\" \" : google.protobuf.Duration{}})" ),
342342 MAP_FIELD_INDEXING (
343343 "msg.map_int64_message[1].bb" ,
344- "cel.@attribute(msg, [[95, \" map_int64_message\" , -1 , [3, 11]], 1, [1, \" bb\" , 5]], 0)" ),
344+ "cel.@attribute(msg, [[95, \" map_int64_message\" , -10 , [3, 11]], 1, [1, \" bb\" , 5]], 0)" ),
345345 REPEATED_FIELD_INDEXING (
346346 "msg.repeated_nested_message[0].bb" ,
347347 "cel.@attribute(msg, [[51, \" repeated_nested_message\" , 11], 0, [1, \" bb\" , 5]], 0)" ),
348348 MAP_AND_REPEATED_FIELD_INDEXING (
349349 "msg.map_int64_nested_type[1].child.payload.repeated_nested_message[0].bb" ,
350- "cel.@attribute(msg, [[62, \" map_int64_nested_type\" , -1 , [3, 11]], 1, "
350+ "cel.@attribute(msg, [[62, \" map_int64_nested_type\" , -10 , [3, 11]], 1, "
351351 + "[1, \" child\" , 11], [2, \" payload\" , 11], "
352352 + "[51, \" repeated_nested_message\" , 11], 0, [1, \" bb\" , 5]], 0)" ),
353353 MAP_FIELD_UINT_KEY_INDEXING (
354354 "msg.map_uint64_message[1u].bb" ,
355- "cel.@attribute(msg, [[217, \" map_uint64_message\" , -1 , [4, 11]], 1u, "
355+ "cel.@attribute(msg, [[217, \" map_uint64_message\" , -10 , [4, 11]], 1u, "
356356 + "[1, \" bb\" , 5]], 0)" ),
357357 MAP_FIELD_BOOL_KEY_INDEXING (
358358 "msg.map_bool_message[true].bb" ,
359- "cel.@attribute(msg, [[73, \" map_bool_message\" , -1 , [8, 11]], true, "
359+ "cel.@attribute(msg, [[73, \" map_bool_message\" , -10 , [8, 11]], true, "
360360 + "[1, \" bb\" , 5]], 0)" ),
361361 REPEATED_FIELD_HAS_THROUGH_INDEX (
362362 "has(msg.repeated_nested_message[0].bb)" ,
363363 "cel.@hasField(msg, [[51, \" repeated_nested_message\" , 11], 0, [1, \" bb\" ]])" ),
364364 MAP_FIELD_HAS_THROUGH_INDEX (
365365 "has(msg.map_int64_nested_type[1].child.payload.single_int64)" ,
366- "cel.@hasField(msg, [[62, \" map_int64_nested_type\" , -1 , [3, 11]], 1, "
366+ "cel.@hasField(msg, [[62, \" map_int64_nested_type\" , -10 , [3, 11]], 1, "
367367 + "[1, \" child\" ], [2, \" payload\" ], [2, \" single_int64\" ]])" ),
368368 HAS_THROUGH_TWO_INDICES (
369369 "has(msg.map_int64_nested_type[1].child.payload.repeated_nested_message[0].bb)" ,
370- "cel.@hasField(msg, [[62, \" map_int64_nested_type\" , -1 , [3, 11]], 1, "
370+ "cel.@hasField(msg, [[62, \" map_int64_nested_type\" , -10 , [3, 11]], 1, "
371371 + "[1, \" child\" , 11], [2, \" payload\" , 11], "
372372 + "[51, \" repeated_nested_message\" , 11], 0, [1, \" bb\" ]])" ),
373373 REPEATED_FIELD_DYNAMIC_INDEX_STOPS_AT_INDEX (
@@ -404,18 +404,18 @@ private enum RewriteTestCase {
404404 PROTO_MAP_FIELD_SELECT_STOPS_AT_MAP_BOUNDARY (
405405 "msg.map_string_message.key.bb" ,
406406 "cel.@attribute("
407- + "cel.@attribute(msg, [[227, \" map_string_message\" , -1 , [9, 11]]],"
407+ + "cel.@attribute(msg, [[227, \" map_string_message\" , -10 , [9, 11]]],"
408408 + " {\" \" : cel.expr.conformance.proto3.TestAllTypes.NestedMessage{}}).key, "
409409 + "[[1, \" bb\" , 5]], 0)" ),
410410 PROTO_MAP_FIELD_HAS_STOPS_AT_MAP_BOUNDARY (
411411 "has(msg.map_string_message.key.bb)" ,
412412 "cel.@hasField("
413- + "cel.@attribute(msg, [[227, \" map_string_message\" , -1 , [9, 11]]],"
413+ + "cel.@attribute(msg, [[227, \" map_string_message\" , -10 , [9, 11]]],"
414414 + " {\" \" : cel.expr.conformance.proto3.TestAllTypes.NestedMessage{}}).key, "
415415 + "[[1, \" bb\" ]])" ),
416416 PROTO_MAP_FIELD_SELECT_STOPS_AT_ANY_BOUNDARY (
417417 "msg.map_string_any['k'].value" ,
418- "cel.@attribute(msg, [[311, \" map_string_any\" , -1 , [9, 11]]],"
418+ "cel.@attribute(msg, [[311, \" map_string_any\" , -10 , [9, 11]]],"
419419 + " {\" \" : google.protobuf.Any{}})[\" k\" ].value" ),
420420 ANY_FIELD (
421421 "msg.single_any" ,
@@ -561,7 +561,7 @@ public void optimize_withFileDescriptorsIterable_success() throws Exception {
561561 + " cel.@attribute(msg, [[51, \" repeated_nested_message\" , 11]],"
562562 + " [.cel.expr.conformance.proto3.TestAllTypes.NestedMessage{}]))'}" ,
563563 "{expression: '[[1]].map(cel, msg.map_int64_message)', expected: '[[1]].map(cel,"
564- + " cel.@attribute(msg, [[95, \" map_int64_message\" , -1 , [3, 11]]],"
564+ + " cel.@attribute(msg, [[95, \" map_int64_message\" , -10 , [3, 11]]],"
565565 + " {0: .cel.expr.conformance.proto3.TestAllTypes.NestedMessage{}}))'}"
566566 })
567567 public void optimize_messageNameUnderShadowingComprehensionVar_rewrites (
@@ -681,7 +681,7 @@ public void optimize_messageNameInBindInit_rewrites() throws Exception {
681681 + " cel.@attribute(msg, [[102, \" single_timestamp\" , 11]],"
682682 + " .google.protobuf.Timestamp{}))'}" ,
683683 "{expression: '[1].map(duration, msg.map_string_duration)', expected: '[1].map(duration,"
684- + " cel.@attribute(msg, [[243, \" map_string_duration\" , -1 , [9, 11]]],"
684+ + " cel.@attribute(msg, [[243, \" map_string_duration\" , -10 , [9, 11]]],"
685685 + " {\" \" : .google.protobuf.Duration{}}))'}"
686686 })
687687 public void optimize_durationOrTimestampUnderShadowingComprehensionVar_rewrites (
@@ -1724,7 +1724,7 @@ public void optimize_optionalMapKeySelection_rewritesMapField() throws Exception
17241724
17251725 assertThat (CEL_UNPARSER .unparse (optimizedAst ))
17261726 .isEqualTo (
1727- "cel.@attribute(msg, [[61, \" map_string_string\" , -1 , [9, 9]]], {\" \" : \" \" }).?key" );
1727+ "cel.@attribute(msg, [[61, \" map_string_string\" , -10 , [9, 9]]], {\" \" : \" \" }).?key" );
17281728 }
17291729
17301730 @ Test
0 commit comments