open-policy-agent/opa

default keyword in dotted reference results in error

Closed this issue · 1 comments

Short description

Evaluating a dot style reference that ended with a keyword ("default") resulted in an error message.

1 error occurred: policy.rego:7: rego_parse_error: unexpected default keyword: expected number
	hello if input.default == "world"

If the reference is adjusted to use the "canonical" style notation, it works as expected.

input["default"]

This might also affect other keywords, I haven't tested them.

Steps To Reproduce

Doesn't work: https://play.openpolicyagent.org/p/ckjGcUUaT0
Works: https://play.openpolicyagent.org/p/66dbzCEwJ0

Expected behavior

We should be able to end a reference with ".default", it's used in terraform quite a bit.

There is an existing issue for this. Closing this and we can track in #6432.