Compiler strict mode check for unused function arguments with else
keyword
#358
-
Hi! I'm trying out OPA v0.50.0 with strict mode enabled on the compiler, and I wanted to check if I should expect to be getting an error for an unused parameter in certain situations with functions using the is_authenticated(subject) {
subject.authenticated
subject.identity != ""
} else = false # opa v0.50.0 emits the error on this line; the error isn't emitted if `else = false` is removed If this kind of situation is now supposed to trigger an unused variable error starting in v0.50.0, are there any workarounds in v0.50.0 which would allow me to simultaneously:
When searching about topics related to this behavior, so far I've found: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@ethanjli honoring a function with a default value would be a workaround. Also something like below: is_authenticated(subject) {
subject.authenticated
subject.identity != ""
} else = false {
_ := subject
} But this seems like a bug. Can you please open an issue with these details? |
Beta Was this translation helpful? Give feedback.
@ethanjli honoring a function with a default value would be a workaround. Also something like below:
But this seems like a bug. Can you please open an issue with these details?