You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to reference an item in a generated map by its numeric index in a some .. in iteration seems to have the type checker confused. I'd expect this to work:
package p
import rego.v1
ns := [1, 2, 3]
nums[x] contains ns if some x in ns
bug if {
some n1 in ns
some n2 in nums[n1]
}
anderseknert
changed the title
Type checker failure on referencing generated map with numeric keys inside some .. in iteration
Type checker failure on referencing generated map with numeric keys
May 7, 2024
Trying to reference an item in a generated map by its numeric index in a
some .. in
iteration seems to have the type checker confused. I'd expect this to work:But it doesn't:
❯ opa eval -f pretty -d p.rego data.p 1 error occurred: p.rego:11: rego_type_error: undefined ref: data.p.nums[n1][__local6__] data.p.nums[n1][__local6__] ^ have (type): number want (one of): [__local2__]
The text was updated successfully, but these errors were encountered: