open-policy-agent/opa

Error message when using a keyword in ref should suggest `["keyword"]` syntax

Opened this issue · 3 comments

package p

r {
    input.default
}
opa eval -d p.rego -f pretty data.p.r
1 error occurred: p.rego:4: rego_parse_error: unexpected default keyword: expected ident
	input.default

This error message is difficult to understand, and does not provide a solution. If possible, we should suggest rewriting the ref to be input["default"]. Finally, let's try and avoid internal lingo like "ident" in these type of messages.

I'm agreeing with most points, but wouldn't it be great if the above was just valid? ✨ There's no ambiguity here. Same with input.default, input.with.foo, input.import.foobar, input.package... the list is long.

That would be awesome! 🤩

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.