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
Add rule requiring explicit value (instead of relying on implicit true) when creating an object using the syntax foo[key] if {...}
Reasoning
In v1, this creates an object hello={"world":true}:
hello[input.message] if {
input.message =="world"
}
While almost identical code in v0 created a set hello={"world"}:
hello[input.message] {
input.message =="world"
}
Considering the amount of documentation/discussions available for v0 syntax it's easy to mistake these two. And even when ignoring that aspect, it's better for readability to have it explicitly written out as such:
hello[input.message] :=true if {
input.message =="world"
}
Notes
There might be other instances where this rule (avoid implicit true) may apply, this was the one I stumbled upon