mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
feat: Handle computed reference roots in RVM compiler
Allow compile_chained_ref to fall back to “evaluate root expression → chain access” so literal arrays, comprehensions, and other computed roots no longer raise NotSimpleReferenceChain. Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
@@ -32,15 +32,11 @@ const OPA_TODO_FOLDERS: &[&str] = &[
|
||||
"example",
|
||||
"fix1863",
|
||||
"functions",
|
||||
"jsonschema",
|
||||
"partialdocconstants",
|
||||
"partialobjectdoc",
|
||||
"planner-ir",
|
||||
"refheads",
|
||||
"replacen",
|
||||
"semverisvalid",
|
||||
"sets",
|
||||
"time",
|
||||
"type",
|
||||
"varreferences",
|
||||
"virtualdocs",
|
||||
|
||||
@@ -196,6 +196,30 @@ cases:
|
||||
query: data.test.main
|
||||
want_result: "web1"
|
||||
|
||||
- note: literal_array_root_access
|
||||
data: {}
|
||||
modules:
|
||||
- |
|
||||
package test
|
||||
|
||||
y := ["x", "y"][1]
|
||||
|
||||
main := y
|
||||
query: data.test.main
|
||||
want_result: "y"
|
||||
|
||||
- note: computed_object_root_access
|
||||
data: {}
|
||||
modules:
|
||||
- |
|
||||
package test
|
||||
|
||||
x := strings.replace_n({k: v | k := ["f", "foo"][i]; v := ["x", "xxx"][i]}, "foo")
|
||||
|
||||
main := x
|
||||
query: data.test.main
|
||||
want_result: "xoo"
|
||||
|
||||
- note: string_literal_bracket_access
|
||||
data: {}
|
||||
modules:
|
||||
|
||||
Reference in New Issue
Block a user