google / cel-java

Fast, portable, non-Turing complete expression evaluation with gradual typing (Java)
https://cel.dev
Apache License 2.0
81 stars 15 forks source link

Add a SubexpressionOptimizer baseline test case for fully extractable presence tests #287

Closed copybara-service[bot] closed 1 month ago

copybara-service[bot] commented 1 month ago

Add a SubexpressionOptimizer baseline test case for fully extractable presence tests

Note that this isn't actually rewriting the AST in the most optimized form.

Example: has({'a': true}.a) && has({'a': true}.a) should rewrite to:

cel.@block([has({'a': true}.a)], @index0 && @index0)., not

cel.@block([{"a": true}], has(@index0.a) && has(@index0.a)).

This will be addressed with the incoming mutable AST enhancements.