From 5565150f30552fb0a9db2267667b1348a2c42c88 Mon Sep 17 00:00:00 2001 From: d0cd Date: Wed, 16 Nov 2022 01:22:29 -0800 Subject: [PATCH] Regen expectations --- compiler/compiler/src/compiler.rs | 2 +- .../compiler/function/complex_recursion_fail.out | 2 +- .../compiler/function/function_call_out_of_order.out | 10 ++++++++++ .../compiler/function/mutual_recursion_fail.out | 2 +- .../compiler/function/self_recursive_cycle_fail.out | 2 +- .../compiler/records/duplicate_circuit_name_fail.out | 2 +- .../compiler/tuple/function_return_zero_fail.out | 5 +++++ 7 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 tests/expectations/compiler/function/function_call_out_of_order.out create mode 100644 tests/expectations/compiler/tuple/function_return_zero_fail.out diff --git a/compiler/compiler/src/compiler.rs b/compiler/compiler/src/compiler.rs index c990449de3..3fcf0f1cca 100644 --- a/compiler/compiler/src/compiler.rs +++ b/compiler/compiler/src/compiler.rs @@ -224,7 +224,7 @@ impl<'a> Compiler<'a> { self.parse_program()?; let (symbol_table, struct_graph, call_graph) = self.compiler_stages()?; - let bytecode = CodeGenerator::do_pass((&self.ast, &symbol_table.handler, &struct_graph, &call_graph))?; + let bytecode = CodeGenerator::do_pass((&self.ast, &symbol_table, &struct_graph, &call_graph))?; Ok((symbol_table, bytecode)) } diff --git a/tests/expectations/compiler/function/complex_recursion_fail.out b/tests/expectations/compiler/function/complex_recursion_fail.out index 28fe069329..afa95d695d 100644 --- a/tests/expectations/compiler/function/complex_recursion_fail.out +++ b/tests/expectations/compiler/function/complex_recursion_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:7:16\n |\n 7 | return two(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:11:16\n |\n 11 | return three(n) + four(n);\n | ^^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:11:27\n |\n 11 | return three(n) + four(n);\n | ^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:15:16\n |\n 15 | return one(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:19:16\n |\n 19 | return one(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:23:16\n |\n 23 | return six(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:27:16\n |\n 27 | return seven(n) + eight(n);\n | ^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:27:27\n |\n 27 | return seven(n) + eight(n);\n | ^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:31:16\n |\n 31 | return five(n);\n | ^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:35:16\n |\n 35 | return five(n);\n | ^^^^^^^\nError [ETYC0372053]: Cyclic dependency between functions: `one` --> `two` --> `three` --> `one`\n" + - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:7:16\n |\n 7 | return two(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:11:16\n |\n 11 | return three(n) + four(n);\n | ^^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:11:27\n |\n 11 | return three(n) + four(n);\n | ^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:15:16\n |\n 15 | return one(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:19:16\n |\n 19 | return one(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:23:16\n |\n 23 | return six(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:27:16\n |\n 27 | return seven(n) + eight(n);\n | ^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:27:27\n |\n 27 | return seven(n) + eight(n);\n | ^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:31:16\n |\n 31 | return five(n);\n | ^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:35:16\n |\n 35 | return five(n);\n | ^^^^^^^\nError [ETYC0372066]: Cyclic dependency between functions: `one` --> `two` --> `three` --> `one`\n" diff --git a/tests/expectations/compiler/function/function_call_out_of_order.out b/tests/expectations/compiler/function/function_call_out_of_order.out new file mode 100644 index 0000000000..98240cf6b3 --- /dev/null +++ b/tests/expectations/compiler/function/function_call_out_of_order.out @@ -0,0 +1,10 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - output: + - initial_input_ast: no input + initial_ast: 4d3f6c6d7473e2d981f1b66cdc0aa6c8c838b0cd5119749f88dd78173d948429 + unrolled_ast: 4d3f6c6d7473e2d981f1b66cdc0aa6c8c838b0cd5119749f88dd78173d948429 + ssa_ast: fa0c588d9ee1505dd06a0b90526b09e62f4336d4ce9f2e7be420235cd93bc9ab + flattened_ast: de929e7ddaf5ac129f46d064d2581b79cad2a4ff2d91243af77c07dd1d2d9146 diff --git a/tests/expectations/compiler/function/mutual_recursion_fail.out b/tests/expectations/compiler/function/mutual_recursion_fail.out index 825749507c..9f2ad2e058 100644 --- a/tests/expectations/compiler/function/mutual_recursion_fail.out +++ b/tests/expectations/compiler/function/mutual_recursion_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:5:16\n |\n 5 | return bar(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:9:16\n |\n 9 | return foo(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:13:16\n |\n 13 | return bax(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:17:16\n |\n 17 | return baz(n);\n | ^^^^^^\nError [ETYC0372053]: Cyclic dependency between functions: `foo` --> `bar` --> `foo`\n" + - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:5:16\n |\n 5 | return bar(n);\n | ^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:9:16\n |\n 9 | return foo(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:13:16\n |\n 13 | return bax(n);\n | ^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:17:16\n |\n 17 | return baz(n);\n | ^^^^^^\nError [ETYC0372066]: Cyclic dependency between functions: `foo` --> `bar` --> `foo`\n" diff --git a/tests/expectations/compiler/function/self_recursive_cycle_fail.out b/tests/expectations/compiler/function/self_recursive_cycle_fail.out index 5da6ad7ecb..cc63ee3a09 100644 --- a/tests/expectations/compiler/function/self_recursive_cycle_fail.out +++ b/tests/expectations/compiler/function/self_recursive_cycle_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:8:20\n |\n 8 | return fib(n - 1u8) + fib(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:8:35\n |\n 8 | return fib(n - 1u8) + fib(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:16:20\n |\n 16 | return foo(n - 1u8) + foo(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:16:35\n |\n 16 | return foo(n - 1u8) + foo(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372053]: Cyclic dependency between functions: `fib` --> `fib`\n" + - "Error [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:8:20\n |\n 8 | return fib(n - 1u8) + fib(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372047]: Cannot call another function from a standard function.\n --> compiler-test:8:35\n |\n 8 | return fib(n - 1u8) + fib(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:16:20\n |\n 16 | return foo(n - 1u8) + foo(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372048]: Cannot call a local transition function from a transition function.\n --> compiler-test:16:35\n |\n 16 | return foo(n - 1u8) + foo(n - 2u8);\n | ^^^^^^^^^^^^\nError [ETYC0372066]: Cyclic dependency between functions: `fib` --> `fib`\n" diff --git a/tests/expectations/compiler/records/duplicate_circuit_name_fail.out b/tests/expectations/compiler/records/duplicate_circuit_name_fail.out index ad015e587f..d08b2052e9 100644 --- a/tests/expectations/compiler/records/duplicate_circuit_name_fail.out +++ b/tests/expectations/compiler/records/duplicate_circuit_name_fail.out @@ -2,4 +2,4 @@ namespace: Compile expectation: Fail outputs: - - "Failed to parse string. Remaining invalid string is: \"closure main:\n output true as boolean;\n\n\n\"" + - "Failed to parse string. Remaining invalid string is: \"closure main:\n output true as boolean;\n\"" diff --git a/tests/expectations/compiler/tuple/function_return_zero_fail.out b/tests/expectations/compiler/tuple/function_return_zero_fail.out new file mode 100644 index 0000000000..03ecce8660 --- /dev/null +++ b/tests/expectations/compiler/tuple/function_return_zero_fail.out @@ -0,0 +1,5 @@ +--- +namespace: Compile +expectation: Fail +outputs: + - "Failed to parse string. Parsing Error: VerboseError { errors: [(\"closure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\", Nom(Tag)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\", Nom(Alt)), (\"\\n\\n\\nclosure main:\\n input r0 as boolean;\\n input r1 as boolean;\\n\", Nom(Many1))] }"