Describe the bug
any ternary expression will execute the function on either result of the condition if the true or false part includes a function
To Reproduce
fun test(): Text {
echo("executed")
return "bar"
}
main (args) {
echo(
len(args) >= 1 then "foo" else test() // always true, to show that the function is function is executed either way
)
}
returns:
Expected behavior
Additional context
the issue is caused by src/modules/function/invocation.rs automatically pushing the function execution back into query during translation in src/expression/ternop/ternary.rs, where only the return variable is then generated
test__0_v0
ret_test0_v0__7_27="${ret_test0_v0}"
printf '%s\n' "$(if (( 2 > 1 )); then echo "foo"; else echo "${ret_test0_v0__7_27}"; fi)"
Describe the bug
any ternary expression will execute the function on either result of the condition if the true or false part includes a function
To Reproduce
returns:
Expected behavior
Additional context
the issue is caused by
src/modules/function/invocation.rsautomatically pushing the function execution back into query during translation insrc/expression/ternop/ternary.rs, where only the return variable is then generated