leo/tests/compiler/circuits/member_function_nested.leo

31 lines
434 B
Plaintext
Raw Normal View History

2021-05-05 11:37:51 +03:00
/*
namespace: Compile
expectation: Pass
inputs:
- inline.in: |
[main]
x: u32 = 10;
[registers]
r0: bool = false;
*/
circuit Foo {
x: u32,
2020-12-01 19:54:51 +03:00
function add_x(self, y: u32) -> u32 {
return self.x + y;
}
2020-12-01 19:54:51 +03:00
function call_add_x(self, y: u32) -> u32 {
return self.add_x(y);
}
}
2021-05-05 11:37:51 +03:00
function main(x: u32) -> bool {
2021-05-06 14:27:42 +03:00
let a = Foo { x };
let b = a.add_x(1u32);
2021-05-05 11:37:51 +03:00
return b == x + 1;
}