Open
Description
The following example circuit fails:
pragma circom 2.1.9;
template Foo() {
signal input x;
signal output out;
var y = (x == 0) ? 1 : 0; // this is the problematic line
out <-- y;
out === 1 - x;
}
component main {public [x]} = Foo();
with the error message:
if branch or else branch is not a store to the signal, which is the only option for ternary operation
However, if you replace the problematic line with:
signal y <-- (x == 0) ? 1 : 0;
then it will succeed, even though the resulting circuit and witness is exactly the same (as circom optimizes that unused signal away).
So this limitation does not make any sense to me.
Not sure how many similar limitations are there with static computation involving dynamic inputs, but I would expect all of those to work.
Metadata
Metadata
Assignees
Labels
No labels