Skip to content

Commit 2f86c31

Browse files
committed
all-false-on-empty-array
Signed-off-by: yaacov <kobi.zamir@gmail.com>
1 parent 7b788df commit 2f86c31

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

v6/pkg/walkers/semantics/walk.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ func evaluateArrayUnaryExpression(operator tsl.Operator, arr []interface{}) (int
311311
return false, nil
312312

313313
case tsl.OpAll:
314+
// Return true if array is empty
315+
if len(arr) == 0 {
316+
return false, nil
317+
}
318+
314319
// Return true only if all elements are true
315320
for _, val := range arr {
316321
if boolVal, ok := val.(bool); ok {

0 commit comments

Comments
 (0)