Closed 000wan closed 11 months ago
Hi!
We have improved the error message for the prefix operator in our last commit, now we return the following error message when we detect it:
error[P1012]: illegal expression: circom language does not admit the ++i operator, use i++ instead
┌─ "aux.circom":6:35
│
6 │ for(var i = 0; i < arg_count; ++i){
│ ^^^ here
previous errors were found
Thank you for reporting this issue
Great to hear that! Thanks for your work, and hope this would help somebody from debugging lol
Hi, I've been working with
circom 2.0.0
, compiling circuits withcircom circuit.circom --r1cs --wasm --sym -o .
I was struggling with the following error for a long time, which indicates the last character of the circuit file.It turns out that the problem was the for loop using the prefix increment operator.
I had to change it to the postfix increment, and noticed that the prefix op is not implemented in circom: https://docs.circom.io/circom-language/basic-operators/#arithmetic-operators Moreover, for the single-line prefix op
the compiler shows an appropriate error message.
So we should either improve the error message for the op inside the loop declaration, or implement prefix op (If this is hard, I think allowing prefix op only for the for loop is totally ok).