Skip to content

Commit

Permalink
every: non collections should evaluate to false
Browse files Browse the repository at this point in the history
See open-policy-agent/opa#6763

Signed-off-by: Anand Krishnamoorthi <[email protected]>
  • Loading branch information
anakrish committed May 28, 2024
1 parent 2b82f28 commit 03859d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,9 @@ impl Interpreter {
}
}
}
Value::Undefined | Value::Null => r = false,
// Other types cause every to evaluate to true even though
// it is supposed to happen only for empty domain.
_ => (),
_ => {
r = false;
}
};
self.contexts.pop();
self.scopes.pop();
Expand Down
1 change: 0 additions & 1 deletion tests/interpreter/cases/every/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ cases:
x1: 100
x2: 100
x3: 100
x4: 100

- note: negative
data: {}
Expand Down

0 comments on commit 03859d9

Please sign in to comment.