From 2bb1d8f8d60a8d994e919a267527edd16ea1e0dc Mon Sep 17 00:00:00 2001 From: gluax <16431709+gluax@users.noreply.github.com> Date: Fri, 28 Jan 2022 10:34:02 -0800 Subject: [PATCH] migrate parser tests from staging --- .../parser/parser/circuits/big_self.leo.out | 5 +- .../parser/circuits/const_functions.leo.out | 253 +++++ .../parser/parser/circuits/consts.leo.out | 41 + .../parser/parser/circuits/empty.leo.out | 1 - .../circuits/field_and_functions.leo.out | 62 +- .../parser/parser/circuits/fields.leo.out | 1 - .../parser/circuits/fields_fail.leo.out | 2 +- .../parser/parser/circuits/functions.leo.out | 50 +- .../parser/circuits/mixed_order_fail.leo.out | 5 + .../parser/circuits/mut_self_fail.leo.out | 5 + .../parser/parser/circuits/ref_self.leo.out | 57 ++ .../parser/parser/circuits/self.leo.out | 5 +- .../parser/circuits/struct_fail.leo.out | 5 + .../expression/access/array_access.leo.out | 483 ++++----- .../access/array_range_access.leo.out | 771 +++++++------- .../parser/expression/access/call.leo.out | 116 ++- .../parser/expression/access/circuit.leo.out | 229 +++-- .../expression/access/circuit_static.leo.out | 222 ++-- .../parser/expression/access/tuple.leo.out | 219 ++-- .../parser/expression/array_init.leo.out | 22 + .../parser/expression/array_init_fail.leo.out | 1 + .../parser/expression/array_len.leo.out | 466 +++++---- .../parser/expression/literal/access.leo.out | 963 ++++++++++++++++++ .../expression/literal/group_fail.leo.out | 1 - .../parser/expression/unary/negate.leo.out | 49 +- .../parser/expression/unary/not.leo.out | 49 +- .../parser/parser/functions/annotated.leo.out | 168 ++- .../annotated_arg_not_ident_int.leo.out | 5 + .../functions/annotated_context_fail.leo.out | 5 + .../parser/functions/annotated_param.leo.out | 5 +- .../parser/functions/annotated_twice.leo.out | 8 +- .../functions/bounded_recursion.leo.out | 208 ++++ .../functions/bounded_recursion_fail.leo.out | 208 ++++ .../parser/functions/const_function.leo.out | 53 + .../parser/functions/const_param.leo.out | 8 +- .../parser/functions/const_self_bad.leo.out | 4 +- .../parser/parser/functions/empty.leo.out | 4 +- .../parser/parser/functions/empty2.leo.out | 4 +- .../functions/infinite_recursion_fail.leo.out | 120 +++ .../parser/functions/param_array.leo.out | 4 +- .../functions/param_array_unsized.leo.out | 4 +- .../parser/functions/param_circuit.leo.out | 4 +- .../parser/functions/param_tuple.leo.out | 4 +- .../parser/parser/functions/params.leo.out | 4 +- .../parser/functions/params_return.leo.out | 4 +- .../parser/parser/functions/return.leo.out | 4 +- .../parser/functions/return_tuple.leo.out | 4 +- .../import/import_empty_list_fail.leo.out | 2 +- .../parser/import/invalid_chars_fail.leo.out | 5 + .../parser/parser/import/keyword_fail.leo.out | 5 + .../serialize/linear_regression.leo.out | 677 ++++++++++++ .../parser/serialize/one_plus_one.leo.out | 36 + .../parser/serialize/palindrome.leo.out | 554 ++++++++++ .../parser/serialize/parser_error.leo.out | 5 + .../parser/serialize/pedersen_hash.leo.out | 169 +++ .../parser/serialize/silly_sudoku.leo.out | 528 ++++++++++ .../parser/parser/statement/console.leo.out | 36 +- .../parser/statement/let_mut_recover.leo.out | 5 + .../parser/unreachable/eat_ident.leo.out | 5 + .../parser/parser/unreachable/eat_int.leo.out | 5 + tests/parser/circuits/const_functions.leo | 23 + tests/parser/circuits/consts.leo | 9 + tests/parser/circuits/field_and_functions.leo | 1 + tests/parser/circuits/fields_fail.leo | 3 +- tests/parser/circuits/functions.leo | 5 +- tests/parser/circuits/mixed_order_fail.leo | 19 + .../{mut_self.leo => mut_self_fail.leo} | 2 +- tests/parser/circuits/ref_self.leo | 10 + tests/parser/circuits/struct_fail.leo | 9 + tests/parser/expression/array_init.leo | 4 +- tests/parser/expression/array_init_fail.leo | 2 + tests/parser/expression/literal/access.leo | 51 + .../parser/expression/literal/group_fail.leo | 2 - tests/parser/functions/annotated.leo | 19 +- .../functions/annotated_arg_not_ident_int.leo | 14 + .../functions/annotated_context_fail.leo | 14 + tests/parser/functions/annotated_fail.leo | 9 - tests/parser/functions/bounded_recursion.leo | 15 + .../functions/bounded_recursion_fail.leo | 15 + tests/parser/functions/const_function.leo | 8 + .../functions/infinite_recursion_fail.leo | 13 + .../parser/import/import_empty_list_fail.leo | 4 +- tests/parser/import/invalid_chars_fail.leo | 8 + tests/parser/import/keyword_fail.leo | 8 + tests/parser/serialize/linear_regression.leo | 70 ++ tests/parser/serialize/one_plus_one.leo | 8 + tests/parser/serialize/palindrome.leo | 64 ++ tests/parser/serialize/parser_error.leo | 6 + tests/parser/serialize/pedersen_hash.leo | 30 + tests/parser/serialize/silly_sudoku.leo | 76 ++ tests/parser/statement/definition_fail.leo | 2 +- tests/parser/statement/let_mut_recover.leo | 9 + tests/parser/unreachable/eat_int.leo | 2 +- 93 files changed, 6167 insertions(+), 1314 deletions(-) create mode 100644 tests/expectations/parser/parser/circuits/const_functions.leo.out create mode 100644 tests/expectations/parser/parser/circuits/consts.leo.out create mode 100644 tests/expectations/parser/parser/circuits/mixed_order_fail.leo.out create mode 100644 tests/expectations/parser/parser/circuits/mut_self_fail.leo.out create mode 100644 tests/expectations/parser/parser/circuits/ref_self.leo.out create mode 100644 tests/expectations/parser/parser/circuits/struct_fail.leo.out create mode 100644 tests/expectations/parser/parser/expression/literal/access.leo.out create mode 100644 tests/expectations/parser/parser/functions/annotated_arg_not_ident_int.leo.out create mode 100644 tests/expectations/parser/parser/functions/annotated_context_fail.leo.out create mode 100644 tests/expectations/parser/parser/functions/bounded_recursion.leo.out create mode 100644 tests/expectations/parser/parser/functions/bounded_recursion_fail.leo.out create mode 100644 tests/expectations/parser/parser/functions/const_function.leo.out create mode 100644 tests/expectations/parser/parser/functions/infinite_recursion_fail.leo.out create mode 100644 tests/expectations/parser/parser/import/invalid_chars_fail.leo.out create mode 100644 tests/expectations/parser/parser/import/keyword_fail.leo.out create mode 100644 tests/expectations/parser/parser/serialize/linear_regression.leo.out create mode 100644 tests/expectations/parser/parser/serialize/one_plus_one.leo.out create mode 100644 tests/expectations/parser/parser/serialize/palindrome.leo.out create mode 100644 tests/expectations/parser/parser/serialize/parser_error.leo.out create mode 100644 tests/expectations/parser/parser/serialize/pedersen_hash.leo.out create mode 100644 tests/expectations/parser/parser/serialize/silly_sudoku.leo.out create mode 100644 tests/expectations/parser/parser/statement/let_mut_recover.leo.out create mode 100644 tests/expectations/parser/parser/unreachable/eat_ident.leo.out create mode 100644 tests/expectations/parser/parser/unreachable/eat_int.leo.out create mode 100644 tests/parser/circuits/const_functions.leo create mode 100644 tests/parser/circuits/consts.leo create mode 100644 tests/parser/circuits/mixed_order_fail.leo rename tests/parser/circuits/{mut_self.leo => mut_self_fail.leo} (83%) create mode 100644 tests/parser/circuits/ref_self.leo create mode 100644 tests/parser/circuits/struct_fail.leo create mode 100644 tests/parser/expression/literal/access.leo create mode 100644 tests/parser/functions/annotated_arg_not_ident_int.leo create mode 100644 tests/parser/functions/annotated_context_fail.leo delete mode 100644 tests/parser/functions/annotated_fail.leo create mode 100644 tests/parser/functions/bounded_recursion.leo create mode 100644 tests/parser/functions/bounded_recursion_fail.leo create mode 100644 tests/parser/functions/const_function.leo create mode 100644 tests/parser/functions/infinite_recursion_fail.leo create mode 100644 tests/parser/import/invalid_chars_fail.leo create mode 100644 tests/parser/import/keyword_fail.leo create mode 100644 tests/parser/serialize/linear_regression.leo create mode 100644 tests/parser/serialize/one_plus_one.leo create mode 100644 tests/parser/serialize/palindrome.leo create mode 100644 tests/parser/serialize/parser_error.leo create mode 100644 tests/parser/serialize/pedersen_hash.leo create mode 100644 tests/parser/serialize/silly_sudoku.leo create mode 100644 tests/parser/statement/let_mut_recover.leo diff --git a/tests/expectations/parser/parser/circuits/big_self.leo.out b/tests/expectations/parser/parser/circuits/big_self.leo.out index 285482cf47..8d6223649f 100644 --- a/tests/expectations/parser/parser/circuits/big_self.leo.out +++ b/tests/expectations/parser/parser/circuits/big_self.leo.out @@ -10,13 +10,14 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: - CircuitFunction: - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() -> Self {\\\"}\"}" input: [] + const_: false output: SelfType + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/circuits/const_functions.leo.out b/tests/expectations/parser/parser/circuits/const_functions.leo.out new file mode 100644 index 0000000000..0cd2d5e744 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/const_functions.leo.out @@ -0,0 +1,253 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32\\\"}\"}" + - IntegerType: U32 + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x() { \\\"}\"}" + input: [] + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 6 + line_stop: 6 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 6 + line_stop: 6 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 5 + line_stop: 7 + col_start: 24 + col_stop: 6 + path: "" + content: " const function x() { \n ...\n }" + span: + line_start: 5 + line_stop: 7 + col_start: 11 + col_stop: 6 + path: "" + content: " const function x() { \n ...\n }" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x(self) { \\\"}\"}" + input: + - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function x(self) { \\\"}\"}" + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 9 + line_stop: 9 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 9 + line_stop: 9 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 8 + line_stop: 10 + col_start: 28 + col_stop: 6 + path: "" + content: " const function x(self) { \n ...\n }" + span: + line_start: 8 + line_stop: 10 + col_start: 11 + col_stop: 6 + path: "" + content: " const function x(self) { \n ...\n }" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function c(const self) { \\\"}\"}" + input: + - ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function c(const self) { \\\"}\"}" + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 12 + line_stop: 12 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 12 + line_stop: 12 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 11 + line_stop: 13 + col_start: 34 + col_stop: 6 + path: "" + content: " const function c(const self) { \n ...\n }" + span: + line_start: 11 + line_stop: 13 + col_start: 11 + col_stop: 6 + path: "" + content: " const function c(const self) { \n ...\n }" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}" + input: + - ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}" + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, x: u32) {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: U32 + span: + line_start: 14 + line_stop: 14 + col_start: 34 + col_stop: 35 + path: "" + content: " const function b(const self, x: u32) {" + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 15 + line_stop: 15 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 15 + line_stop: 15 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 14 + line_stop: 16 + col_start: 42 + col_stop: 6 + path: "" + content: " const function b(const self, x: u32) {\n ...\n }" + span: + line_start: 14 + line_stop: 16 + col_start: 11 + col_stop: 6 + path: "" + content: " const function b(const self, x: u32) {\n ...\n }" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}" + input: + - ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":22,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}" + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":40,\\\"col_stop\\\":41,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function b(const self, const x: u32) {\\\"}\"}" + const_: true + mutable: false + type_: + IntegerType: U32 + span: + line_start: 17 + line_stop: 17 + col_start: 40 + col_stop: 41 + path: "" + content: " const function b(const self, const x: u32) {" + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 18 + line_stop: 18 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 18 + line_stop: 18 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 17 + line_stop: 19 + col_start: 48 + col_stop: 6 + path: "" + content: " const function b(const self, const x: u32) {\n ...\n }" + span: + line_start: 17 + line_stop: 19 + col_start: 11 + col_stop: 6 + path: "" + content: " const function b(const self, const x: u32) {\n ...\n }" + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/circuits/consts.leo.out b/tests/expectations/parser/parser/circuits/consts.leo.out new file mode 100644 index 0000000000..84c302700b --- /dev/null +++ b/tests/expectations/parser/parser/circuits/consts.leo.out @@ -0,0 +1,41 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitConst: + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const x: u32 = 2;\\\"}\"}" + - IntegerType: U32 + - Value: + Implicit: + - "2" + - span: + line_start: 4 + line_stop: 4 + col_start: 27 + col_stop: 28 + path: "" + content: " static const x: u32 = 2;" + - CircuitConst: + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const y: u32 = 5;\\\"}\"}" + - IntegerType: U32 + - Value: + Implicit: + - "5" + - span: + line_start: 5 + line_stop: 5 + col_start: 27 + col_stop: 28 + path: "" + content: " static const y: u32 = 5;" + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/circuits/empty.leo.out b/tests/expectations/parser/parser/circuits/empty.leo.out index a5ceaec155..eb759bfecd 100644 --- a/tests/expectations/parser/parser/circuits/empty.leo.out +++ b/tests/expectations/parser/parser/circuits/empty.leo.out @@ -10,7 +10,6 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: [] global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out index bf637c4ed0..db42615815 100644 --- a/tests/expectations/parser/parser/circuits/field_and_functions.leo.out +++ b/tests/expectations/parser/parser/circuits/field_and_functions.leo.out @@ -10,19 +10,33 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: + - CircuitConst: + - "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" static const a: u8 = 10;\\\"}\"}" + - IntegerType: U8 + - Value: + Implicit: + - "10" + - span: + line_start: 4 + line_stop: 4 + col_start: 26 + col_stop: 28 + path: "" + content: " static const a: u8 = 10;" - CircuitVariable: - - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32,\\\"}\"}" - IntegerType: U32 - CircuitVariable: - - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: u32\\\"}\"}" + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: u32\\\"}\"}" - IntegerType: U32 - CircuitFunction: - annotations: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -30,38 +44,40 @@ outputs: TupleInit: elements: [] span: - line_start: 7 - line_stop: 7 + line_start: 8 + line_stop: 8 col_start: 16 col_stop: 18 path: "" content: " return ();" span: - line_start: 7 - line_stop: 7 + line_start: 8 + line_stop: 8 col_start: 9 col_stop: 18 path: "" content: " return ();" span: - line_start: 6 - line_stop: 8 + line_start: 7 + line_stop: 9 col_start: 18 col_stop: 6 path: "" content: " function x() {\n ...\n }" span: - line_start: 6 - line_stop: 8 + line_start: 7 + line_stop: 9 col_start: 5 col_stop: 6 path: "" content: " function x() {\n ...\n }" - CircuitFunction: - annotations: [] - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" + annotations: {} + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -69,29 +85,29 @@ outputs: TupleInit: elements: [] span: - line_start: 10 - line_stop: 10 + line_start: 11 + line_stop: 11 col_start: 16 col_stop: 18 path: "" content: " return ();" span: - line_start: 10 - line_stop: 10 + line_start: 11 + line_stop: 11 col_start: 9 col_stop: 18 path: "" content: " return ();" span: - line_start: 9 - line_stop: 11 + line_start: 10 + line_stop: 12 col_start: 18 col_stop: 6 path: "" content: " function y() {\n ...\n }" span: - line_start: 9 - line_stop: 11 + line_start: 10 + line_stop: 12 col_start: 5 col_stop: 6 path: "" diff --git a/tests/expectations/parser/parser/circuits/fields.leo.out b/tests/expectations/parser/parser/circuits/fields.leo.out index 7464095aaa..7f5a0460a1 100644 --- a/tests/expectations/parser/parser/circuits/fields.leo.out +++ b/tests/expectations/parser/parser/circuits/fields.leo.out @@ -10,7 +10,6 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: - CircuitVariable: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: u32;\\\"}\"}" diff --git a/tests/expectations/parser/parser/circuits/fields_fail.leo.out b/tests/expectations/parser/parser/circuits/fields_fail.leo.out index 8c4dbaf736..2225346003 100644 --- a/tests/expectations/parser/parser/circuits/fields_fail.leo.out +++ b/tests/expectations/parser/parser/circuits/fields_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.\n --> test:10:11\n |\n 10 | y: u32;\n | ^" + - "Error [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.\n --> test:10:11\n |\n 10 | y: u32;\n | ^\nError [EPAR0370006]: Cannot mix use of commas and semi-colons for circuit member variable declarations.\n --> test:11:5\n |\n 11 | , // recovery witness\n | ^" diff --git a/tests/expectations/parser/parser/circuits/functions.leo.out b/tests/expectations/parser/parser/circuits/functions.leo.out index 48a6234f16..c6db22f69c 100644 --- a/tests/expectations/parser/parser/circuits/functions.leo.out +++ b/tests/expectations/parser/parser/circuits/functions.leo.out @@ -10,13 +10,14 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: - CircuitFunction: - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -52,10 +53,12 @@ outputs: path: "" content: " function x() {\n ...\n }" - CircuitFunction: - annotations: [] + annotations: {} identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function y() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -90,5 +93,46 @@ outputs: col_stop: 6 path: "" content: " function y() {\n ...\n }" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const function z() {\\\"}\"}" + input: [] + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 11 + line_stop: 11 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 11 + line_stop: 11 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 10 + line_stop: 12 + col_start: 24 + col_stop: 6 + path: "" + content: " const function z() {\n ...\n }" + span: + line_start: 10 + line_stop: 12 + col_start: 11 + col_stop: 6 + path: "" + content: " const function z() {\n ...\n }" global_consts: {} functions: {} diff --git a/tests/expectations/parser/parser/circuits/mixed_order_fail.leo.out b/tests/expectations/parser/parser/circuits/mixed_order_fail.leo.out new file mode 100644 index 0000000000..7ef15bf91e --- /dev/null +++ b/tests/expectations/parser/parser/circuits/mixed_order_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370022]: Member functions must come after member variables.\n --> test:7:5\n |\n 7 | foo: u8,\n | ^^^\nError [EPAR0370021]: Member functions must come after member consts.\n --> test:9:18\n |\n 9 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^\nError [EPAR0370020]: Member variables must come after member consts.\n --> test:15:18\n |\n 15 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^" diff --git a/tests/expectations/parser/parser/circuits/mut_self_fail.leo.out b/tests/expectations/parser/parser/circuits/mut_self_fail.leo.out new file mode 100644 index 0000000000..7a1b004381 --- /dev/null +++ b/tests/expectations/parser/parser/circuits/mut_self_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370019]: `mut self` is no longer accepted. Use `&self` if you would like to pass in a mutable reference to `self`\n --> test:4:16\n |\n 4 | function x(mut self) {\n | ^^^^^^^^" diff --git a/tests/expectations/parser/parser/circuits/ref_self.leo.out b/tests/expectations/parser/parser/circuits/ref_self.leo.out new file mode 100644 index 0000000000..36a7f97eae --- /dev/null +++ b/tests/expectations/parser/parser/circuits/ref_self.leo.out @@ -0,0 +1,57 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": + circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" + members: + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(&self) {\\\"}\"}" + input: + - RefSelfKeyword: "{\"name\":\"&self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(&self) {\\\"}\"}" + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 5 + line_stop: 5 + col_start: 16 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 18 + path: "" + content: " return ();" + span: + line_start: 4 + line_stop: 6 + col_start: 23 + col_stop: 6 + path: "" + content: " function x(&self) {\n ...\n }" + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: "" + content: " function x(&self) {\n ...\n }" + global_consts: {} + functions: {} diff --git a/tests/expectations/parser/parser/circuits/self.leo.out b/tests/expectations/parser/parser/circuits/self.leo.out index 913f60dad1..ab817ab360 100644 --- a/tests/expectations/parser/parser/circuits/self.leo.out +++ b/tests/expectations/parser/parser/circuits/self.leo.out @@ -10,14 +10,15 @@ outputs: circuits: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}": circuit_name: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit X {\\\"}\"}" - core_mapping: ~ members: - CircuitFunction: - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" input: - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function x(self) {\\\"}\"}" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/circuits/struct_fail.leo.out b/tests/expectations/parser/parser/circuits/struct_fail.leo.out new file mode 100644 index 0000000000..aee38799dc --- /dev/null +++ b/tests/expectations/parser/parser/circuits/struct_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected circuit -- got 'struct'\n --> test:3:1\n |\n 3 | struct A {}\n | ^^^^^^\nError [EPAR0370005]: expected circuit -- got 'class'\n --> test:5:1\n |\n 5 | class C {}\n | ^^^^^" diff --git a/tests/expectations/parser/parser/expression/access/array_access.leo.out b/tests/expectations/parser/parser/expression/access/array_access.leo.out index 1ab093eebc..045d403df6 100644 --- a/tests/expectations/parser/parser/expression/access/array_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_access.leo.out @@ -2,170 +2,179 @@ namespace: ParseExpression expectation: Pass outputs: - - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0]\\\"}\"}" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0]" - - ArrayAccess: - array: - Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X[1]\\\"}\"}" - index: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "X[1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "X[1]" - - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8]\\\"}\"}" - index: - Value: - Integer: - - U8 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 6 - path: "" - content: "x[0u8]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[0u8]" - - ArrayAccess: - array: - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1u8][2u8]\\\"}\"}" - index: - Value: - Integer: - - U8 - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 6 - path: "" - content: "x[1u8][2u8]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[1u8][2u8]" - index: - Value: - Integer: - - U8 - - "2" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 11 - path: "" - content: "x[1u8][2u8]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[1u8][2u8]" - - ArrayAccess: - array: - ArrayAccess: - array: - ArrayAccess: + - Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0]\\\"}\"}" + index: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[0]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x[0]" + - Access: + Array: + array: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X[1]\\\"}\"}" + index: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "X[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "X[1]" + - Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8]\\\"}\"}" + index: + Value: + Integer: + - U8 + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: "" + content: "x[0u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x[0u8]" + - Access: + Array: + array: + Access: + Array: array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1u8][2u8]\\\"}\"}" index: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + Value: + Integer: + - U8 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: "" + content: "x[1u8][2u8]" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 5 + col_stop: 7 + path: "" + content: "x[1u8][2u8]" + index: + Value: + Integer: + - U8 + - "2" + - span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: "" + content: "x[1u8][2u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "x[1u8][2u8]" + - Access: + Array: + array: + Access: + Array: + array: + Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x[x][y][z]" + index: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 path: "" content: "x[x][y][z]" - index: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[x][y][z]" - index: - Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: "" - content: "x[x][y][z]" + index: + Identifier: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x][y][z]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "x[x][y][z]" - Call: function: - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0]()\\\"}\"}" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0]()" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0]()" + Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0]()\\\"}\"}" + index: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[0]()" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x[0]()" arguments: [] span: line_start: 1 @@ -174,61 +183,64 @@ outputs: col_stop: 7 path: "" content: "x[0]()" - - ArrayAccess: - array: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x()[0]\\\"}\"}" - arguments: [] - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x()[0]" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x()[0]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x()[0]" + - Access: + Array: + array: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x()[0]\\\"}\"}" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: "x()[0]" + index: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: "" + content: "x()[0]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x()[0]" - Call: function: - CircuitStaticFunctionAccess: - circuit: - Call: - function: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - arguments: - - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x(y)::y(x)" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x(y)::y(x)" + Access: + Static: + inner: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x(y)::y(x)" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: "" + content: "x(y)::y(x)" arguments: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x(y)::y(x)\\\"}\"}" span: @@ -238,37 +250,40 @@ outputs: col_stop: 11 path: "" content: "x(y)::y(x)" - - ArrayAccess: - array: - TupleAccess: - tuple: - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + - Access: + Array: + array: + Access: + Tuple: + tuple: + Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x[x].0[x]" index: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + value: "0" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 5 + col_stop: 7 path: "" content: "x[x].0[x]" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[x].0[x]" - index: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[x].0[x]" + index: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x].0[x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "x[x].0[x]" diff --git a/tests/expectations/parser/parser/expression/access/array_range_access.leo.out b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out index ecaf1054ae..d930ff5e17 100644 --- a/tests/expectations/parser/parser/expression/access/array_range_access.leo.out +++ b/tests/expectations/parser/parser/expression/access/array_range_access.leo.out @@ -2,133 +2,171 @@ namespace: ParseExpression expectation: Pass outputs: - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" - left: ~ - right: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "x[..]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..]\\\"}\"}" - left: - Value: - Implicit: - - "1" - - span: + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" + left: ~ + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: "x[..]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..]\\\"}\"}" + left: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[1..]" + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x[1..]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..1]\\\"}\"}" + left: ~ + right: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: "" + content: "x[..1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x[..1]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..1]\\\"}\"}" + left: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[1..1]" + right: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: "" + content: "x[1..1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: "" + content: "x[1..1]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0..100]\\\"}\"}" + left: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[0..100]" + right: + Value: + Implicit: + - "100" + - span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 9 + path: "" + content: "x[0..100]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "x[0..100]" + - Access: + Array: + array: + Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[323452345.2345234523453453][323452345.2345234523453453]\\\"}\"}" + index: + Access: + Tuple: + tuple: + Value: + Implicit: + - "323452345" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 12 + path: "" + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + index: + value: "2345234523453453" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 29 + path: "" + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + span: line_start: 1 line_stop: 1 - col_start: 3 - col_stop: 4 + col_start: 1 + col_stop: 30 path: "" - content: "x[1..]" - right: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[1..]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..1]\\\"}\"}" - left: ~ - right: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 6 - path: "" - content: "x[..1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x[..1]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[1..1]\\\"}\"}" - left: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[1..1]" - right: - Value: - Implicit: - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 7 - path: "" - content: "x[1..1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x[1..1]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0..100]\\\"}\"}" - left: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0..100]" - right: - Value: - Implicit: - - "100" - - span: - line_start: 1 - line_stop: 1 - col_start: 6 - col_stop: 9 - path: "" - content: "x[0..100]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 10 - path: "" - content: "x[0..100]" - - ArrayAccess: - array: - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[323452345.2345234523453453][323452345.2345234523453453]\\\"}\"}" - index: - TupleAccess: + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + index: + Access: + Tuple: tuple: Value: Implicit: @@ -136,8 +174,8 @@ outputs: - span: line_start: 1 line_stop: 1 - col_start: 3 - col_stop: 12 + col_start: 31 + col_stop: 40 path: "" content: "x[323452345.2345234523453453][323452345.2345234523453453]" index: @@ -145,277 +183,264 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 3 - col_stop: 29 + col_start: 31 + col_stop: 57 path: "" content: "x[323452345.2345234523453453][323452345.2345234523453453]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 30 - path: "" - content: "x[323452345.2345234523453453][323452345.2345234523453453]" - index: - TupleAccess: - tuple: - Value: - Implicit: - - "323452345" - - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 40 - path: "" - content: "x[323452345.2345234523453453][323452345.2345234523453453]" - index: - value: "2345234523453453" - span: - line_start: 1 - line_stop: 1 - col_start: 31 - col_stop: 57 - path: "" - content: "x[323452345.2345234523453453][323452345.2345234523453453]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 58 - path: "" - content: "x[323452345.2345234523453453][323452345.2345234523453453]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8..1u8]\\\"}\"}" - left: - Value: - Integer: - - U8 - - "0" - - span: + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 58 + path: "" + content: "x[323452345.2345234523453453][323452345.2345234523453453]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8..1u8]\\\"}\"}" + left: + Value: + Integer: + - U8 + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: "" + content: "x[0u8..1u8]" + right: + Value: + Integer: + - U8 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: "" + content: "x[0u8..1u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "x[0u8..1u8]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8..]\\\"}\"}" + left: + Value: + Integer: + - U8 + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: "" + content: "x[0u8..]" + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "x[0u8..]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..0u8]\\\"}\"}" + left: ~ + right: + Value: + Integer: + - U8 + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 8 + path: "" + content: "x[..0u8]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "x[..0u8]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" + left: ~ + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: "x[..]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + left: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" + span: line_start: 1 line_stop: 1 col_start: 3 col_stop: 6 path: "" - content: "x[0u8..1u8]" - right: - Value: - Integer: - - U8 - - "1" - - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 11 - path: "" - content: "x[0u8..1u8]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[0u8..1u8]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0u8..]\\\"}\"}" - left: - Value: - Integer: - - U8 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 6 - path: "" - content: "x[0u8..]" - right: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[0u8..]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..0u8]\\\"}\"}" - left: ~ - right: - Value: - Integer: - - U8 - - "0" - - span: + content: "x[x.y..]" + type_: ~ + right: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "x[x.y..]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + left: ~ + right: + Access: + Member: + inner: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" + span: line_start: 1 line_stop: 1 col_start: 5 col_stop: 8 path: "" - content: "x[..0u8]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..0u8]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..]\\\"}\"}" - left: ~ - right: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: "x[..]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" - left: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 6 - path: "" - content: "x[x.y..]" - type_: ~ - right: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[x.y..]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" - left: ~ - right: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" - name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[..y.x]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 5 - col_stop: 8 - path: "" - content: "x[..y.x]" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "x[..y.x]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" - left: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 6 - path: "" - content: "x[x.y..y.x]" - type_: ~ - right: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" - name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 8 - col_stop: 11 - path: "" - content: "x[x.y..y.x]" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "x[x.y..y.x]" - - ArrayRangeAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" - left: - CircuitMemberAccess: - circuit: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + content: "x[..y.x]" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "x[..y.x]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + left: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" span: line_start: 1 line_stop: 1 col_start: 3 col_stop: 6 path: "" + content: "x[x.y..y.x]" + type_: ~ + right: + Access: + Member: + inner: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y..y.x]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 8 + col_stop: 11 + path: "" + content: "x[x.y..y.x]" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "x[x.y..y.x]" + - Access: + ArrayRange: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + left: + Access: + Member: + inner: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 6 + path: "" + content: "x[x.y.x..y.x.y]" + type_: ~ + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 8 + path: "" content: "x[x.y.x..y.x.y]" type_: ~ - name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 8 - path: "" - content: "x[x.y.x..y.x.y]" - type_: ~ - right: - CircuitMemberAccess: - circuit: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" - name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + right: + Access: + Member: + inner: + Access: + Member: + inner: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 10 + col_stop: 13 + path: "" + content: "x[x.y.x..y.x.y]" + type_: ~ + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" span: line_start: 1 line_stop: 1 col_start: 10 - col_stop: 13 + col_stop: 15 path: "" content: "x[x.y.x..y.x.y]" type_: ~ - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":14,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[x.y.x..y.x.y]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 10 - col_stop: 15 - path: "" - content: "x[x.y.x..y.x.y]" - type_: ~ - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 16 - path: "" - content: "x[x.y.x..y.x.y]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: "" + content: "x[x.y.x..y.x.y]" diff --git a/tests/expectations/parser/parser/expression/access/call.leo.out b/tests/expectations/parser/parser/expression/access/call.leo.out index 56ad6d5493..eb541b94a7 100644 --- a/tests/expectations/parser/parser/expression/access/call.leo.out +++ b/tests/expectations/parser/parser/expression/access/call.leo.out @@ -65,17 +65,19 @@ outputs: content: "x(x, y, z)" - Call: function: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y()" + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y()" arguments: [] span: line_start: 1 @@ -86,17 +88,19 @@ outputs: content: "x::y()" - Call: function: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y(x)" + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y(x)" arguments: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y(x)\\\"}\"}" span: @@ -108,18 +112,19 @@ outputs: content: "x::y(x)" - Call: function: - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0(x) + Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.0(x) arguments: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0(x)\\\"}\"}" span: @@ -131,27 +136,28 @@ outputs: content: x.0(x) - Call: function: - ArrayAccess: - array: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" - index: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 4 - path: "" - content: "x[0](x)" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x[0](x)" + Access: + Array: + array: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" + index: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 4 + path: "" + content: "x[0](x)" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x[0](x)" arguments: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":7,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x[0](x)\\\"}\"}" span: diff --git a/tests/expectations/parser/parser/expression/access/circuit.leo.out b/tests/expectations/parser/parser/expression/access/circuit.leo.out index e84068ed71..19b5bb9c4a 100644 --- a/tests/expectations/parser/parser/expression/access/circuit.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit.leo.out @@ -2,67 +2,72 @@ namespace: ParseExpression expectation: Pass outputs: - - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y - type_: ~ - - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" - name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: X.Y - type_: ~ - - CircuitMemberAccess: - circuit: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y.z - type_: ~ - name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: x.y.z - type_: ~ + - Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.y + type_: ~ + - Access: + Member: + inner: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" + name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X.Y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: X.Y + type_: ~ + - Access: + Member: + inner: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.y.z + type_: ~ + name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.z\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: x.y.z + type_: ~ - Call: function: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y() - type_: ~ + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.y() + type_: ~ arguments: [] span: line_start: 1 @@ -71,58 +76,62 @@ outputs: col_stop: 6 path: "" content: x.y() - - TupleAccess: - tuple: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.y.0 - type_: ~ - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: x.y.0 - - ArrayAccess: - array: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: "x.y[1]" - type_: ~ - index: - Value: - Implicit: - - "1" - - span: + - Access: + Tuple: + tuple: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y.0\\\"}\"}" + span: line_start: 1 line_stop: 1 - col_start: 5 - col_stop: 6 + col_start: 1 + col_stop: 4 + path: "" + content: x.y.0 + type_: ~ + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: x.y.0 + - Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":3,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.y[1]\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 path: "" content: "x.y[1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x.y[1]" + type_: ~ + index: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: "" + content: "x.y[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x.y[1]" diff --git a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out index e0d20d272f..f01ebb1773 100644 --- a/tests/expectations/parser/parser/expression/access/circuit_static.leo.out +++ b/tests/expectations/parser/parser/expression/access/circuit_static.leo.out @@ -2,62 +2,72 @@ namespace: ParseExpression expectation: Pass outputs: - - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y" - - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" - name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "X::Y" - - CircuitStaticFunctionAccess: - circuit: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y::z" - name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x::y::z" + - Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y" + - Access: + Static: + inner: + Identifier: "{\"name\":\"X\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" + name: "{\"name\":\"Y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"X::Y\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "X::Y" + - Access: + Static: + inner: + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y::z" + name: "{\"name\":\"z\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y::z\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: "" + content: "x::y::z" - Call: function: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y()" + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y()" arguments: [] span: line_start: 1 @@ -66,56 +76,62 @@ outputs: col_stop: 7 path: "" content: "x::y()" - - TupleAccess: - tuple: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y.0" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "x::y.0" - - ArrayAccess: - array: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 5 - path: "" - content: "x::y[1]" - index: - Value: - Implicit: - - "1" - - span: + - Access: + Tuple: + tuple: + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y.0\\\"}\"}" + type_: ~ + span: line_start: 1 line_stop: 1 - col_start: 6 - col_stop: 7 + col_start: 1 + col_stop: 5 + path: "" + content: "x::y.0" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "x::y.0" + - Access: + Array: + array: + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x::y[1]\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 path: "" content: "x::y[1]" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 8 - path: "" - content: "x::y[1]" + index: + Value: + Implicit: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 6 + col_stop: 7 + path: "" + content: "x::y[1]" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: "" + content: "x::y[1]" diff --git a/tests/expectations/parser/parser/expression/access/tuple.leo.out b/tests/expectations/parser/parser/expression/access/tuple.leo.out index 5a9b570777..e904278a34 100644 --- a/tests/expectations/parser/parser/expression/access/tuple.leo.out +++ b/tests/expectations/parser/parser/expression/access/tuple.leo.out @@ -2,108 +2,117 @@ namespace: ParseExpression expectation: Pass outputs: - - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0\\\"}\"}" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0 - - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.1\\\"}\"}" - index: - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.1 - - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.2\\\"}\"}" - index: - value: "2" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.2 - - TupleAccess: - tuple: - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.0\\\"}\"}" - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.0.0 - index: - value: "0" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: x.0.0 - - TupleAccess: - tuple: - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.1.1\\\"}\"}" - index: - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.1.1 - index: - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: x.1.1 - - TupleAccess: - tuple: - TupleAccess: - tuple: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.2.2\\\"}\"}" - index: - value: "2" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 4 - path: "" - content: x.2.2 - index: - value: "2" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 6 - path: "" - content: x.2.2 + - Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.0 + - Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.1\\\"}\"}" + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.1 + - Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.2\\\"}\"}" + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.2 + - Access: + Tuple: + tuple: + Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.0.0\\\"}\"}" + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.0.0 + index: + value: "0" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: x.0.0 + - Access: + Tuple: + tuple: + Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.1.1\\\"}\"}" + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.1.1 + index: + value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: x.1.1 + - Access: + Tuple: + tuple: + Access: + Tuple: + tuple: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"x.2.2\\\"}\"}" + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: x.2.2 + index: + value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: x.2.2 diff --git a/tests/expectations/parser/parser/expression/array_init.leo.out b/tests/expectations/parser/parser/expression/array_init.leo.out index 00b738d2cb..bf542ace05 100644 --- a/tests/expectations/parser/parser/expression/array_init.leo.out +++ b/tests/expectations/parser/parser/expression/array_init.leo.out @@ -88,6 +88,28 @@ outputs: col_stop: 12 path: "" content: "[0; (1, 2)]" + - ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "[0; (1, 2,)]" + dimensions: + - value: "1" + - value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "[0; (1, 2,)]" - ArrayInit: element: Value: diff --git a/tests/expectations/parser/parser/expression/array_init_fail.leo.out b/tests/expectations/parser/parser/expression/array_init_fail.leo.out index 0eacb46895..d8a72305fd 100644 --- a/tests/expectations/parser/parser/expression/array_init_fail.leo.out +++ b/tests/expectations/parser/parser/expression/array_init_fail.leo.out @@ -4,3 +4,4 @@ expectation: Fail outputs: - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^" - "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^" + - "Error [EPAR0370023]: Array dimensions specified as a tuple cannot be empty.\n --> test:1:5\n |\n 1 | [0; ()]\n | ^^" diff --git a/tests/expectations/parser/parser/expression/array_len.leo.out b/tests/expectations/parser/parser/expression/array_len.leo.out index 42b12f37b3..5d31cbeb55 100644 --- a/tests/expectations/parser/parser/expression/array_len.leo.out +++ b/tests/expectations/parser/parser/expression/array_len.leo.out @@ -2,209 +2,287 @@ namespace: ParseExpression expectation: Pass outputs: - - LengthOf: - inner: - ArrayInit: - element: - Value: - Integer: - - U8 - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "[0u8; 1].len()" - dimensions: - - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "[0u8; 1].len()" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "[0u8; 1].len()" - - LengthOf: - inner: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 3 - path: "" - content: "[0; 1].len()" - dimensions: - - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "[0; 1].len()" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 7 - path: "" - content: "[0; 1].len()" - - LengthOf: - inner: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 3 - path: "" - content: "[0; (1)].len()" - dimensions: - - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "[0; (1)].len()" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 9 - path: "" - content: "[0; (1)].len()" - - LengthOf: - inner: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 3 - path: "" - content: "[0; (1, 2)].len()" - dimensions: - - value: "1" - - value: "2" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "[0; (1, 2)].len()" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 12 - path: "" - content: "[0; (1, 2)].len()" - - LengthOf: - inner: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 3 - path: "" - content: "[0; (1, 2, 3)].len()" - dimensions: - - value: "1" - - value: "2" - - value: "3" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 15 - path: "" - content: "[0; (1, 2, 3)].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + Value: + Integer: + - U8 + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: "" + content: "[0u8; 1].len()" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "[0u8; 1].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[0u8; 1].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "[0u8; 1].len()" + type_: ~ + arguments: [] span: line_start: 1 line_stop: 1 col_start: 1 col_stop: 15 path: "" - content: "[0; (1, 2, 3)].len()" - - LengthOf: - inner: - ArrayInit: - element: - ArrayInit: - element: - ArrayInit: - element: - Value: - Implicit: - - "0" - - span: - line_start: 1 - line_stop: 1 - col_start: 4 - col_stop: 5 - path: "" - content: "[[[0; 3]; 2]; 1].len()" - dimensions: - - value: "3" - span: - line_start: 1 - line_stop: 1 - col_start: 3 - col_stop: 9 - path: "" - content: "[[[0; 3]; 2]; 1].len()" - dimensions: - - value: "2" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 13 - path: "" - content: "[[[0; 3]; 2]; 1].len()" - dimensions: - - value: "1" - span: - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 17 - path: "" - content: "[[[0; 3]; 2]; 1].len()" + content: "[0u8; 1].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "[0; 1].len()" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: "[0; 1].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[0; 1].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "[0; 1].len()" + type_: ~ + arguments: [] span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 17 + col_stop: 13 + path: "" + content: "[0; 1].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "[0; (1)].len()" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "[0; (1)].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[0; (1)].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "[0; (1)].len()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: "" + content: "[0; (1)].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "[0; (1, 2)].len()" + dimensions: + - value: "1" + - value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "[0; (1, 2)].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[0; (1, 2)].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: "" + content: "[0; (1, 2)].len()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 18 + path: "" + content: "[0; (1, 2)].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "[0; (1, 2, 3)].len()" + dimensions: + - value: "1" + - value: "2" + - value: "3" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 15 + path: "" + content: "[0; (1, 2, 3)].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":16,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[0; (1, 2, 3)].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 19 + path: "" + content: "[0; (1, 2, 3)].len()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 21 + path: "" + content: "[0; (1, 2, 3)].len()" + - Call: + function: + Access: + Member: + inner: + ArrayInit: + element: + ArrayInit: + element: + ArrayInit: + element: + Value: + Implicit: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 4 + col_stop: 5 + path: "" + content: "[[[0; 3]; 2]; 1].len()" + dimensions: + - value: "3" + span: + line_start: 1 + line_stop: 1 + col_start: 3 + col_stop: 9 + path: "" + content: "[[[0; 3]; 2]; 1].len()" + dimensions: + - value: "2" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 13 + path: "" + content: "[[[0; 3]; 2]; 1].len()" + dimensions: + - value: "1" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 17 + path: "" + content: "[[[0; 3]; 2]; 1].len()" + name: "{\"name\":\"len\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":18,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"[[[0; 3]; 2]; 1].len()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 21 + path: "" + content: "[[[0; 3]; 2]; 1].len()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 23 path: "" content: "[[[0; 3]; 2]; 1].len()" diff --git a/tests/expectations/parser/parser/expression/literal/access.leo.out b/tests/expectations/parser/parser/expression/literal/access.leo.out new file mode 100644 index 0000000000..e2dbf60e24 --- /dev/null +++ b/tests/expectations/parser/parser/expression/literal/access.leo.out @@ -0,0 +1,963 @@ +--- +namespace: ParseExpression +expectation: Pass +outputs: + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Address: + - aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8 + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 64 + path: "" + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":65,\\\"col_stop\\\":69,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 69 + path: "" + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 71 + path: "" + content: aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"address\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"address::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: "" + content: "address::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 16 + path: "" + content: "address::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Boolean: + - "true" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: true.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"true.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: true.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: true.call() + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"bool\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"bool::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "bool::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "bool::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Char: + character: + Scalar: 97 + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: "'a'.call()" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"'a'.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "'a'.call()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "'a'.call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"char\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"char::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "char::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "char::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Field: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: 1field.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1field.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1field.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: "" + content: 1field.call() + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"field\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"field::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "field::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: "" + content: "field::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Group: + Single: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: "" + content: 0group.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"0group.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 0group.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: "" + content: 0group.call() + - Call: + function: + Access: + Member: + inner: + Value: + Group: + Tuple: + x: + Number: + - "0" + - span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 3 + path: "" + content: "(0, 1)group.call()" + y: + Number: + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 5 + col_stop: 6 + path: "" + content: "(0, 1)group.call()" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 12 + path: "" + content: "(0, 1)group.call()" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":13,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"(0, 1)group.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 17 + path: "" + content: "(0, 1)group.call()" + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 19 + path: "" + content: "(0, 1)group.call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"group\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":8,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"group::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "group::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 14 + path: "" + content: "group::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - I8 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: 1i8.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1i8.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: 1i8.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: 1i8.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - I16 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1i16.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1i16.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1i16.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1i16.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - I32 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1i32.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1i32.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1i32.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1i32.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - I64 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1i64.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1i64.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1i64.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1i64.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - I128 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: 1i128.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1i128.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: 1i128.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: 1i128.call() + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"i8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i8::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "i8::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "i8::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"i16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i16::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "i16::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "i16::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"i32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i32::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "i32::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "i32::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"i64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i64::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "i64::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "i64::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"i128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"i128::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "i128::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "i128::call()" + - Value: + Implicit: + - "" + - span: + line_start: 0 + line_stop: 0 + col_start: 0 + col_stop: 0 + path: "" + content: "" + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - U8 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 4 + path: "" + content: 1u8.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1u8.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: 1u8.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: 1u8.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - U16 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1u16.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1u16.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1u16.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1u16.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - U32 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1u32.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1u32.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1u32.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1u32.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - U64 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: "" + content: 1u64.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1u64.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: 1u64.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: 1u64.call() + - Call: + function: + Access: + Member: + inner: + Value: + Integer: + - U128 + - "1" + - span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: "" + content: 1u128.call() + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"1u128.call()\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: 1u128.call() + type_: ~ + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: 1u128.call() + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"u8\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u8::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: "" + content: "u8::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "u8::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"u16\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u16::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "u16::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "u16::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"u32\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u32::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "u32::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "u32::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"u64\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":4,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u64::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: "" + content: "u64::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 12 + path: "" + content: "u64::call()" + - Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"u128\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" + name: "{\"name\":\"call\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":7,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"u128::call()\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 11 + path: "" + content: "u128::call()" + arguments: [] + span: + line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: "" + content: "u128::call()" diff --git a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out index 8816fb7773..e9076add85 100644 --- a/tests/expectations/parser/parser/expression/literal/group_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/group_fail.leo.out @@ -2,7 +2,6 @@ namespace: ParseExpression expectation: Fail outputs: - - "Error [EPAR0370009]: unexpected string: expected 'expression', got 'group'\n --> test:1:1\n |\n 1 | group\n | ^^^^^" - "did not consume all input: 'group' @ 1:3-8\n" - "did not consume all input: 'group' @ 1:6-11\n" - "Error [EPAR0370009]: unexpected string: expected 'expression', got ','\n --> test:1:2\n |\n 1 | (,)group\n | ^" diff --git a/tests/expectations/parser/parser/expression/unary/negate.leo.out b/tests/expectations/parser/parser/expression/unary/negate.leo.out index 9fe8865d44..649b722072 100644 --- a/tests/expectations/parser/parser/expression/unary/negate.leo.out +++ b/tests/expectations/parser/parser/expression/unary/negate.leo.out @@ -15,18 +15,19 @@ outputs: content: "-x" - Unary: inner: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "-x.y" - type_: ~ + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: "" + content: "-x.y" + type_: ~ op: Negate span: line_start: 1 @@ -37,17 +38,19 @@ outputs: content: "-x.y" - Unary: inner: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "-x::y" + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"-x::y\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 6 + path: "" + content: "-x::y" op: Negate span: line_start: 1 diff --git a/tests/expectations/parser/parser/expression/unary/not.leo.out b/tests/expectations/parser/parser/expression/unary/not.leo.out index 04de6a3e4c..71716da156 100644 --- a/tests/expectations/parser/parser/expression/unary/not.leo.out +++ b/tests/expectations/parser/parser/expression/unary/not.leo.out @@ -15,18 +15,19 @@ outputs: content: "!x" - Unary: inner: - CircuitMemberAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 5 - path: "" - content: "!x.y" - type_: ~ + Access: + Member: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":4,\\\"col_stop\\\":5,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x.y\\\"}\"}" + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 5 + path: "" + content: "!x.y" + type_: ~ op: Not span: line_start: 1 @@ -37,17 +38,19 @@ outputs: content: "!x.y" - Unary: inner: - CircuitStaticFunctionAccess: - circuit: - Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" - span: - line_start: 1 - line_stop: 1 - col_start: 2 - col_stop: 6 - path: "" - content: "!x::y" + Access: + Static: + inner: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":2,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"!x::y\\\"}\"}" + type_: ~ + span: + line_start: 1 + line_stop: 1 + col_start: 2 + col_stop: 6 + path: "" + content: "!x::y" op: Not span: line_start: 1 diff --git a/tests/expectations/parser/parser/functions/annotated.leo.out b/tests/expectations/parser/parser/functions/annotated.leo.out index 67fcef91c6..d9e264e6cf 100644 --- a/tests/expectations/parser/parser/functions/annotated.leo.out +++ b/tests/expectations/parser/parser/functions/annotated.leo.out @@ -10,9 +10,10 @@ outputs: circuits: {} global_consts: {} functions: - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": + "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function a() {\\\"}\"}": annotations: - - span: + test: + span: line_start: 3 line_stop: 3 col_start: 1 @@ -21,9 +22,11 @@ outputs: content: "@test" name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" arguments: [] - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" + identifier: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function a() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -50,11 +53,166 @@ outputs: col_start: 14 col_stop: 2 path: "" - content: "function x() {\n ...\n}" + content: "function a() {\n ...\n}" span: line_start: 4 line_stop: 6 col_start: 1 col_stop: 2 path: "" - content: "function x() {\n ...\n}" + content: "function a() {\n ...\n}" + "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function b() {\\\"}\"}": + annotations: + test: + span: + line_start: 8 + line_stop: 8 + col_start: 1 + col_stop: 12 + path: "" + content: "@test(test)" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test(test)\\\"}\"}" + arguments: + - test + identifier: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function b() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 10 + line_stop: 10 + col_start: 12 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 9 + line_stop: 11 + col_start: 14 + col_stop: 2 + path: "" + content: "function b() {\n ...\n}" + span: + line_start: 9 + line_stop: 11 + col_start: 1 + col_stop: 2 + path: "" + content: "function b() {\n ...\n}" + "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function c() {\\\"}\"}": + annotations: + test: + span: + line_start: 13 + line_stop: 13 + col_start: 1 + col_stop: 13 + path: "" + content: "@test(test,)" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test(test,)\\\"}\"}" + arguments: + - test + identifier: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function c() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 15 + line_stop: 15 + col_start: 12 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 15 + line_stop: 15 + col_start: 5 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 14 + line_stop: 16 + col_start: 14 + col_stop: 2 + path: "" + content: "function c() {\n ...\n}" + span: + line_start: 14 + line_stop: 16 + col_start: 1 + col_stop: 2 + path: "" + content: "function c() {\n ...\n}" + "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function d() {\\\"}\"}": + annotations: + test: + span: + line_start: 18 + line_stop: 18 + col_start: 1 + col_stop: 8 + path: "" + content: "@test()" + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test()\\\"}\"}" + arguments: [] + identifier: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function d() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 20 + line_stop: 20 + col_start: 12 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 20 + line_stop: 20 + col_start: 5 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 19 + line_stop: 21 + col_start: 14 + col_stop: 2 + path: "" + content: "function d() {\n ...\n}" + span: + line_start: 19 + line_stop: 21 + col_start: 1 + col_stop: 2 + path: "" + content: "function d() {\n ...\n}" diff --git a/tests/expectations/parser/parser/functions/annotated_arg_not_ident_int.leo.out b/tests/expectations/parser/parser/functions/annotated_arg_not_ident_int.leo.out new file mode 100644 index 0000000000..34585e8f24 --- /dev/null +++ b/tests/expectations/parser/parser/functions/annotated_arg_not_ident_int.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'ident or int', got '?'\n --> test:3:6\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident or int', got '?'\n --> test:3:14\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out new file mode 100644 index 0000000000..15e47e1265 --- /dev/null +++ b/tests/expectations/parser/parser/functions/annotated_context_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:3:2\n |\n 3 | @context\n | ^^^^^^^\nError [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/functions/annotated_param.leo.out b/tests/expectations/parser/parser/functions/annotated_param.leo.out index 9d5acf38e5..5e5e8b0796 100644 --- a/tests/expectations/parser/parser/functions/annotated_param.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_param.leo.out @@ -12,7 +12,8 @@ outputs: functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: - - span: + test: + span: line_start: 3 line_stop: 3 col_start: 1 @@ -24,7 +25,9 @@ outputs: - test identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/annotated_twice.leo.out b/tests/expectations/parser/parser/functions/annotated_twice.leo.out index 5b3bda5319..7afe638d67 100644 --- a/tests/expectations/parser/parser/functions/annotated_twice.leo.out +++ b/tests/expectations/parser/parser/functions/annotated_twice.leo.out @@ -12,7 +12,8 @@ outputs: functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": annotations: - - span: + test: + span: line_start: 3 line_stop: 3 col_start: 1 @@ -21,7 +22,8 @@ outputs: content: "@test @test2" name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test @test2\\\"}\"}" arguments: [] - - span: + test2: + span: line_start: 3 line_stop: 3 col_start: 7 @@ -32,7 +34,9 @@ outputs: arguments: [] identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/bounded_recursion.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out new file mode 100644 index 0000000000..53e1ab419b --- /dev/null +++ b/tests/expectations/parser/parser/functions/bounded_recursion.leo.out @@ -0,0 +1,208 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" + const_: true + mutable: false + type_: + IntegerType: U32 + span: + line_start: 3 + line_stop: 3 + col_start: 18 + col_stop: 19 + path: "" + content: "function x(const y: u32) {" + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if y < 5u32 {\\\"}\"}" + right: + Value: + Integer: + - U32 + - "5" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 16 + path: "" + content: " if y < 5u32 {" + op: Lt + span: + line_start: 4 + line_stop: 4 + col_start: 8 + col_stop: 16 + path: "" + content: " if y < 5u32 {" + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(y+1);\\\"}\"}" + arguments: + - Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(y+1);\\\"}\"}" + right: + Value: + Implicit: + - "1" + - span: + line_start: 5 + line_stop: 5 + col_start: 13 + col_stop: 14 + path: "" + content: " x(y+1);" + op: Add + span: + line_start: 5 + line_stop: 5 + col_start: 11 + col_stop: 14 + path: "" + content: " x(y+1);" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 15 + path: "" + content: " x(y+1);" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 15 + path: "" + content: " x(y+1);" + span: + line_start: 4 + line_stop: 6 + col_start: 17 + col_stop: 6 + path: "" + content: " if y < 5u32 {\n ...\n }" + next: ~ + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: "" + content: " if y < 5u32 {\n ...\n }" + span: + line_start: 3 + line_stop: 7 + col_start: 26 + col_stop: 2 + path: "" + content: "function x(const y: u32) {\n ...\n ...\n ...\n}" + span: + line_start: 3 + line_stop: 7 + col_start: 1 + col_stop: 2 + path: "" + content: "function x(const y: u32) {\n ...\n ...\n ...\n}" + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: Boolean + span: + line_start: 9 + line_stop: 9 + col_start: 15 + col_stop: 16 + path: "" + content: "function main(y: bool) -> bool {" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(1u32);\\\"}\"}" + arguments: + - Value: + Integer: + - U32 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 7 + col_stop: 11 + path: "" + content: " x(1u32);" + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 12 + path: "" + content: " x(1u32);" + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 12 + path: "" + content: " x(1u32);" + - Return: + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return y;\\\"}\"}" + span: + line_start: 11 + line_stop: 11 + col_start: 5 + col_stop: 13 + path: "" + content: " return y;" + span: + line_start: 9 + line_stop: 12 + col_start: 32 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" + span: + line_start: 9 + line_stop: 12 + col_start: 1 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" diff --git a/tests/expectations/parser/parser/functions/bounded_recursion_fail.leo.out b/tests/expectations/parser/parser/functions/bounded_recursion_fail.leo.out new file mode 100644 index 0000000000..aed18632e6 --- /dev/null +++ b/tests/expectations/parser/parser/functions/bounded_recursion_fail.leo.out @@ -0,0 +1,208 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" + const_: true + mutable: false + type_: + IntegerType: U32 + span: + line_start: 3 + line_stop: 3 + col_start: 18 + col_stop: 19 + path: "" + content: "function x(const y: u32) {" + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if y < 999u32 {\\\"}\"}" + right: + Value: + Integer: + - U32 + - "999" + - span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 18 + path: "" + content: " if y < 999u32 {" + op: Lt + span: + line_start: 4 + line_stop: 4 + col_start: 8 + col_stop: 18 + path: "" + content: " if y < 999u32 {" + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(y+1);\\\"}\"}" + arguments: + - Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":11,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(y+1);\\\"}\"}" + right: + Value: + Implicit: + - "1" + - span: + line_start: 5 + line_stop: 5 + col_start: 13 + col_stop: 14 + path: "" + content: " x(y+1);" + op: Add + span: + line_start: 5 + line_stop: 5 + col_start: 11 + col_stop: 14 + path: "" + content: " x(y+1);" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 15 + path: "" + content: " x(y+1);" + span: + line_start: 5 + line_stop: 5 + col_start: 9 + col_stop: 15 + path: "" + content: " x(y+1);" + span: + line_start: 4 + line_stop: 6 + col_start: 19 + col_stop: 6 + path: "" + content: " if y < 999u32 {\n ...\n }" + next: ~ + span: + line_start: 4 + line_stop: 6 + col_start: 5 + col_stop: 6 + path: "" + content: " if y < 999u32 {\n ...\n }" + span: + line_start: 3 + line_stop: 7 + col_start: 26 + col_stop: 2 + path: "" + content: "function x(const y: u32) {\n ...\n ...\n ...\n}" + span: + line_start: 3 + line_stop: 7 + col_start: 1 + col_stop: 2 + path: "" + content: "function x(const y: u32) {\n ...\n ...\n ...\n}" + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: Boolean + span: + line_start: 9 + line_stop: 9 + col_start: 15 + col_stop: 16 + path: "" + content: "function main(y: bool) -> bool {" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x(1u32);\\\"}\"}" + arguments: + - Value: + Integer: + - U32 + - "1" + - span: + line_start: 10 + line_stop: 10 + col_start: 7 + col_stop: 11 + path: "" + content: " x(1u32);" + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 12 + path: "" + content: " x(1u32);" + span: + line_start: 10 + line_stop: 10 + col_start: 5 + col_stop: 12 + path: "" + content: " x(1u32);" + - Return: + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return y;\\\"}\"}" + span: + line_start: 11 + line_stop: 11 + col_start: 5 + col_stop: 13 + path: "" + content: " return y;" + span: + line_start: 9 + line_stop: 12 + col_start: 32 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" + span: + line_start: 9 + line_stop: 12 + col_start: 1 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" diff --git a/tests/expectations/parser/parser/functions/const_function.leo.out b/tests/expectations/parser/parser/functions/const_function.leo.out new file mode 100644 index 0000000000..142f12dfb9 --- /dev/null +++ b/tests/expectations/parser/parser/functions/const_function.leo.out @@ -0,0 +1,53 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const function x() {\\\"}\"}" + input: [] + const_: true + output: ~ + core_mapping: ~ + block: + statements: + - Return: + expression: + TupleInit: + elements: [] + span: + line_start: 4 + line_stop: 4 + col_start: 12 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 14 + path: "" + content: " return ();" + span: + line_start: 3 + line_stop: 5 + col_start: 20 + col_stop: 2 + path: "" + content: "const function x() {\n ...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 7 + col_stop: 2 + path: "" + content: "const function x() {\n ...\n}" diff --git a/tests/expectations/parser/parser/functions/const_param.leo.out b/tests/expectations/parser/parser/functions/const_param.leo.out index 974b0032ef..f1302d128d 100644 --- a/tests/expectations/parser/parser/functions/const_param.leo.out +++ b/tests/expectations/parser/parser/functions/const_param.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" input: - Variable: @@ -40,7 +40,9 @@ outputs: col_stop: 27 path: "" content: "function x(x: u32, const y: i32) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: @@ -76,7 +78,7 @@ outputs: path: "" content: "function x(x: u32, const y: i32) {\n ...\n}" "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" input: - Variable: @@ -105,7 +107,9 @@ outputs: col_stop: 27 path: "" content: "function x(const x: u32, y: i32) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/const_self_bad.leo.out b/tests/expectations/parser/parser/functions/const_self_bad.leo.out index 13de7c2191..3b02d74ff3 100644 --- a/tests/expectations/parser/parser/functions/const_self_bad.leo.out +++ b/tests/expectations/parser/parser/functions/const_self_bad.leo.out @@ -11,11 +11,13 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}" input: - ConstSelfKeyword: "{\"name\":\"const self\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const self) {\\\"}\"}" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/empty.leo.out b/tests/expectations/parser/parser/functions/empty.leo.out index 319f4a6f56..4bd3bfbc1a 100644 --- a/tests/expectations/parser/parser/functions/empty.leo.out +++ b/tests/expectations/parser/parser/functions/empty.leo.out @@ -11,10 +11,12 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/empty2.leo.out b/tests/expectations/parser/parser/functions/empty2.leo.out index 31558387f6..60c3f10b1c 100644 --- a/tests/expectations/parser/parser/functions/empty2.leo.out +++ b/tests/expectations/parser/parser/functions/empty2.leo.out @@ -11,10 +11,12 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() {}\\\"}\"}" input: [] + const_: false output: ~ + core_mapping: ~ block: statements: [] span: diff --git a/tests/expectations/parser/parser/functions/infinite_recursion_fail.leo.out b/tests/expectations/parser/parser/functions/infinite_recursion_fail.leo.out new file mode 100644 index 0000000000..93a823f907 --- /dev/null +++ b/tests/expectations/parser/parser/functions/infinite_recursion_fail.leo.out @@ -0,0 +1,120 @@ +--- +namespace: Parse +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function inf() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" inf();\\\"}\"}" + arguments: [] + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 10 + path: "" + content: " inf();" + span: + line_start: 4 + line_stop: 4 + col_start: 5 + col_stop: 10 + path: "" + content: " inf();" + span: + line_start: 3 + line_stop: 5 + col_start: 16 + col_stop: 2 + path: "" + content: "function inf() {\n ...\n}" + span: + line_start: 3 + line_stop: 5 + col_start: 1 + col_stop: 2 + path: "" + content: "function inf() {\n ...\n}" + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: Boolean + span: + line_start: 7 + line_stop: 7 + col_start: 15 + col_stop: 16 + path: "" + content: "function main(y: bool) -> bool {" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Expression: + expression: + Call: + function: + Identifier: "{\"name\":\"inf\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":5,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" inf();\\\"}\"}" + arguments: [] + span: + line_start: 8 + line_stop: 8 + col_start: 5 + col_stop: 10 + path: "" + content: " inf();" + span: + line_start: 8 + line_stop: 8 + col_start: 5 + col_stop: 10 + path: "" + content: " inf();" + - Return: + expression: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return y;\\\"}\"}" + span: + line_start: 9 + line_stop: 9 + col_start: 5 + col_stop: 13 + path: "" + content: " return y;" + span: + line_start: 7 + line_stop: 10 + col_start: 32 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" + span: + line_start: 7 + line_stop: 10 + col_start: 1 + col_stop: 2 + path: "" + content: "function main(y: bool) -> bool {\n ...\n ...\n}" diff --git a/tests/expectations/parser/parser/functions/param_array.leo.out b/tests/expectations/parser/parser/functions/param_array.leo.out index 02d219333a..b648d79414 100644 --- a/tests/expectations/parser/parser/functions/param_array.leo.out +++ b/tests/expectations/parser/parser/functions/param_array.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; 12]) {\\\"}\"}" input: - Variable: @@ -29,7 +29,9 @@ outputs: col_stop: 13 path: "" content: "function x(x: [u8; 12]) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/param_array_unsized.leo.out b/tests/expectations/parser/parser/functions/param_array_unsized.leo.out index e34bccbcb2..41594cf508 100644 --- a/tests/expectations/parser/parser/functions/param_array_unsized.leo.out +++ b/tests/expectations/parser/parser/functions/param_array_unsized.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; _]) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: [u8; _]) {\\\"}\"}" input: - Variable: @@ -29,7 +29,9 @@ outputs: col_stop: 13 path: "" content: "function x(x: [u8; _]) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/param_circuit.leo.out b/tests/expectations/parser/parser/functions/param_circuit.leo.out index 41aa2496ab..2d18f67ce0 100644 --- a/tests/expectations/parser/parser/functions/param_circuit.leo.out +++ b/tests/expectations/parser/parser/functions/param_circuit.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}" input: - Variable: @@ -27,7 +27,9 @@ outputs: col_stop: 13 path: "" content: "function x(x: MyCircuit) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/param_tuple.leo.out b/tests/expectations/parser/parser/functions/param_tuple.leo.out index 1b81592a70..17e104a53a 100644 --- a/tests/expectations/parser/parser/functions/param_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/param_tuple.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: (u32, i32)) {\\\"}\"}" input: - Variable: @@ -29,7 +29,9 @@ outputs: col_stop: 13 path: "" content: "function x(x: (u32, i32)) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/params.leo.out b/tests/expectations/parser/parser/functions/params.leo.out index 6f84f7488c..26c4fe8b37 100644 --- a/tests/expectations/parser/parser/functions/params.leo.out +++ b/tests/expectations/parser/parser/functions/params.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" input: - Variable: @@ -40,7 +40,9 @@ outputs: col_stop: 21 path: "" content: "function x(x: u32, y: i32) {" + const_: false output: ~ + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/params_return.leo.out b/tests/expectations/parser/parser/functions/params_return.leo.out index 0ceb91e0d2..681070bf9c 100644 --- a/tests/expectations/parser/parser/functions/params_return.leo.out +++ b/tests/expectations/parser/parser/functions/params_return.leo.out @@ -11,7 +11,7 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" input: - Variable: @@ -40,8 +40,10 @@ outputs: col_stop: 21 path: "" content: "function x(x: u32, y: i32) -> u32 {" + const_: false output: IntegerType: U32 + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/return.leo.out b/tests/expectations/parser/parser/functions/return.leo.out index e2b451091d..abaabd9585 100644 --- a/tests/expectations/parser/parser/functions/return.leo.out +++ b/tests/expectations/parser/parser/functions/return.leo.out @@ -11,11 +11,13 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> u32 {\\\"}\"}" input: [] + const_: false output: IntegerType: U32 + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/functions/return_tuple.leo.out b/tests/expectations/parser/parser/functions/return_tuple.leo.out index 054adbbf0c..0fa5721ff3 100644 --- a/tests/expectations/parser/parser/functions/return_tuple.leo.out +++ b/tests/expectations/parser/parser/functions/return_tuple.leo.out @@ -11,13 +11,15 @@ outputs: global_consts: {} functions: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}": - annotations: [] + annotations: {} identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x() -> (u32, u32) {\\\"}\"}" input: [] + const_: false output: Tuple: - IntegerType: U32 - IntegerType: U32 + core_mapping: ~ block: statements: - Return: diff --git a/tests/expectations/parser/parser/import/import_empty_list_fail.leo.out b/tests/expectations/parser/parser/import/import_empty_list_fail.leo.out index e9201ce299..0436fedf95 100644 --- a/tests/expectations/parser/parser/import/import_empty_list_fail.leo.out +++ b/tests/expectations/parser/parser/import/import_empty_list_fail.leo.out @@ -2,4 +2,4 @@ namespace: Parse expectation: Fail outputs: - - "Error [EPAR0370002]: Cannot import empty list\n --> test:3:8\n |\n 3 | import a.();\n | ^" + - "Error [EPAR0370002]: Cannot import empty list\n --> test:3:8\n |\n 3 | import a.();\n | ^\nError [EPAR0370002]: Cannot import empty list\n --> test:5:8\n |\n 5 | import a.();\n | ^" diff --git a/tests/expectations/parser/parser/import/invalid_chars_fail.leo.out b/tests/expectations/parser/parser/import/invalid_chars_fail.leo.out new file mode 100644 index 0000000000..e44abfa775 --- /dev/null +++ b/tests/expectations/parser/parser/import/invalid_chars_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370012]: package names must be lowercase alphanumeric ascii with underscores and singular dashes\n --> test:3:8\n |\n 3 | import AB.c;\n | ^^\nError [EPAR0370012]: package names must be lowercase alphanumeric ascii with underscores and singular dashes\n --> test:5:8\n |\n 5 | import AB.c;\n | ^^" diff --git a/tests/expectations/parser/parser/import/keyword_fail.leo.out b/tests/expectations/parser/parser/import/keyword_fail.leo.out new file mode 100644 index 0000000000..c229c8167f --- /dev/null +++ b/tests/expectations/parser/parser/import/keyword_fail.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370009]: unexpected string: expected 'package name', got 'function'\n --> test:3:8\n |\n 3 | import function.a;\n | ^^^^^^^^\nError [EPAR0370009]: unexpected string: expected 'package name', got 'import'\n --> test:5:8\n |\n 5 | import import.a;\n | ^^^^^^" diff --git a/tests/expectations/parser/parser/serialize/linear_regression.leo.out b/tests/expectations/parser/parser/serialize/linear_regression.leo.out new file mode 100644 index 0000000000..91a060a842 --- /dev/null +++ b/tests/expectations/parser/parser/serialize/linear_regression.leo.out @@ -0,0 +1,677 @@ +--- +namespace: Serialize +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Point {\\\"}\"}": + circuit_name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit Point {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x: i32,\\\"}\"}" + - IntegerType: I32 + - CircuitVariable: + - "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y: i32,\\\"}\"}" + - IntegerType: I32 + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"new\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(x: i32, y: i32) -> Self { \\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(x: i32, y: i32) -> Self { \\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(x: i32, y: i32) -> Self { \\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + const_: false + output: SelfType + core_mapping: ~ + block: + statements: + - Return: + expression: + CircuitInit: + name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { x, y };\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { x, y };\\\"}\"}" + expression: ~ + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { x, y };\\\"}\"}" + expression: ~ + "{\"name\":\"LinearRegression\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":9,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit LinearRegression {\\\"}\"}": + circuit_name: "{\"name\":\"LinearRegression\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":9,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit LinearRegression {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":5,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" points: [Point; 5],\\\"}\"}" + - Array: + - Identifier: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":14,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" points: [Point; 5],\\\"}\"}" + - - value: "5" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"new\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":14,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(points: [Point; 5]) -> Self { \\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":18,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(points: [Point; 5]) -> Self { \\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Identifier: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":16,\\\"line_stop\\\":16,\\\"col_start\\\":27,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(points: [Point; 5]) -> Self { \\\"}\"}" + - - value: "5" + const_: false + output: SelfType + core_mapping: ~ + block: + statements: + - Return: + expression: + CircuitInit: + name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { points };\\\"}\"}" + members: + - identifier: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { points };\\\"}\"}" + expression: ~ + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":14,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function slope(self) -> i32 { \\\"}\"}" + input: + - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":20,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function slope(self) -> i32 { \\\"}\"}" + const_: false + output: + IntegerType: I32 + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"num_points\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":13,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let num_points = 5i32;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "5" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x_sum = 0i32; \\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y_sum = 0i32; \\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"xy_sum\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":13,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let xy_sum = 0i32; \\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x2_sum\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":13,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x2_sum = 0i32; \\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Iteration: + variable: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for i in 0..5 {\\\"}\"}" + start: + Value: + Implicit: "0" + stop: + Value: + Implicit: "5" + inclusive: false + block: + statements: + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + accesses: [] + value: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":27,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":37,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + type_: ~ + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y;\\\"}\"}" + accesses: [] + value: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":27,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y;\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":37,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y;\\\"}\"}" + type_: ~ + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"xy_sum\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":13,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + accesses: [] + value: + Binary: + left: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":23,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":28,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":35,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":38,\\\"col_stop\\\":39,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + type_: ~ + right: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":42,\\\"col_stop\\\":46,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":47,\\\"col_stop\\\":53,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":54,\\\"col_stop\\\":55,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":32,\\\"line_stop\\\":32,\\\"col_start\\\":57,\\\"col_stop\\\":58,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" xy_sum += self.points[i].x * self.points[i].y;\\\"}\"}" + type_: ~ + op: Mul + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"x2_sum\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":13,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + accesses: [] + value: + Binary: + left: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":23,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":28,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":35,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":38,\\\"col_stop\\\":39,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + type_: ~ + right: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":42,\\\"col_stop\\\":46,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":47,\\\"col_stop\\\":53,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":54,\\\"col_stop\\\":55,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":33,\\\"line_stop\\\":33,\\\"col_start\\\":57,\\\"col_stop\\\":58,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x2_sum += self.points[i].x * self.points[i].x;\\\"}\"}" + type_: ~ + op: Mul + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"numerator\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":13,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let numerator = (num_points * xy_sum) - (x_sum * y_sum); \\\"}\"}" + type_: ~ + value: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"num_points\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":26,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let numerator = (num_points * xy_sum) - (x_sum * y_sum); \\\"}\"}" + right: + Identifier: "{\"name\":\"xy_sum\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":39,\\\"col_stop\\\":45,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let numerator = (num_points * xy_sum) - (x_sum * y_sum); \\\"}\"}" + op: Mul + right: + Binary: + left: + Identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":50,\\\"col_stop\\\":55,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let numerator = (num_points * xy_sum) - (x_sum * y_sum); \\\"}\"}" + right: + Identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":35,\\\"line_stop\\\":35,\\\"col_start\\\":58,\\\"col_stop\\\":63,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let numerator = (num_points * xy_sum) - (x_sum * y_sum); \\\"}\"}" + op: Mul + op: Sub + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"denominator\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":13,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let denominator = (num_points * x2_sum) - (x_sum * x_sum);\\\"}\"}" + type_: ~ + value: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"num_points\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":28,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let denominator = (num_points * x2_sum) - (x_sum * x_sum);\\\"}\"}" + right: + Identifier: "{\"name\":\"x2_sum\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":41,\\\"col_stop\\\":47,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let denominator = (num_points * x2_sum) - (x_sum * x_sum);\\\"}\"}" + op: Mul + right: + Binary: + left: + Identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":52,\\\"col_stop\\\":57,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let denominator = (num_points * x2_sum) - (x_sum * x_sum);\\\"}\"}" + right: + Identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":60,\\\"col_stop\\\":65,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let denominator = (num_points * x2_sum) - (x_sum * x_sum);\\\"}\"}" + op: Mul + op: Sub + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = numerator / denominator;\\\"}\"}" + type_: ~ + value: + Binary: + left: + Identifier: "{\"name\":\"numerator\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":21,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = numerator / denominator;\\\"}\"}" + right: + Identifier: "{\"name\":\"denominator\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":33,\\\"col_stop\\\":44,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = numerator / denominator;\\\"}\"}" + op: Div + - Return: + expression: + Identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":38,\\\"line_stop\\\":38,\\\"col_start\\\":16,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return slope;\\\"}\"}" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"offset\",\"span\":\"{\\\"line_start\\\":41,\\\"line_stop\\\":41,\\\"col_start\\\":14,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function offset(self, slope: i32) -> i32 {\\\"}\"}" + input: + - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":41,\\\"line_stop\\\":41,\\\"col_start\\\":21,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function offset(self, slope: i32) -> i32 {\\\"}\"}" + - Variable: + identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":41,\\\"line_stop\\\":41,\\\"col_start\\\":27,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function offset(self, slope: i32) -> i32 {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + const_: false + output: + IntegerType: I32 + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"num_points\",\"span\":\"{\\\"line_start\\\":42,\\\"line_stop\\\":42,\\\"col_start\\\":13,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let num_points = 5i32; \\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "5" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":44,\\\"line_stop\\\":44,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let x_sum = 0i32;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":45,\\\"line_stop\\\":45,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let y_sum = 0i32;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - I32 + - "0" + - Iteration: + variable: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":46,\\\"line_stop\\\":46,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for i in 0..5 {\\\"}\"}" + start: + Value: + Implicit: "0" + stop: + Value: + Implicit: "5" + inclusive: false + block: + statements: + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":47,\\\"line_stop\\\":47,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + accesses: [] + value: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":47,\\\"line_stop\\\":47,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":47,\\\"line_stop\\\":47,\\\"col_start\\\":27,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":47,\\\"line_stop\\\":47,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + name: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":47,\\\"line_stop\\\":47,\\\"col_start\\\":37,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" x_sum += self.points[i].x;\\\"}\"}" + type_: ~ + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":13,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y; \\\"}\"}" + accesses: [] + value: + Access: + Member: + inner: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":22,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y; \\\"}\"}" + name: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":27,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y; \\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":34,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y; \\\"}\"}" + name: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":37,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" y_sum += self.points[i].y; \\\"}\"}" + type_: ~ + - Return: + expression: + Binary: + left: + Binary: + left: + Identifier: "{\"name\":\"y_sum\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":17,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return (y_sum - slope * x_sum) / num_points;\\\"}\"}" + right: + Binary: + left: + Identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":25,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return (y_sum - slope * x_sum) / num_points;\\\"}\"}" + right: + Identifier: "{\"name\":\"x_sum\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":33,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return (y_sum - slope * x_sum) / num_points;\\\"}\"}" + op: Mul + op: Sub + right: + Identifier: "{\"name\":\"num_points\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":42,\\\"col_stop\\\":52,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return (y_sum - slope * x_sum) / num_points;\\\"}\"}" + op: Div + global_consts: {} + functions: + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main (x: i32, y: i32) -> [i32; 2] {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main (x: i32, y: i32) -> [i32; 2] {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main (x: i32, y: i32) -> [i32; 2] {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + - Variable: + identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":24,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main (x: i32, y: i32) -> [i32; 2] {\\\"}\"}" + const_: false + mutable: true + type_: + IntegerType: I32 + const_: false + output: + Array: + - IntegerType: I32 + - - value: "2" + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":7,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let points: [Point; 5] = [\\\"}\"}" + type_: + Array: + - Identifier: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":16,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let points: [Point; 5] = [\\\"}\"}" + - - value: "5" + value: + ArrayInline: + elements: + - Expression: + CircuitInit: + name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 1, y: y + 1},\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 1, y: y + 1},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 1, y: y + 1},\\\"}\"}" + right: + Value: + Implicit: "1" + op: Add + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 1, y: y + 1},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 1, y: y + 1},\\\"}\"}" + right: + Value: + Implicit: "1" + op: Add + - Expression: + CircuitInit: + name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 2, y: y + 2},\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 2, y: y + 2},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 2, y: y + 2},\\\"}\"}" + right: + Value: + Implicit: "2" + op: Add + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 2, y: y + 2},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 2, y: y + 2},\\\"}\"}" + right: + Value: + Implicit: "2" + op: Add + - Expression: + CircuitInit: + name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 3, y: y + 3},\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 3, y: y + 3},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 3, y: y + 3},\\\"}\"}" + right: + Value: + Implicit: "3" + op: Add + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 3, y: y + 3},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 3, y: y + 3},\\\"}\"}" + right: + Value: + Implicit: "3" + op: Add + - Expression: + CircuitInit: + name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 4, y: y + 4},\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 4, y: y + 4},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 4, y: y + 4},\\\"}\"}" + right: + Value: + Implicit: "4" + op: Add + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 4, y: y + 4},\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 4, y: y + 4},\\\"}\"}" + right: + Value: + Implicit: "4" + op: Add + - Expression: + CircuitInit: + name: "{\"name\":\"Point\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 5, y: y + 5}\\\"}\"}" + members: + - identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 5, y: y + 5}\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":16,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 5, y: y + 5}\\\"}\"}" + right: + Value: + Implicit: "5" + op: Add + - identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":23,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 5, y: y + 5}\\\"}\"}" + expression: + Binary: + left: + Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" Point{x: x + 5, y: y + 5}\\\"}\"}" + right: + Value: + Implicit: "5" + op: Add + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"reg\",\"span\":\"{\\\"line_start\\\":63,\\\"line_stop\\\":63,\\\"col_start\\\":7,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let reg = LinearRegression::new(points);\\\"}\"}" + type_: ~ + value: + Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"LinearRegression\",\"span\":\"{\\\"line_start\\\":63,\\\"line_stop\\\":63,\\\"col_start\\\":13,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let reg = LinearRegression::new(points);\\\"}\"}" + name: "{\"name\":\"new\",\"span\":\"{\\\"line_start\\\":63,\\\"line_stop\\\":63,\\\"col_start\\\":31,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let reg = LinearRegression::new(points);\\\"}\"}" + type_: ~ + arguments: + - Identifier: "{\"name\":\"points\",\"span\":\"{\\\"line_start\\\":63,\\\"line_stop\\\":63,\\\"col_start\\\":35,\\\"col_stop\\\":41,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let reg = LinearRegression::new(points);\\\"}\"}" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":64,\\\"line_stop\\\":64,\\\"col_start\\\":7,\\\"col_stop\\\":12,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = reg.slope();\\\"}\"}" + type_: ~ + value: + Call: + function: + Access: + Member: + inner: + Identifier: "{\"name\":\"reg\",\"span\":\"{\\\"line_start\\\":64,\\\"line_stop\\\":64,\\\"col_start\\\":15,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = reg.slope();\\\"}\"}" + name: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":64,\\\"line_stop\\\":64,\\\"col_start\\\":19,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let slope = reg.slope();\\\"}\"}" + type_: ~ + arguments: [] + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"offset\",\"span\":\"{\\\"line_start\\\":65,\\\"line_stop\\\":65,\\\"col_start\\\":7,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let offset = reg.offset(slope);\\\"}\"}" + type_: ~ + value: + Call: + function: + Access: + Member: + inner: + Identifier: "{\"name\":\"reg\",\"span\":\"{\\\"line_start\\\":65,\\\"line_stop\\\":65,\\\"col_start\\\":16,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let offset = reg.offset(slope);\\\"}\"}" + name: "{\"name\":\"offset\",\"span\":\"{\\\"line_start\\\":65,\\\"line_stop\\\":65,\\\"col_start\\\":20,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let offset = reg.offset(slope);\\\"}\"}" + type_: ~ + arguments: + - Identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":65,\\\"line_stop\\\":65,\\\"col_start\\\":27,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let offset = reg.offset(slope);\\\"}\"}" + - Return: + expression: + ArrayInline: + elements: + - Expression: + Identifier: "{\"name\":\"slope\",\"span\":\"{\\\"line_start\\\":66,\\\"line_stop\\\":66,\\\"col_start\\\":11,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return [slope, offset];\\\"}\"}" + - Expression: + Identifier: "{\"name\":\"offset\",\"span\":\"{\\\"line_start\\\":66,\\\"line_stop\\\":66,\\\"col_start\\\":18,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return [slope, offset];\\\"}\"}" diff --git a/tests/expectations/parser/parser/serialize/one_plus_one.leo.out b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out new file mode 100644 index 0000000000..e417be3b50 --- /dev/null +++ b/tests/expectations/parser/parser/serialize/one_plus_one.leo.out @@ -0,0 +1,36 @@ +--- +namespace: Serialize +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main() -> u8 {\\\"}\"}" + input: [] + const_: false + output: + IntegerType: U8 + core_mapping: ~ + block: + statements: + - Return: + expression: + Binary: + left: + Value: + Integer: + - U8 + - "1" + right: + Value: + Integer: + - U8 + - "1" + op: Add diff --git a/tests/expectations/parser/parser/serialize/palindrome.leo.out b/tests/expectations/parser/parser/serialize/palindrome.leo.out new file mode 100644 index 0000000000..6ecc69d502 --- /dev/null +++ b/tests/expectations/parser/parser/serialize/palindrome.leo.out @@ -0,0 +1,554 @@ +--- +namespace: Serialize +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":15,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(str: [char; 20]) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Char + - - value: "20" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Return: + expression: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":12,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return is_palindrome(str);\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return is_palindrome(str);\\\"}\"}" + "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":10,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":10,\\\"line_stop\\\":10,\\\"col_start\\\":24,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function is_palindrome(str: [char; 20]) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Char + - - value: "20" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"str_len\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":11,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const str_len = 20u32; // saving const for convenience\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - U32 + - "20" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = true;\\\"}\"}" + type_: ~ + value: + Value: + Boolean: "true" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"processed\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":9,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let processed = 0u8;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - U8 + - "0" + - Iteration: + variable: "{\"name\":\"start\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":9,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for start in 0..(str_len / 2) {\\\"}\"}" + start: + Value: + Implicit: "0" + stop: + Binary: + left: + Identifier: "{\"name\":\"str_len\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":22,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for start in 0..(str_len / 2) {\\\"}\"}" + right: + Value: + Implicit: "2" + op: Div + inclusive: false + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"start_sym\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":13,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let start_sym = str[start];\\\"}\"}" + type_: ~ + value: + Access: + Array: + array: + Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":25,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let start_sym = str[start];\\\"}\"}" + index: + Identifier: "{\"name\":\"start\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":29,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let start_sym = str[start];\\\"}\"}" + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"start_sym\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":12,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if start_sym != ' ' {\\\"}\"}" + right: + Value: + Char: + character: + Scalar: 32 + op: Ne + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"skipped\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":17,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let skipped = 0u8;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - U8 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"end_empty\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":17,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let end_empty = 0u8;\\\"}\"}" + type_: ~ + value: + Value: + Integer: + - U8 + - "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":17,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let end_sym = ' ';\\\"}\"}" + type_: ~ + value: + Value: + Char: + character: + Scalar: 32 + - Iteration: + variable: "{\"name\":\"end\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":17,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for end in (str_len - 1)..start {\\\"}\"}" + start: + Binary: + left: + Identifier: "{\"name\":\"str_len\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":25,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for end in (str_len - 1)..start {\\\"}\"}" + right: + Value: + Implicit: "1" + op: Sub + stop: + Identifier: "{\"name\":\"start\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":39,\\\"col_stop\\\":44,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for end in (str_len - 1)..start {\\\"}\"}" + inclusive: false + block: + statements: + - Conditional: + condition: + Binary: + left: + Binary: + left: + Binary: + left: + Access: + Array: + array: + Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":20,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' && skipped == processed && end_sym == ' ' {\\\"}\"}" + index: + Identifier: "{\"name\":\"end\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":24,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' && skipped == processed && end_sym == ' ' {\\\"}\"}" + right: + Value: + Char: + character: + Scalar: 32 + op: Ne + right: + Binary: + left: + Identifier: "{\"name\":\"skipped\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":39,\\\"col_stop\\\":46,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' && skipped == processed && end_sym == ' ' {\\\"}\"}" + right: + Identifier: "{\"name\":\"processed\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":50,\\\"col_stop\\\":59,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' && skipped == processed && end_sym == ' ' {\\\"}\"}" + op: Eq + op: And + right: + Binary: + left: + Identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":63,\\\"col_stop\\\":70,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' && skipped == processed && end_sym == ' ' {\\\"}\"}" + right: + Value: + Char: + character: + Scalar: 32 + op: Eq + op: And + block: + statements: + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":21,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" end_sym = str[end];\\\"}\"}" + accesses: [] + value: + Access: + Array: + array: + Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":31,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" end_sym = str[end];\\\"}\"}" + index: + Identifier: "{\"name\":\"end\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":35,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" end_sym = str[end];\\\"}\"}" + next: + Block: + statements: + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"end_empty\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":21,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" end_empty = end_empty + 1;\\\"}\"}" + accesses: [] + value: + Binary: + left: + Identifier: "{\"name\":\"end_empty\",\"span\":\"{\\\"line_start\\\":28,\\\"line_stop\\\":28,\\\"col_start\\\":33,\\\"col_stop\\\":42,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" end_empty = end_empty + 1;\\\"}\"}" + right: + Value: + Implicit: "1" + op: Add + - Conditional: + condition: + Binary: + left: + Access: + Array: + array: + Identifier: "{\"name\":\"str\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":24,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' {\\\"}\"}" + index: + Identifier: "{\"name\":\"end\",\"span\":\"{\\\"line_start\\\":29,\\\"line_stop\\\":29,\\\"col_start\\\":28,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if str[end] != ' ' {\\\"}\"}" + right: + Value: + Char: + character: + Scalar: 32 + op: Ne + block: + statements: + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"skipped\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":25,\\\"col_stop\\\":32,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" skipped = skipped + 1;\\\"}\"}" + accesses: [] + value: + Binary: + left: + Identifier: "{\"name\":\"skipped\",\"span\":\"{\\\"line_start\\\":30,\\\"line_stop\\\":30,\\\"col_start\\\":35,\\\"col_stop\\\":42,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" skipped = skipped + 1;\\\"}\"}" + right: + Value: + Implicit: "1" + op: Add + next: ~ + - Conditional: + condition: + Binary: + left: + Identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":16,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if end_sym != ' ' {\\\"}\"}" + right: + Value: + Char: + character: + Scalar: 32 + op: Ne + block: + statements: + - Console: + function: + Log: + string: + - Scalar: 67 + - Scalar: 111 + - Scalar: 109 + - Scalar: 112 + - Scalar: 97 + - Scalar: 114 + - Scalar: 105 + - Scalar: 110 + - Scalar: 103 + - Scalar: 58 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + - Scalar: 32 + - Scalar: 63 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + parameters: + - Identifier: "{\"name\":\"start_sym\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":51,\\\"col_stop\\\":60,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"Comparing: {} ? {}\\\\\\\", start_sym, end_sym);\\\"}\"}" + - Identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":37,\\\"line_stop\\\":37,\\\"col_start\\\":62,\\\"col_stop\\\":69,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"Comparing: {} ? {}\\\\\\\", start_sym, end_sym);\\\"}\"}" + - Conditional: + condition: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":39,\\\"line_stop\\\":39,\\\"col_start\\\":20,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if result {\\\"}\"}" + block: + statements: + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":40,\\\"line_stop\\\":40,\\\"col_start\\\":21,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" result = (start_sym == end_sym);\\\"}\"}" + accesses: [] + value: + Binary: + left: + Identifier: "{\"name\":\"start_sym\",\"span\":\"{\\\"line_start\\\":40,\\\"line_stop\\\":40,\\\"col_start\\\":31,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" result = (start_sym == end_sym);\\\"}\"}" + right: + Identifier: "{\"name\":\"end_sym\",\"span\":\"{\\\"line_start\\\":40,\\\"line_stop\\\":40,\\\"col_start\\\":44,\\\"col_stop\\\":51,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" result = (start_sym == end_sym);\\\"}\"}" + op: Eq + next: ~ + - Assign: + operation: Assign + assignee: + identifier: "{\"name\":\"processed\",\"span\":\"{\\\"line_start\\\":43,\\\"line_stop\\\":43,\\\"col_start\\\":17,\\\"col_stop\\\":26,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" processed = processed + 1;\\\"}\"}" + accesses: [] + value: + Binary: + left: + Identifier: "{\"name\":\"processed\",\"span\":\"{\\\"line_start\\\":43,\\\"line_stop\\\":43,\\\"col_start\\\":29,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" processed = processed + 1;\\\"}\"}" + right: + Value: + Implicit: "1" + op: Add + next: ~ + next: ~ + - Console: + function: + Log: + string: + - Scalar: 82 + - Scalar: 101 + - Scalar: 115 + - Scalar: 117 + - Scalar: 108 + - Scalar: 116 + - Scalar: 32 + - Scalar: 105 + - Scalar: 115 + - Scalar: 58 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + parameters: + - Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":48,\\\"line_stop\\\":48,\\\"col_start\\\":34,\\\"col_stop\\\":40,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"Result is: {}\\\\\\\", result);\\\"}\"}" + - Return: + expression: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":50,\\\"line_stop\\\":50,\\\"col_start\\\":12,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return result;\\\"}\"}" + "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}": + annotations: + test: + arguments: [] + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":53,\\\"line_stop\\\":53,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" + identifier: "{\"name\":\"test_is_palindrome\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":10,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_is_palindrome() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":55,\\\"line_stop\\\":55,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"a b a \\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 97 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 98 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 97 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":56,\\\"line_stop\\\":56,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"😀😀😀😀😀 😀😀😀😀😀\\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Scalar: 128512 + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"borrow or rob \\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 98 + - Scalar: 111 + - Scalar: 114 + - Scalar: 114 + - Scalar: 111 + - Scalar: 119 + - Scalar: 32 + - Scalar: 111 + - Scalar: 114 + - Scalar: 32 + - Scalar: 114 + - Scalar: 111 + - Scalar: 98 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":58,\\\"line_stop\\\":58,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"bbbb aaaa aaaa bbbb\\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 98 + - Scalar: 98 + - Scalar: 98 + - Scalar: 98 + - Scalar: 32 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 32 + - Scalar: 32 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 32 + - Scalar: 98 + - Scalar: 98 + - Scalar: 98 + - Scalar: 98 + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":59,\\\"line_stop\\\":59,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"aaaaaaaaaaaaaaaaaaaa\\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Scalar: 97 + - Console: + function: + Assert: + Call: + function: + Identifier: "{\"name\":\"is_palindrome\",\"span\":\"{\\\"line_start\\\":60,\\\"line_stop\\\":60,\\\"col_start\\\":20,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(is_palindrome(\\\\\\\"taco cat \\\\\\\"));\\\"}\"}" + arguments: + - Value: + String: + - Scalar: 116 + - Scalar: 97 + - Scalar: 99 + - Scalar: 111 + - Scalar: 32 + - Scalar: 99 + - Scalar: 97 + - Scalar: 116 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 + - Scalar: 32 diff --git a/tests/expectations/parser/parser/serialize/parser_error.leo.out b/tests/expectations/parser/parser/serialize/parser_error.leo.out new file mode 100644 index 0000000000..716c636e1b --- /dev/null +++ b/tests/expectations/parser/parser/serialize/parser_error.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Serialize +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got 'invalid'\n --> test:3:1\n |\n 3 | invalid\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/serialize/pedersen_hash.leo.out b/tests/expectations/parser/parser/serialize/pedersen_hash.leo.out new file mode 100644 index 0000000000..9ac6f544ab --- /dev/null +++ b/tests/expectations/parser/parser/serialize/pedersen_hash.leo.out @@ -0,0 +1,169 @@ +--- +namespace: Serialize +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: [] + imports: {} + aliases: {} + circuits: + "{\"name\":\"PedersenHash\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit PedersenHash {\\\"}\"}": + circuit_name: "{\"name\":\"PedersenHash\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":9,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"circuit PedersenHash {\\\"}\"}" + members: + - CircuitVariable: + - "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":5,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" parameters: [group; 256];\\\"}\"}" + - Array: + - Group + - - value: "256" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"new\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":14,\\\"col_stop\\\":17,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(parameters: [group; 256]) -> Self {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function new(parameters: [group; 256]) -> Self {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Group + - - value: "256" + const_: false + output: SelfType + core_mapping: ~ + block: + statements: + - Return: + expression: + CircuitInit: + name: "{\"name\":\"Self\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { parameters: parameters };\\\"}\"}" + members: + - identifier: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":23,\\\"col_stop\\\":33,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { parameters: parameters };\\\"}\"}" + expression: + Identifier: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":35,\\\"col_stop\\\":45,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return Self { parameters: parameters };\\\"}\"}" + - CircuitFunction: + annotations: {} + identifier: "{\"name\":\"hash\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":14,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function hash(self, bits: [bool; 256]) -> group {\\\"}\"}" + input: + - SelfKeyword: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":19,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function hash(self, bits: [bool; 256]) -> group {\\\"}\"}" + - Variable: + identifier: "{\"name\":\"bits\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":25,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" function hash(self, bits: [bool; 256]) -> group {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Boolean + - - value: "256" + const_: false + output: Group + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"digest\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":13,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let digest: group = 0group;\\\"}\"}" + type_: Group + value: + Value: + Group: + Single: "0" + - Iteration: + variable: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":13,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" for i in 0..256 {\\\"}\"}" + start: + Value: + Implicit: "0" + stop: + Value: + Implicit: "256" + inclusive: false + block: + statements: + - Conditional: + condition: + Access: + Array: + array: + Identifier: "{\"name\":\"bits\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":16,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if bits[i] {\\\"}\"}" + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":21,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" if bits[i] {\\\"}\"}" + block: + statements: + - Assign: + operation: Add + assignee: + identifier: "{\"name\":\"digest\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":17,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" digest += self.parameters[i];\\\"}\"}" + accesses: [] + value: + Access: + Array: + array: + Access: + Member: + inner: + Identifier: "{\"name\":\"self\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":27,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" digest += self.parameters[i];\\\"}\"}" + name: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":32,\\\"col_stop\\\":42,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" digest += self.parameters[i];\\\"}\"}" + type_: ~ + index: + Identifier: "{\"name\":\"i\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":43,\\\"col_stop\\\":44,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" digest += self.parameters[i];\\\"}\"}" + next: ~ + - Return: + expression: + Identifier: "{\"name\":\"digest\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":16,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return digest;\\\"}\"}" + global_consts: {} + functions: + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"hash_input\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":15,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - Boolean + - - value: "256" + - Variable: + identifier: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":23,\\\"line_stop\\\":23,\\\"col_start\\\":46,\\\"col_stop\\\":56,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group {\\\"}\"}" + const_: true + mutable: false + type_: + Array: + - Group + - - value: "256" + const_: false + output: Group + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Const + variable_names: + - mutable: false + identifier: "{\"name\":\"pedersen\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":11,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const pedersen = PedersenHash::new(parameters);\\\"}\"}" + type_: ~ + value: + Call: + function: + Access: + Static: + inner: + Identifier: "{\"name\":\"PedersenHash\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":22,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const pedersen = PedersenHash::new(parameters);\\\"}\"}" + name: "{\"name\":\"new\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":36,\\\"col_stop\\\":39,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const pedersen = PedersenHash::new(parameters);\\\"}\"}" + type_: ~ + arguments: + - Identifier: "{\"name\":\"parameters\",\"span\":\"{\\\"line_start\\\":24,\\\"line_stop\\\":24,\\\"col_start\\\":40,\\\"col_stop\\\":50,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" const pedersen = PedersenHash::new(parameters);\\\"}\"}" + - Return: + expression: + Call: + function: + Access: + Member: + inner: + Identifier: "{\"name\":\"pedersen\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":12,\\\"col_stop\\\":20,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return pedersen.hash(hash_input);\\\"}\"}" + name: "{\"name\":\"hash\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":21,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return pedersen.hash(hash_input);\\\"}\"}" + type_: ~ + arguments: + - Identifier: "{\"name\":\"hash_input\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":26,\\\"col_stop\\\":36,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return pedersen.hash(hash_input);\\\"}\"}" diff --git a/tests/expectations/parser/parser/serialize/silly_sudoku.leo.out b/tests/expectations/parser/parser/serialize/silly_sudoku.leo.out new file mode 100644 index 0000000000..f0c7db8212 --- /dev/null +++ b/tests/expectations/parser/parser/serialize/silly_sudoku.leo.out @@ -0,0 +1,528 @@ +--- +namespace: Serialize +expectation: Pass +outputs: + - name: "" + expected_input: [] + import_statements: + - package_or_packages: + Package: + name: "{\"name\":\"lib\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":8,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import lib.SillySudoku;\\\"}\"}" + access: + Symbol: + symbol: "{\"name\":\"SillySudoku\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":23,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"import lib.SillySudoku;\\\"}\"}" + alias: ~ + imports: {} + aliases: {} + circuits: {} + global_consts: {} + functions: + "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool {\\\"}\"}": + annotations: {} + identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":10,\\\"col_stop\\\":14,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool {\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":15,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + - Variable: + identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":37,\\\"col_stop\\\":43,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool {\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + const_: false + output: Boolean + core_mapping: ~ + block: + statements: + - Console: + function: + Log: + string: + - Scalar: 83 + - Scalar: 116 + - Scalar: 97 + - Scalar: 114 + - Scalar: 116 + - Scalar: 105 + - Scalar: 110 + - Scalar: 103 + - Scalar: 32 + - Scalar: 83 + - Scalar: 117 + - Scalar: 100 + - Scalar: 111 + - Scalar: 107 + - Scalar: 117 + - Scalar: 32 + - Scalar: 115 + - Scalar: 111 + - Scalar: 108 + - Scalar: 118 + - Scalar: 101 + - Scalar: 114 + - Scalar: 46 + - Scalar: 46 + - Scalar: 46 + parameters: [] + - Console: + function: + Log: + string: + - Scalar: 123 + - Scalar: 125 + parameters: + - Identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"{}\\\\\\\", puzzle);\\\"}\"}" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"sudoku\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let sudoku = SillySudoku { puzzle_grid: puzzle };\\\"}\"}" + type_: ~ + value: + CircuitInit: + name: "{\"name\":\"SillySudoku\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":18,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let sudoku = SillySudoku { puzzle_grid: puzzle };\\\"}\"}" + members: + - identifier: "{\"name\":\"puzzle_grid\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":32,\\\"col_stop\\\":43,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let sudoku = SillySudoku { puzzle_grid: puzzle };\\\"}\"}" + expression: + Identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":45,\\\"col_stop\\\":51,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let sudoku = SillySudoku { puzzle_grid: puzzle };\\\"}\"}" + - Console: + function: + Log: + string: + - Scalar: 67 + - Scalar: 104 + - Scalar: 101 + - Scalar: 99 + - Scalar: 107 + - Scalar: 105 + - Scalar: 110 + - Scalar: 103 + - Scalar: 32 + - Scalar: 83 + - Scalar: 117 + - Scalar: 100 + - Scalar: 111 + - Scalar: 107 + - Scalar: 117 + - Scalar: 32 + - Scalar: 97 + - Scalar: 110 + - Scalar: 115 + - Scalar: 119 + - Scalar: 101 + - Scalar: 114 + - Scalar: 46 + - Scalar: 46 + - Scalar: 46 + parameters: [] + - Console: + function: + Log: + string: + - Scalar: 123 + - Scalar: 125 + parameters: + - Identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"{}\\\\\\\", answer);\\\"}\"}" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = sudoku.solve(answer);\\\"}\"}" + type_: ~ + value: + Call: + function: + Access: + Member: + inner: + Identifier: "{\"name\":\"sudoku\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":18,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = sudoku.solve(answer);\\\"}\"}" + name: "{\"name\":\"solve\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":25,\\\"col_stop\\\":30,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = sudoku.solve(answer);\\\"}\"}" + type_: ~ + arguments: + - Identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":17,\\\"line_stop\\\":17,\\\"col_start\\\":31,\\\"col_stop\\\":37,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = sudoku.solve(answer);\\\"}\"}" + - Console: + function: + Log: + string: + - Scalar: 84 + - Scalar: 104 + - Scalar: 101 + - Scalar: 32 + - Scalar: 97 + - Scalar: 110 + - Scalar: 115 + - Scalar: 119 + - Scalar: 101 + - Scalar: 114 + - Scalar: 32 + - Scalar: 105 + - Scalar: 115 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + - Scalar: 46 + parameters: + - Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":38,\\\"col_stop\\\":44,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"The answer is {}.\\\\\\\", result);\\\"}\"}" + - Return: + expression: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":12,\\\"col_stop\\\":18,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" return result;\\\"}\"}" + "{\"name\":\"test_solve_pass\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":10,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_pass() {\\\"}\"}": + annotations: + test: + arguments: [] + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":25,\\\"line_stop\\\":25,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" + identifier: "{\"name\":\"test_solve_pass\",\"span\":\"{\\\"line_start\\\":26,\\\"line_stop\\\":26,\\\"col_start\\\":10,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_pass() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":27,\\\"line_stop\\\":27,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let puzzle: [u8; (3, 3)] = [[0, 2, 0],\\\"}\"}" + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + value: + ArrayInline: + elements: + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "2" + - Expression: + Value: + Implicit: "0" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "6" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "8" + - Expression: + Value: + Implicit: "9" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":31,\\\"line_stop\\\":31,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let answer: [u8; (3, 3)] = [[1, 2, 3],\\\"}\"}" + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + value: + ArrayInline: + elements: + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "1" + - Expression: + Value: + Implicit: "2" + - Expression: + Value: + Implicit: "3" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "4" + - Expression: + Value: + Implicit: "5" + - Expression: + Value: + Implicit: "6" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "7" + - Expression: + Value: + Implicit: "8" + - Expression: + Value: + Implicit: "9" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":36,\\\"line_stop\\\":36,\\\"col_start\\\":31,\\\"col_stop\\\":37,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Console: + function: + Assert: + Binary: + left: + Value: + Boolean: "true" + right: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":39,\\\"line_stop\\\":39,\\\"col_start\\\":28,\\\"col_stop\\\":34,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(true == result);\\\"}\"}" + op: Eq + "{\"name\":\"test_solve_fail\",\"span\":\"{\\\"line_start\\\":44,\\\"line_stop\\\":44,\\\"col_start\\\":10,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_fail() {\\\"}\"}": + annotations: + test: + arguments: [] + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":43,\\\"line_stop\\\":43,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test\\\"}\"}" + identifier: "{\"name\":\"test_solve_fail\",\"span\":\"{\\\"line_start\\\":44,\\\"line_stop\\\":44,\\\"col_start\\\":10,\\\"col_stop\\\":25,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_fail() {\\\"}\"}" + input: [] + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":45,\\\"line_stop\\\":45,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let puzzle: [u8; (3, 3)] = [[0, 2, 0],\\\"}\"}" + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + value: + ArrayInline: + elements: + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "2" + - Expression: + Value: + Implicit: "0" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "6" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "0" + - Expression: + Value: + Implicit: "8" + - Expression: + Value: + Implicit: "0" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":49,\\\"line_stop\\\":49,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let answer: [u8; (3, 3)] = [[1, 2, 3],\\\"}\"}" + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + value: + ArrayInline: + elements: + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "1" + - Expression: + Value: + Implicit: "2" + - Expression: + Value: + Implicit: "3" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "4" + - Expression: + Value: + Implicit: "5" + - Expression: + Value: + Implicit: "6" + - Expression: + ArrayInline: + elements: + - Expression: + Value: + Implicit: "7" + - Expression: + Value: + Implicit: "8" + - Expression: + Value: + Implicit: "8" + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":54,\\\"line_stop\\\":54,\\\"col_start\\\":31,\\\"col_stop\\\":37,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Console: + function: + Assert: + Binary: + left: + Value: + Boolean: "false" + right: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":57,\\\"line_stop\\\":57,\\\"col_start\\\":29,\\\"col_stop\\\":35,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(false == result);\\\"}\"}" + op: Eq + "{\"name\":\"test_solve_with_input\",\"span\":\"{\\\"line_start\\\":62,\\\"line_stop\\\":62,\\\"col_start\\\":10,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_with_input(\\\"}\"}": + annotations: + test: + arguments: + - test_input + name: "{\"name\":\"test\",\"span\":\"{\\\"line_start\\\":61,\\\"line_stop\\\":61,\\\"col_start\\\":2,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"@test(test_input)\\\"}\"}" + identifier: "{\"name\":\"test_solve_with_input\",\"span\":\"{\\\"line_start\\\":62,\\\"line_stop\\\":62,\\\"col_start\\\":10,\\\"col_stop\\\":31,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function test_solve_with_input(\\\"}\"}" + input: + - Variable: + identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":63,\\\"line_stop\\\":63,\\\"col_start\\\":5,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" puzzle: [u8; (3, 3)],\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + - Variable: + identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":64,\\\"line_stop\\\":64,\\\"col_start\\\":5,\\\"col_stop\\\":11,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" answer: [u8; (3, 3)],\\\"}\"}" + const_: false + mutable: true + type_: + Array: + - IntegerType: U8 + - - value: "3" + - value: "3" + - Variable: + identifier: "{\"name\":\"expected\",\"span\":\"{\\\"line_start\\\":65,\\\"line_stop\\\":65,\\\"col_start\\\":5,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" expected: bool\\\"}\"}" + const_: false + mutable: true + type_: Boolean + const_: false + output: ~ + core_mapping: ~ + block: + statements: + - Definition: + declaration_type: Let + variable_names: + - mutable: true + identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":68,\\\"line_stop\\\":68,\\\"col_start\\\":9,\\\"col_stop\\\":15,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + type_: ~ + value: + Call: + function: + Identifier: "{\"name\":\"main\",\"span\":\"{\\\"line_start\\\":68,\\\"line_stop\\\":68,\\\"col_start\\\":18,\\\"col_stop\\\":22,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + arguments: + - Identifier: "{\"name\":\"puzzle\",\"span\":\"{\\\"line_start\\\":68,\\\"line_stop\\\":68,\\\"col_start\\\":23,\\\"col_stop\\\":29,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Identifier: "{\"name\":\"answer\",\"span\":\"{\\\"line_start\\\":68,\\\"line_stop\\\":68,\\\"col_start\\\":31,\\\"col_stop\\\":37,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let result = main(puzzle, answer);\\\"}\"}" + - Console: + function: + Log: + string: + - Scalar: 101 + - Scalar: 120 + - Scalar: 112 + - Scalar: 101 + - Scalar: 99 + - Scalar: 116 + - Scalar: 101 + - Scalar: 100 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + - Scalar: 44 + - Scalar: 32 + - Scalar: 103 + - Scalar: 111 + - Scalar: 116 + - Scalar: 32 + - Scalar: 123 + - Scalar: 125 + parameters: + - Identifier: "{\"name\":\"expected\",\"span\":\"{\\\"line_start\\\":70,\\\"line_stop\\\":70,\\\"col_start\\\":40,\\\"col_stop\\\":48,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"expected {}, got {}\\\\\\\", expected, result);\\\"}\"}" + - Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":70,\\\"line_stop\\\":70,\\\"col_start\\\":50,\\\"col_stop\\\":56,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.log(\\\\\\\"expected {}, got {}\\\\\\\", expected, result);\\\"}\"}" + - Console: + function: + Assert: + Binary: + left: + Identifier: "{\"name\":\"expected\",\"span\":\"{\\\"line_start\\\":72,\\\"line_stop\\\":72,\\\"col_start\\\":20,\\\"col_stop\\\":28,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(expected == result);\\\"}\"}" + right: + Identifier: "{\"name\":\"result\",\"span\":\"{\\\"line_start\\\":72,\\\"line_stop\\\":72,\\\"col_start\\\":32,\\\"col_stop\\\":38,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" console.assert(expected == result);\\\"}\"}" + op: Eq diff --git a/tests/expectations/parser/parser/statement/console.leo.out b/tests/expectations/parser/parser/statement/console.leo.out index f8bb2b4c7d..ac03e47b00 100644 --- a/tests/expectations/parser/parser/statement/console.leo.out +++ b/tests/expectations/parser/parser/statement/console.leo.out @@ -24,15 +24,15 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 15 - col_stop: 22 + col_start: 14 + col_stop: 23 path: "" content: "console.error(\"{}\", x);" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 22 + col_stop: 23 path: "" content: "console.error(\"{}\", x);" - Console: @@ -49,15 +49,15 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 15 - col_stop: 27 + col_start: 14 + col_stop: 28 path: "" content: "console.error(\"{}{}\", x, y);" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 27 + col_stop: 28 path: "" content: "console.error(\"{}{}\", x, y);" - Console: @@ -69,15 +69,15 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 15 - col_stop: 18 + col_start: 14 + col_stop: 19 path: "" content: "console.error(\"x\");" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 18 + col_stop: 19 path: "" content: "console.error(\"x\");" - Console: @@ -91,15 +91,15 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 13 - col_stop: 20 + col_start: 12 + col_stop: 21 path: "" content: "console.log(\"{}\", x);" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 20 + col_stop: 21 path: "" content: "console.log(\"{}\", x);" - Console: @@ -116,15 +116,15 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 13 - col_stop: 25 + col_start: 12 + col_stop: 26 path: "" content: "console.log(\"{}{}\", x, y);" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 25 + col_stop: 26 path: "" content: "console.log(\"{}{}\", x, y);" - Console: @@ -136,14 +136,14 @@ outputs: span: line_start: 1 line_stop: 1 - col_start: 13 - col_stop: 16 + col_start: 12 + col_stop: 17 path: "" content: "console.log(\"x\");" span: line_start: 1 line_stop: 1 col_start: 1 - col_stop: 16 + col_stop: 17 path: "" content: "console.log(\"x\");" diff --git a/tests/expectations/parser/parser/statement/let_mut_recover.leo.out b/tests/expectations/parser/parser/statement/let_mut_recover.leo.out new file mode 100644 index 0000000000..6e6b2f1418 --- /dev/null +++ b/tests/expectations/parser/parser/statement/let_mut_recover.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:4:5\n |\n 4 | let mut x = 0;\n | ^^^^^^^\nError [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:5:5\n |\n 5 | let mut y = 0; // recovery witness\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/unreachable/eat_ident.leo.out b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out new file mode 100644 index 0000000000..a979c804ac --- /dev/null +++ b/tests/expectations/parser/parser/unreachable/eat_ident.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected { -- got 'circuit'\n --> test:4:1\n |\n 4 | circuit ;\n | ^^^^^^^" diff --git a/tests/expectations/parser/parser/unreachable/eat_int.leo.out b/tests/expectations/parser/parser/unreachable/eat_int.leo.out new file mode 100644 index 0000000000..f4b4c369d8 --- /dev/null +++ b/tests/expectations/parser/parser/unreachable/eat_int.leo.out @@ -0,0 +1,5 @@ +--- +namespace: Parse +expectation: Fail +outputs: + - "Error [EPAR0370005]: expected 'import', 'circuit', 'function', 'test', '@' -- got 'x'\n --> test:3:1\n |\n 3 | x.0_try_to_hit_hit_eat_int_unreachable\n | ^" diff --git a/tests/parser/circuits/const_functions.leo b/tests/parser/circuits/const_functions.leo new file mode 100644 index 0000000000..21fb9d5e12 --- /dev/null +++ b/tests/parser/circuits/const_functions.leo @@ -0,0 +1,23 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + x: u32 + const function x() { + return (); + } + const function x(self) { + return (); + } + const function c(const self) { + return (); + } + const function b(const self, x: u32) { + return (); + } + const function b(const self, const x: u32) { + return (); + } +} diff --git a/tests/parser/circuits/consts.leo b/tests/parser/circuits/consts.leo new file mode 100644 index 0000000000..e50b3829a7 --- /dev/null +++ b/tests/parser/circuits/consts.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + static const x: u32 = 2; + static const y: u32 = 5; +} \ No newline at end of file diff --git a/tests/parser/circuits/field_and_functions.leo b/tests/parser/circuits/field_and_functions.leo index 51d09324ec..99ce46e134 100644 --- a/tests/parser/circuits/field_and_functions.leo +++ b/tests/parser/circuits/field_and_functions.leo @@ -4,6 +4,7 @@ expectation: Pass */ circuit X { + static const a: u8 = 10; x: u32, y: u32 function x() { diff --git a/tests/parser/circuits/fields_fail.leo b/tests/parser/circuits/fields_fail.leo index a56bdb1a6e..6ebc22b0b1 100644 --- a/tests/parser/circuits/fields_fail.leo +++ b/tests/parser/circuits/fields_fail.leo @@ -11,4 +11,5 @@ circuit X { circuit X { x: u32, y: u32; -} \ No newline at end of file + , // recovery witness +} diff --git a/tests/parser/circuits/functions.leo b/tests/parser/circuits/functions.leo index 4eff256a0a..511bb48aa0 100644 --- a/tests/parser/circuits/functions.leo +++ b/tests/parser/circuits/functions.leo @@ -10,4 +10,7 @@ circuit X { function y() { return (); } -} \ No newline at end of file + const function z() { + return (); + } +} diff --git a/tests/parser/circuits/mixed_order_fail.leo b/tests/parser/circuits/mixed_order_fail.leo new file mode 100644 index 0000000000..7267cf0465 --- /dev/null +++ b/tests/parser/circuits/mixed_order_fail.leo @@ -0,0 +1,19 @@ +/* +namespace: Parse +expectation: Fail +*/ + +circuit A { + function a() {} + const function z() {} + + foo: u8, + + static const BAR: u8 = 0u8; +} + +circuit B { + foo: u8, + + static const BAR: u8 = 0u8; +} diff --git a/tests/parser/circuits/mut_self.leo b/tests/parser/circuits/mut_self_fail.leo similarity index 83% rename from tests/parser/circuits/mut_self.leo rename to tests/parser/circuits/mut_self_fail.leo index 952f73a236..dff6af2db1 100644 --- a/tests/parser/circuits/mut_self.leo +++ b/tests/parser/circuits/mut_self_fail.leo @@ -1,6 +1,6 @@ /* namespace: Parse -expectation: Pass +expectation: Fail */ circuit X { diff --git a/tests/parser/circuits/ref_self.leo b/tests/parser/circuits/ref_self.leo new file mode 100644 index 0000000000..8e5c19f820 --- /dev/null +++ b/tests/parser/circuits/ref_self.leo @@ -0,0 +1,10 @@ +/* +namespace: Parse +expectation: Pass +*/ + +circuit X { + function x(&self) { + return (); + } +} \ No newline at end of file diff --git a/tests/parser/circuits/struct_fail.leo b/tests/parser/circuits/struct_fail.leo new file mode 100644 index 0000000000..582b508aab --- /dev/null +++ b/tests/parser/circuits/struct_fail.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Fail +*/ + +struct A {} +circuit B {} +class C {} +circuit D {} diff --git a/tests/parser/expression/array_init.leo b/tests/parser/expression/array_init.leo index 8efc49b5d6..343be881e7 100644 --- a/tests/parser/expression/array_init.leo +++ b/tests/parser/expression/array_init.leo @@ -11,6 +11,8 @@ expectation: Pass [0; (1, 2)] +[0; (1, 2,)] + [0; (1, 2, 3)] -[[[0; 3]; 2]; 1] \ No newline at end of file +[[[0; 3]; 2]; 1] diff --git a/tests/parser/expression/array_init_fail.leo b/tests/parser/expression/array_init_fail.leo index b9ff1835f8..8cd5b5eb0b 100644 --- a/tests/parser/expression/array_init_fail.leo +++ b/tests/parser/expression/array_init_fail.leo @@ -7,3 +7,5 @@ expectation: Fail [...0u8; 1] [...0; 1] + +[0; ()] diff --git a/tests/parser/expression/literal/access.leo b/tests/parser/expression/literal/access.leo new file mode 100644 index 0000000000..bb30728808 --- /dev/null +++ b/tests/parser/expression/literal/access.leo @@ -0,0 +1,51 @@ +/* +namespace: ParseExpression +expectation: Pass +*/ + +// address +aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8.call() +address::call() + +// bool +true.call() +bool::call() + +// char +'a'.call() +char::call() + +// field +1field.call() +field::call() + +//group +0group.call() +(0, 1)group.call() +group::call() + +// ints +1i8.call() +1i16.call() +1i32.call() +1i64.call() +1i128.call() + +i8::call() +i16::call() +i32::call() +i64::call() +i128::call() + +// uints +1u8.call() +1u16.call() +1u32.call() +1u64.call() +1u128.call() + +u8::call() +u16::call() +u32::call() +u64::call() +u128::call() \ No newline at end of file diff --git a/tests/parser/expression/literal/group_fail.leo b/tests/parser/expression/literal/group_fail.leo index 6a5651d9c0..1b0ecd1de2 100644 --- a/tests/parser/expression/literal/group_fail.leo +++ b/tests/parser/expression/literal/group_fail.leo @@ -3,8 +3,6 @@ namespace: ParseExpression expectation: Fail */ -group - ()group (123)group diff --git a/tests/parser/functions/annotated.leo b/tests/parser/functions/annotated.leo index 39a1686dd7..56568b959a 100644 --- a/tests/parser/functions/annotated.leo +++ b/tests/parser/functions/annotated.leo @@ -4,6 +4,21 @@ expectation: Pass */ @test -function x() { +function a() { return (); -} \ No newline at end of file +} + +@test(test) +function b() { + return (); +} + +@test(test,) +function c() { + return (); +} + +@test() +function d() { + return (); +} diff --git a/tests/parser/functions/annotated_arg_not_ident_int.leo b/tests/parser/functions/annotated_arg_not_ident_int.leo new file mode 100644 index 0000000000..20780213f0 --- /dev/null +++ b/tests/parser/functions/annotated_arg_not_ident_int.leo @@ -0,0 +1,14 @@ +/* +namespace: Parse +expectation: Fail +*/ + +@foo(?, bar, ?) +function x() { + return (); +} + +@context // recovery witness +function x() { + return (); +} diff --git a/tests/parser/functions/annotated_context_fail.leo b/tests/parser/functions/annotated_context_fail.leo new file mode 100644 index 0000000000..1daef2c25c --- /dev/null +++ b/tests/parser/functions/annotated_context_fail.leo @@ -0,0 +1,14 @@ +/* +namespace: Parse +expectation: Fail +*/ + +@context +function f() { + return (); +} + +@context // recovery witness +function g() { + return (); +} diff --git a/tests/parser/functions/annotated_fail.leo b/tests/parser/functions/annotated_fail.leo deleted file mode 100644 index 2f21d6171c..0000000000 --- a/tests/parser/functions/annotated_fail.leo +++ /dev/null @@ -1,9 +0,0 @@ -/* -namespace: Parse -expectation: Fail -*/ - -@test(test,) -function x() { - return (); -} \ No newline at end of file diff --git a/tests/parser/functions/bounded_recursion.leo b/tests/parser/functions/bounded_recursion.leo new file mode 100644 index 0000000000..6ca5a10f4e --- /dev/null +++ b/tests/parser/functions/bounded_recursion.leo @@ -0,0 +1,15 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(const y: u32) { + if y < 5u32 { + x(y+1); + } +} + +function main(y: bool) -> bool { + x(1u32); + return y; +} \ No newline at end of file diff --git a/tests/parser/functions/bounded_recursion_fail.leo b/tests/parser/functions/bounded_recursion_fail.leo new file mode 100644 index 0000000000..96c93779d4 --- /dev/null +++ b/tests/parser/functions/bounded_recursion_fail.leo @@ -0,0 +1,15 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function x(const y: u32) { + if y < 999u32 { + x(y+1); + } +} + +function main(y: bool) -> bool { + x(1u32); + return y; +} \ No newline at end of file diff --git a/tests/parser/functions/const_function.leo b/tests/parser/functions/const_function.leo new file mode 100644 index 0000000000..fd8703b9fc --- /dev/null +++ b/tests/parser/functions/const_function.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Pass +*/ + +const function x() { + return (); +} diff --git a/tests/parser/functions/infinite_recursion_fail.leo b/tests/parser/functions/infinite_recursion_fail.leo new file mode 100644 index 0000000000..b1660ba188 --- /dev/null +++ b/tests/parser/functions/infinite_recursion_fail.leo @@ -0,0 +1,13 @@ +/* +namespace: Parse +expectation: Pass +*/ + +function inf() { + inf(); +} + +function main(y: bool) -> bool { + inf(); + return y; +} \ No newline at end of file diff --git a/tests/parser/import/import_empty_list_fail.leo b/tests/parser/import/import_empty_list_fail.leo index 536a91d51a..4e8bbe7b80 100644 --- a/tests/parser/import/import_empty_list_fail.leo +++ b/tests/parser/import/import_empty_list_fail.leo @@ -3,4 +3,6 @@ namespace: Parse expectation: Fail */ -import a.(); \ No newline at end of file +import a.(); + +import a.(); diff --git a/tests/parser/import/invalid_chars_fail.leo b/tests/parser/import/invalid_chars_fail.leo new file mode 100644 index 0000000000..47cf2bcb72 --- /dev/null +++ b/tests/parser/import/invalid_chars_fail.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Fail +*/ + +import AB.c; + +import AB.c; diff --git a/tests/parser/import/keyword_fail.leo b/tests/parser/import/keyword_fail.leo new file mode 100644 index 0000000000..11b5456b79 --- /dev/null +++ b/tests/parser/import/keyword_fail.leo @@ -0,0 +1,8 @@ +/* +namespace: Parse +expectation: Fail +*/ + +import function.a; + +import import.a; diff --git a/tests/parser/serialize/linear_regression.leo b/tests/parser/serialize/linear_regression.leo new file mode 100644 index 0000000000..b64dd2cbac --- /dev/null +++ b/tests/parser/serialize/linear_regression.leo @@ -0,0 +1,70 @@ +/* +namespace: Serialize +expectation: Pass +*/ + +circuit Point { + x: i32, + y: i32, + + function new(x: i32, y: i32) -> Self { + return Self { x, y }; + } +} + +circuit LinearRegression { + points: [Point; 5], + + // Instantiates a linear regression circuit. + function new(points: [Point; 5]) -> Self { + return Self { points }; + } + + // Return the slope of the linear regression. + function slope(self) -> i32 { + + let num_points = 5i32; + // Calculate the sums. + let x_sum = 0i32; + let y_sum = 0i32; + let xy_sum = 0i32; + let x2_sum = 0i32; + for i in 0..5 { + x_sum += self.points[i].x; + y_sum += self.points[i].y; + xy_sum += self.points[i].x * self.points[i].y; + x2_sum += self.points[i].x * self.points[i].x; + } + let numerator = (num_points * xy_sum) - (x_sum * y_sum); + let denominator = (num_points * x2_sum) - (x_sum * x_sum); + let slope = numerator / denominator; + return slope; + } + // Return the offset of the linear regression. + function offset(self, slope: i32) -> i32 { + let num_points = 5i32; + // Calculate the sum. + let x_sum = 0i32; + let y_sum = 0i32; + for i in 0..5 { + x_sum += self.points[i].x; + y_sum += self.points[i].y; + } + return (y_sum - slope * x_sum) / num_points; + } +} + + +function main (x: i32, y: i32) -> [i32; 2] { + let points: [Point; 5] = [ + Point{x: x + 1, y: y + 1}, + Point{x: x + 2, y: y + 2}, + Point{x: x + 3, y: y + 3}, + Point{x: x + 4, y: y + 4}, + Point{x: x + 5, y: y + 5} + ]; + let reg = LinearRegression::new(points); + let slope = reg.slope(); + let offset = reg.offset(slope); + return [slope, offset]; +} diff --git a/tests/parser/serialize/one_plus_one.leo b/tests/parser/serialize/one_plus_one.leo new file mode 100644 index 0000000000..46862774c2 --- /dev/null +++ b/tests/parser/serialize/one_plus_one.leo @@ -0,0 +1,8 @@ +/* +namespace: Serialize +expectation: Pass +*/ + +function main() -> u8 { + return 1u8 + 1u8; +} diff --git a/tests/parser/serialize/palindrome.leo b/tests/parser/serialize/palindrome.leo new file mode 100644 index 0000000000..ebc9bb7e11 --- /dev/null +++ b/tests/parser/serialize/palindrome.leo @@ -0,0 +1,64 @@ +/* +namespace: Serialize +expectation: Pass +*/ + +// This Program takes in any 20-byte low register string and tells +// whether a string is a palindrome ignoring any spaces. + +function main(str: [char; 20]) -> bool { + return is_palindrome(str); +} + +function is_palindrome(str: [char; 20]) -> bool { + const str_len = 20u32; // saving const for convenience + + // By default we assume that input is a palindrome. + let result = true; + let processed = 0u8; + + for start in 0..(str_len / 2) { + let start_sym = str[start]; + if start_sym != ' ' { + let skipped = 0u8; + let end_empty = 0u8; + let end_sym = ' '; + + for end in (str_len - 1)..start { + if str[end] != ' ' && skipped == processed && end_sym == ' ' { + end_sym = str[end]; + } else { + end_empty = end_empty + 1; + if str[end] != ' ' { + skipped = skipped + 1; + } + } + } + + // If there are symbols left to the right from the start. + if end_sym != ' ' { + console.log("Comparing: {} ? {}", start_sym, end_sym); + + if result { + result = (start_sym == end_sym); + } + + processed = processed + 1; + } + } + } + + console.log("Result is: {}", result); + + return result; +} + +@test +function test_is_palindrome() { + console.assert(is_palindrome("a b a ")); + console.assert(is_palindrome("😀😀😀😀😀 😀😀😀😀😀")); + console.assert(is_palindrome("borrow or rob ")); + console.assert(is_palindrome("bbbb aaaa aaaa bbbb")); + console.assert(is_palindrome("aaaaaaaaaaaaaaaaaaaa")); + console.assert(is_palindrome("taco cat ")); +} diff --git a/tests/parser/serialize/parser_error.leo b/tests/parser/serialize/parser_error.leo new file mode 100644 index 0000000000..91be4d8733 --- /dev/null +++ b/tests/parser/serialize/parser_error.leo @@ -0,0 +1,6 @@ +/* +namespace: Serialize +expectation: Fail +*/ + +invalid \ No newline at end of file diff --git a/tests/parser/serialize/pedersen_hash.leo b/tests/parser/serialize/pedersen_hash.leo new file mode 100644 index 0000000000..b8520a9be4 --- /dev/null +++ b/tests/parser/serialize/pedersen_hash.leo @@ -0,0 +1,30 @@ +/* +namespace: Serialize +expectation: Pass +*/ + +circuit PedersenHash { + parameters: [group; 256]; + + // Instantiates a Pedersen hash circuit + function new(parameters: [group; 256]) -> Self { + return Self { parameters: parameters }; + } + + function hash(self, bits: [bool; 256]) -> group { + let digest: group = 0group; + for i in 0..256 { + if bits[i] { + digest += self.parameters[i]; + } + } + return digest; + } +} + +// The 'pedersen-hash' main function. +function main(hash_input: [bool; 256], const parameters: [group; 256]) -> group { + const pedersen = PedersenHash::new(parameters); + return pedersen.hash(hash_input); +} + diff --git a/tests/parser/serialize/silly_sudoku.leo b/tests/parser/serialize/silly_sudoku.leo new file mode 100644 index 0000000000..1b940e2689 --- /dev/null +++ b/tests/parser/serialize/silly_sudoku.leo @@ -0,0 +1,76 @@ +/* +namespace: Serialize +expectation: Pass +*/ + +import lib.SillySudoku; + +// The `silly-sudoku` main function +function main(puzzle: [u8; (3, 3)], answer: [u8; (3, 3)]) -> bool { + console.log("Starting Sudoku solver..."); + console.log("{}", puzzle); + + // Instantiate the Sudoku puzzle. + let sudoku = SillySudoku { puzzle_grid: puzzle }; + + console.log("Checking Sudoku answer..."); + console.log("{}", answer); + + // Evaluate the Sudoku puzzle with the given answer. + let result = sudoku.solve(answer); + + console.log("The answer is {}.", result); + + return result; +} + +// Tests that the `silly-sudoku` circuit outputs true on a correct answer. +@test +function test_solve_pass() { + let puzzle: [u8; (3, 3)] = [[0, 2, 0], + [0, 0, 6], + [0, 8, 9]]; + + let answer: [u8; (3, 3)] = [[1, 2, 3], + [4, 5, 6], + [7, 8, 9]]; + + // Runs the Sudoku checker. + let result = main(puzzle, answer); + + // Expects the result to be true. + console.assert(true == result); +} + +// Tests that the `silly-sudoku` circuit outputs false on an incorrect answer. +@test +function test_solve_fail() { + let puzzle: [u8; (3, 3)] = [[0, 2, 0], + [0, 0, 6], + [0, 8, 0]]; + + let answer: [u8; (3, 3)] = [[1, 2, 3], + [4, 5, 6], + [7, 8, 8]]; // We have an extra `8` in this column! + + // Runs the Sudoku checker. + let result = main(puzzle, answer); + + // Expects the result to be false. + console.assert(false == result); +} + +// Test that the `silly-sudoku` circuit outputs the expected value on a custom test input. +@test(test_input) +function test_solve_with_input( + puzzle: [u8; (3, 3)], + answer: [u8; (3, 3)], + expected: bool +) { + // Runs the Sudoku checker. + let result = main(puzzle, answer); + + console.log("expected {}, got {}", expected, result); + + console.assert(expected == result); +} diff --git a/tests/parser/statement/definition_fail.leo b/tests/parser/statement/definition_fail.leo index 7e3fd0d28b..7bdfc14af2 100644 --- a/tests/parser/statement/definition_fail.leo +++ b/tests/parser/statement/definition_fail.leo @@ -51,4 +51,4 @@ let (x,y,,) = (); let (,x,y) = (); -let (x,,y) = (); \ No newline at end of file +let (x,,y) = (); diff --git a/tests/parser/statement/let_mut_recover.leo b/tests/parser/statement/let_mut_recover.leo new file mode 100644 index 0000000000..cc3fa19096 --- /dev/null +++ b/tests/parser/statement/let_mut_recover.leo @@ -0,0 +1,9 @@ +/* +namespace: Parse +expectation: Fail +*/ + +function foo() { + let mut x = 0; + let mut y = 0; // recovery witness +} diff --git a/tests/parser/unreachable/eat_int.leo b/tests/parser/unreachable/eat_int.leo index 7748be8ab5..b8bd8aa886 100644 --- a/tests/parser/unreachable/eat_int.leo +++ b/tests/parser/unreachable/eat_int.leo @@ -1,5 +1,5 @@ /* -namespace: ParseExpression +namespace: Parse expectation: Fail */