iden3 / circom

zkSnark circuit compiler
GNU General Public License v3.0
1.32k stars 254 forks source link

bug fix: cover NonCompatibleBranchTypes #184

Closed rubydusa closed 1 year ago

rubydusa commented 1 year ago

It seems that the report code NonCompatibleBranchTypes was accidentally not covered. I checked if any other report codes were left out and as far as I can tell this is the only one.

The following code causes Circom to panic

How to reproduce the bug:

a.circom

pragma circom 2.1.5;

function A(t) {
    return t == 1 ? [1, 2, 3] : 4;
}

b.circom

pragma circom 2.1.5;

include "./a.circom";

template B() {
    var a0[3] = A(1);
}

component main = B();

run:

circom b.circom
clararod9 commented 1 year ago

I'm merging your PR, thank you for your contribution :-)