@@ -1417,7 +1417,8 @@ def expr(self, tree: lark.Tree) -> Result:
14171417 expr : conditionalor ["?" conditionalor ":" expr]
14181418
14191419 The default implementation short-circuits
1420- and can ignore an CELEvalError in a sub-expression.
1420+ and can ignore a CELEvalError in the two alternative sub-expressions.
1421+ The conditional sub-expression CELEvalError is propogated out as the result.
14211422
14221423 See https://github.com/google/cel-spec/blob/master/doc/langdef.md#logical-operators
14231424
@@ -2030,15 +2031,25 @@ def member_dot_arg(self, tree: lark.Tree) -> Result:
20302031 Tuple [lark .Tree , lark .Token ], tree .children [:2 ]
20312032 )
20322033
2033- if method_name_token .value in {"map" , "filter" , "all" , "exists" , "exists_one" , "reduce" , "min" }:
2034+ if method_name_token .value in {
2035+ "map" ,
2036+ "filter" ,
2037+ "all" ,
2038+ "exists" ,
2039+ "exists_one" ,
2040+ "reduce" ,
2041+ "min" ,
2042+ }:
20342043 member_list = cast (celpy .celtypes .ListType , self .visit (member_tree ))
20352044
20362045 if isinstance (member_list , CELEvalError ):
20372046 return member_list
20382047
20392048 if method_name_token .value == "map" :
20402049 sub_expr = self .build_macro_eval (tree )
2041- mapping = cast (Iterable [celpy .celtypes .Value ], map (sub_expr , member_list ))
2050+ mapping = cast (
2051+ Iterable [celpy .celtypes .Value ], map (sub_expr , member_list )
2052+ )
20422053 result = celpy .celtypes .ListType (mapping )
20432054 return result
20442055
@@ -2052,19 +2063,25 @@ def member_dot_arg(self, tree: lark.Tree) -> Result:
20522063 and_oper = cast (
20532064 CELBoolFunction ,
20542065 eval_error ("no such overload" , TypeError )(
2055- celpy .celtypes .logical_and )
2066+ celpy .celtypes .logical_and
2067+ ),
2068+ )
2069+ reduction = reduce (
2070+ and_oper , map (sub_expr , member_list ), celpy .celtypes .BoolType (True )
20562071 )
2057- reduction = reduce (and_oper , map (sub_expr , member_list ), celpy .celtypes .BoolType (True ))
20582072 return reduction
20592073
20602074 elif method_name_token .value == "exists" :
20612075 sub_expr = self .build_ss_macro_eval (tree )
20622076 or_oper = cast (
20632077 CELBoolFunction ,
20642078 eval_error ("no such overload" , TypeError )(
2065- celpy .celtypes .logical_or )
2079+ celpy .celtypes .logical_or
2080+ ),
2081+ )
2082+ reduction = reduce (
2083+ or_oper , map (sub_expr , member_list ), celpy .celtypes .BoolType (False )
20662084 )
2067- reduction = reduce (or_oper , map (sub_expr , member_list ), celpy .celtypes .BoolType (False ))
20682085 return reduction
20692086
20702087 elif method_name_token .value == "exists_one" :
0 commit comments