leo/tests/compiler/circuits/mut_self_variable_conditional.leo

24 lines
359 B
Plaintext
Raw Normal View History

2021-05-05 11:37:51 +03:00
/*
namespace: Compile
expectation: Pass
2021-05-12 20:47:03 +03:00
input_file: input/dummy.in
2021-05-05 11:37:51 +03:00
*/
2021-05-12 20:47:03 +03:00
function main(y: bool) -> bool {
let f = Foo { a: 0u32 };
f.bar();
2021-05-12 20:47:03 +03:00
return y == true;
}
circuit Foo {
a: u32;
function bar(mut self) {
if true {
self.a = 5u32; // Mutating a variable inside a conditional statement should work.
}
}
2021-05-05 11:37:51 +03:00
}