Open philipaconrad opened 2 years ago
This issue has been automatically marked as inactive because it has not had any activity in the last 30 days.
This issue may be stale, but it's still an issue! :sweat_smile:
Hopefully, I or someone else will have time to triage this issue in the parser soon.
@philipaconrad I've put it into the backlog; that way, it won't get picked up (and picked on) by the stale bot.
The underlying issue here is that the parser has been treating unary minus parsing as part of how numeric literals are parsed (ex: -.05
is fine, but -input.x
is not).
I suspect the best way to fix this might be to do rewriting into something like numbers.negate(input.x)
, since that would easily cover most of the obvious syntactic variations around numbers/variables/refs that are possible, at the expense of slightly more complicated parsing/AST structure. :slightly_frowning_face:
Short description
Quoting from the PR discussion on #4955, @shaded-enmity dug up this test case that fails mysteriously:
This looks like a possible parser bug, where a ref (
input.number
) is being treated differently somehow than a raw numeric constant.Steps To Reproduce
opa eval --format=pretty 'output := -input.number'
Expected behavior
Ideally, the error should be different or non-existent for the
opa eval
example.Additional Context
This behavior can also be observed on the Rego Playground.