fix: Implement RVM set ops correctly

- treat set subtraction in RVM the same as the interpreter by supporting
  Value::Set operands in sub_values
- emit internal-only builtin names for set union/intersection and register
  handlers so compiled bytecode resolves without exposing new Rego builtins
- add regression coverage for literal set difference/intersection
  (x/y from failure.rego) in tests/rvm/rego/cases/sets.yaml

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-12-03 14:38:17 -06:00
parent 252ae0e312
commit a514e8da83
4 changed files with 58 additions and 2 deletions

View File

@@ -142,7 +142,7 @@ impl<'a> Compiler<'a> {
match op {
BinOp::Union => {
let builtin_index = self.get_builtin_index("sets.union")?;
let builtin_index = self.get_builtin_index("__builtin_sets.union")?;
let params = BuiltinCallParams {
dest,
builtin_index,
@@ -156,7 +156,7 @@ impl<'a> Compiler<'a> {
self.emit_instruction(Instruction::BuiltinCall { params_index }, span);
}
BinOp::Intersection => {
let builtin_index = self.get_builtin_index("sets.intersection")?;
let builtin_index = self.get_builtin_index("__builtin_sets.intersection")?;
let params = BuiltinCallParams {
dest,
builtin_index,