leo/tests/compiler/mutability/circuit_variable_mut.leo

18 lines
251 B
Plaintext
Raw Normal View History

2021-05-03 17:28:53 +03:00
/*
namespace: Compile
expectation: Pass
2021-05-05 18:29:44 +03:00
input_file: input/dummy.in
2021-05-03 17:28:53 +03:00
*/
2020-09-03 04:01:47 +03:00
circuit Foo {
2020-12-01 19:54:51 +03:00
x: u32
2020-09-03 04:01:47 +03:00
}
2021-05-03 17:28:53 +03:00
// Using let makes a circuit variable mutable.
function main(y: bool) -> bool{
let a = Foo { x: 1 };
2020-09-03 04:01:47 +03:00
a.x = 0;
2021-07-01 23:40:29 +03:00
return (a.x == 0u32) == y;
2021-05-05 18:29:44 +03:00
}