leo/tests/compiler/mutability/circuit_function_mut.leo

23 lines
255 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 {
2021-05-03 17:28:53 +03:00
x: u32
function foo(mut self) {
self.x = 10;
}
2020-09-03 04:01:47 +03:00
}
2021-05-03 17:28:53 +03:00
2021-05-05 18:29:44 +03:00
function main() -> bool {
let a = Foo { x: 1 };
2021-05-03 17:28:53 +03:00
a.foo();
2021-05-05 18:29:44 +03:00
return a.x == 10u32;
}