leo/tests/compiler/mutability/circuit_function_mut.leo

21 lines
228 B
Plaintext
Raw Normal View History

2021-05-03 17:28:53 +03:00
/*
namespace: Compile
expectation: Pass
*/
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
2020-09-03 04:01:47 +03:00
function main() {
let a = Foo { x: 1 };
2021-05-03 17:28:53 +03:00
a.foo();
console.assert(a.x == 10u32);
2020-09-03 04:01:47 +03:00
}