feat: Soft-assert mode for builtin out-params under not

- Add a scoped soft_assert_mode to the compiler so `not` statements compile their subexpressions without emitting hard AssertCondition/AssertNotUndefined instructions.
- Teach binding-plan application to return an optional result register; equality plans now yield a boolean in soft mode, allowing not abs(-5 , 3) to succeed instead of aborting.
- Update function-call, loop, and rule plumbing to consume the new binding-plan outcome, including copying the produced register when an out-parameter equality is used.
- Trim the OPA TODO list to the remaining troublesome folders.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-12-02 15:06:23 -06:00
parent 30bd134a0b
commit b7b3d3ec87
10 changed files with 83 additions and 80 deletions
-52
View File
@@ -20,21 +20,9 @@ const OPA_REPO: &str = "https://github.com/open-policy-agent/opa";
const OPA_BRANCH: &str = "v1.2.0";
const OPA_TODO_FOLDERS: &[&str] = &[
"arithmetic",
"aggregates",
"array",
"base64builtins",
"base64urlbuiltins",
"baseandvirtualdocs",
"bitsand",
"bitsnegate",
"bitsor",
"bitsshiftleft",
"bitsshiftright",
"bitsxor",
"casts",
"comparisonexpr",
"comprehensions",
"dataderef",
"defaultkeyword",
"disjunction",
@@ -44,57 +32,17 @@ const OPA_TODO_FOLDERS: &[&str] = &[
"example",
"fix1863",
"functions",
"functionerrors",
"globmatch",
"globquotemeta",
"hexbuiltins",
"indirectreferences",
"intersection",
"jsonbuiltins",
"jsonfilter",
"jsonfilteridempotent",
"jsonremove",
"jsonremoveidempotent",
"jsonschema",
"netcidrcontains",
"netcidrisvalid",
"numbersrange",
"objectfilter",
"objectfilteridempotent",
"objectfilternonstringkey",
"objectget",
"objectremove",
"objectremoveidempotent",
"objectremovenonstringkey",
"objectunion",
"partialdocconstants",
"partialobjectdoc",
"planner-ir",
"rand",
"reachable",
"refheads",
"regexfind",
"regexfindallstringsubmatch",
"regexisvalid",
"regexmatchtemplate",
"regexsplit",
"replacen",
"semvercompare",
"semverisvalid",
"sets",
"strings",
"time",
"trim",
"trimleft",
"trimprefix",
"trimright",
"trimspace",
"trimsuffix",
"type",
"typebuiltin",
"typenamebuiltin",
"union",
"urlbuiltins",
"varreferences",
"virtualdocs",
"walkbuiltin",
@@ -81,3 +81,15 @@ cases:
}
query: data.test.rule5
want_result: "#undefined"
- note: builtin_out_param_negated_equality
data: {}
modules:
- |
package test
rule5 if {
not abs(-5, 3)
}
query: data.test.rule5
want_result: true