Skip to content

Condition syntax sometimes evaluates the wrong branch #50

@sewi-cpan

Description

@sewi-cpan

false ? true.exists_one(i, false) : false raises *BoolType* object is not iterable.
Expected: The first false should skip the first branch of the condition and execute the "else" branch (the last false).

The CEL language definition says:

To get traditional left-to-right short-circuiting evaluation of logical operators, as in C or other languages (also called "McCarthy Evaluation"), the expression e1 && e2 can be rewritten e1 ? e2 : false. Similarly, e1 || e2 can be rewritten e1 ? true : e2.

This error doesn't happen for false ? 1/0 : true. This condition correctly skips the division by zero.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions