leo/docs/error-guides/parser/mixed_commas_and_semicolons.md
2022-02-28 09:42:37 -08:00

824 B

Mixed commas and semicolons in circuit definitions

Example

This error occurs when mixing semicolons, ;, and commas, , together in the list of member variables in a circuit definition.

Erroneous code example:

circuit A {
    foo: u8,
    bar: u16;
}

The compiler will reject this code with:

Error [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.
    --> test.leo:3:13
     |
   3 |     bar: u16;
     |             ^

Solutions

The solution is simply to consistently use ; or , after each member variable, and avoid mixing ; and , together. So we could write either...:

circuit A {
    foo: u8,
    bar: u16,
}

...or write...:

circuit A {
    foo: u8;
    bar: u16;
}

...and the compiler would accept it.