From 73eb5f9a8c1818b94a35bf4c41d67bacd1ab885a Mon Sep 17 00:00:00 2001 From: Jonathan Tatum Date: Thu, 26 Dec 2024 11:29:51 -0800 Subject: [PATCH] Opt tests into updated accumulator variable ahead of default enabling. PiperOrigin-RevId: 709846512 --- checker/src/test/resources/mapExpr.baseline | 28 ++-- .../src/test/resources/mapFilterExpr.baseline | 24 +-- .../resources/namespacedFunctions.baseline | 14 +- .../src/test/resources/quantifiers.baseline | 26 +-- checker/src/test/resources/types.baseline | 6 +- .../cel/common/ast/CelExprFormatterTest.java | 10 +- .../cel/common/ast/CelExprVisitorTest.java | 5 +- .../CelNavigableExprVisitorTest.java | 36 ++-- .../parser/CelParserParameterizedTest.java | 28 ++-- parser/src/test/resources/parser.baseline | 158 +++++++++--------- ...baseline => parser_legacyAccuVar.baseline} | 76 ++++----- .../dev/cel/testing/CelBaselineTestCase.java | 1 + 12 files changed, 213 insertions(+), 199 deletions(-) rename parser/src/test/resources/{parser_updatedAccuVar.baseline => parser_legacyAccuVar.baseline} (77%) diff --git a/checker/src/test/resources/mapExpr.baseline b/checker/src/test/resources/mapExpr.baseline index 4ddb9061..2f7964bc 100644 --- a/checker/src/test/resources/mapExpr.baseline +++ b/checker/src/test/resources/mapExpr.baseline @@ -9,14 +9,14 @@ __comprehension__( // Target x~cel.expr.conformance.proto3.TestAllTypes^x.repeated_int64~list(int), // Accumulator - __result__, + @result, // Init []~list(double), // LoopCondition true~bool, // LoopStep _+_( - __result__~list(double)^__result__, + @result~list(double)^@result, [ double( x~int^x @@ -24,7 +24,7 @@ __comprehension__( ]~list(double) )~list(double)^add_list, // Result - __result__~list(double)^__result__)~list(double) + @result~list(double)^@result)~list(double) Source: [].map(x, [].map(y, x in y && y in x)) declare x { @@ -32,8 +32,8 @@ declare x { } =====> ERROR: test_location:1:33: found no matching overload for '@in' applied to '(list(%elem0), %elem0)' (candidates: (%A7, list(%A7)),(%A8, map(%A8, %B9))) - | [].map(x, [].map(y, x in y && y in x)) - | ................................^ + | [].map(x, [].map(y, x in y && y in x)) + | ................................^ Source: [{}.map(c,c,c)]+[{}.map(c,c,c)] declare x { @@ -48,7 +48,7 @@ _+_( // Target {}~map(bool, dyn), // Accumulator - __result__, + @result, // Init []~list(bool), // LoopCondition @@ -57,15 +57,15 @@ _+_( _?_:_( c~bool^c, _+_( - __result__~list(bool)^__result__, + @result~list(bool)^@result, [ c~bool^c ]~list(bool) )~list(bool)^add_list, - __result__~list(bool)^__result__ + @result~list(bool)^@result )~list(bool)^conditional, // Result - __result__~list(bool)^__result__)~list(bool) + @result~list(bool)^@result)~list(bool) ]~list(list(bool)), [ __comprehension__( @@ -74,7 +74,7 @@ _+_( // Target {}~map(bool, dyn), // Accumulator - __result__, + @result, // Init []~list(bool), // LoopCondition @@ -83,14 +83,14 @@ _+_( _?_:_( c~bool^c, _+_( - __result__~list(bool)^__result__, + @result~list(bool)^@result, [ c~bool^c ]~list(bool) )~list(bool)^add_list, - __result__~list(bool)^__result__ + @result~list(bool)^@result )~list(bool)^conditional, // Result - __result__~list(bool)^__result__)~list(bool) + @result~list(bool)^@result)~list(bool) ]~list(list(bool)) -)~list(list(bool))^add_list +)~list(list(bool))^add_list \ No newline at end of file diff --git a/checker/src/test/resources/mapFilterExpr.baseline b/checker/src/test/resources/mapFilterExpr.baseline index 1a9fd224..1a66e493 100644 --- a/checker/src/test/resources/mapFilterExpr.baseline +++ b/checker/src/test/resources/mapFilterExpr.baseline @@ -9,7 +9,7 @@ __comprehension__( // Target x~cel.expr.conformance.proto3.TestAllTypes^x.repeated_int64~list(int), // Accumulator - __result__, + @result, // Init []~list(double), // LoopCondition @@ -21,17 +21,17 @@ __comprehension__( 0~int )~bool^greater_int64, _+_( - __result__~list(double)^__result__, + @result~list(double)^@result, [ double( x~int^x )~double^int64_to_double ]~list(double) )~list(double)^add_list, - __result__~list(double)^__result__ + @result~list(double)^@result )~list(double)^conditional, // Result - __result__~list(double)^__result__)~list(double) + @result~list(double)^@result)~list(double) Source: lists.filter(x, x > 1.5) declare x { @@ -47,7 +47,7 @@ __comprehension__( // Target lists~dyn^lists, // Accumulator - __result__, + @result, // Init []~list(dyn), // LoopCondition @@ -59,15 +59,15 @@ __comprehension__( 1.5~double )~bool^greater_double|greater_int64_double|greater_uint64_double, _+_( - __result__~list(dyn)^__result__, + @result~list(dyn)^@result, [ x~dyn^x ]~list(dyn) )~list(dyn)^add_list, - __result__~list(dyn)^__result__ + @result~list(dyn)^@result )~list(dyn)^conditional, // Result - __result__~list(dyn)^__result__)~list(dyn) + @result~list(dyn)^@result)~list(dyn) Source: args.user["myextension"].customAttributes.filter(x, x.name == "hobbies") declare x { @@ -89,7 +89,7 @@ __comprehension__( "myextension"~string )~dyn^index_map.customAttributes~dyn, // Accumulator - __result__, + @result, // Init []~list(dyn), // LoopCondition @@ -101,12 +101,12 @@ __comprehension__( "hobbies"~string )~bool^equals, _+_( - __result__~list(dyn)^__result__, + @result~list(dyn)^@result, [ x~dyn^x ]~list(dyn) )~list(dyn)^add_list, - __result__~list(dyn)^__result__ + @result~list(dyn)^@result )~list(dyn)^conditional, // Result - __result__~list(dyn)^__result__)~list(dyn) + @result~list(dyn)^@result)~list(dyn) \ No newline at end of file diff --git a/checker/src/test/resources/namespacedFunctions.baseline b/checker/src/test/resources/namespacedFunctions.baseline index 449ea511..b6ace0e3 100644 --- a/checker/src/test/resources/namespacedFunctions.baseline +++ b/checker/src/test/resources/namespacedFunctions.baseline @@ -84,14 +84,14 @@ __comprehension__( )~int^ns_func_overload ]~list(int), // Accumulator - __result__, + @result, // Init []~list(int), // LoopCondition true~bool, // LoopStep _+_( - __result__~list(int)^__result__, + @result~list(int)^@result, [ _*_( x~int^x, @@ -100,7 +100,7 @@ __comprehension__( ]~list(int) )~list(int)^add_list, // Result - __result__~list(int)^__result__)~list(int) + @result~list(int)^@result)~list(int) Source: [1, 2].map(x, x * ns.func('test')) declare ns.func { @@ -119,14 +119,14 @@ __comprehension__( 2~int ]~list(int), // Accumulator - __result__, + @result, // Init []~list(int), // LoopCondition true~bool, // LoopStep _+_( - __result__~list(int)^__result__, + @result~list(int)^@result, [ _*_( x~int^x, @@ -137,7 +137,7 @@ __comprehension__( ]~list(int) )~list(int)^add_list, // Result - __result__~list(int)^__result__)~list(int) + @result~list(int)^@result)~list(int) Source: func('hello') declare ns.func { @@ -165,4 +165,4 @@ ns.func( ns.func( "test"~string )~int^ns_func_overload -)~int^ns_member_overload +)~int^ns_member_overload \ No newline at end of file diff --git a/checker/src/test/resources/quantifiers.baseline b/checker/src/test/resources/quantifiers.baseline index 2573ca27..3f204a6f 100644 --- a/checker/src/test/resources/quantifiers.baseline +++ b/checker/src/test/resources/quantifiers.baseline @@ -11,48 +11,48 @@ _&&_( // Target x~cel.expr.conformance.proto3.TestAllTypes^x.repeated_int64~list(int), // Accumulator - __result__, + @result, // Init true~bool, // LoopCondition @not_strictly_false( - __result__~bool^__result__ + @result~bool^@result )~bool^not_strictly_false, // LoopStep _&&_( - __result__~bool^__result__, + @result~bool^@result, _>_( e~int^e, 0~int )~bool^greater_int64 )~bool^logical_and, // Result - __result__~bool^__result__)~bool, + @result~bool^@result)~bool, __comprehension__( // Variable e, // Target x~cel.expr.conformance.proto3.TestAllTypes^x.repeated_int64~list(int), // Accumulator - __result__, + @result, // Init false~bool, // LoopCondition @not_strictly_false( !_( - __result__~bool^__result__ + @result~bool^@result )~bool^logical_not )~bool^not_strictly_false, // LoopStep _||_( - __result__~bool^__result__, + @result~bool^@result, _<_( e~int^e, 0~int )~bool^less_int64 )~bool^logical_or, // Result - __result__~bool^__result__)~bool + @result~bool^@result)~bool )~bool^logical_and, __comprehension__( // Variable @@ -60,7 +60,7 @@ _&&_( // Target x~cel.expr.conformance.proto3.TestAllTypes^x.repeated_int64~list(int), // Accumulator - __result__, + @result, // Init 0~int, // LoopCondition @@ -72,14 +72,14 @@ _&&_( 0~int )~bool^equals, _+_( - __result__~int^__result__, + @result~int^@result, 1~int )~int^add_int64, - __result__~int^__result__ + @result~int^@result )~int^conditional, // Result _==_( - __result__~int^__result__, + @result~int^@result, 1~int )~bool^equals)~bool -)~bool^logical_and +)~bool^logical_and \ No newline at end of file diff --git a/checker/src/test/resources/types.baseline b/checker/src/test/resources/types.baseline index 61f3f442..939e0ed9 100644 --- a/checker/src/test/resources/types.baseline +++ b/checker/src/test/resources/types.baseline @@ -27,14 +27,14 @@ __comprehension__( // Target {}~map(dyn, dyn), // Accumulator - __result__, + @result, // Init []~list(list(dyn)), // LoopCondition true~bool, // LoopStep _+_( - __result__~list(list(dyn))^__result__, + @result~list(list(dyn))^@result, [ [ c~dyn^c, @@ -45,4 +45,4 @@ __comprehension__( ]~list(list(dyn)) )~list(list(dyn))^add_list, // Result - __result__~list(list(dyn))^__result__)~list(list(dyn)) + @result~list(list(dyn))^@result)~list(list(dyn)) \ No newline at end of file diff --git a/common/src/test/java/dev/cel/common/ast/CelExprFormatterTest.java b/common/src/test/java/dev/cel/common/ast/CelExprFormatterTest.java index 002d9d2a..8bab0ee5 100644 --- a/common/src/test/java/dev/cel/common/ast/CelExprFormatterTest.java +++ b/common/src/test/java/dev/cel/common/ast/CelExprFormatterTest.java @@ -20,6 +20,7 @@ import com.google.testing.junit.testparameterinjector.TestParameterInjector; import dev.cel.common.CelAbstractSyntaxTree; import dev.cel.common.CelFunctionDecl; +import dev.cel.common.CelOptions; import dev.cel.common.CelOverloadDecl; import dev.cel.common.types.SimpleType; import dev.cel.common.types.StructTypeReference; @@ -272,6 +273,7 @@ public void map() throws Exception { public void comprehension() throws Exception { CelCompiler celCompiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.STANDARD_MACROS) .build(); CelAbstractSyntaxTree ast = celCompiler.compile("[1, 2, 3].exists(x, x > 0)").getAst(); @@ -291,7 +293,7 @@ public void comprehension() throws Exception { + " }\n" + " }\n" + " }\n" - + " accu_var: __result__\n" + + " accu_var: @result\n" + " accu_init: {\n" + " CONSTANT [10] { value: false }\n" + " }\n" @@ -303,7 +305,7 @@ public void comprehension() throws Exception { + " function: !_\n" + " args: {\n" + " IDENT [11] {\n" - + " name: __result__\n" + + " name: @result\n" + " }\n" + " }\n" + " }\n" @@ -315,7 +317,7 @@ public void comprehension() throws Exception { + " function: _||_\n" + " args: {\n" + " IDENT [14] {\n" - + " name: __result__\n" + + " name: @result\n" + " }\n" + " CALL [8] {\n" + " function: _>_\n" @@ -331,7 +333,7 @@ public void comprehension() throws Exception { + " }\n" + " result: {\n" + " IDENT [16] {\n" - + " name: __result__\n" + + " name: @result\n" + " }\n" + " }\n" + "}"); diff --git a/common/src/test/java/dev/cel/common/ast/CelExprVisitorTest.java b/common/src/test/java/dev/cel/common/ast/CelExprVisitorTest.java index ef1188ee..9365eb61 100644 --- a/common/src/test/java/dev/cel/common/ast/CelExprVisitorTest.java +++ b/common/src/test/java/dev/cel/common/ast/CelExprVisitorTest.java @@ -20,6 +20,7 @@ import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableList; import dev.cel.common.CelAbstractSyntaxTree; +import dev.cel.common.CelOptions; import dev.cel.common.ast.CelExpr.CelCall; import dev.cel.common.ast.CelExpr.CelComprehension; import dev.cel.common.ast.CelExpr.CelIdent; @@ -245,6 +246,7 @@ public void visitCall() throws Exception { public void visitStruct_fieldkey() throws Exception { CelCompiler celCompiler = CelCompilerFactory.standardCelCompilerBuilder() + .addMessageTypes(TestAllTypes.getDescriptor()) .setContainer(TestAllTypes.getDescriptor().getFullName()) .build(); @@ -320,6 +322,7 @@ public void visitList() throws Exception { public void visitComprehension() throws Exception { CelCompiler celCompiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.ALL) .build(); CelAbstractSyntaxTree ast = celCompiler.compile("[1, 1].all(x, x == 1)").getAst(); @@ -343,7 +346,7 @@ public void visitComprehension() throws Exception { assertThat(comprehension.loopStep().call().args()).hasSize(2); assertThat(visitedReference.list().get().elements()).isEqualTo(iterRangeElements); assertThat(visitedReference.identifier()) - .hasValue(CelIdent.newBuilder().setName("__result__").build()); + .hasValue(CelIdent.newBuilder().setName("@result").build()); assertThat(visitedReference.arguments()).hasSize(10); } diff --git a/common/src/test/java/dev/cel/common/navigation/CelNavigableExprVisitorTest.java b/common/src/test/java/dev/cel/common/navigation/CelNavigableExprVisitorTest.java index 2dddb515..0a4ba42b 100644 --- a/common/src/test/java/dev/cel/common/navigation/CelNavigableExprVisitorTest.java +++ b/common/src/test/java/dev/cel/common/navigation/CelNavigableExprVisitorTest.java @@ -810,6 +810,7 @@ public void emptyMapConstruction_allNodesReturned() throws Exception { public void comprehension_preOrder_allNodesReturned() throws Exception { CelCompiler compiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.EXISTS) .build(); CelAbstractSyntaxTree ast = compiler.compile("[true].exists(i, i)").getAst(); @@ -825,7 +826,7 @@ public void comprehension_preOrder_allNodesReturned() throws Exception { CelExpr iterRangeConstExpr = CelExpr.ofConstant(2, CelConstant.ofValue(true)); CelExpr iterRange = CelExpr.ofList(1, ImmutableList.of(iterRangeConstExpr), ImmutableList.of()); CelExpr accuInit = CelExpr.ofConstant(6, CelConstant.ofValue(false)); - CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "__result__"); + CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "@result"); CelExpr loopConditionCallExpr = CelExpr.ofCall( 8, @@ -838,7 +839,7 @@ public void comprehension_preOrder_allNodesReturned() throws Exception { Optional.empty(), Operator.NOT_STRICTLY_FALSE.getFunction(), ImmutableList.of(loopConditionCallExpr)); - CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "__result__"); + CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "@result"); CelExpr loopStepVarExpr = CelExpr.ofIdent(5, "i"); CelExpr loopStep = CelExpr.ofCall( @@ -846,10 +847,10 @@ public void comprehension_preOrder_allNodesReturned() throws Exception { Optional.empty(), Operator.LOGICAL_OR.getFunction(), ImmutableList.of(loopStepResultExpr, loopStepVarExpr)); - CelExpr result = CelExpr.ofIdent(12, "__result__"); + CelExpr result = CelExpr.ofIdent(12, "@result"); CelExpr comprehension = CelExpr.ofComprehension( - 13, "i", iterRange, "__result__", accuInit, loopCondition, loopStep, result); + 13, "i", iterRange, "@result", accuInit, loopCondition, loopStep, result); assertThat(allNodes).hasSize(11); assertThat(allNodes) .containsExactly( @@ -871,6 +872,7 @@ public void comprehension_preOrder_allNodesReturned() throws Exception { public void comprehension_postOrder_allNodesReturned() throws Exception { CelCompiler compiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.EXISTS) .build(); CelAbstractSyntaxTree ast = compiler.compile("[true].exists(i, i)").getAst(); @@ -886,7 +888,7 @@ public void comprehension_postOrder_allNodesReturned() throws Exception { CelExpr iterRangeConstExpr = CelExpr.ofConstant(2, CelConstant.ofValue(true)); CelExpr iterRange = CelExpr.ofList(1, ImmutableList.of(iterRangeConstExpr), ImmutableList.of()); CelExpr accuInit = CelExpr.ofConstant(6, CelConstant.ofValue(false)); - CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "__result__"); + CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "@result"); CelExpr loopConditionCallExpr = CelExpr.ofCall( 8, @@ -899,7 +901,7 @@ public void comprehension_postOrder_allNodesReturned() throws Exception { Optional.empty(), Operator.NOT_STRICTLY_FALSE.getFunction(), ImmutableList.of(loopConditionCallExpr)); - CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "__result__"); + CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "@result"); CelExpr loopStepVarExpr = CelExpr.ofIdent(5, "i"); CelExpr loopStep = CelExpr.ofCall( @@ -907,10 +909,10 @@ public void comprehension_postOrder_allNodesReturned() throws Exception { Optional.empty(), Operator.LOGICAL_OR.getFunction(), ImmutableList.of(loopStepResultExpr, loopStepVarExpr)); - CelExpr result = CelExpr.ofIdent(12, "__result__"); + CelExpr result = CelExpr.ofIdent(12, "@result"); CelExpr comprehension = CelExpr.ofComprehension( - 13, "i", iterRange, "__result__", accuInit, loopCondition, loopStep, result); + 13, "i", iterRange, "@result", accuInit, loopCondition, loopStep, result); assertThat(allNodes).hasSize(11); assertThat(allNodes) .containsExactly( @@ -1008,6 +1010,7 @@ public void comprehension_postOrder_maxIdsSet() throws Exception { public void comprehension_allNodes_parentsPopulated() throws Exception { CelCompiler compiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.EXISTS) .build(); CelAbstractSyntaxTree ast = compiler.compile("[true].exists(i, i)").getAst(); @@ -1018,7 +1021,7 @@ public void comprehension_allNodes_parentsPopulated() throws Exception { CelExpr iterRangeConstExpr = CelExpr.ofConstant(2, CelConstant.ofValue(true)); CelExpr iterRange = CelExpr.ofList(1, ImmutableList.of(iterRangeConstExpr), ImmutableList.of()); CelExpr accuInit = CelExpr.ofConstant(6, CelConstant.ofValue(false)); - CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "__result__"); + CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "@result"); CelExpr loopConditionCallExpr = CelExpr.ofCall( 8, @@ -1031,7 +1034,7 @@ public void comprehension_allNodes_parentsPopulated() throws Exception { Optional.empty(), Operator.NOT_STRICTLY_FALSE.getFunction(), ImmutableList.of(loopConditionCallExpr)); - CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "__result__"); + CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "@result"); CelExpr loopStepVarExpr = CelExpr.ofIdent(5, "i"); CelExpr loopStep = CelExpr.ofCall( @@ -1039,10 +1042,10 @@ public void comprehension_allNodes_parentsPopulated() throws Exception { Optional.empty(), Operator.LOGICAL_OR.getFunction(), ImmutableList.of(loopStepResultExpr, loopStepVarExpr)); - CelExpr result = CelExpr.ofIdent(12, "__result__"); + CelExpr result = CelExpr.ofIdent(12, "@result"); CelExpr comprehension = CelExpr.ofComprehension( - 13, "i", iterRange, "__result__", accuInit, loopCondition, loopStep, result); + 13, "i", iterRange, "@result", accuInit, loopCondition, loopStep, result); assertThat(allNodes).hasSize(11); assertThat(allNodes.get(0).parent()).isEmpty(); // comprehension assertThat(allNodes.get(1).parent().get().expr()).isEqualTo(comprehension); // iter_range @@ -1066,6 +1069,7 @@ public void comprehension_allNodes_parentsPopulated() throws Exception { public void comprehension_filterComprehension_allNodesReturned() throws Exception { CelCompiler compiler = CelCompilerFactory.standardCelCompilerBuilder() + .setOptions(CelOptions.current().enableHiddenAccumulatorVar(true).build()) .setStandardMacros(CelStandardMacro.EXISTS) .build(); CelAbstractSyntaxTree ast = compiler.compile("[true].exists(i, i)").getAst(); @@ -1081,7 +1085,7 @@ public void comprehension_filterComprehension_allNodesReturned() throws Exceptio CelExpr iterRangeConstExpr = CelExpr.ofConstant(2, CelConstant.ofValue(true)); CelExpr iterRange = CelExpr.ofList(1, ImmutableList.of(iterRangeConstExpr), ImmutableList.of()); CelExpr accuInit = CelExpr.ofConstant(6, CelConstant.ofValue(false)); - CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "__result__"); + CelExpr loopConditionIdentExpr = CelExpr.ofIdent(7, "@result"); CelExpr loopConditionCallExpr = CelExpr.ofCall( 8, @@ -1094,7 +1098,7 @@ public void comprehension_filterComprehension_allNodesReturned() throws Exceptio Optional.empty(), Operator.NOT_STRICTLY_FALSE.getFunction(), ImmutableList.of(loopConditionCallExpr)); - CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "__result__"); + CelExpr loopStepResultExpr = CelExpr.ofIdent(10, "@result"); CelExpr loopStepVarExpr = CelExpr.ofIdent(5, "i"); CelExpr loopStep = CelExpr.ofCall( @@ -1102,10 +1106,10 @@ public void comprehension_filterComprehension_allNodesReturned() throws Exceptio Optional.empty(), Operator.LOGICAL_OR.getFunction(), ImmutableList.of(loopStepResultExpr, loopStepVarExpr)); - CelExpr result = CelExpr.ofIdent(12, "__result__"); + CelExpr result = CelExpr.ofIdent(12, "@result"); CelExpr comprehension = CelExpr.ofComprehension( - 13, "i", iterRange, "__result__", accuInit, loopCondition, loopStep, result); + 13, "i", iterRange, "@result", accuInit, loopCondition, loopStep, result); assertThat(allNodes).hasSize(1); assertThat(allNodes.get(0).expr()).isEqualTo(comprehension); } diff --git a/parser/src/test/java/dev/cel/parser/CelParserParameterizedTest.java b/parser/src/test/java/dev/cel/parser/CelParserParameterizedTest.java index 073b548b..22d40117 100644 --- a/parser/src/test/java/dev/cel/parser/CelParserParameterizedTest.java +++ b/parser/src/test/java/dev/cel/parser/CelParserParameterizedTest.java @@ -69,16 +69,20 @@ public final class CelParserParameterizedTest extends BaselineTestCase { .setId(1) .setConstant(CelConstant.ofValue(10L)) .build()))) - .setOptions(CelOptions.current().populateMacroCalls(true).build()) + .setOptions( + CelOptions.current() + .populateMacroCalls(true) + .enableHiddenAccumulatorVar(true) + .build()) .build(); - private static final CelParser PARSER_WITH_UPDATED_ACCU_VAR = + private static final CelParser PARSER_WITH_OLD_ACCU_VAR = PARSER .toParserBuilder() .setOptions( CelOptions.current() .populateMacroCalls(true) - .enableHiddenAccumulatorVar(true) + .enableHiddenAccumulatorVar(false) .build()) .build(); @@ -120,7 +124,7 @@ public void parser() { runTest(PARSER, "a"); runTest(PARSER, "a?b:c"); runTest(PARSER, "a || b"); - runTest(PARSER, "a || b || c || d || e || f "); + runTest(PARSER, "a || b || c || d || e || f"); runTest(PARSER, "a && b"); runTest(PARSER, "a && b && c && d && e && f && g"); runTest(PARSER, "a && b && c && d || e && f && g && h"); @@ -204,14 +208,14 @@ public void parser() { } @Test - public void parser_updatedAccuVar() { - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "x * 2"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "has(m.f)"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "m.exists_one(v, f)"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "m.all(v, f)"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "m.map(v, f)"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "m.map(v, p, f)"); - runTest(PARSER_WITH_UPDATED_ACCU_VAR, "m.filter(v, p)"); + public void parser_legacyAccuVar() { + runTest(PARSER_WITH_OLD_ACCU_VAR, "x * 2"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "has(m.f)"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "m.exists_one(v, f)"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "m.all(v, f)"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "m.map(v, f)"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "m.map(v, p, f)"); + runTest(PARSER_WITH_OLD_ACCU_VAR, "m.filter(v, p)"); } @Test diff --git a/parser/src/test/resources/parser.baseline b/parser/src/test/resources/parser.baseline index 455cf24d..435b92a1 100644 --- a/parser/src/test/resources/parser.baseline +++ b/parser/src/test/resources/parser.baseline @@ -735,7 +735,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init 0^#5:int64#, // LoopCondition @@ -744,14 +744,14 @@ P: __comprehension__( _?_:_( f^#4:Expr.Ident#, _+_( - __result__^#7:Expr.Ident#, + @result^#7:Expr.Ident#, 1^#8:int64# )^#9:Expr.Call#, - __result__^#10:Expr.Ident# + @result^#10:Expr.Ident# )^#11:Expr.Call#, // Result _==_( - __result__^#12:Expr.Ident#, + @result^#12:Expr.Ident#, 1^#13:int64# )^#14:Expr.Call#)^#15:Expr.Comprehension# L: __comprehension__( @@ -760,7 +760,7 @@ L: __comprehension__( // Target m^#1[1,0]#, // Accumulator - __result__, + @result, // Init 0^#5[1,12]#, // LoopCondition @@ -769,14 +769,14 @@ L: __comprehension__( _?_:_( f^#4[1,16]#, _+_( - __result__^#7[1,12]#, + @result^#7[1,12]#, 1^#8[1,12]# )^#9[1,12]#, - __result__^#10[1,12]# + @result^#10[1,12]# )^#11[1,12]#, // Result _==_( - __result__^#12[1,12]#, + @result^#12[1,12]#, 1^#13[1,12]# )^#14[1,12]#)^#15[1,12]# M: m^#1:Expr.Ident#.exists_one( @@ -792,40 +792,40 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#5:Expr.CreateList#, // LoopCondition true^#6:bool#, // LoopStep _+_( - __result__^#7:Expr.Ident#, + @result^#7:Expr.Ident#, [ f^#4:Expr.Ident# ]^#8:Expr.CreateList# )^#9:Expr.Call#, // Result - __result__^#10:Expr.Ident#)^#11:Expr.Comprehension# + @result^#10:Expr.Ident#)^#11:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - __result__, + @result, // Init []^#5[1,5]#, // LoopCondition true^#6[1,5]#, // LoopStep _+_( - __result__^#7[1,5]#, + @result^#7[1,5]#, [ f^#4[1,9]# ]^#8[1,5]# )^#9[1,5]#, // Result - __result__^#10[1,5]#)^#11[1,5]# + @result^#10[1,5]#)^#11[1,5]# M: m^#1:Expr.Ident#.map( v^#3:Expr.Ident#, f^#4:Expr.Ident# @@ -839,7 +839,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#6:Expr.CreateList#, // LoopCondition @@ -848,22 +848,22 @@ P: __comprehension__( _?_:_( p^#4:Expr.Ident#, _+_( - __result__^#8:Expr.Ident#, + @result^#8:Expr.Ident#, [ f^#5:Expr.Ident# ]^#9:Expr.CreateList# )^#10:Expr.Call#, - __result__^#11:Expr.Ident# + @result^#11:Expr.Ident# )^#12:Expr.Call#, // Result - __result__^#13:Expr.Ident#)^#14:Expr.Comprehension# + @result^#13:Expr.Ident#)^#14:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - __result__, + @result, // Init []^#6[1,5]#, // LoopCondition @@ -872,15 +872,15 @@ L: __comprehension__( _?_:_( p^#4[1,9]#, _+_( - __result__^#8[1,5]#, + @result^#8[1,5]#, [ f^#5[1,12]# ]^#9[1,5]# )^#10[1,5]#, - __result__^#11[1,5]# + @result^#11[1,5]# )^#12[1,5]#, // Result - __result__^#13[1,5]#)^#14[1,5]# + @result^#13[1,5]#)^#14[1,5]# M: m^#1:Expr.Ident#.map( v^#3:Expr.Ident#, p^#4:Expr.Ident#, @@ -895,7 +895,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#5:Expr.CreateList#, // LoopCondition @@ -904,22 +904,22 @@ P: __comprehension__( _?_:_( p^#4:Expr.Ident#, _+_( - __result__^#7:Expr.Ident#, + @result^#7:Expr.Ident#, [ v^#3:Expr.Ident# ]^#8:Expr.CreateList# )^#9:Expr.Call#, - __result__^#10:Expr.Ident# + @result^#10:Expr.Ident# )^#11:Expr.Call#, // Result - __result__^#12:Expr.Ident#)^#13:Expr.Comprehension# + @result^#12:Expr.Ident#)^#13:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - __result__, + @result, // Init []^#5[1,8]#, // LoopCondition @@ -928,15 +928,15 @@ L: __comprehension__( _?_:_( p^#4[1,12]#, _+_( - __result__^#7[1,8]#, + @result^#7[1,8]#, [ v^#3[1,9]# ]^#8[1,8]# )^#9[1,8]#, - __result__^#10[1,8]# + @result^#10[1,8]# )^#11[1,8]#, // Result - __result__^#12[1,8]#)^#13[1,8]# + @result^#12[1,8]#)^#13[1,8]# M: m^#1:Expr.Ident#.filter( v^#3:Expr.Ident#, p^#4:Expr.Ident# @@ -1205,7 +1205,7 @@ P: __comprehension__( // Target x^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#19:Expr.CreateList#, // LoopCondition @@ -1218,7 +1218,7 @@ P: __comprehension__( // Target y^#4:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#10:Expr.CreateList#, // LoopCondition @@ -1230,32 +1230,32 @@ P: __comprehension__( 0^#9:int64# )^#8:Expr.Call#, _+_( - __result__^#12:Expr.Ident#, + @result^#12:Expr.Ident#, [ z^#6:Expr.Ident# ]^#13:Expr.CreateList# )^#14:Expr.Call#, - __result__^#15:Expr.Ident# + @result^#15:Expr.Ident# )^#16:Expr.Call#, // Result - __result__^#17:Expr.Ident#)^#18:Expr.Comprehension#, + @result^#17:Expr.Ident#)^#18:Expr.Comprehension#, _+_( - __result__^#21:Expr.Ident#, + @result^#21:Expr.Ident#, [ y^#3:Expr.Ident# ]^#22:Expr.CreateList# )^#23:Expr.Call#, - __result__^#24:Expr.Ident# + @result^#24:Expr.Ident# )^#25:Expr.Call#, // Result - __result__^#26:Expr.Ident#)^#27:Expr.Comprehension# + @result^#26:Expr.Ident#)^#27:Expr.Comprehension# L: __comprehension__( // Variable y, // Target x^#1[1,0]#, // Accumulator - __result__, + @result, // Init []^#19[1,8]#, // LoopCondition @@ -1268,7 +1268,7 @@ L: __comprehension__( // Target y^#4[1,12]#, // Accumulator - __result__, + @result, // Init []^#10[1,20]#, // LoopCondition @@ -1280,25 +1280,25 @@ L: __comprehension__( 0^#9[1,28]# )^#8[1,26]#, _+_( - __result__^#12[1,20]#, + @result^#12[1,20]#, [ z^#6[1,21]# ]^#13[1,20]# )^#14[1,20]#, - __result__^#15[1,20]# + @result^#15[1,20]# )^#16[1,20]#, // Result - __result__^#17[1,20]#)^#18[1,20]#, + @result^#17[1,20]#)^#18[1,20]#, _+_( - __result__^#21[1,8]#, + @result^#21[1,8]#, [ y^#3[1,9]# ]^#22[1,8]# )^#23[1,8]#, - __result__^#24[1,8]# + @result^#24[1,8]# )^#25[1,8]#, // Result - __result__^#26[1,8]#)^#27[1,8]# + @result^#26[1,8]#)^#27[1,8]# M: x^#1:Expr.Ident#.filter( y^#3:Expr.Ident#, ^#18:filter# @@ -1319,7 +1319,7 @@ P: __comprehension__( // Target a^#2:Expr.Ident#.b~test-only~^#4:Expr.Select#, // Accumulator - __result__, + @result, // Init []^#8:Expr.CreateList#, // LoopCondition @@ -1328,22 +1328,22 @@ P: __comprehension__( _?_:_( c^#7:Expr.Ident#, _+_( - __result__^#10:Expr.Ident#, + @result^#10:Expr.Ident#, [ c^#6:Expr.Ident# ]^#11:Expr.CreateList# )^#12:Expr.Call#, - __result__^#13:Expr.Ident# + @result^#13:Expr.Ident# )^#14:Expr.Call#, // Result - __result__^#15:Expr.Ident#)^#16:Expr.Comprehension# + @result^#15:Expr.Ident#)^#16:Expr.Comprehension# L: __comprehension__( // Variable c, // Target a^#2[1,4]#.b~test-only~^#4[1,3]#, // Accumulator - __result__, + @result, // Init []^#8[1,15]#, // LoopCondition @@ -1352,15 +1352,15 @@ L: __comprehension__( _?_:_( c^#7[1,19]#, _+_( - __result__^#10[1,15]#, + @result^#10[1,15]#, [ c^#6[1,16]# ]^#11[1,15]# )^#12[1,15]#, - __result__^#13[1,15]# + @result^#13[1,15]# )^#14[1,15]#, // Result - __result__^#15[1,15]#)^#16[1,15]# + @result^#15[1,15]#)^#16[1,15]# M: ^#4:has#.filter( c^#6:Expr.Ident#, c^#7:Expr.Ident# @@ -1377,7 +1377,7 @@ P: __comprehension__( // Target x^#1:Expr.Ident#, // Accumulator - __result__, + @result, // Init []^#35:Expr.CreateList#, // LoopCondition @@ -1391,62 +1391,62 @@ P: __comprehension__( // Target y^#4:Expr.Ident#, // Accumulator - __result__, + @result, // Init false^#11:bool#, // LoopCondition @not_strictly_false( !_( - __result__^#12:Expr.Ident# + @result^#12:Expr.Ident# )^#13:Expr.Call# )^#14:Expr.Call#, // LoopStep _||_( - __result__^#15:Expr.Ident#, + @result^#15:Expr.Ident#, z^#8:Expr.Ident#.a~test-only~^#10:Expr.Select# )^#16:Expr.Call#, // Result - __result__^#17:Expr.Ident#)^#18:Expr.Comprehension#, + @result^#17:Expr.Ident#)^#18:Expr.Comprehension#, __comprehension__( // Variable z, // Target y^#20:Expr.Ident#, // Accumulator - __result__, + @result, // Init false^#27:bool#, // LoopCondition @not_strictly_false( !_( - __result__^#28:Expr.Ident# + @result^#28:Expr.Ident# )^#29:Expr.Call# )^#30:Expr.Call#, // LoopStep _||_( - __result__^#31:Expr.Ident#, + @result^#31:Expr.Ident#, z^#24:Expr.Ident#.b~test-only~^#26:Expr.Select# )^#32:Expr.Call#, // Result - __result__^#33:Expr.Ident#)^#34:Expr.Comprehension# + @result^#33:Expr.Ident#)^#34:Expr.Comprehension# )^#19:Expr.Call#, _+_( - __result__^#37:Expr.Ident#, + @result^#37:Expr.Ident#, [ y^#3:Expr.Ident# ]^#38:Expr.CreateList# )^#39:Expr.Call#, - __result__^#40:Expr.Ident# + @result^#40:Expr.Ident# )^#41:Expr.Call#, // Result - __result__^#42:Expr.Ident#)^#43:Expr.Comprehension# + @result^#42:Expr.Ident#)^#43:Expr.Comprehension# L: __comprehension__( // Variable y, // Target x^#1[1,0]#, // Accumulator - __result__, + @result, // Init []^#35[1,8]#, // LoopCondition @@ -1460,55 +1460,55 @@ L: __comprehension__( // Target y^#4[1,12]#, // Accumulator - __result__, + @result, // Init false^#11[1,20]#, // LoopCondition @not_strictly_false( !_( - __result__^#12[1,20]# + @result^#12[1,20]# )^#13[1,20]# )^#14[1,20]#, // LoopStep _||_( - __result__^#15[1,20]#, + @result^#15[1,20]#, z^#8[1,28]#.a~test-only~^#10[1,27]# )^#16[1,20]#, // Result - __result__^#17[1,20]#)^#18[1,20]#, + @result^#17[1,20]#)^#18[1,20]#, __comprehension__( // Variable z, // Target y^#20[1,37]#, // Accumulator - __result__, + @result, // Init false^#27[1,45]#, // LoopCondition @not_strictly_false( !_( - __result__^#28[1,45]# + @result^#28[1,45]# )^#29[1,45]# )^#30[1,45]#, // LoopStep _||_( - __result__^#31[1,45]#, + @result^#31[1,45]#, z^#24[1,53]#.b~test-only~^#26[1,52]# )^#32[1,45]#, // Result - __result__^#33[1,45]#)^#34[1,45]# + @result^#33[1,45]#)^#34[1,45]# )^#19[1,34]#, _+_( - __result__^#37[1,8]#, + @result^#37[1,8]#, [ y^#3[1,9]# ]^#38[1,8]# )^#39[1,8]#, - __result__^#40[1,8]# + @result^#40[1,8]# )^#41[1,8]#, // Result - __result__^#42[1,8]#)^#43[1,8]# + @result^#42[1,8]#)^#43[1,8]# M: x^#1:Expr.Ident#.filter( y^#3:Expr.Ident#, _&&_( @@ -1622,4 +1622,4 @@ L: [ I: while =====> P: while^#1:Expr.Ident# -L: while^#1[1,0]# +L: while^#1[1,0]# \ No newline at end of file diff --git a/parser/src/test/resources/parser_updatedAccuVar.baseline b/parser/src/test/resources/parser_legacyAccuVar.baseline similarity index 77% rename from parser/src/test/resources/parser_updatedAccuVar.baseline rename to parser/src/test/resources/parser_legacyAccuVar.baseline index e2d198fc..5f9a48b3 100644 --- a/parser/src/test/resources/parser_updatedAccuVar.baseline +++ b/parser/src/test/resources/parser_legacyAccuVar.baseline @@ -25,7 +25,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - @result, + __result__, // Init 0^#5:int64#, // LoopCondition @@ -34,14 +34,14 @@ P: __comprehension__( _?_:_( f^#4:Expr.Ident#, _+_( - @result^#7:Expr.Ident#, + __result__^#7:Expr.Ident#, 1^#8:int64# )^#9:Expr.Call#, - @result^#10:Expr.Ident# + __result__^#10:Expr.Ident# )^#11:Expr.Call#, // Result _==_( - @result^#12:Expr.Ident#, + __result__^#12:Expr.Ident#, 1^#13:int64# )^#14:Expr.Call#)^#15:Expr.Comprehension# L: __comprehension__( @@ -50,7 +50,7 @@ L: __comprehension__( // Target m^#1[1,0]#, // Accumulator - @result, + __result__, // Init 0^#5[1,12]#, // LoopCondition @@ -59,14 +59,14 @@ L: __comprehension__( _?_:_( f^#4[1,16]#, _+_( - @result^#7[1,12]#, + __result__^#7[1,12]#, 1^#8[1,12]# )^#9[1,12]#, - @result^#10[1,12]# + __result__^#10[1,12]# )^#11[1,12]#, // Result _==_( - @result^#12[1,12]#, + __result__^#12[1,12]#, 1^#13[1,12]# )^#14[1,12]#)^#15[1,12]# M: m^#1:Expr.Ident#.exists_one( @@ -82,40 +82,40 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - @result, + __result__, // Init true^#5:bool#, // LoopCondition @not_strictly_false( - @result^#6:Expr.Ident# + __result__^#6:Expr.Ident# )^#7:Expr.Call#, // LoopStep _&&_( - @result^#8:Expr.Ident#, + __result__^#8:Expr.Ident#, f^#4:Expr.Ident# )^#9:Expr.Call#, // Result - @result^#10:Expr.Ident#)^#11:Expr.Comprehension# + __result__^#10:Expr.Ident#)^#11:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - @result, + __result__, // Init true^#5[1,5]#, // LoopCondition @not_strictly_false( - @result^#6[1,5]# + __result__^#6[1,5]# )^#7[1,5]#, // LoopStep _&&_( - @result^#8[1,5]#, + __result__^#8[1,5]#, f^#4[1,9]# )^#9[1,5]#, // Result - @result^#10[1,5]#)^#11[1,5]# + __result__^#10[1,5]#)^#11[1,5]# M: m^#1:Expr.Ident#.all( v^#3:Expr.Ident#, f^#4:Expr.Ident# @@ -129,40 +129,40 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - @result, + __result__, // Init []^#5:Expr.CreateList#, // LoopCondition true^#6:bool#, // LoopStep _+_( - @result^#7:Expr.Ident#, + __result__^#7:Expr.Ident#, [ f^#4:Expr.Ident# ]^#8:Expr.CreateList# )^#9:Expr.Call#, // Result - @result^#10:Expr.Ident#)^#11:Expr.Comprehension# + __result__^#10:Expr.Ident#)^#11:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - @result, + __result__, // Init []^#5[1,5]#, // LoopCondition true^#6[1,5]#, // LoopStep _+_( - @result^#7[1,5]#, + __result__^#7[1,5]#, [ f^#4[1,9]# ]^#8[1,5]# )^#9[1,5]#, // Result - @result^#10[1,5]#)^#11[1,5]# + __result__^#10[1,5]#)^#11[1,5]# M: m^#1:Expr.Ident#.map( v^#3:Expr.Ident#, f^#4:Expr.Ident# @@ -176,7 +176,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - @result, + __result__, // Init []^#6:Expr.CreateList#, // LoopCondition @@ -185,22 +185,22 @@ P: __comprehension__( _?_:_( p^#4:Expr.Ident#, _+_( - @result^#8:Expr.Ident#, + __result__^#8:Expr.Ident#, [ f^#5:Expr.Ident# ]^#9:Expr.CreateList# )^#10:Expr.Call#, - @result^#11:Expr.Ident# + __result__^#11:Expr.Ident# )^#12:Expr.Call#, // Result - @result^#13:Expr.Ident#)^#14:Expr.Comprehension# + __result__^#13:Expr.Ident#)^#14:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - @result, + __result__, // Init []^#6[1,5]#, // LoopCondition @@ -209,15 +209,15 @@ L: __comprehension__( _?_:_( p^#4[1,9]#, _+_( - @result^#8[1,5]#, + __result__^#8[1,5]#, [ f^#5[1,12]# ]^#9[1,5]# )^#10[1,5]#, - @result^#11[1,5]# + __result__^#11[1,5]# )^#12[1,5]#, // Result - @result^#13[1,5]#)^#14[1,5]# + __result__^#13[1,5]#)^#14[1,5]# M: m^#1:Expr.Ident#.map( v^#3:Expr.Ident#, p^#4:Expr.Ident#, @@ -232,7 +232,7 @@ P: __comprehension__( // Target m^#1:Expr.Ident#, // Accumulator - @result, + __result__, // Init []^#5:Expr.CreateList#, // LoopCondition @@ -241,22 +241,22 @@ P: __comprehension__( _?_:_( p^#4:Expr.Ident#, _+_( - @result^#7:Expr.Ident#, + __result__^#7:Expr.Ident#, [ v^#3:Expr.Ident# ]^#8:Expr.CreateList# )^#9:Expr.Call#, - @result^#10:Expr.Ident# + __result__^#10:Expr.Ident# )^#11:Expr.Call#, // Result - @result^#12:Expr.Ident#)^#13:Expr.Comprehension# + __result__^#12:Expr.Ident#)^#13:Expr.Comprehension# L: __comprehension__( // Variable v, // Target m^#1[1,0]#, // Accumulator - @result, + __result__, // Init []^#5[1,8]#, // LoopCondition @@ -265,15 +265,15 @@ L: __comprehension__( _?_:_( p^#4[1,12]#, _+_( - @result^#7[1,8]#, + __result__^#7[1,8]#, [ v^#3[1,9]# ]^#8[1,8]# )^#9[1,8]#, - @result^#10[1,8]# + __result__^#10[1,8]# )^#11[1,8]#, // Result - @result^#12[1,8]#)^#13[1,8]# + __result__^#12[1,8]#)^#13[1,8]# M: m^#1:Expr.Ident#.filter( v^#3:Expr.Ident#, p^#4:Expr.Ident# diff --git a/testing/src/main/java/dev/cel/testing/CelBaselineTestCase.java b/testing/src/main/java/dev/cel/testing/CelBaselineTestCase.java index 50382436..04d6a3c5 100644 --- a/testing/src/main/java/dev/cel/testing/CelBaselineTestCase.java +++ b/testing/src/main/java/dev/cel/testing/CelBaselineTestCase.java @@ -58,6 +58,7 @@ public abstract class CelBaselineTestCase extends BaselineTestCase { CelOptions.current() .enableTimestampEpoch(true) .enableHeterogeneousNumericComparisons(true) + .enableHiddenAccumulatorVar(true) .enableOptionalSyntax(true) .comprehensionMaxIterations(1_000) .build();