From cfc6deb3d6d00d0c7e15f55bbb62800ff0c80e78 Mon Sep 17 00:00:00 2001 From: Sean Billig Date: Wed, 18 May 2022 14:22:27 -0700 Subject: [PATCH] wip --- crates/analyzer/tests/errors.rs | 35 +- .../analysis__abi_encoding_stress.snap | 478 ++- .../analysis__address_bytes10_map.snap | 102 +- .../tests/snapshots/analysis__assert.snap | 157 +- .../snapshots/analysis__associated_fns.snap | 171 +- .../tests/snapshots/analysis__aug_assign.snap | 247 +- .../tests/snapshots/analysis__balances.snap | 114 +- .../tests/snapshots/analysis__base_tuple.snap | 5 +- .../snapshots/analysis__basic_ingot.snap | 317 +- .../analysis__call_statement_with_args.snap | 84 +- .../analysis__call_statement_with_args_2.snap | 42 +- ...analysis__call_statement_without_args.snap | 84 +- .../analysis__checked_arithmetic.snap | 1888 +++++----- .../snapshots/analysis__const_generics.snap | 22 +- .../snapshots/analysis__const_local.snap | 6 +- .../snapshots/analysis__constructor.snap | 53 +- .../snapshots/analysis__create2_contract.snap | 35 +- .../snapshots/analysis__create_contract.snap | 46 +- .../analysis__create_contract_from_init.snap | 30 +- .../analysis__data_copying_stress.snap | 496 ++- .../tests/snapshots/analysis__empty.snap | 6 +- .../snapshots/analysis__erc20_token.snap | 1486 ++++---- .../tests/snapshots/analysis__events.snap | 110 +- .../analysis__external_contract.snap | 130 +- .../analysis__for_loop_with_break.snap | 82 +- .../analysis__for_loop_with_continue.snap | 81 +- .../analysis__for_loop_with_static_array.snap | 71 +- .../tests/snapshots/analysis__guest_book.snap | 68 +- .../snapshots/analysis__if_statement.snap | 30 +- .../snapshots/analysis__if_statement_2.snap | 36 +- ...__if_statement_with_block_declaration.snap | 66 +- .../tests/snapshots/analysis__keccak.snap | 39 +- .../tests/snapshots/analysis__math.snap | 149 +- .../snapshots/analysis__module_const.snap | 67 +- .../analysis__module_level_events.snap | 21 +- .../snapshots/analysis__multi_param.snap | 5 +- .../tests/snapshots/analysis__nested_map.snap | 196 +- .../snapshots/analysis__numeric_sizes.snap | 420 +-- .../tests/snapshots/analysis__ownable.snap | 229 +- .../analysis__pure_fn_standalone.snap | 94 +- .../analysis__return_addition_i256.snap | 5 +- .../analysis__return_addition_u128.snap | 5 +- .../analysis__return_addition_u256.snap | 5 +- .../snapshots/analysis__return_array.snap | 11 +- .../analysis__return_bitwiseand_u128.snap | 5 +- .../analysis__return_bitwiseand_u256.snap | 5 +- .../analysis__return_bitwiseor_u256.snap | 5 +- .../analysis__return_bitwiseshl_u256.snap | 5 +- .../analysis__return_bitwiseshr_i256.snap | 5 +- .../analysis__return_bitwiseshr_u256.snap | 5 +- .../analysis__return_bitwisexor_u256.snap | 5 +- .../analysis__return_bool_false.snap | 5 +- .../analysis__return_bool_inverted.snap | 5 +- .../analysis__return_bool_op_and.snap | 5 +- .../analysis__return_bool_op_or.snap | 5 +- .../snapshots/analysis__return_bool_true.snap | 5 +- .../analysis__return_builtin_attributes.snap | 216 +- .../analysis__return_division_i256.snap | 5 +- .../analysis__return_division_u256.snap | 5 +- .../analysis__return_empty_tuple.snap | 70 +- .../snapshots/analysis__return_eq_u256.snap | 5 +- .../snapshots/analysis__return_gt_i256.snap | 5 +- .../snapshots/analysis__return_gt_u256.snap | 5 +- .../snapshots/analysis__return_gte_i256.snap | 5 +- .../snapshots/analysis__return_gte_u256.snap | 5 +- .../snapshots/analysis__return_i128_cast.snap | 5 +- .../snapshots/analysis__return_i256.snap | 5 +- .../analysis__return_identity_u128.snap | 5 +- .../analysis__return_identity_u16.snap | 5 +- .../analysis__return_identity_u256.snap | 5 +- .../analysis__return_identity_u32.snap | 5 +- .../analysis__return_identity_u64.snap | 5 +- .../analysis__return_identity_u8.snap | 5 +- .../snapshots/analysis__return_lt_i256.snap | 5 +- .../snapshots/analysis__return_lt_u128.snap | 5 +- .../snapshots/analysis__return_lt_u256.snap | 5 +- .../snapshots/analysis__return_lte_i256.snap | 5 +- .../snapshots/analysis__return_lte_u256.snap | 5 +- .../snapshots/analysis__return_mod_i256.snap | 5 +- .../snapshots/analysis__return_mod_u256.snap | 5 +- .../snapshots/analysis__return_msg_sig.snap | 5 +- .../analysis__return_multiplication_i256.snap | 5 +- .../analysis__return_multiplication_u256.snap | 5 +- .../analysis__return_noteq_u256.snap | 5 +- .../snapshots/analysis__return_pow_i256.snap | 5 +- .../snapshots/analysis__return_pow_u256.snap | 5 +- .../analysis__return_subtraction_i256.snap | 5 +- .../analysis__return_subtraction_u256.snap | 5 +- .../snapshots/analysis__return_u128_cast.snap | 5 +- .../snapshots/analysis__return_u256.snap | 5 +- .../analysis__return_u256_from_called_fn.snap | 26 +- ..._return_u256_from_called_fn_with_args.snap | 111 +- .../tests/snapshots/analysis__revert.snap | 84 +- .../snapshots/analysis__self_address.snap | 5 +- .../tests/snapshots/analysis__send_value.snap | 5 +- .../analysis__simple_open_auction.snap | 261 +- .../analysis__sized_vals_in_sto.snap | 187 +- .../tests/snapshots/analysis__strings.snap | 77 +- .../tests/snapshots/analysis__struct_fns.snap | 674 ++-- .../tests/snapshots/analysis__structs.snap | 2116 ++++++----- .../analysis__ternary_expression.snap | 21 +- .../snapshots/analysis__tuple_stress.snap | 298 +- .../snapshots/analysis__two_contracts.snap | 100 +- .../snapshots/analysis__type_aliases.snap | 168 +- .../snapshots/analysis__u128_u128_map.snap | 100 +- .../snapshots/analysis__u16_u16_map.snap | 100 +- .../snapshots/analysis__u256_u256_map.snap | 100 +- .../snapshots/analysis__u32_u32_map.snap | 100 +- .../snapshots/analysis__u64_u64_map.snap | 100 +- .../tests/snapshots/analysis__u8_u8_map.snap | 100 +- .../tests/snapshots/analysis__uniswap.snap | 3105 +++++++++-------- .../tests/snapshots/analysis__while_loop.snap | 73 +- .../analysis__while_loop_with_break.snap | 19 +- .../analysis__while_loop_with_break_2.snap | 66 +- .../analysis__while_loop_with_continue.snap | 34 +- .../tests/snapshots/errors__bad_ingot.snap | 22 +- .../snapshots/errors__bad_visibility.snap | 89 +- .../errors__break_without_loop_2.snap | 6 +- .../errors__call_balance_of_with_2_args.snap | 10 +- ...rors__call_balance_of_with_wrong_type.snap | 6 +- ...rs__call_balance_of_without_parameter.snap | 10 +- .../errors__call_balance_with_arg.snap | 10 +- .../errors__call_builtin_object.snap | 6 +- ...rrors__call_call_on_external_contract.snap | 6 +- .../snapshots/errors__call_call_on_self.snap | 6 +- .../errors__call_create2_with_wrong_type.snap | 28 +- .../errors__call_create_with_wrong_type.snap | 8 +- .../snapshots/errors__call_duplicate_def.snap | 25 +- .../errors__call_event_with_wrong_types.snap | 16 +- ..._call_non_pub_fn_on_external_contract.snap | 13 +- ..._static_function_without_double_colon.snap | 4 +- .../errors__call_to_mut_fn_without_self.snap | 4 +- .../errors__call_to_pure_fn_on_self.snap | 4 +- ...defined_function_on_external_contract.snap | 6 +- ...l_undefined_function_on_memory_struct.snap | 6 +- ..._undefined_function_on_storage_struct.snap | 6 +- .../snapshots/errors__call_with_pub_fns.snap | 38 +- .../errors__call_wrong_return_type.snap | 2 +- .../tests/snapshots/errors__cannot_move2.snap | 6 +- .../errors__circular_type_alias.snap | 8 +- .../tests/snapshots/errors__const_assign.snap | 12 +- .../errors__const_generics_param.snap | 24 +- .../tests/snapshots/errors__const_local.snap | 22 +- .../errors__continue_without_loop_2.snap | 6 +- ...rs__ctx_builtins_param_incorrect_type.snap | 16 +- .../snapshots/errors__ctx_missing_event.snap | 12 +- .../errors__ctx_missing_internal_call.snap | 4 +- .../snapshots/errors__ctx_not_after_self.snap | 2 +- .../snapshots/errors__ctx_not_first.snap | 2 +- .../errors__ctx_passed_external_call.snap | 4 +- .../tests/snapshots/errors__ctx_pure.snap | 2 +- .../errors__ctx_undefined_contract_init.snap | 10 +- .../errors__ctx_undefined_create.snap | 10 +- .../errors__ctx_undefined_create2.snap | 10 +- .../errors__ctx_undefined_event.snap | 6 +- ...ors__duplicate_arg_in_contract_method.snap | 4 +- .../errors__duplicate_contract_in_module.snap | 4 +- .../errors__duplicate_event_in_contract.snap | 14 +- .../errors__duplicate_method_in_contract.snap | 16 +- .../errors__duplicate_struct_in_module.snap | 4 +- .../errors__duplicate_typedef_in_module.snap | 14 +- .../errors__duplicate_var_in_child_scope.snap | 2 +- .../errors__duplicate_var_in_for_loop.snap | 20 +- .../snapshots/errors__emit_bad_args.snap | 34 +- .../errors__for_loop_sto_iter_no_copy.snap | 2 +- ...rrors__init_call_on_external_contract.snap | 6 +- .../snapshots/errors__init_call_on_self.snap | 6 +- .../snapshots/errors__init_duplicate_def.snap | 25 +- .../errors__init_wrong_return_type.snap | 2 +- .../errors__invalid_block_field.snap | 6 +- .../errors__invalid_chain_field.snap | 6 +- .../errors__invalid_contract_field.snap | 6 +- .../snapshots/errors__invalid_msg_field.snap | 6 +- .../errors__invalid_string_field.snap | 6 +- .../errors__invalid_struct_field.snap | 6 +- .../errors__invalid_tuple_field.snap | 6 +- .../snapshots/errors__invalid_tx_field.snap | 6 +- .../errors__invalid_var_declaration_1.snap | 6 +- .../errors__invalid_var_declaration_2.snap | 6 +- .../tests/snapshots/errors__issue_451.snap | 27 +- .../errors__mislabeled_call_args.snap | 8 +- ...eled_call_args_external_contract_call.snap | 12 +- .../errors__mislabeled_call_args_self.snap | 8 +- .../errors__mismatch_return_type.snap | 4 +- .../snapshots/errors__missing_return.snap | 2 +- .../errors__missing_return_after_if.snap | 2 +- .../errors__missing_return_in_else.snap | 2 +- .../tests/snapshots/errors__missing_self.snap | 4 +- .../snapshots/errors__module_const_call.snap | 6 +- .../snapshots/errors__needs_mem_copy.snap | 4 +- .../tests/snapshots/errors__non_pub_init.snap | 9 +- .../tests/snapshots/errors__not_callable.snap | 18 +- .../errors__private_struct_field.snap | 6 +- .../errors__return_complex_struct.snap | 6 +- .../snapshots/errors__return_from_init.snap | 2 +- .../errors__return_type_not_fixedsize.snap | 6 +- .../errors__return_type_undefined.snap | 6 +- .../errors__revert_sto_error_no_copy.snap | 4 +- .../errors__self_in_standalone_fn.snap | 4 +- .../tests/snapshots/errors__self_misuse.snap | 34 +- .../snapshots/errors__self_not_first.snap | 2 +- .../errors__shadow_builtin_function.snap | 20 +- .../errors__shadow_builtin_type.snap | 28 +- .../errors__strict_boolean_if_else.snap | 2 +- .../errors__struct_recursive_cycles.snap | 11 +- .../errors__undefined_type_param.snap | 2 +- .../snapshots/errors__unsafe_misuse.snap | 39 +- .../snapshots/errors__unsafe_nesting.snap | 18 +- crates/library/std/src/evm.fe | 2 +- crates/lowering/src/ast_utils.rs | 45 +- .../tests/snapshots/lowering__and_or.snap | 166 +- .../tests/snapshots/lowering__aug_assign.snap | 45 +- .../tests/snapshots/lowering__base_tuple.snap | 45 +- .../lowering__custom_empty_type.snap | 12 +- .../tests/snapshots/lowering__init.snap | 10 +- .../snapshots/lowering__list_expressions.snap | 12 +- .../tests/snapshots/lowering__map_tuple.snap | 13 +- .../snapshots/lowering__module_const.snap | 45 +- .../tests/snapshots/lowering__module_fn.snap | 24 +- .../lowering__module_level_events.snap | 10 +- .../snapshots/lowering__nested_tuple.snap | 19 +- .../snapshots/lowering__return_unit.snap | 44 +- .../tests/snapshots/lowering__struct_fn.snap | 12 +- .../tests/snapshots/lowering__ternary.snap | 72 +- .../snapshots/lowering__tuple_destruct.snap | 15 +- .../snapshots/lowering__type_alias_tuple.snap | 9 +- .../snapshots/lowering__unit_implicit.snap | 10 +- crates/parser/src/ast.rs | 49 +- crates/parser/src/lexer/token.rs | 2 +- .../snapshots/cases__print_ast__defs.snap | 46 + .../snapshots/cases__print_ast__erc20.snap | 124 + .../cases__print_ast__expr_parens.snap | 28 + .../cases__print_ast__guest_book.snap | 24 + .../compile_errors/abi_encode_from_storage.fe | 2 +- .../compile_errors/abi_encode_u256.fe | 8 +- .../compile_errors/assert_sto_msg_no_copy.fe | 8 +- .../compile_errors/bad_ingot/src/bing.fe | 3 +- .../compile_errors/bad_ingot/src/biz/bad.fe | 6 +- .../compile_errors/bad_ingot/src/foo.fe | 6 +- .../compile_errors/bad_ingot/src/main.fe | 10 +- .../fixtures/compile_errors/bad_string.fe | 6 +- .../compile_errors/bad_tuple_attr1.fe | 6 +- .../compile_errors/bad_tuple_attr2.fe | 8 +- .../compile_errors/bad_tuple_attr3.fe | 8 +- .../compile_errors/bad_visibility/src/foo.fe | 20 +- .../compile_errors/bad_visibility/src/main.fe | 31 +- .../compile_errors/call_builtin_object.fe | 9 +- .../call_call_on_external_contract.fe | 19 +- .../compile_errors/call_call_on_self.fe | 11 +- .../call_create2_with_wrong_type.fe | 10 +- .../call_create_with_wrong_type.fe | 9 +- .../compile_errors/call_duplicate_def.fe | 15 +- .../call_event_with_wrong_types.fe | 9 +- .../call_non_pub_fn_on_external_contract.fe | 19 +- ...ll_static_function_without_double_colon.fe | 15 +- .../call_to_mut_fn_without_self.fe | 9 +- .../compile_errors/call_to_pure_fn_on_self.fe | 11 +- ...undefined_function_on_external_contract.fe | 13 +- ...all_undefined_function_on_memory_struct.fe | 15 +- ...ll_undefined_function_on_storage_struct.fe | 15 +- .../compile_errors/call_with_pub_fns.fe | 15 +- .../compile_errors/call_wrong_return_type.fe | 8 +- .../fixtures/compile_errors/cannot_move.fe | 6 +- .../fixtures/compile_errors/cannot_move2.fe | 13 +- .../circular_dependency_create.fe | 9 +- .../circular_dependency_create2.fe | 9 +- .../compile_errors/circular_type_alias.fe | 2 + .../fixtures/compile_errors/const_assign.fe | 13 +- .../compile_errors/const_generics_param.fe | 29 +- .../fixtures/compile_errors/const_local.fe | 30 +- .../ctx_builtins_param_incorrect_type.fe | 15 +- .../fixtures/compile_errors/ctx_init.fe | 2 +- .../compile_errors/ctx_missing_create.fe | 12 +- .../compile_errors/ctx_missing_event.fe | 9 +- .../ctx_missing_internal_call.fe | 11 +- .../compile_errors/ctx_missing_load.fe | 12 +- .../compile_errors/ctx_not_after_self.fe | 6 +- .../fixtures/compile_errors/ctx_not_first.fe | 6 +- .../ctx_passed_external_call.fe | 15 +- .../fixtures/compile_errors/ctx_pure.fe | 3 +- .../fixtures/compile_errors/ctx_undeclared.fe | 8 +- .../ctx_undefined_contract_init.fe | 11 +- .../compile_errors/ctx_undefined_create.fe | 11 +- .../compile_errors/ctx_undefined_create2.fe | 11 +- .../compile_errors/ctx_undefined_event.fe | 11 +- .../duplicate_arg_in_contract_method.fe | 6 +- .../duplicate_contract_in_module.fe | 14 +- .../duplicate_event_in_contract.fe | 9 +- .../duplicate_field_in_contract.fe | 3 +- .../duplicate_field_in_struct.fe | 6 +- .../duplicate_method_in_contract.fe | 10 +- .../duplicate_struct_in_module.fe | 13 +- .../duplicate_typedef_in_module.fe | 8 +- .../duplicate_var_in_child_scope.fe | 9 +- .../duplicate_var_in_contract_method.fe | 6 +- .../duplicate_var_in_for_loop.fe | 18 +- .../fixtures/compile_errors/emit_bad_args.fe | 17 +- .../external_call_type_error.fe | 14 +- .../external_call_wrong_number_of_params.fe | 12 +- .../for_loop_sto_iter_no_copy.fe | 11 +- .../fixtures/compile_errors/indexed_event.fe | 6 +- .../init_call_on_external_contract.fe | 21 +- .../compile_errors/init_call_on_self.fe | 11 +- .../compile_errors/init_duplicate_def.fe | 15 +- .../compile_errors/init_wrong_return_type.fe | 8 +- .../compile_errors/invalid_block_field.fe | 9 +- .../compile_errors/invalid_chain_field.fe | 9 +- .../invalid_compiler_version.fe | 3 +- .../compile_errors/invalid_contract_field.fe | 10 +- .../compile_errors/invalid_msg_field.fe | 9 +- .../compile_errors/invalid_string_field.fe | 9 +- .../compile_errors/invalid_struct_field.fe | 15 +- .../compile_errors/invalid_tuple_field.fe | 10 +- .../compile_errors/invalid_tx_field.fe | 9 +- .../invalid_var_declaration_1.fe | 8 +- .../invalid_var_declaration_2.fe | 8 +- .../fixtures/compile_errors/issue_451.fe | 14 +- .../compile_errors/mislabeled_call_args.fe | 12 +- ...abeled_call_args_external_contract_call.fe | 16 +- .../mislabeled_call_args_self.fe | 10 +- .../compile_errors/mismatch_return_type.fe | 7 +- .../fixtures/compile_errors/missing_return.fe | 6 +- .../compile_errors/missing_return_after_if.fe | 9 +- .../compile_errors/missing_return_in_else.fe | 13 +- .../fixtures/compile_errors/missing_self.fe | 17 +- .../compile_errors/module_const_call.fe | 8 +- .../fixtures/compile_errors/needs_mem_copy.fe | 9 +- .../fixtures/compile_errors/non_pub_init.fe | 6 +- .../fixtures/compile_errors/not_callable.fe | 24 +- .../fixtures/compile_errors/not_in_scope.fe | 14 +- .../fixtures/compile_errors/not_in_scope_2.fe | 12 +- .../compile_errors/private_struct_field.fe | 15 +- .../return_addition_with_mixed_types.fe | 6 +- ...urn_call_to_fn_with_param_type_mismatch.fe | 10 +- .../return_call_to_fn_without_return.fe | 10 +- .../compile_errors/return_complex_struct.fe | 13 +- .../compile_errors/return_from_init.fe | 6 +- .../compile_errors/return_lt_mixed_types.fe | 6 +- .../return_type_not_fixedsize.fe | 6 +- .../compile_errors/return_type_undefined.fe | 6 +- .../revert_sto_error_no_copy.fe | 11 +- .../compile_errors/self_in_standalone_fn.fe | 12 +- .../fixtures/compile_errors/self_misuse.fe | 53 +- .../fixtures/compile_errors/self_not_first.fe | 6 +- .../compile_errors/shadow_builtin_function.fe | 18 +- .../compile_errors/shadow_builtin_type.fe | 15 +- .../compile_errors/strict_boolean_if_else.fe | 11 +- .../compile_errors/struct_call_bad_args.fe | 10 +- .../struct_call_without_kw_args.fe | 10 +- .../struct_private_constructor.fe | 10 +- .../compile_errors/struct_recursive_cycles.fe | 19 +- .../compile_errors/undefined_type_param.fe | 18 +- .../fixtures/compile_errors/unsafe_misuse.fe | 82 +- .../fixtures/compile_errors/unsafe_nesting.fe | 20 +- .../test-files/fixtures/crashes/agroce531.fe | 10 +- .../test-files/fixtures/crashes/agroce550.fe | 8 +- .../test-files/fixtures/crashes/agroce551.fe | 8 +- .../test-files/fixtures/crashes/agroce623.fe | 8 +- .../fixtures/crashes/revert_const.fe | 10 +- .../test-files/fixtures/demos/erc20_token.fe | 2 +- .../fixtures/demos/simple_open_auction.fe | 70 +- crates/test-files/fixtures/demos/uniswap.fe | 74 +- .../fixtures/differential/math_i8.fe | 100 +- .../fixtures/differential/math_u8.fe | 141 +- .../differential/storage_and_memory.fe | 90 +- .../fixtures/features/abi_decode_checks.fe | 25 +- .../fixtures/features/address_bytes10_map.fe | 2 +- crates/test-files/fixtures/features/arrays.fe | 9 +- crates/test-files/fixtures/features/assert.fe | 18 +- .../fixtures/features/associated_fns.fe | 30 +- .../fixtures/features/aug_assign.fe | 42 +- .../test-files/fixtures/features/balances.fe | 9 +- .../fixtures/features/base_tuple.fe | 6 +- .../test-files/fixtures/features/call_fn.fe | 16 +- .../features/call_statement_with_args.fe | 9 +- .../features/call_statement_with_args_2.fe | 9 +- .../features/call_statement_without_args.fe | 9 +- .../fixtures/features/cast_address_to_u256.fe | 10 +- .../fixtures/features/checked_arithmetic.fe | 222 +- .../fixtures/features/const_generics.fe | 18 +- .../fixtures/features/const_local.fe | 8 +- .../fixtures/features/constructor.fe | 11 +- .../fixtures/features/create2_contract.fe | 13 +- .../fixtures/features/create_contract.fe | 12 +- .../features/create_contract_from_init.fe | 17 +- .../fixtures/features/ctx_init_in_call.fe | 15 +- .../features/ctx_param_external_func_call.fe | 22 +- .../features/ctx_param_internal_func_call.fe | 13 +- .../fixtures/features/ctx_param_simple.fe | 9 +- crates/test-files/fixtures/features/empty.fe | 5 +- crates/test-files/fixtures/features/events.fe | 29 +- .../fixtures/features/external_contract.fe | 32 +- .../fixtures/features/for_loop_with_break.fe | 15 +- .../features/for_loop_with_continue.fe | 15 +- .../features/for_loop_with_static_array.fe | 12 +- .../for_loop_with_static_array_from_sto.fe | 14 +- .../fixtures/features/if_statement.fe | 12 +- .../fixtures/features/if_statement_2.fe | 13 +- .../features/if_statement_test_from_sto.fe | 21 +- .../if_statement_with_block_declaration.fe | 14 +- .../fixtures/features/int_literal_coercion.fe | 6 +- .../fixtures/features/intrinsics.fe | 235 +- crates/test-files/fixtures/features/keccak.fe | 13 +- .../test-files/fixtures/features/map_tuple.fe | 6 +- crates/test-files/fixtures/features/math.fe | 19 +- .../fixtures/features/module_const.fe | 9 +- .../fixtures/features/module_level_events.fe | 11 +- .../fixtures/features/multi_param.fe | 6 +- .../fixtures/features/nested_map.fe | 15 +- .../fixtures/features/numeric_casts.fe | 22 +- .../fixtures/features/numeric_sizes.fe | 78 +- .../test-files/fixtures/features/ownable.fe | 42 +- .../test-files/fixtures/features/pure_fn.fe | 8 +- .../features/pure_fn_internal_call.fe | 11 +- .../fixtures/features/pure_fn_standalone.fe | 18 +- .../fixtures/features/radix_binary.fe | 6 +- .../test-files/fixtures/features/radix_hex.fe | 6 +- .../fixtures/features/radix_octal.fe | 6 +- .../fixtures/features/return_addition_i256.fe | 6 +- .../fixtures/features/return_addition_u128.fe | 6 +- .../fixtures/features/return_addition_u256.fe | 6 +- .../fixtures/features/return_array.fe | 8 +- .../features/return_bitwiseand_u128.fe | 6 +- .../features/return_bitwiseand_u256.fe | 6 +- .../features/return_bitwiseor_u256.fe | 6 +- .../features/return_bitwiseshl_i64_coerced.fe | 6 +- .../fixtures/features/return_bitwiseshl_i8.fe | 6 +- .../features/return_bitwiseshl_u256.fe | 6 +- .../fixtures/features/return_bitwiseshl_u8.fe | 6 +- .../features/return_bitwiseshr_i256.fe | 6 +- .../features/return_bitwiseshr_u256.fe | 6 +- .../features/return_bitwisexor_u256.fe | 6 +- .../fixtures/features/return_bool_false.fe | 6 +- .../fixtures/features/return_bool_inverted.fe | 6 +- .../fixtures/features/return_bool_op_and.fe | 8 +- .../fixtures/features/return_bool_op_or.fe | 8 +- .../fixtures/features/return_bool_true.fe | 6 +- .../features/return_builtin_attributes.fe | 34 +- .../features/return_cast_i8_to_unsigned.fe | 6 +- .../features/return_cast_u8_to_signed.fe | 6 +- .../fixtures/features/return_division_i256.fe | 6 +- .../fixtures/features/return_division_u256.fe | 6 +- .../fixtures/features/return_eq_u256.fe | 6 +- .../features/return_from_memory_i8.fe | 16 +- .../features/return_from_storage_array_i8.fe | 11 +- .../features/return_from_storage_i8.fe | 18 +- .../fixtures/features/return_gt_i256.fe | 6 +- .../fixtures/features/return_gt_u256.fe | 6 +- .../fixtures/features/return_gte_i256.fe | 6 +- .../fixtures/features/return_gte_u256.fe | 6 +- .../fixtures/features/return_i128_cast.fe | 6 +- .../fixtures/features/return_i256.fe | 6 +- .../fixtures/features/return_identity_u128.fe | 6 +- .../fixtures/features/return_identity_u16.fe | 6 +- .../fixtures/features/return_identity_u256.fe | 6 +- .../fixtures/features/return_identity_u32.fe | 6 +- .../fixtures/features/return_identity_u64.fe | 6 +- .../fixtures/features/return_identity_u8.fe | 6 +- .../fixtures/features/return_int_array.fe | 9 +- .../fixtures/features/return_invert_i128.fe | 6 +- .../fixtures/features/return_invert_i16.fe | 6 +- .../fixtures/features/return_invert_i256.fe | 6 +- .../fixtures/features/return_invert_i32.fe | 6 +- .../fixtures/features/return_invert_i64.fe | 6 +- .../fixtures/features/return_invert_i8.fe | 6 +- .../fixtures/features/return_invert_u128.fe | 6 +- .../fixtures/features/return_invert_u16.fe | 6 +- .../fixtures/features/return_invert_u256.fe | 6 +- .../fixtures/features/return_invert_u32.fe | 6 +- .../fixtures/features/return_invert_u64.fe | 6 +- .../fixtures/features/return_invert_u8.fe | 6 +- .../fixtures/features/return_lt_i256.fe | 6 +- .../fixtures/features/return_lt_u128.fe | 6 +- .../fixtures/features/return_lt_u256.fe | 6 +- .../fixtures/features/return_lte_i256.fe | 6 +- .../fixtures/features/return_lte_u256.fe | 6 +- .../fixtures/features/return_mod_i256.fe | 6 +- .../fixtures/features/return_mod_u256.fe | 6 +- .../fixtures/features/return_msg_sig.fe | 6 +- .../features/return_multiplication_i256.fe | 6 +- .../features/return_multiplication_u256.fe | 6 +- .../fixtures/features/return_noteq_u256.fe | 6 +- .../fixtures/features/return_pow_i256.fe | 6 +- .../fixtures/features/return_pow_u256.fe | 6 +- .../features/return_subtraction_i256.fe | 6 +- .../features/return_subtraction_u256.fe | 6 +- .../features/return_sum_list_expression_1.fe | 9 +- .../features/return_sum_list_expression_2.fe | 13 +- .../fixtures/features/return_u128_cast.fe | 6 +- .../fixtures/features/return_u256.fe | 6 +- .../features/return_u256_from_called_fn.fe | 11 +- .../return_u256_from_called_fn_with_args.fe | 13 +- .../fixtures/features/return_unit.fe | 30 +- crates/test-files/fixtures/features/revert.fe | 18 +- .../fixtures/features/self_address.fe | 8 +- .../fixtures/features/send_value.fe | 6 +- .../fixtures/features/short_circuit.fe | 21 +- .../fixtures/features/sized_vals_in_sto.fe | 34 +- .../test-files/fixtures/features/strings.fe | 26 +- .../fixtures/features/struct_fns.fe | 116 +- .../test-files/fixtures/features/structs.fe | 131 +- .../fixtures/features/ternary_expression.fe | 9 +- .../fixtures/features/tuple_destructuring.fe | 12 +- .../fixtures/features/two_contracts.fe | 21 +- .../fixtures/features/type_aliases.fe | 20 +- .../fixtures/features/u128_u128_map.fe | 11 +- .../fixtures/features/u16_u16_map.fe | 11 +- .../fixtures/features/u256_u256_map.fe | 11 +- .../fixtures/features/u32_u32_map.fe | 11 +- .../fixtures/features/u64_u64_map.fe | 11 +- .../test-files/fixtures/features/u8_u8_map.fe | 11 +- .../fixtures/features/while_loop.fe | 12 +- .../features/while_loop_test_from_sto.fe | 13 +- .../features/while_loop_with_break.fe | 9 +- .../features/while_loop_with_break_2.fe | 12 +- .../features/while_loop_with_continue.fe | 13 +- .../fixtures/ingots/basic_ingot/src/bar.fe | 6 +- .../ingots/basic_ingot/src/bar/baz.fe | 3 +- .../ingots/basic_ingot/src/bar/mee.fe | 11 +- .../fixtures/ingots/basic_ingot/src/bing.fe | 14 +- .../ingots/basic_ingot/src/ding/dang.fe | 2 +- .../ingots/basic_ingot/src/ding/dong.fe | 12 +- .../fixtures/ingots/basic_ingot/src/main.fe | 32 +- .../ingots/pub_contract_ingot/src/foo.fe | 14 +- .../ingots/pub_contract_ingot/src/main.fe | 13 +- .../ingots/visibility_ingot/src/foo.fe | 14 +- .../ingots/visibility_ingot/src/main.fe | 11 +- crates/test-files/fixtures/lowering/and_or.fe | 55 +- .../fixtures/lowering/array_tuple.fe | 8 +- .../fixtures/lowering/aug_assign.fe | 42 +- .../fixtures/lowering/base_tuple.fe | 31 +- .../fixtures/lowering/custom_empty_type.fe | 11 +- crates/test-files/fixtures/lowering/init.fe | 6 +- .../fixtures/lowering/list_expressions.fe | 6 +- .../test-files/fixtures/lowering/map_tuple.fe | 6 +- .../fixtures/lowering/module_const.fe | 79 +- .../test-files/fixtures/lowering/module_fn.fe | 19 +- .../fixtures/lowering/module_level_events.fe | 9 +- .../fixtures/lowering/nested_tuple.fe | 6 +- .../fixtures/lowering/return_unit.fe | 50 +- .../test-files/fixtures/lowering/struct_fn.fe | 28 +- .../test-files/fixtures/lowering/ternary.fe | 28 +- .../fixtures/lowering/tuple_destruct.fe | 8 +- .../fixtures/lowering/type_alias_tuple.fe | 3 +- .../fixtures/lowering/unit_implicit.fe | 6 +- crates/test-files/fixtures/printing/defs.fe | 20 +- .../printing/guest_book_no_comments.fe | 2 +- .../fixtures/stress/abi_encoding_stress.fe | 71 +- .../fixtures/stress/data_copying_stress.fe | 58 +- .../fixtures/stress/external_calls.fe | 90 +- .../fixtures/stress/tuple_stress.fe | 48 +- 551 files changed, 12363 insertions(+), 11023 deletions(-) create mode 100644 crates/parser/tests/cases/snapshots/cases__print_ast__defs.snap create mode 100644 crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap create mode 100644 crates/parser/tests/cases/snapshots/cases__print_ast__expr_parens.snap create mode 100644 crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap diff --git a/crates/analyzer/tests/errors.rs b/crates/analyzer/tests/errors.rs index 54c0a618c9..eae39ba2f3 100644 --- a/crates/analyzer/tests/errors.rs +++ b/crates/analyzer/tests/errors.rs @@ -81,28 +81,7 @@ macro_rules! test_stmt { #[wasm_bindgen_test] fn $name() { let src = format!( - "contract C:\n pub fn f(self):\n {}", - $stmt.replace('\n', "\n ") - ); - if cfg!(target_arch = "wasm32") { - fe_common::assert_snapshot_wasm!( - concat!("snapshots/errors__", stringify!($name), ".snap"), - error_string("[snippet]", &src) - ); - } else { - assert_snapshot!(error_string("[snippet]", &src)); - } - } - }; -} - -macro_rules! test_stmt_unsafe { - ($name:ident, $stmt:expr) => { - #[test] - #[wasm_bindgen_test] - fn $name() { - let src = format!( - "contract C:\n pub fn f(self):\n unsafe:\n {}", + "contract C {{\n pub fn f(self) {{\n {}\n }}\n}}", $stmt.replace('\n', "\n ") ); if cfg!(target_arch = "wasm32") { @@ -136,7 +115,7 @@ test_stmt! { binary_op_boolean_mismatch3, "1 or 2" } test_stmt! { bool_constructor, "bool(true)" } test_stmt! { bool_cast, "bool(0)" } test_stmt! { break_without_loop, "break" } -test_stmt! { break_without_loop_2, "if true:\n break" } +test_stmt! { break_without_loop_2, "if true { break }" } test_stmt! { call_undefined_function_on_contract, "self.doesnt_exist()" } test_stmt! { call_address_with_wrong_type, "address(true)" } test_stmt! { call_keccak_without_parameter, "keccak256()" } @@ -145,13 +124,13 @@ test_stmt! { call_keccak_with_2_args, "keccak256(1, 2)" } test_stmt! { call_keccak_with_generic_args, "keccak256<10>(1)" } test_stmt! { cast_address_to_u64, "u64(address(0))" } -test_stmt_unsafe! { call_balance_of_without_parameter, "std::evm::balance_of()" } -test_stmt_unsafe! { call_balance_of_with_wrong_type, "std::evm::balance_of(true)" } -test_stmt_unsafe! { call_balance_of_with_2_args, "std::evm::balance_of(address(0), 2)" } -test_stmt_unsafe! { call_balance_with_arg, "std::evm::balance(address(0))" } +test_stmt! { call_balance_of_without_parameter, "unsafe { std::evm::balance_of() }" } +test_stmt! { call_balance_of_with_wrong_type, "unsafe { std::evm::balance_of(true) }" } +test_stmt! { call_balance_of_with_2_args, "unsafe { std::evm::balance_of(address(0), 2) }" } +test_stmt! { call_balance_with_arg, "unsafe { std::evm::balance(address(0)) }" } test_stmt! { clone_arg_count, "let x: Array = [5, 6]\nlet y: Array = x.clone(y)" } test_stmt! { continue_without_loop, "continue" } -test_stmt! { continue_without_loop_2, "if true:\n continue" } +test_stmt! { continue_without_loop_2, "if true { continue }" } test_stmt! { emit_undefined_event, "emit MyEvent()" } test_stmt! { emit_type_name, "emit u8()" } test_stmt! { emit_variable, "let x: u8 = 10\nemit x()" } diff --git a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap index 7fd546442f..3d4840c3a0 100644 --- a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap @@ -16,43 +16,44 @@ note: │ ^^^^^^^^^^^^^^^^^^^^ address note: - ┌─ abi_encoding_stress.fe:10:5 + ┌─ abi_encoding_stress.fe:11:5 │ -10 │ my_addrs: Array +11 │ my_addrs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -11 │ my_u128: u128 +12 │ my_u128: u128 │ ^^^^^^^^^^^^^ u128 -12 │ my_string: String<10> +13 │ my_string: String<10> │ ^^^^^^^^^^^^^^^^^^^^^ String<10> -13 │ my_u16s: Array +14 │ my_u16s: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array -14 │ my_bool: bool +15 │ my_bool: bool │ ^^^^^^^^^^^^^ bool -15 │ my_bytes: Array +16 │ my_bytes: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ abi_encoding_stress.fe:18:9 + ┌─ abi_encoding_stress.fe:19:9 │ -18 │ my_addrs: Array +19 │ my_addrs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -19 │ my_u128: u128 +20 │ my_u128: u128 │ ^^^^^^^^^^^^^ u128 -20 │ my_string: String<10> +21 │ my_string: String<10> │ ^^^^^^^^^^^^^^^^^^^^^ String<10> -21 │ my_u16s: Array +22 │ my_u16s: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array -22 │ my_bool: bool +23 │ my_bool: bool │ ^^^^^^^^^^^^^ bool -23 │ my_bytes: Array +24 │ my_bytes: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ abi_encoding_stress.fe:25:5 + ┌─ abi_encoding_stress.fe:27:5 │ -25 │ ╭ pub fn set_my_addrs(self, my_addrs: Array): -26 │ │ self.my_addrs = my_addrs - │ ╰────────────────────────────────^ attributes hash: 8893819222299525150 +27 │ ╭ pub fn set_my_addrs(self, my_addrs: Array) { +28 │ │ self.my_addrs = my_addrs +29 │ │ } + │ ╰─────^ attributes hash: 8893819222299525150 │ = FunctionSignature { self_decl: Some( @@ -81,25 +82,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:26:9 + ┌─ abi_encoding_stress.fe:28:9 │ -26 │ self.my_addrs = my_addrs +28 │ self.my_addrs = my_addrs │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:26:9 + ┌─ abi_encoding_stress.fe:28:9 │ -26 │ self.my_addrs = my_addrs +28 │ self.my_addrs = my_addrs │ ^^^^^^^^^^^^^ ^^^^^^^^ Array: Memory │ │ │ Array: Storage { nonce: Some(0) } note: - ┌─ abi_encoding_stress.fe:28:5 + ┌─ abi_encoding_stress.fe:31:5 │ -28 │ ╭ pub fn get_my_addrs(self) -> Array: -29 │ │ return self.my_addrs.to_mem() - │ ╰─────────────────────────────────────^ attributes hash: 1736881624347502724 +31 │ ╭ pub fn get_my_addrs(self) -> Array { +32 │ │ return self.my_addrs.to_mem() +33 │ │ } + │ ╰─────^ attributes hash: 1736881624347502724 │ = FunctionSignature { self_decl: Some( @@ -118,29 +120,30 @@ note: } note: - ┌─ abi_encoding_stress.fe:29:16 + ┌─ abi_encoding_stress.fe:32:16 │ -29 │ return self.my_addrs.to_mem() +32 │ return self.my_addrs.to_mem() │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:29:16 + ┌─ abi_encoding_stress.fe:32:16 │ -29 │ return self.my_addrs.to_mem() +32 │ return self.my_addrs.to_mem() │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(0) } note: - ┌─ abi_encoding_stress.fe:29:16 + ┌─ abi_encoding_stress.fe:32:16 │ -29 │ return self.my_addrs.to_mem() +32 │ return self.my_addrs.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(0) } => Memory note: - ┌─ abi_encoding_stress.fe:31:5 + ┌─ abi_encoding_stress.fe:35:5 │ -31 │ ╭ pub fn set_my_u128(self, my_u128: u128): -32 │ │ self.my_u128 = my_u128 - │ ╰──────────────────────────────^ attributes hash: 15199964699853061770 +35 │ ╭ pub fn set_my_u128(self, my_u128: u128) { +36 │ │ self.my_u128 = my_u128 +37 │ │ } + │ ╰─────^ attributes hash: 15199964699853061770 │ = FunctionSignature { self_decl: Some( @@ -168,25 +171,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:32:9 + ┌─ abi_encoding_stress.fe:36:9 │ -32 │ self.my_u128 = my_u128 +36 │ self.my_u128 = my_u128 │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:32:9 + ┌─ abi_encoding_stress.fe:36:9 │ -32 │ self.my_u128 = my_u128 +36 │ self.my_u128 = my_u128 │ ^^^^^^^^^^^^ ^^^^^^^ u128: Value │ │ │ u128: Storage { nonce: Some(1) } note: - ┌─ abi_encoding_stress.fe:34:5 + ┌─ abi_encoding_stress.fe:39:5 │ -34 │ ╭ pub fn get_my_u128(self) -> u128: -35 │ │ return self.my_u128 - │ ╰───────────────────────────^ attributes hash: 15343208064821852867 +39 │ ╭ pub fn get_my_u128(self) -> u128 { +40 │ │ return self.my_u128 +41 │ │ } + │ ╰─────^ attributes hash: 15343208064821852867 │ = FunctionSignature { self_decl: Some( @@ -204,23 +208,24 @@ note: } note: - ┌─ abi_encoding_stress.fe:35:16 + ┌─ abi_encoding_stress.fe:40:16 │ -35 │ return self.my_u128 +40 │ return self.my_u128 │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:35:16 + ┌─ abi_encoding_stress.fe:40:16 │ -35 │ return self.my_u128 +40 │ return self.my_u128 │ ^^^^^^^^^^^^ u128: Storage { nonce: Some(1) } => Value note: - ┌─ abi_encoding_stress.fe:37:5 + ┌─ abi_encoding_stress.fe:43:5 │ -37 │ ╭ pub fn set_my_string(self, my_string: String<10>): -38 │ │ self.my_string = my_string - │ ╰──────────────────────────────────^ attributes hash: 241116312146617781 +43 │ ╭ pub fn set_my_string(self, my_string: String<10>) { +44 │ │ self.my_string = my_string +45 │ │ } + │ ╰─────^ attributes hash: 241116312146617781 │ = FunctionSignature { self_decl: Some( @@ -248,25 +253,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:38:9 + ┌─ abi_encoding_stress.fe:44:9 │ -38 │ self.my_string = my_string +44 │ self.my_string = my_string │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:38:9 + ┌─ abi_encoding_stress.fe:44:9 │ -38 │ self.my_string = my_string +44 │ self.my_string = my_string │ ^^^^^^^^^^^^^^ ^^^^^^^^^ String<10>: Memory │ │ │ String<10>: Storage { nonce: Some(2) } note: - ┌─ abi_encoding_stress.fe:40:5 + ┌─ abi_encoding_stress.fe:47:5 │ -40 │ ╭ pub fn get_my_string(self) -> String<10>: -41 │ │ return self.my_string.to_mem() - │ ╰──────────────────────────────────────^ attributes hash: 1556448784000816371 +47 │ ╭ pub fn get_my_string(self) -> String<10> { +48 │ │ return self.my_string.to_mem() +49 │ │ } + │ ╰─────^ attributes hash: 1556448784000816371 │ = FunctionSignature { self_decl: Some( @@ -284,29 +290,30 @@ note: } note: - ┌─ abi_encoding_stress.fe:41:16 + ┌─ abi_encoding_stress.fe:48:16 │ -41 │ return self.my_string.to_mem() +48 │ return self.my_string.to_mem() │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:41:16 + ┌─ abi_encoding_stress.fe:48:16 │ -41 │ return self.my_string.to_mem() +48 │ return self.my_string.to_mem() │ ^^^^^^^^^^^^^^ String<10>: Storage { nonce: Some(2) } note: - ┌─ abi_encoding_stress.fe:41:16 + ┌─ abi_encoding_stress.fe:48:16 │ -41 │ return self.my_string.to_mem() +48 │ return self.my_string.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^ String<10>: Storage { nonce: Some(2) } => Memory note: - ┌─ abi_encoding_stress.fe:43:5 + ┌─ abi_encoding_stress.fe:51:5 │ -43 │ ╭ pub fn set_my_u16s(self, my_u16s: Array): -44 │ │ self.my_u16s = my_u16s - │ ╰──────────────────────────────^ attributes hash: 15015381430419725173 +51 │ ╭ pub fn set_my_u16s(self, my_u16s: Array) { +52 │ │ self.my_u16s = my_u16s +53 │ │ } + │ ╰─────^ attributes hash: 15015381430419725173 │ = FunctionSignature { self_decl: Some( @@ -337,25 +344,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:44:9 + ┌─ abi_encoding_stress.fe:52:9 │ -44 │ self.my_u16s = my_u16s +52 │ self.my_u16s = my_u16s │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:44:9 + ┌─ abi_encoding_stress.fe:52:9 │ -44 │ self.my_u16s = my_u16s +52 │ self.my_u16s = my_u16s │ ^^^^^^^^^^^^ ^^^^^^^ Array: Memory │ │ │ Array: Storage { nonce: Some(3) } note: - ┌─ abi_encoding_stress.fe:46:5 + ┌─ abi_encoding_stress.fe:55:5 │ -46 │ ╭ pub fn get_my_u16s(self) -> Array: -47 │ │ return self.my_u16s.to_mem() - │ ╰────────────────────────────────────^ attributes hash: 14119474618304681318 +55 │ ╭ pub fn get_my_u16s(self) -> Array { +56 │ │ return self.my_u16s.to_mem() +57 │ │ } + │ ╰─────^ attributes hash: 14119474618304681318 │ = FunctionSignature { self_decl: Some( @@ -376,29 +384,30 @@ note: } note: - ┌─ abi_encoding_stress.fe:47:16 + ┌─ abi_encoding_stress.fe:56:16 │ -47 │ return self.my_u16s.to_mem() +56 │ return self.my_u16s.to_mem() │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:47:16 + ┌─ abi_encoding_stress.fe:56:16 │ -47 │ return self.my_u16s.to_mem() +56 │ return self.my_u16s.to_mem() │ ^^^^^^^^^^^^ Array: Storage { nonce: Some(3) } note: - ┌─ abi_encoding_stress.fe:47:16 + ┌─ abi_encoding_stress.fe:56:16 │ -47 │ return self.my_u16s.to_mem() +56 │ return self.my_u16s.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(3) } => Memory note: - ┌─ abi_encoding_stress.fe:49:5 + ┌─ abi_encoding_stress.fe:59:5 │ -49 │ ╭ pub fn set_my_bool(self, my_bool: bool): -50 │ │ self.my_bool = my_bool - │ ╰──────────────────────────────^ attributes hash: 3845928701529339179 +59 │ ╭ pub fn set_my_bool(self, my_bool: bool) { +60 │ │ self.my_bool = my_bool +61 │ │ } + │ ╰─────^ attributes hash: 3845928701529339179 │ = FunctionSignature { self_decl: Some( @@ -424,25 +433,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:50:9 + ┌─ abi_encoding_stress.fe:60:9 │ -50 │ self.my_bool = my_bool +60 │ self.my_bool = my_bool │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:50:9 + ┌─ abi_encoding_stress.fe:60:9 │ -50 │ self.my_bool = my_bool +60 │ self.my_bool = my_bool │ ^^^^^^^^^^^^ ^^^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(4) } note: - ┌─ abi_encoding_stress.fe:52:5 + ┌─ abi_encoding_stress.fe:63:5 │ -52 │ ╭ pub fn get_my_bool(self) -> bool: -53 │ │ return self.my_bool - │ ╰───────────────────────────^ attributes hash: 2163156009319630199 +63 │ ╭ pub fn get_my_bool(self) -> bool { +64 │ │ return self.my_bool +65 │ │ } + │ ╰─────^ attributes hash: 2163156009319630199 │ = FunctionSignature { self_decl: Some( @@ -458,23 +468,24 @@ note: } note: - ┌─ abi_encoding_stress.fe:53:16 + ┌─ abi_encoding_stress.fe:64:16 │ -53 │ return self.my_bool +64 │ return self.my_bool │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:53:16 + ┌─ abi_encoding_stress.fe:64:16 │ -53 │ return self.my_bool +64 │ return self.my_bool │ ^^^^^^^^^^^^ bool: Storage { nonce: Some(4) } => Value note: - ┌─ abi_encoding_stress.fe:55:5 + ┌─ abi_encoding_stress.fe:67:5 │ -55 │ ╭ pub fn set_my_bytes(self, my_bytes: Array): -56 │ │ self.my_bytes = my_bytes - │ ╰────────────────────────────────^ attributes hash: 11573101353594183790 +67 │ ╭ pub fn set_my_bytes(self, my_bytes: Array) { +68 │ │ self.my_bytes = my_bytes +69 │ │ } + │ ╰─────^ attributes hash: 11573101353594183790 │ = FunctionSignature { self_decl: Some( @@ -505,25 +516,26 @@ note: } note: - ┌─ abi_encoding_stress.fe:56:9 + ┌─ abi_encoding_stress.fe:68:9 │ -56 │ self.my_bytes = my_bytes +68 │ self.my_bytes = my_bytes │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:56:9 + ┌─ abi_encoding_stress.fe:68:9 │ -56 │ self.my_bytes = my_bytes +68 │ self.my_bytes = my_bytes │ ^^^^^^^^^^^^^ ^^^^^^^^ Array: Memory │ │ │ Array: Storage { nonce: Some(5) } note: - ┌─ abi_encoding_stress.fe:58:5 + ┌─ abi_encoding_stress.fe:71:5 │ -58 │ ╭ pub fn get_my_bytes(self) -> Array: -59 │ │ return self.my_bytes.to_mem() - │ ╰─────────────────────────────────────^ attributes hash: 157798734366762321 +71 │ ╭ pub fn get_my_bytes(self) -> Array { +72 │ │ return self.my_bytes.to_mem() +73 │ │ } + │ ╰─────^ attributes hash: 157798734366762321 │ = FunctionSignature { self_decl: Some( @@ -544,34 +556,30 @@ note: } note: - ┌─ abi_encoding_stress.fe:59:16 + ┌─ abi_encoding_stress.fe:72:16 │ -59 │ return self.my_bytes.to_mem() +72 │ return self.my_bytes.to_mem() │ ^^^^ Foo: Value note: - ┌─ abi_encoding_stress.fe:59:16 + ┌─ abi_encoding_stress.fe:72:16 │ -59 │ return self.my_bytes.to_mem() +72 │ return self.my_bytes.to_mem() │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } note: - ┌─ abi_encoding_stress.fe:59:16 + ┌─ abi_encoding_stress.fe:72:16 │ -59 │ return self.my_bytes.to_mem() +72 │ return self.my_bytes.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } => Memory note: - ┌─ abi_encoding_stress.fe:61:5 + ┌─ abi_encoding_stress.fe:75:5 │ -61 │ ╭ pub fn get_my_struct() -> MyStruct: -62 │ │ return MyStruct( -63 │ │ my_num: 42, -64 │ │ my_num2: u8(26), -65 │ │ my_bool: true, -66 │ │ my_addr: address(123456) -67 │ │ ) - │ ╰─────────^ attributes hash: 16166951200114277325 +75 │ ╭ pub fn get_my_struct() -> MyStruct { +76 │ │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) +77 │ │ } + │ ╰─────^ attributes hash: 16166951200114277325 │ = FunctionSignature { self_decl: None, @@ -588,51 +596,45 @@ note: } note: - ┌─ abi_encoding_stress.fe:63:21 + ┌─ abi_encoding_stress.fe:76:33 │ -63 │ my_num: 42, - │ ^^ u256: Value -64 │ my_num2: u8(26), - │ ^^ u8: Value +76 │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) + │ ^^ ^^ u8: Value + │ │ + │ u256: Value note: - ┌─ abi_encoding_stress.fe:64:22 + ┌─ abi_encoding_stress.fe:76:46 │ -64 │ my_num2: u8(26), - │ ^^^^^^ u8: Value -65 │ my_bool: true, - │ ^^^^ bool: Value -66 │ my_addr: address(123456) - │ ^^^^^^ u256: Value +76 │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) + │ ^^^^^^ ^^^^ ^^^^^^ u256: Value + │ │ │ + │ │ bool: Value + │ u8: Value note: - ┌─ abi_encoding_stress.fe:66:22 + ┌─ abi_encoding_stress.fe:76:78 │ -66 │ my_addr: address(123456) - │ ^^^^^^^^^^^^^^^ address: Value +76 │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) + │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ abi_encoding_stress.fe:62:16 - │ -62 │ return MyStruct( - │ ╭────────────────^ -63 │ │ my_num: 42, -64 │ │ my_num2: u8(26), -65 │ │ my_bool: true, -66 │ │ my_addr: address(123456) -67 │ │ ) - │ ╰─────────^ MyStruct: Memory + ┌─ abi_encoding_stress.fe:76:16 + │ +76 │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:69:5 + ┌─ abi_encoding_stress.fe:79:5 │ -69 │ ╭ pub fn mod_my_struct(my_struct: MyStruct) -> MyStruct: -70 │ │ my_struct.my_num = 12341234 -71 │ │ my_struct.my_num2 = u8(42) -72 │ │ my_struct.my_bool = false -73 │ │ my_struct.my_addr = address(9999) -74 │ │ return my_struct - │ ╰────────────────────────^ attributes hash: 11747697140833990696 +79 │ ╭ pub fn mod_my_struct(my_struct: MyStruct) -> MyStruct { +80 │ │ my_struct.my_num = 12341234 +81 │ │ my_struct.my_num2 = u8(42) +82 │ │ my_struct.my_bool = false +83 │ │ my_struct.my_addr = address(9999) +84 │ │ return my_struct +85 │ │ } + │ ╰─────^ attributes hash: 11747697140833990696 │ = FunctionSignature { self_decl: None, @@ -662,74 +664,70 @@ note: } note: - ┌─ abi_encoding_stress.fe:70:9 + ┌─ abi_encoding_stress.fe:80:9 │ -70 │ my_struct.my_num = 12341234 +80 │ my_struct.my_num = 12341234 │ ^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:70:9 + ┌─ abi_encoding_stress.fe:80:9 │ -70 │ my_struct.my_num = 12341234 +80 │ my_struct.my_num = 12341234 │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Memory -71 │ my_struct.my_num2 = u8(42) +81 │ my_struct.my_num2 = u8(42) │ ^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:71:9 + ┌─ abi_encoding_stress.fe:81:9 │ -71 │ my_struct.my_num2 = u8(42) +81 │ my_struct.my_num2 = u8(42) │ ^^^^^^^^^^^^^^^^^ ^^ u8: Value │ │ │ u8: Memory note: - ┌─ abi_encoding_stress.fe:71:29 + ┌─ abi_encoding_stress.fe:81:29 │ -71 │ my_struct.my_num2 = u8(42) +81 │ my_struct.my_num2 = u8(42) │ ^^^^^^ u8: Value -72 │ my_struct.my_bool = false +82 │ my_struct.my_bool = false │ ^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:72:9 + ┌─ abi_encoding_stress.fe:82:9 │ -72 │ my_struct.my_bool = false +82 │ my_struct.my_bool = false │ ^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Memory -73 │ my_struct.my_addr = address(9999) +83 │ my_struct.my_addr = address(9999) │ ^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:73:9 + ┌─ abi_encoding_stress.fe:83:9 │ -73 │ my_struct.my_addr = address(9999) +83 │ my_struct.my_addr = address(9999) │ ^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ address: Memory note: - ┌─ abi_encoding_stress.fe:73:29 + ┌─ abi_encoding_stress.fe:83:29 │ -73 │ my_struct.my_addr = address(9999) +83 │ my_struct.my_addr = address(9999) │ ^^^^^^^^^^^^^ address: Value -74 │ return my_struct +84 │ return my_struct │ ^^^^^^^^^ MyStruct: Memory note: - ┌─ abi_encoding_stress.fe:76:5 + ┌─ abi_encoding_stress.fe:87:5 │ -76 │ ╭ pub fn emit_my_event(self, ctx: Context): -77 │ │ emit MyEvent( -78 │ │ ctx, -79 │ │ my_addrs: self.my_addrs.to_mem(), - · │ -84 │ │ my_bytes: self.my_bytes.to_mem() -85 │ │ ) - │ ╰─────────^ attributes hash: 1731341862738941170 +87 │ ╭ pub fn emit_my_event(self, ctx: Context) { +88 │ │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) +89 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -760,95 +758,89 @@ note: } note: - ┌─ abi_encoding_stress.fe:78:13 + ┌─ abi_encoding_stress.fe:88:22 │ -78 │ ctx, - │ ^^^ Context: Memory -79 │ my_addrs: self.my_addrs.to_mem(), - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^ ^^^^ Foo: Value + │ │ + │ Context: Memory note: - ┌─ abi_encoding_stress.fe:79:23 + ┌─ abi_encoding_stress.fe:88:37 │ -79 │ my_addrs: self.my_addrs.to_mem(), - │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(0) } +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(0) } note: - ┌─ abi_encoding_stress.fe:79:23 + ┌─ abi_encoding_stress.fe:88:37 │ -79 │ my_addrs: self.my_addrs.to_mem(), - │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(0) } => Memory -80 │ my_u128: self.my_u128, - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ Array: Storage { nonce: Some(0) } => Memory note: - ┌─ abi_encoding_stress.fe:80:22 + ┌─ abi_encoding_stress.fe:88:70 │ -80 │ my_u128: self.my_u128, - │ ^^^^^^^^^^^^ u128: Storage { nonce: Some(1) } => Value -81 │ my_string: self.my_string.to_mem(), - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ u128: Storage { nonce: Some(1) } => Value note: - ┌─ abi_encoding_stress.fe:81:24 + ┌─ abi_encoding_stress.fe:88:95 │ -81 │ my_string: self.my_string.to_mem(), - │ ^^^^^^^^^^^^^^ String<10>: Storage { nonce: Some(2) } +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^ String<10>: Storage { nonce: Some(2) } note: - ┌─ abi_encoding_stress.fe:81:24 + ┌─ abi_encoding_stress.fe:88:95 │ -81 │ my_string: self.my_string.to_mem(), - │ ^^^^^^^^^^^^^^^^^^^^^^^ String<10>: Storage { nonce: Some(2) } => Memory -82 │ my_u16s: self.my_u16s.to_mem(), - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ String<10>: Storage { nonce: Some(2) } => Memory note: - ┌─ abi_encoding_stress.fe:82:22 + ┌─ abi_encoding_stress.fe:88:129 │ -82 │ my_u16s: self.my_u16s.to_mem(), - │ ^^^^^^^^^^^^ Array: Storage { nonce: Some(3) } +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^ Array: Storage { nonce: Some(3) } note: - ┌─ abi_encoding_stress.fe:82:22 + ┌─ abi_encoding_stress.fe:88:129 │ -82 │ my_u16s: self.my_u16s.to_mem(), - │ ^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(3) } => Memory -83 │ my_bool: self.my_bool, - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ Array: Storage { nonce: Some(3) } => Memory note: - ┌─ abi_encoding_stress.fe:83:22 + ┌─ abi_encoding_stress.fe:88:161 │ -83 │ my_bool: self.my_bool, - │ ^^^^^^^^^^^^ bool: Storage { nonce: Some(4) } => Value -84 │ my_bytes: self.my_bytes.to_mem() - │ ^^^^ Foo: Value +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ bool: Storage { nonce: Some(4) } => Value note: - ┌─ abi_encoding_stress.fe:84:23 + ┌─ abi_encoding_stress.fe:88:185 │ -84 │ my_bytes: self.my_bytes.to_mem() - │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } note: - ┌─ abi_encoding_stress.fe:84:23 + ┌─ abi_encoding_stress.fe:88:185 │ -84 │ my_bytes: self.my_bytes.to_mem() - │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } => Memory +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(5) } => Memory note: - ┌─ abi_encoding_stress.fe:77:9 - │ -77 │ ╭ emit MyEvent( -78 │ │ ctx, -79 │ │ my_addrs: self.my_addrs.to_mem(), -80 │ │ my_u128: self.my_u128, - · │ -84 │ │ my_bytes: self.my_bytes.to_mem() -85 │ │ ) - │ ╰─────────^ attributes hash: 2185685122923697263 - │ + ┌─ abi_encoding_stress.fe:88:9 + │ +88 │ emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 2185685122923697263 + │ = Event { name: "MyEvent", fields: [ diff --git a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap index ca8cd9645f..5cd353e9fb 100644 --- a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ address_bytes10_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: address) -> Array: +4 │ ╭ pub fn read_bar(self, key: address) -> Array { 5 │ │ return self.bar[key].to_mem() - │ ╰─────────────────────────────────────^ attributes hash: 7365261960972751402 +6 │ │ } + │ ╰─────^ attributes hash: 7365261960972751402 │ = FunctionSignature { self_decl: Some( @@ -71,67 +72,68 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: None } => Memory note: - ┌─ address_bytes10_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: address, value: Array): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 10331226497424577374 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Array( - Array { - size: 10, - inner: Numeric( - U8, - ), - }, - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ address_bytes10_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: address, value: Array) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 10331226497424577374 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Array( + Array { + size: 10, + inner: Numeric( + U8, + ), + }, + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ address_bytes10_map.fe:8:9 + ┌─ address_bytes10_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ address_bytes10_map.fe:8:9 + ┌─ address_bytes10_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ address: Value │ │ │ Map>: Storage { nonce: Some(0) } note: - ┌─ address_bytes10_map.fe:8:9 + ┌─ address_bytes10_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ Array: Memory │ │ │ Array: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__assert.snap b/crates/analyzer/tests/snapshots/analysis__assert.snap index 8697cf7847..8caccc07a7 100644 --- a/crates/analyzer/tests/snapshots/analysis__assert.snap +++ b/crates/analyzer/tests/snapshots/analysis__assert.snap @@ -14,9 +14,10 @@ note: note: ┌─ assert.fe:5:5 │ -5 │ ╭ pub fn bar(baz: u256): +5 │ ╭ pub fn bar(baz: u256) { 6 │ │ assert baz > 5 - │ ╰──────────────────────^ attributes hash: 2614610269237134179 +7 │ │ } + │ ╰─────^ attributes hash: 2614610269237134179 │ = FunctionSignature { self_decl: None, @@ -56,57 +57,59 @@ note: │ ^^^^^^^ bool: Value note: - ┌─ assert.fe:8:5 - │ -8 │ ╭ pub fn revert_with_static_string(baz: u256): -9 │ │ assert baz > 5, "Must be greater than five" - │ ╰───────────────────────────────────────────────────^ attributes hash: 2614610269237134179 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "baz", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ assert.fe:9:5 + │ + 9 │ ╭ pub fn revert_with_static_string(baz: u256) { +10 │ │ assert baz > 5, "Must be greater than five" +11 │ │ } + │ ╰─────^ attributes hash: 2614610269237134179 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "baz", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ assert.fe:9:16 - │ -9 │ assert baz > 5, "Must be greater than five" - │ ^^^ ^ u256: Value - │ │ - │ u256: Value + ┌─ assert.fe:10:16 + │ +10 │ assert baz > 5, "Must be greater than five" + │ ^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ assert.fe:9:16 - │ -9 │ assert baz > 5, "Must be greater than five" - │ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<25>: Memory - │ │ - │ bool: Value + ┌─ assert.fe:10:16 + │ +10 │ assert baz > 5, "Must be greater than five" + │ ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<25>: Memory + │ │ + │ bool: Value note: - ┌─ assert.fe:11:5 + ┌─ assert.fe:13:5 │ -11 │ ╭ pub fn revert_with(baz: u256, reason: String<1000>): -12 │ │ assert baz > 5, reason - │ ╰──────────────────────────────^ attributes hash: 10044481770469626577 +13 │ ╭ pub fn revert_with(baz: u256, reason: String<1000>) { +14 │ │ assert baz > 5, reason +15 │ │ } + │ ╰─────^ attributes hash: 10044481770469626577 │ = FunctionSignature { self_decl: None, @@ -143,28 +146,29 @@ note: } note: - ┌─ assert.fe:12:16 + ┌─ assert.fe:14:16 │ -12 │ assert baz > 5, reason +14 │ assert baz > 5, reason │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ assert.fe:12:16 + ┌─ assert.fe:14:16 │ -12 │ assert baz > 5, reason +14 │ assert baz > 5, reason │ ^^^^^^^ ^^^^^^ String<1000>: Memory │ │ │ bool: Value note: - ┌─ assert.fe:14:5 + ┌─ assert.fe:17:5 │ -14 │ ╭ pub fn assert_sto_bool(self): -15 │ │ self.my_bool = false -16 │ │ assert self.my_bool - │ ╰───────────────────────────^ attributes hash: 18235041182630809162 +17 │ ╭ pub fn assert_sto_bool(self) { +18 │ │ self.my_bool = false +19 │ │ assert self.my_bool +20 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -180,34 +184,35 @@ note: } note: - ┌─ assert.fe:15:9 + ┌─ assert.fe:18:9 │ -15 │ self.my_bool = false +18 │ self.my_bool = false │ ^^^^ Foo: Value note: - ┌─ assert.fe:15:9 + ┌─ assert.fe:18:9 │ -15 │ self.my_bool = false +18 │ self.my_bool = false │ ^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(0) } -16 │ assert self.my_bool +19 │ assert self.my_bool │ ^^^^ Foo: Value note: - ┌─ assert.fe:16:16 + ┌─ assert.fe:19:16 │ -16 │ assert self.my_bool +19 │ assert self.my_bool │ ^^^^^^^^^^^^ bool: Storage { nonce: Some(0) } => Value note: - ┌─ assert.fe:18:5 + ┌─ assert.fe:22:5 │ -18 │ ╭ pub fn assert_sto_string_msg(self): -19 │ │ self.my_string = "hello" -20 │ │ assert false, self.my_string.to_mem() - │ ╰─────────────────────────────────────────────^ attributes hash: 18235041182630809162 +22 │ ╭ pub fn assert_sto_string_msg(self) { +23 │ │ self.my_string = "hello" +24 │ │ assert false, self.my_string.to_mem() +25 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -223,33 +228,33 @@ note: } note: - ┌─ assert.fe:19:9 + ┌─ assert.fe:23:9 │ -19 │ self.my_string = "hello" +23 │ self.my_string = "hello" │ ^^^^ Foo: Value note: - ┌─ assert.fe:19:9 + ┌─ assert.fe:23:9 │ -19 │ self.my_string = "hello" +23 │ self.my_string = "hello" │ ^^^^^^^^^^^^^^ ^^^^^^^ String<5>: Memory │ │ │ String<5>: Storage { nonce: Some(1) } -20 │ assert false, self.my_string.to_mem() +24 │ assert false, self.my_string.to_mem() │ ^^^^^ ^^^^ Foo: Value │ │ │ bool: Value note: - ┌─ assert.fe:20:23 + ┌─ assert.fe:24:23 │ -20 │ assert false, self.my_string.to_mem() +24 │ assert false, self.my_string.to_mem() │ ^^^^^^^^^^^^^^ String<5>: Storage { nonce: Some(1) } note: - ┌─ assert.fe:20:23 + ┌─ assert.fe:24:23 │ -20 │ assert false, self.my_string.to_mem() +24 │ assert false, self.my_string.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^ String<5>: Storage { nonce: Some(1) } => Memory diff --git a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap index 3b64ebc6bb..6dd61318bb 100644 --- a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ associated_fns.fe:3:3 + ┌─ associated_fns.fe:2:5 │ -3 │ ╭ pub fn square(x: u256) -> u256: -4 │ │ return x * x - │ ╰────────────────^ attributes hash: 6622018637299644818 +2 │ ╭ pub fn square(x: u256) -> u256 { +3 │ │ return x * x +4 │ │ } + │ ╰─────^ attributes hash: 6622018637299644818 │ = FunctionSignature { self_decl: None, @@ -36,83 +37,85 @@ note: } note: - ┌─ associated_fns.fe:4:12 + ┌─ associated_fns.fe:3:16 │ -4 │ return x * x - │ ^ ^ u256: Value - │ │ - │ u256: Value +3 │ return x * x + │ ^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ associated_fns.fe:4:12 + ┌─ associated_fns.fe:3:16 │ -4 │ return x * x - │ ^^^^^ u256: Value +3 │ return x * x + │ ^^^^^ u256: Value note: - ┌─ associated_fns.fe:7:3 + ┌─ associated_fns.fe:8:5 │ -7 │ pub x: u256 - │ ^^^^^^^^^^^ u256 +8 │ pub x: u256 + │ ^^^^^^^^^^^ u256 note: - ┌─ associated_fns.fe:8:3 - │ -8 │ ╭ pub fn new(x: u256) -> MyStruct: -9 │ │ return MyStruct(x) - │ ╰──────────────────────^ attributes hash: 2145703897684373991 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "x", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Struct( - Struct { - name: "MyStruct", - field_count: 1, - }, - ), - ), - } + ┌─ associated_fns.fe:10:5 + │ +10 │ ╭ pub fn new(x: u256) -> MyStruct { +11 │ │ return MyStruct(x) +12 │ │ } + │ ╰─────^ attributes hash: 2145703897684373991 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "x", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Struct( + Struct { + name: "MyStruct", + field_count: 1, + }, + ), + ), + } note: - ┌─ associated_fns.fe:9:21 - │ -9 │ return MyStruct(x) - │ ^ u256: Value + ┌─ associated_fns.fe:11:25 + │ +11 │ return MyStruct(x) + │ ^ u256: Value note: - ┌─ associated_fns.fe:9:12 - │ -9 │ return MyStruct(x) - │ ^^^^^^^^^^^ MyStruct: Memory + ┌─ associated_fns.fe:11:16 + │ +11 │ return MyStruct(x) + │ ^^^^^^^^^^^ MyStruct: Memory note: - ┌─ associated_fns.fe:12:3 + ┌─ associated_fns.fe:16:5 │ -12 │ my_struct: MyStruct - │ ^^^^^^^^^^^^^^^^^^^ MyStruct +16 │ my_struct: MyStruct + │ ^^^^^^^^^^^^^^^^^^^ MyStruct note: - ┌─ associated_fns.fe:14:3 + ┌─ associated_fns.fe:18:5 │ -14 │ ╭ pub fn bar(self, val: u256) -> u256: -15 │ │ self.my_struct = MyStruct::new(x: val) -16 │ │ return Lib::square(x: self.my_struct.x) - │ ╰───────────────────────────────────────────^ attributes hash: 2950430758151367369 +18 │ ╭ pub fn bar(self, val: u256) -> u256 { +19 │ │ self.my_struct = MyStruct::new(x: val) +20 │ │ return Lib::square(x: self.my_struct.x) +21 │ │ } + │ ╰─────^ attributes hash: 2950430758151367369 │ = FunctionSignature { self_decl: Some( @@ -142,43 +145,43 @@ note: } note: - ┌─ associated_fns.fe:15:5 + ┌─ associated_fns.fe:19:9 │ -15 │ self.my_struct = MyStruct::new(x: val) - │ ^^^^ Foo: Value +19 │ self.my_struct = MyStruct::new(x: val) + │ ^^^^ Foo: Value note: - ┌─ associated_fns.fe:15:5 + ┌─ associated_fns.fe:19:9 │ -15 │ self.my_struct = MyStruct::new(x: val) - │ ^^^^^^^^^^^^^^ ^^^ u256: Value - │ │ - │ MyStruct: Storage { nonce: Some(0) } +19 │ self.my_struct = MyStruct::new(x: val) + │ ^^^^^^^^^^^^^^ ^^^ u256: Value + │ │ + │ MyStruct: Storage { nonce: Some(0) } note: - ┌─ associated_fns.fe:15:22 + ┌─ associated_fns.fe:19:26 │ -15 │ self.my_struct = MyStruct::new(x: val) - │ ^^^^^^^^^^^^^^^^^^^^^ MyStruct: Memory -16 │ return Lib::square(x: self.my_struct.x) - │ ^^^^ Foo: Value +19 │ self.my_struct = MyStruct::new(x: val) + │ ^^^^^^^^^^^^^^^^^^^^^ MyStruct: Memory +20 │ return Lib::square(x: self.my_struct.x) + │ ^^^^ Foo: Value note: - ┌─ associated_fns.fe:16:27 + ┌─ associated_fns.fe:20:31 │ -16 │ return Lib::square(x: self.my_struct.x) - │ ^^^^^^^^^^^^^^ MyStruct: Storage { nonce: Some(0) } +20 │ return Lib::square(x: self.my_struct.x) + │ ^^^^^^^^^^^^^^ MyStruct: Storage { nonce: Some(0) } note: - ┌─ associated_fns.fe:16:27 + ┌─ associated_fns.fe:20:31 │ -16 │ return Lib::square(x: self.my_struct.x) - │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value +20 │ return Lib::square(x: self.my_struct.x) + │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value note: - ┌─ associated_fns.fe:16:12 + ┌─ associated_fns.fe:20:16 │ -16 │ return Lib::square(x: self.my_struct.x) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +20 │ return Lib::square(x: self.my_struct.x) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap index 5361ebc923..f22675eb02 100644 --- a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap +++ b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap @@ -12,10 +12,11 @@ note: note: ┌─ aug_assign.fe:4:5 │ -4 │ ╭ pub fn add(a: u256, b: u256) -> u256: +4 │ ╭ pub fn add(a: u256, b: u256) -> u256 { 5 │ │ a += b 6 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 +7 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -64,12 +65,13 @@ note: │ ^ u256: Value note: - ┌─ aug_assign.fe:8:5 + ┌─ aug_assign.fe:9:5 │ - 8 │ ╭ pub fn sub(a: u256, b: u256) -> u256: - 9 │ │ a -= b -10 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 + 9 │ ╭ pub fn sub(a: u256, b: u256) -> u256 { +10 │ │ a -= b +11 │ │ return a +12 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -108,22 +110,23 @@ note: } note: - ┌─ aug_assign.fe:9:9 + ┌─ aug_assign.fe:10:9 │ - 9 │ a -= b +10 │ a -= b │ ^ ^ u256: Value │ │ │ u256: Value -10 │ return a +11 │ return a │ ^ u256: Value note: - ┌─ aug_assign.fe:12:5 + ┌─ aug_assign.fe:14:5 │ -12 │ ╭ pub fn mul(a: u256, b: u256) -> u256: -13 │ │ a *= b -14 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 +14 │ ╭ pub fn mul(a: u256, b: u256) -> u256 { +15 │ │ a *= b +16 │ │ return a +17 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -162,22 +165,23 @@ note: } note: - ┌─ aug_assign.fe:13:9 + ┌─ aug_assign.fe:15:9 │ -13 │ a *= b +15 │ a *= b │ ^ ^ u256: Value │ │ │ u256: Value -14 │ return a +16 │ return a │ ^ u256: Value note: - ┌─ aug_assign.fe:16:5 + ┌─ aug_assign.fe:19:5 │ -16 │ ╭ pub fn div(a: u256, b: u256) -> u256: -17 │ │ a /= b -18 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 +19 │ ╭ pub fn div(a: u256, b: u256) -> u256 { +20 │ │ a /= b +21 │ │ return a +22 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -216,22 +220,23 @@ note: } note: - ┌─ aug_assign.fe:17:9 + ┌─ aug_assign.fe:20:9 │ -17 │ a /= b +20 │ a /= b │ ^ ^ u256: Value │ │ │ u256: Value -18 │ return a +21 │ return a │ ^ u256: Value note: - ┌─ aug_assign.fe:20:5 + ┌─ aug_assign.fe:24:5 │ -20 │ ╭ pub fn mod(a: u256, b: u256) -> u256: -21 │ │ a %= b -22 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 +24 │ ╭ pub fn mod(a: u256, b: u256) -> u256 { +25 │ │ a %= b +26 │ │ return a +27 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -270,22 +275,23 @@ note: } note: - ┌─ aug_assign.fe:21:9 + ┌─ aug_assign.fe:25:9 │ -21 │ a %= b +25 │ a %= b │ ^ ^ u256: Value │ │ │ u256: Value -22 │ return a +26 │ return a │ ^ u256: Value note: - ┌─ aug_assign.fe:24:5 + ┌─ aug_assign.fe:29:5 │ -24 │ ╭ pub fn pow(a: u256, b: u256) -> u256: -25 │ │ a **= b -26 │ │ return a - │ ╰────────────────^ attributes hash: 14373109651426912995 +29 │ ╭ pub fn pow(a: u256, b: u256) -> u256 { +30 │ │ a **= b +31 │ │ return a +32 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -324,22 +330,23 @@ note: } note: - ┌─ aug_assign.fe:25:9 + ┌─ aug_assign.fe:30:9 │ -25 │ a **= b +30 │ a **= b │ ^ ^ u256: Value │ │ │ u256: Value -26 │ return a +31 │ return a │ ^ u256: Value note: - ┌─ aug_assign.fe:28:5 + ┌─ aug_assign.fe:34:5 │ -28 │ ╭ pub fn lshift(a: u8, b: u8) -> u8: -29 │ │ a <<= b -30 │ │ return a - │ ╰────────────────^ attributes hash: 3365128954177167387 +34 │ ╭ pub fn lshift(a: u8, b: u8) -> u8 { +35 │ │ a <<= b +36 │ │ return a +37 │ │ } + │ ╰─────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, @@ -378,22 +385,23 @@ note: } note: - ┌─ aug_assign.fe:29:9 + ┌─ aug_assign.fe:35:9 │ -29 │ a <<= b +35 │ a <<= b │ ^ ^ u8: Value │ │ │ u8: Value -30 │ return a +36 │ return a │ ^ u8: Value note: - ┌─ aug_assign.fe:32:5 + ┌─ aug_assign.fe:39:5 │ -32 │ ╭ pub fn rshift(a: u8, b: u8) -> u8: -33 │ │ a >>= b -34 │ │ return a - │ ╰────────────────^ attributes hash: 3365128954177167387 +39 │ ╭ pub fn rshift(a: u8, b: u8) -> u8 { +40 │ │ a >>= b +41 │ │ return a +42 │ │ } + │ ╰─────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, @@ -432,22 +440,23 @@ note: } note: - ┌─ aug_assign.fe:33:9 + ┌─ aug_assign.fe:40:9 │ -33 │ a >>= b +40 │ a >>= b │ ^ ^ u8: Value │ │ │ u8: Value -34 │ return a +41 │ return a │ ^ u8: Value note: - ┌─ aug_assign.fe:36:5 + ┌─ aug_assign.fe:44:5 │ -36 │ ╭ pub fn bit_or(a: u8, b: u8) -> u8: -37 │ │ a |= b -38 │ │ return a - │ ╰────────────────^ attributes hash: 3365128954177167387 +44 │ ╭ pub fn bit_or(a: u8, b: u8) -> u8 { +45 │ │ a |= b +46 │ │ return a +47 │ │ } + │ ╰─────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, @@ -486,22 +495,23 @@ note: } note: - ┌─ aug_assign.fe:37:9 + ┌─ aug_assign.fe:45:9 │ -37 │ a |= b +45 │ a |= b │ ^ ^ u8: Value │ │ │ u8: Value -38 │ return a +46 │ return a │ ^ u8: Value note: - ┌─ aug_assign.fe:40:5 + ┌─ aug_assign.fe:49:5 │ -40 │ ╭ pub fn bit_xor(a: u8, b: u8) -> u8: -41 │ │ a ^= b -42 │ │ return a - │ ╰────────────────^ attributes hash: 3365128954177167387 +49 │ ╭ pub fn bit_xor(a: u8, b: u8) -> u8 { +50 │ │ a ^= b +51 │ │ return a +52 │ │ } + │ ╰─────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, @@ -540,22 +550,23 @@ note: } note: - ┌─ aug_assign.fe:41:9 + ┌─ aug_assign.fe:50:9 │ -41 │ a ^= b +50 │ a ^= b │ ^ ^ u8: Value │ │ │ u8: Value -42 │ return a +51 │ return a │ ^ u8: Value note: - ┌─ aug_assign.fe:44:5 + ┌─ aug_assign.fe:54:5 │ -44 │ ╭ pub fn bit_and(a: u8, b: u8) -> u8: -45 │ │ a &= b -46 │ │ return a - │ ╰────────────────^ attributes hash: 3365128954177167387 +54 │ ╭ pub fn bit_and(a: u8, b: u8) -> u8 { +55 │ │ a &= b +56 │ │ return a +57 │ │ } + │ ╰─────^ attributes hash: 3365128954177167387 │ = FunctionSignature { self_decl: None, @@ -594,23 +605,24 @@ note: } note: - ┌─ aug_assign.fe:45:9 + ┌─ aug_assign.fe:55:9 │ -45 │ a &= b +55 │ a &= b │ ^ ^ u8: Value │ │ │ u8: Value -46 │ return a +56 │ return a │ ^ u8: Value note: - ┌─ aug_assign.fe:48:5 + ┌─ aug_assign.fe:59:5 │ -48 │ ╭ pub fn add_from_sto(self, a: u256, b: u256) -> u256: -49 │ │ self.my_num = a -50 │ │ self.my_num += b -51 │ │ return self.my_num - │ ╰──────────────────────────^ attributes hash: 3506345928150766050 +59 │ ╭ pub fn add_from_sto(self, a: u256, b: u256) -> u256 { +60 │ │ self.my_num = a +61 │ │ self.my_num += b +62 │ │ return self.my_num +63 │ │ } + │ ╰─────^ attributes hash: 3506345928150766050 │ = FunctionSignature { self_decl: Some( @@ -651,46 +663,47 @@ note: } note: - ┌─ aug_assign.fe:49:9 + ┌─ aug_assign.fe:60:9 │ -49 │ self.my_num = a +60 │ self.my_num = a │ ^^^^ Foo: Value note: - ┌─ aug_assign.fe:49:9 + ┌─ aug_assign.fe:60:9 │ -49 │ self.my_num = a +60 │ self.my_num = a │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } -50 │ self.my_num += b +61 │ self.my_num += b │ ^^^^ Foo: Value note: - ┌─ aug_assign.fe:50:9 + ┌─ aug_assign.fe:61:9 │ -50 │ self.my_num += b +61 │ self.my_num += b │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } -51 │ return self.my_num +62 │ return self.my_num │ ^^^^ Foo: Value note: - ┌─ aug_assign.fe:51:16 + ┌─ aug_assign.fe:62:16 │ -51 │ return self.my_num +62 │ return self.my_num │ ^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value note: - ┌─ aug_assign.fe:53:5 + ┌─ aug_assign.fe:65:5 │ -53 │ ╭ pub fn add_from_mem(a: u256, b: u256) -> u256: -54 │ │ let my_array: Array -55 │ │ my_array[7] = a -56 │ │ my_array[7] += b -57 │ │ return my_array[7] - │ ╰──────────────────────────^ attributes hash: 14373109651426912995 +65 │ ╭ pub fn add_from_mem(a: u256, b: u256) -> u256 { +66 │ │ let my_array: Array +67 │ │ my_array[7] = a +68 │ │ my_array[7] += b +69 │ │ return my_array[7] +70 │ │ } + │ ╰─────^ attributes hash: 14373109651426912995 │ = FunctionSignature { self_decl: None, @@ -729,47 +742,47 @@ note: } note: - ┌─ aug_assign.fe:54:23 + ┌─ aug_assign.fe:66:23 │ -54 │ let my_array: Array +66 │ let my_array: Array │ ^^^^^^^^^^^^^^^ Array note: - ┌─ aug_assign.fe:55:9 + ┌─ aug_assign.fe:67:9 │ -55 │ my_array[7] = a +67 │ my_array[7] = a │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ aug_assign.fe:55:9 + ┌─ aug_assign.fe:67:9 │ -55 │ my_array[7] = a +67 │ my_array[7] = a │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -56 │ my_array[7] += b +68 │ my_array[7] += b │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ aug_assign.fe:56:9 + ┌─ aug_assign.fe:68:9 │ -56 │ my_array[7] += b +68 │ my_array[7] += b │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -57 │ return my_array[7] +69 │ return my_array[7] │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ aug_assign.fe:57:16 + ┌─ aug_assign.fe:69:16 │ -57 │ return my_array[7] +69 │ return my_array[7] │ ^^^^^^^^^^^ u256: Memory => Value diff --git a/crates/analyzer/tests/snapshots/analysis__balances.snap b/crates/analyzer/tests/snapshots/analysis__balances.snap index db25123286..80543a6138 100644 --- a/crates/analyzer/tests/snapshots/analysis__balances.snap +++ b/crates/analyzer/tests/snapshots/analysis__balances.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ balances.fe:5:5 │ -5 │ ╭ pub fn my_balance(self, ctx: Context) -> u256: +5 │ ╭ pub fn my_balance(self, ctx: Context) -> u256 { 6 │ │ return ctx.self_balance() - │ ╰─────────────────────────────────^ attributes hash: 3247318976601732237 +7 │ │ } + │ ╰─────^ attributes hash: 3247318976601732237 │ = FunctionSignature { self_decl: Some( @@ -53,63 +54,64 @@ note: │ ^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ balances.fe:8:5 - │ -8 │ ╭ pub fn other_balance(self, ctx: Context, someone: address) -> u256: -9 │ │ return ctx.balance_of(someone) - │ ╰──────────────────────────────────────^ attributes hash: 7590750053308816492 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "someone", - typ: Ok( - Base( - Address, - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ balances.fe:9:5 + │ + 9 │ ╭ pub fn other_balance(self, ctx: Context, someone: address) -> u256 { +10 │ │ return ctx.balance_of(someone) +11 │ │ } + │ ╰─────^ attributes hash: 7590750053308816492 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "someone", + typ: Ok( + Base( + Address, + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ balances.fe:9:16 - │ -9 │ return ctx.balance_of(someone) - │ ^^^ ^^^^^^^ address: Value - │ │ - │ Context: Memory + ┌─ balances.fe:10:16 + │ +10 │ return ctx.balance_of(someone) + │ ^^^ ^^^^^^^ address: Value + │ │ + │ Context: Memory note: - ┌─ balances.fe:9:16 - │ -9 │ return ctx.balance_of(someone) - │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Value + ┌─ balances.fe:10:16 + │ +10 │ return ctx.balance_of(someone) + │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap index 6f1e7390b7..d81acf2de8 100644 --- a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap +++ b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ base_tuple.fe:2:5 │ -2 │ ╭ pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool): +2 │ ╭ pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool) { 3 │ │ return (my_num, my_bool) - │ ╰────────────────────────────────^ attributes hash: 10319049298189511667 +4 │ │ } + │ ╰─────^ attributes hash: 10319049298189511667 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap index c399574387..759256df5f 100644 --- a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap +++ b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap @@ -6,10 +6,11 @@ expression: snapshot note: ┌─ ingots/basic_ingot/src/main.fe:10:5 │ -10 │ ╭ pub fn get_my_baz() -> Baz: +10 │ ╭ pub fn get_my_baz() -> Baz { 11 │ │ assert file_items_work() 12 │ │ return Baz(my_bool: true, my_u256: 26) - │ ╰──────────────────────────────────────────────^ attributes hash: 12617626076609670469 +13 │ │ } + │ ╰─────^ attributes hash: 12617626076609670469 │ = FunctionSignature { self_decl: None, @@ -42,11 +43,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Baz: Memory note: - ┌─ ingots/basic_ingot/src/main.fe:14:5 + ┌─ ingots/basic_ingot/src/main.fe:15:5 │ -14 │ ╭ pub fn get_my_bing() -> Bong: -15 │ │ return Bong(my_address: address(42)) - │ ╰────────────────────────────────────────────^ attributes hash: 10335209349982667488 +15 │ ╭ pub fn get_my_bing() -> Bong { +16 │ │ return Bong(my_address: address(42)) +17 │ │ } + │ ╰─────^ attributes hash: 10335209349982667488 │ = FunctionSignature { self_decl: None, @@ -63,29 +65,30 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:15:41 + ┌─ ingots/basic_ingot/src/main.fe:16:41 │ -15 │ return Bong(my_address: address(42)) +16 │ return Bong(my_address: address(42)) │ ^^ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:15:33 + ┌─ ingots/basic_ingot/src/main.fe:16:33 │ -15 │ return Bong(my_address: address(42)) +16 │ return Bong(my_address: address(42)) │ ^^^^^^^^^^^ address: Value note: - ┌─ ingots/basic_ingot/src/main.fe:15:16 + ┌─ ingots/basic_ingot/src/main.fe:16:16 │ -15 │ return Bong(my_address: address(42)) +16 │ return Bong(my_address: address(42)) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bing: Memory note: - ┌─ ingots/basic_ingot/src/main.fe:17:5 + ┌─ ingots/basic_ingot/src/main.fe:19:5 │ -17 │ ╭ pub fn get_42() -> u256: -18 │ │ return get_42_backend() - │ ╰───────────────────────────────^ attributes hash: 6115314201970082834 +19 │ ╭ pub fn get_42() -> u256 { +20 │ │ return get_42_backend() +21 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -101,17 +104,18 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:18:16 + ┌─ ingots/basic_ingot/src/main.fe:20:16 │ -18 │ return get_42_backend() +20 │ return get_42_backend() │ ^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:20:5 + ┌─ ingots/basic_ingot/src/main.fe:23:5 │ -20 │ ╭ pub fn get_26() -> u256: -21 │ │ return std::evm::add(13, 13) - │ ╰────────────────────────────────────^ attributes hash: 6115314201970082834 +23 │ ╭ pub fn get_26() -> u256 { +24 │ │ return std::evm::add(13, 13) +25 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -127,26 +131,27 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:21:30 + ┌─ ingots/basic_ingot/src/main.fe:24:30 │ -21 │ return std::evm::add(13, 13) +24 │ return std::evm::add(13, 13) │ ^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:21:16 + ┌─ ingots/basic_ingot/src/main.fe:24:16 │ -21 │ return std::evm::add(13, 13) +24 │ return std::evm::add(13, 13) │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:23:5 + ┌─ ingots/basic_ingot/src/main.fe:27:5 │ -23 │ ╭ pub fn call_on_path(): -24 │ │ assert bar::mee::Mee::kawum() == 1 -25 │ │ assert bar::mee::Mee().rums() == 1 - │ ╰──────────────────────────────────────────^ attributes hash: 8319796915330632390 +27 │ ╭ pub fn call_on_path() { +28 │ │ assert bar::mee::Mee::kawum() == 1 +29 │ │ assert bar::mee::Mee().rums() == 1 +30 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -160,45 +165,42 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:24:16 + ┌─ ingots/basic_ingot/src/main.fe:28:16 │ -24 │ assert bar::mee::Mee::kawum() == 1 +28 │ assert bar::mee::Mee::kawum() == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:24:16 + ┌─ ingots/basic_ingot/src/main.fe:28:16 │ -24 │ assert bar::mee::Mee::kawum() == 1 +28 │ assert bar::mee::Mee::kawum() == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -25 │ assert bar::mee::Mee().rums() == 1 +29 │ assert bar::mee::Mee().rums() == 1 │ ^^^^^^^^^^^^^^^ Mee: Memory note: - ┌─ ingots/basic_ingot/src/main.fe:25:16 + ┌─ ingots/basic_ingot/src/main.fe:29:16 │ -25 │ assert bar::mee::Mee().rums() == 1 +29 │ assert bar::mee::Mee().rums() == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:25:16 + ┌─ ingots/basic_ingot/src/main.fe:29:16 │ -25 │ assert bar::mee::Mee().rums() == 1 +29 │ assert bar::mee::Mee().rums() == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ ingots/basic_ingot/src/main.fe:27:5 + ┌─ ingots/basic_ingot/src/main.fe:32:5 │ -27 │ ╭ pub fn get_my_dyng() -> dong::Dyng: -28 │ │ return dong::Dyng( -29 │ │ my_address: address(8), -30 │ │ my_u256: 42, -31 │ │ my_i8: -1 -32 │ │ ) - │ ╰─────────^ attributes hash: 13186223862505072309 +32 │ ╭ pub fn get_my_dyng() -> dong::Dyng { +33 │ │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) +34 │ │ } + │ ╰─────^ attributes hash: 13186223862505072309 │ = FunctionSignature { self_decl: None, @@ -215,45 +217,40 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:29:33 + ┌─ ingots/basic_ingot/src/main.fe:33:47 │ -29 │ my_address: address(8), - │ ^ u256: Value +33 │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) + │ ^ u256: Value note: - ┌─ ingots/basic_ingot/src/main.fe:29:25 + ┌─ ingots/basic_ingot/src/main.fe:33:39 │ -29 │ my_address: address(8), - │ ^^^^^^^^^^ address: Value -30 │ my_u256: 42, - │ ^^ u256: Value -31 │ my_i8: -1 - │ ^ u256: Value +33 │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) + │ ^^^^^^^^^^ ^^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ address: Value note: - ┌─ ingots/basic_ingot/src/main.fe:31:20 + ┌─ ingots/basic_ingot/src/main.fe:33:71 │ -31 │ my_i8: -1 - │ ^^ i8: Value +33 │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) + │ ^^ i8: Value note: - ┌─ ingots/basic_ingot/src/main.fe:28:16 - │ -28 │ return dong::Dyng( - │ ╭────────────────^ -29 │ │ my_address: address(8), -30 │ │ my_u256: 42, -31 │ │ my_i8: -1 -32 │ │ ) - │ ╰─────────^ Dyng: Memory + ┌─ ingots/basic_ingot/src/main.fe:33:16 + │ +33 │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Dyng: Memory note: - ┌─ ingots/basic_ingot/src/main.fe:34:5 + ┌─ ingots/basic_ingot/src/main.fe:36:5 │ -34 │ ╭ pub fn create_bing_contract(ctx: Context) -> u256: -35 │ │ let bing_contract: BingContract = BingContract.create(ctx, 0) -36 │ │ return bing_contract.add(40, 50) - │ ╰────────────────────────────────────────^ attributes hash: 10526263819290319263 +36 │ ╭ pub fn create_bing_contract(ctx: Context) -> u256 { +37 │ │ let bing_contract: BingContract = BingContract.create(ctx, 0) +38 │ │ return bing_contract.add(40, 50) +39 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -284,43 +281,44 @@ note: } note: - ┌─ ingots/basic_ingot/src/main.fe:35:28 + ┌─ ingots/basic_ingot/src/main.fe:37:28 │ -35 │ let bing_contract: BingContract = BingContract.create(ctx, 0) +37 │ let bing_contract: BingContract = BingContract.create(ctx, 0) │ ^^^^^^^^^^^^ BingContract note: - ┌─ ingots/basic_ingot/src/main.fe:35:63 + ┌─ ingots/basic_ingot/src/main.fe:37:63 │ -35 │ let bing_contract: BingContract = BingContract.create(ctx, 0) +37 │ let bing_contract: BingContract = BingContract.create(ctx, 0) │ ^^^ ^ u256: Value │ │ │ Context: Memory note: - ┌─ ingots/basic_ingot/src/main.fe:35:43 + ┌─ ingots/basic_ingot/src/main.fe:37:43 │ -35 │ let bing_contract: BingContract = BingContract.create(ctx, 0) +37 │ let bing_contract: BingContract = BingContract.create(ctx, 0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ BingContract: Value -36 │ return bing_contract.add(40, 50) +38 │ return bing_contract.add(40, 50) │ ^^^^^^^^^^^^^ ^^ ^^ u256: Value │ │ │ │ │ u256: Value │ BingContract: Value note: - ┌─ ingots/basic_ingot/src/main.fe:36:16 + ┌─ ingots/basic_ingot/src/main.fe:38:16 │ -36 │ return bing_contract.add(40, 50) +38 │ return bing_contract.add(40, 50) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ ingots/basic_ingot/src/bar.fe:2:1 + ┌─ ingots/basic_ingot/src/bar.fe:1:1 │ -2 │ ╭ pub fn file_items_work() -> bool: -3 │ │ return true - │ ╰─────────────^ attributes hash: 5583437014632790429 +1 │ ╭ pub fn file_items_work() -> bool { +2 │ │ return true +3 │ │ } + │ ╰─^ attributes hash: 5583437014632790429 │ = FunctionSignature { self_decl: None, @@ -334,10 +332,10 @@ note: } note: - ┌─ ingots/basic_ingot/src/bar.fe:3:10 + ┌─ ingots/basic_ingot/src/bar.fe:2:12 │ -3 │ return true - │ ^^^^ bool: Value +2 │ return true + │ ^^^^ bool: Value note: @@ -347,11 +345,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^ address note: - ┌─ ingots/basic_ingot/src/bing.fe:6:1 + ┌─ ingots/basic_ingot/src/bing.fe:7:1 │ -6 │ ╭ pub fn get_42_backend() -> u256: -7 │ │ return std::evm::add(21, 21) - │ ╰────────────────────────────────^ attributes hash: 6115314201970082834 +7 │ ╭ pub fn get_42_backend() -> u256 { +8 │ │ return std::evm::add(21, 21) +9 │ │ } + │ ╰─^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -367,25 +366,26 @@ note: } note: - ┌─ ingots/basic_ingot/src/bing.fe:7:26 + ┌─ ingots/basic_ingot/src/bing.fe:8:26 │ -7 │ return std::evm::add(21, 21) +8 │ return std::evm::add(21, 21) │ ^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ ingots/basic_ingot/src/bing.fe:7:12 + ┌─ ingots/basic_ingot/src/bing.fe:8:12 │ -7 │ return std::evm::add(21, 21) +8 │ return std::evm::add(21, 21) │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ ingots/basic_ingot/src/bing.fe:10:4 + ┌─ ingots/basic_ingot/src/bing.fe:12:5 │ -10 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256: -11 │ │ return x + y - │ ╰───────────────────^ attributes hash: 4448606202021980030 +12 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256 { +13 │ │ return x + y +14 │ │ } + │ ╰─────^ attributes hash: 4448606202021980030 │ = FunctionSignature { self_decl: None, @@ -428,18 +428,18 @@ note: } note: - ┌─ ingots/basic_ingot/src/bing.fe:11:15 + ┌─ ingots/basic_ingot/src/bing.fe:13:16 │ -11 │ return x + y - │ ^ ^ u256: Value - │ │ - │ u256: Value +13 │ return x + y + │ ^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ ingots/basic_ingot/src/bing.fe:11:15 + ┌─ ingots/basic_ingot/src/bing.fe:13:16 │ -11 │ return x + y - │ ^^^^^ u256: Value +13 │ return x + y + │ ^^^^^ u256: Value @@ -455,9 +455,10 @@ note: note: ┌─ ingots/basic_ingot/src/bar/mee.fe:2:5 │ -2 │ ╭ pub fn kawum() -> u256: +2 │ ╭ pub fn kawum() -> u256 { 3 │ │ return 1 - │ ╰────────────────^ attributes hash: 6115314201970082834 +4 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -479,11 +480,12 @@ note: │ ^ u256: Value note: - ┌─ ingots/basic_ingot/src/bar/mee.fe:5:5 + ┌─ ingots/basic_ingot/src/bar/mee.fe:6:5 │ -5 │ ╭ pub fn rums(self) -> u256: -6 │ │ return 1 - │ ╰────────────────^ attributes hash: 11773348765973600208 +6 │ ╭ pub fn rums(self) -> u256 { +7 │ │ return 1 +8 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -501,9 +503,9 @@ note: } note: - ┌─ ingots/basic_ingot/src/bar/mee.fe:6:16 + ┌─ ingots/basic_ingot/src/bar/mee.fe:7:16 │ -6 │ return 1 +7 │ return 1 │ ^ u256: Value @@ -515,52 +517,53 @@ note: note: - ┌─ ingots/basic_ingot/src/ding/dong.fe:4:3 + ┌─ ingots/basic_ingot/src/ding/dong.fe:4:5 │ -4 │ pub my_address: address - │ ^^^^^^^^^^^^^^^^^^^^^^^ address -5 │ pub my_u256: u256 - │ ^^^^^^^^^^^^^^^^^ u256 -6 │ pub my_i8: i8 - │ ^^^^^^^^^^^^^ i8 +4 │ pub my_address: address + │ ^^^^^^^^^^^^^^^^^^^^^^^ address +5 │ pub my_u256: u256 + │ ^^^^^^^^^^^^^^^^^ u256 +6 │ pub my_i8: i8 + │ ^^^^^^^^^^^^^ i8 note: - ┌─ ingots/basic_ingot/src/ding/dong.fe:8:1 - │ -8 │ ╭ fn get_bing() -> Bing: -9 │ │ return Bing(my_address: address(0)) - │ ╰───────────────────────────────────────^ attributes hash: 10335209349982667488 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Struct( - Struct { - name: "Bing", - field_count: 1, - }, - ), - ), - } + ┌─ ingots/basic_ingot/src/ding/dong.fe:9:1 + │ + 9 │ ╭ fn get_bing() -> Bing { +10 │ │ return Bing(my_address: address(0)) +11 │ │ } + │ ╰─^ attributes hash: 10335209349982667488 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Struct( + Struct { + name: "Bing", + field_count: 1, + }, + ), + ), + } note: - ┌─ ingots/basic_ingot/src/ding/dong.fe:9:37 - │ -9 │ return Bing(my_address: address(0)) - │ ^ u256: Value + ┌─ ingots/basic_ingot/src/ding/dong.fe:10:37 + │ +10 │ return Bing(my_address: address(0)) + │ ^ u256: Value note: - ┌─ ingots/basic_ingot/src/ding/dong.fe:9:29 - │ -9 │ return Bing(my_address: address(0)) - │ ^^^^^^^^^^ address: Value + ┌─ ingots/basic_ingot/src/ding/dong.fe:10:29 + │ +10 │ return Bing(my_address: address(0)) + │ ^^^^^^^^^^ address: Value note: - ┌─ ingots/basic_ingot/src/ding/dong.fe:9:12 - │ -9 │ return Bing(my_address: address(0)) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bing: Memory + ┌─ ingots/basic_ingot/src/ding/dong.fe:10:12 + │ +10 │ return Bing(my_address: address(0)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bing: Memory diff --git a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap index 9c9b2ce6ae..6315e99df2 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap @@ -12,9 +12,10 @@ note: note: ┌─ call_statement_with_args.fe:4:5 │ -4 │ ╭ fn assign(self, _ val: u256): +4 │ ╭ fn assign(self, _ val: u256) { 5 │ │ self.baz[0] = val - │ ╰─────────────────────────^ attributes hash: 15254234582808678866 +6 │ │ } + │ ╰─────^ attributes hash: 15254234582808678866 │ = FunctionSignature { self_decl: Some( @@ -66,56 +67,57 @@ note: │ u256: Storage { nonce: None } note: - ┌─ call_statement_with_args.fe:7:5 - │ -7 │ ╭ pub fn bar(self) -> u256: -8 │ │ self.assign(100) -9 │ │ return self.baz[0] - │ ╰──────────────────────────^ attributes hash: 11773348765973600208 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ call_statement_with_args.fe:8:5 + │ + 8 │ ╭ pub fn bar(self) -> u256 { + 9 │ │ self.assign(100) +10 │ │ return self.baz[0] +11 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ call_statement_with_args.fe:8:9 + ┌─ call_statement_with_args.fe:9:9 │ -8 │ self.assign(100) +9 │ self.assign(100) │ ^^^^ ^^^ u256: Value │ │ │ Foo: Value note: - ┌─ call_statement_with_args.fe:8:9 - │ -8 │ self.assign(100) - │ ^^^^^^^^^^^^^^^^ (): Value -9 │ return self.baz[0] - │ ^^^^ Foo: Value + ┌─ call_statement_with_args.fe:9:9 + │ + 9 │ self.assign(100) + │ ^^^^^^^^^^^^^^^^ (): Value +10 │ return self.baz[0] + │ ^^^^ Foo: Value note: - ┌─ call_statement_with_args.fe:9:16 - │ -9 │ return self.baz[0] - │ ^^^^^^^^ ^ u256: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ call_statement_with_args.fe:10:16 + │ +10 │ return self.baz[0] + │ ^^^^^^^^ ^ u256: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ call_statement_with_args.fe:9:16 - │ -9 │ return self.baz[0] - │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value + ┌─ call_statement_with_args.fe:10:16 + │ +10 │ return self.baz[0] + │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap index e1c41eb08a..5735079ec7 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args_2.snap @@ -12,10 +12,11 @@ note: note: ┌─ call_statement_with_args_2.fe:4:5 │ -4 │ ╭ fn assign(self, _ val: u256) -> u256: +4 │ ╭ fn assign(self, _ val: u256) -> u256 { 5 │ │ self.baz[0] = val 6 │ │ return val - │ ╰──────────────────^ attributes hash: 11102768331449211201 +7 │ │ } + │ ╰─────^ attributes hash: 11102768331449211201 │ = FunctionSignature { self_decl: Some( @@ -71,12 +72,13 @@ note: │ ^^^ u256: Value note: - ┌─ call_statement_with_args_2.fe:8:5 + ┌─ call_statement_with_args_2.fe:9:5 │ - 8 │ ╭ pub fn bar(self) -> u256: - 9 │ │ self.assign(100) -10 │ │ return self.baz[0] - │ ╰──────────────────────────^ attributes hash: 11773348765973600208 + 9 │ ╭ pub fn bar(self) -> u256 { +10 │ │ self.assign(100) +11 │ │ return self.baz[0] +12 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -94,33 +96,33 @@ note: } note: - ┌─ call_statement_with_args_2.fe:9:9 - │ -9 │ self.assign(100) - │ ^^^^ ^^^ u256: Value - │ │ - │ Foo: Value + ┌─ call_statement_with_args_2.fe:10:9 + │ +10 │ self.assign(100) + │ ^^^^ ^^^ u256: Value + │ │ + │ Foo: Value note: - ┌─ call_statement_with_args_2.fe:9:9 + ┌─ call_statement_with_args_2.fe:10:9 │ - 9 │ self.assign(100) +10 │ self.assign(100) │ ^^^^^^^^^^^^^^^^ u256: Value -10 │ return self.baz[0] +11 │ return self.baz[0] │ ^^^^ Foo: Value note: - ┌─ call_statement_with_args_2.fe:10:16 + ┌─ call_statement_with_args_2.fe:11:16 │ -10 │ return self.baz[0] +11 │ return self.baz[0] │ ^^^^^^^^ ^ u256: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ call_statement_with_args_2.fe:10:16 + ┌─ call_statement_with_args_2.fe:11:16 │ -10 │ return self.baz[0] +11 │ return self.baz[0] │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap b/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap index 249d88acef..ac178ec864 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap @@ -12,9 +12,10 @@ note: note: ┌─ call_statement_without_args.fe:4:5 │ -4 │ ╭ fn assign(self): +4 │ ╭ fn assign(self) { 5 │ │ self.baz[0] = 100 - │ ╰─────────────────────────^ attributes hash: 18235041182630809162 +6 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -52,54 +53,55 @@ note: │ u256: Storage { nonce: None } note: - ┌─ call_statement_without_args.fe:7:5 - │ -7 │ ╭ pub fn bar(self) -> u256: -8 │ │ self.assign() -9 │ │ return self.baz[0] - │ ╰──────────────────────────^ attributes hash: 11773348765973600208 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ call_statement_without_args.fe:8:5 + │ + 8 │ ╭ pub fn bar(self) -> u256 { + 9 │ │ self.assign() +10 │ │ return self.baz[0] +11 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ call_statement_without_args.fe:8:9 + ┌─ call_statement_without_args.fe:9:9 │ -8 │ self.assign() +9 │ self.assign() │ ^^^^ Foo: Value note: - ┌─ call_statement_without_args.fe:8:9 - │ -8 │ self.assign() - │ ^^^^^^^^^^^^^ (): Value -9 │ return self.baz[0] - │ ^^^^ Foo: Value + ┌─ call_statement_without_args.fe:9:9 + │ + 9 │ self.assign() + │ ^^^^^^^^^^^^^ (): Value +10 │ return self.baz[0] + │ ^^^^ Foo: Value note: - ┌─ call_statement_without_args.fe:9:16 - │ -9 │ return self.baz[0] - │ ^^^^^^^^ ^ u256: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ call_statement_without_args.fe:10:16 + │ +10 │ return self.baz[0] + │ ^^^^^^^^ ^ u256: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ call_statement_without_args.fe:9:16 - │ -9 │ return self.baz[0] - │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value + ┌─ call_statement_without_args.fe:10:16 + │ +10 │ return self.baz[0] + │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap index 1d14519585..6ddf7ea3ad 100644 --- a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap +++ b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ checked_arithmetic.fe:3:5 + ┌─ checked_arithmetic.fe:2:5 │ -3 │ ╭ pub fn add_u256(left: u256, right: u256) -> u256: -4 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 8877497213208027149 +2 │ ╭ pub fn add_u256(left: u256, right: u256) -> u256 { +3 │ │ return left + right +4 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, @@ -47,25 +48,26 @@ note: } note: - ┌─ checked_arithmetic.fe:4:16 + ┌─ checked_arithmetic.fe:3:16 │ -4 │ return left + right +3 │ return left + right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:4:16 + ┌─ checked_arithmetic.fe:3:16 │ -4 │ return left + right +3 │ return left + right │ ^^^^^^^^^^^^ u256: Value note: ┌─ checked_arithmetic.fe:6:5 │ -6 │ ╭ pub fn add_u128(left: u128, right: u128) -> u128: +6 │ ╭ pub fn add_u128(left: u128, right: u128) -> u128 { 7 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 11187416061572591496 +8 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, @@ -118,11 +120,12 @@ note: │ ^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:9:5 + ┌─ checked_arithmetic.fe:10:5 │ - 9 │ ╭ pub fn add_u64(left: u64, right: u64) -> u64: -10 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 9316585824156398552 +10 │ ╭ pub fn add_u64(left: u64, right: u64) -> u64 { +11 │ │ return left + right +12 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, @@ -161,25 +164,26 @@ note: } note: - ┌─ checked_arithmetic.fe:10:16 + ┌─ checked_arithmetic.fe:11:16 │ -10 │ return left + right +11 │ return left + right │ ^^^^ ^^^^^ u64: Value │ │ │ u64: Value note: - ┌─ checked_arithmetic.fe:10:16 + ┌─ checked_arithmetic.fe:11:16 │ -10 │ return left + right +11 │ return left + right │ ^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:12:5 + ┌─ checked_arithmetic.fe:14:5 │ -12 │ ╭ pub fn add_u32(left: u32, right: u32) -> u32: -13 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 6948562809403003686 +14 │ ╭ pub fn add_u32(left: u32, right: u32) -> u32 { +15 │ │ return left + right +16 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, @@ -218,25 +222,26 @@ note: } note: - ┌─ checked_arithmetic.fe:13:16 + ┌─ checked_arithmetic.fe:15:16 │ -13 │ return left + right +15 │ return left + right │ ^^^^ ^^^^^ u32: Value │ │ │ u32: Value note: - ┌─ checked_arithmetic.fe:13:16 + ┌─ checked_arithmetic.fe:15:16 │ -13 │ return left + right +15 │ return left + right │ ^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:15:5 + ┌─ checked_arithmetic.fe:18:5 │ -15 │ ╭ pub fn add_u16(left: u16, right: u16) -> u16: -16 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 4214429573900255413 +18 │ ╭ pub fn add_u16(left: u16, right: u16) -> u16 { +19 │ │ return left + right +20 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, @@ -275,25 +280,26 @@ note: } note: - ┌─ checked_arithmetic.fe:16:16 + ┌─ checked_arithmetic.fe:19:16 │ -16 │ return left + right +19 │ return left + right │ ^^^^ ^^^^^ u16: Value │ │ │ u16: Value note: - ┌─ checked_arithmetic.fe:16:16 + ┌─ checked_arithmetic.fe:19:16 │ -16 │ return left + right +19 │ return left + right │ ^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:18:5 + ┌─ checked_arithmetic.fe:22:5 │ -18 │ ╭ pub fn add_u8(left: u8, right: u8) -> u8: -19 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 3749617961046563034 +22 │ ╭ pub fn add_u8(left: u8, right: u8) -> u8 { +23 │ │ return left + right +24 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, @@ -332,25 +338,26 @@ note: } note: - ┌─ checked_arithmetic.fe:19:16 + ┌─ checked_arithmetic.fe:23:16 │ -19 │ return left + right +23 │ return left + right │ ^^^^ ^^^^^ u8: Value │ │ │ u8: Value note: - ┌─ checked_arithmetic.fe:19:16 + ┌─ checked_arithmetic.fe:23:16 │ -19 │ return left + right +23 │ return left + right │ ^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:21:5 + ┌─ checked_arithmetic.fe:26:5 │ -21 │ ╭ pub fn add_i256(left: i256, right: i256) -> i256: -22 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 17908204859155721295 +26 │ ╭ pub fn add_i256(left: i256, right: i256) -> i256 { +27 │ │ return left + right +28 │ │ } + │ ╰─────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, @@ -389,25 +396,26 @@ note: } note: - ┌─ checked_arithmetic.fe:22:16 + ┌─ checked_arithmetic.fe:27:16 │ -22 │ return left + right +27 │ return left + right │ ^^^^ ^^^^^ i256: Value │ │ │ i256: Value note: - ┌─ checked_arithmetic.fe:22:16 + ┌─ checked_arithmetic.fe:27:16 │ -22 │ return left + right +27 │ return left + right │ ^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:24:5 + ┌─ checked_arithmetic.fe:30:5 │ -24 │ ╭ pub fn add_i128(left: i128, right: i128) -> i128: -25 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 1332431709112937827 +30 │ ╭ pub fn add_i128(left: i128, right: i128) -> i128 { +31 │ │ return left + right +32 │ │ } + │ ╰─────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, @@ -446,25 +454,26 @@ note: } note: - ┌─ checked_arithmetic.fe:25:16 + ┌─ checked_arithmetic.fe:31:16 │ -25 │ return left + right +31 │ return left + right │ ^^^^ ^^^^^ i128: Value │ │ │ i128: Value note: - ┌─ checked_arithmetic.fe:25:16 + ┌─ checked_arithmetic.fe:31:16 │ -25 │ return left + right +31 │ return left + right │ ^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:27:5 + ┌─ checked_arithmetic.fe:34:5 │ -27 │ ╭ pub fn add_i64(left: i64, right: i64) -> i64: -28 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 3549113083347694903 +34 │ ╭ pub fn add_i64(left: i64, right: i64) -> i64 { +35 │ │ return left + right +36 │ │ } + │ ╰─────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, @@ -503,25 +512,26 @@ note: } note: - ┌─ checked_arithmetic.fe:28:16 + ┌─ checked_arithmetic.fe:35:16 │ -28 │ return left + right +35 │ return left + right │ ^^^^ ^^^^^ i64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:28:16 + ┌─ checked_arithmetic.fe:35:16 │ -28 │ return left + right +35 │ return left + right │ ^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:30:5 + ┌─ checked_arithmetic.fe:38:5 │ -30 │ ╭ pub fn add_i32(left: i32, right: i32) -> i32: -31 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 15117649447142800500 +38 │ ╭ pub fn add_i32(left: i32, right: i32) -> i32 { +39 │ │ return left + right +40 │ │ } + │ ╰─────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, @@ -560,25 +570,26 @@ note: } note: - ┌─ checked_arithmetic.fe:31:16 + ┌─ checked_arithmetic.fe:39:16 │ -31 │ return left + right +39 │ return left + right │ ^^^^ ^^^^^ i32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:31:16 + ┌─ checked_arithmetic.fe:39:16 │ -31 │ return left + right +39 │ return left + right │ ^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:33:5 + ┌─ checked_arithmetic.fe:42:5 │ -33 │ ╭ pub fn add_i16(left: i16, right: i16) -> i16: -34 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 16520261699954225452 +42 │ ╭ pub fn add_i16(left: i16, right: i16) -> i16 { +43 │ │ return left + right +44 │ │ } + │ ╰─────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, @@ -617,25 +628,26 @@ note: } note: - ┌─ checked_arithmetic.fe:34:16 + ┌─ checked_arithmetic.fe:43:16 │ -34 │ return left + right +43 │ return left + right │ ^^^^ ^^^^^ i16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:34:16 + ┌─ checked_arithmetic.fe:43:16 │ -34 │ return left + right +43 │ return left + right │ ^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:36:5 + ┌─ checked_arithmetic.fe:46:5 │ -36 │ ╭ pub fn add_i8(left: i8, right: i8) -> i8: -37 │ │ return left + right - │ ╰───────────────────────────^ attributes hash: 2984879578165475690 +46 │ ╭ pub fn add_i8(left: i8, right: i8) -> i8 { +47 │ │ return left + right +48 │ │ } + │ ╰─────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, @@ -674,25 +686,26 @@ note: } note: - ┌─ checked_arithmetic.fe:37:16 + ┌─ checked_arithmetic.fe:47:16 │ -37 │ return left + right +47 │ return left + right │ ^^^^ ^^^^^ i8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:37:16 + ┌─ checked_arithmetic.fe:47:16 │ -37 │ return left + right +47 │ return left + right │ ^^^^^^^^^^^^ i8: Value note: - ┌─ checked_arithmetic.fe:39:5 + ┌─ checked_arithmetic.fe:50:5 │ -39 │ ╭ pub fn sub_u256(left: u256, right: u256) -> u256: -40 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 8877497213208027149 +50 │ ╭ pub fn sub_u256(left: u256, right: u256) -> u256 { +51 │ │ return left - right +52 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, @@ -731,25 +744,26 @@ note: } note: - ┌─ checked_arithmetic.fe:40:16 + ┌─ checked_arithmetic.fe:51:16 │ -40 │ return left - right +51 │ return left - right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:40:16 + ┌─ checked_arithmetic.fe:51:16 │ -40 │ return left - right +51 │ return left - right │ ^^^^^^^^^^^^ u256: Value note: - ┌─ checked_arithmetic.fe:42:5 + ┌─ checked_arithmetic.fe:54:5 │ -42 │ ╭ pub fn sub_u128(left: u128, right: u128) -> u128: -43 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 11187416061572591496 +54 │ ╭ pub fn sub_u128(left: u128, right: u128) -> u128 { +55 │ │ return left - right +56 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, @@ -788,25 +802,26 @@ note: } note: - ┌─ checked_arithmetic.fe:43:16 + ┌─ checked_arithmetic.fe:55:16 │ -43 │ return left - right +55 │ return left - right │ ^^^^ ^^^^^ u128: Value │ │ │ u128: Value note: - ┌─ checked_arithmetic.fe:43:16 + ┌─ checked_arithmetic.fe:55:16 │ -43 │ return left - right +55 │ return left - right │ ^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:45:5 + ┌─ checked_arithmetic.fe:58:5 │ -45 │ ╭ pub fn sub_u64(left: u64, right: u64) -> u64: -46 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 9316585824156398552 +58 │ ╭ pub fn sub_u64(left: u64, right: u64) -> u64 { +59 │ │ return left - right +60 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, @@ -845,25 +860,26 @@ note: } note: - ┌─ checked_arithmetic.fe:46:16 + ┌─ checked_arithmetic.fe:59:16 │ -46 │ return left - right +59 │ return left - right │ ^^^^ ^^^^^ u64: Value │ │ │ u64: Value note: - ┌─ checked_arithmetic.fe:46:16 + ┌─ checked_arithmetic.fe:59:16 │ -46 │ return left - right +59 │ return left - right │ ^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:48:5 + ┌─ checked_arithmetic.fe:62:5 │ -48 │ ╭ pub fn sub_u32(left: u32, right: u32) -> u32: -49 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 6948562809403003686 +62 │ ╭ pub fn sub_u32(left: u32, right: u32) -> u32 { +63 │ │ return left - right +64 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, @@ -902,25 +918,26 @@ note: } note: - ┌─ checked_arithmetic.fe:49:16 + ┌─ checked_arithmetic.fe:63:16 │ -49 │ return left - right +63 │ return left - right │ ^^^^ ^^^^^ u32: Value │ │ │ u32: Value note: - ┌─ checked_arithmetic.fe:49:16 + ┌─ checked_arithmetic.fe:63:16 │ -49 │ return left - right +63 │ return left - right │ ^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:51:5 + ┌─ checked_arithmetic.fe:66:5 │ -51 │ ╭ pub fn sub_u16(left: u16, right: u16) -> u16: -52 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 4214429573900255413 +66 │ ╭ pub fn sub_u16(left: u16, right: u16) -> u16 { +67 │ │ return left - right +68 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, @@ -959,25 +976,26 @@ note: } note: - ┌─ checked_arithmetic.fe:52:16 + ┌─ checked_arithmetic.fe:67:16 │ -52 │ return left - right +67 │ return left - right │ ^^^^ ^^^^^ u16: Value │ │ │ u16: Value note: - ┌─ checked_arithmetic.fe:52:16 + ┌─ checked_arithmetic.fe:67:16 │ -52 │ return left - right +67 │ return left - right │ ^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:54:5 + ┌─ checked_arithmetic.fe:70:5 │ -54 │ ╭ pub fn sub_u8(left: u8, right: u8) -> u8: -55 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 3749617961046563034 +70 │ ╭ pub fn sub_u8(left: u8, right: u8) -> u8 { +71 │ │ return left - right +72 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, @@ -1016,25 +1034,26 @@ note: } note: - ┌─ checked_arithmetic.fe:55:16 + ┌─ checked_arithmetic.fe:71:16 │ -55 │ return left - right +71 │ return left - right │ ^^^^ ^^^^^ u8: Value │ │ │ u8: Value note: - ┌─ checked_arithmetic.fe:55:16 + ┌─ checked_arithmetic.fe:71:16 │ -55 │ return left - right +71 │ return left - right │ ^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:57:5 + ┌─ checked_arithmetic.fe:74:5 │ -57 │ ╭ pub fn sub_i256(left: i256, right: i256) -> i256: -58 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 17908204859155721295 +74 │ ╭ pub fn sub_i256(left: i256, right: i256) -> i256 { +75 │ │ return left - right +76 │ │ } + │ ╰─────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, @@ -1073,25 +1092,26 @@ note: } note: - ┌─ checked_arithmetic.fe:58:16 + ┌─ checked_arithmetic.fe:75:16 │ -58 │ return left - right +75 │ return left - right │ ^^^^ ^^^^^ i256: Value │ │ │ i256: Value note: - ┌─ checked_arithmetic.fe:58:16 + ┌─ checked_arithmetic.fe:75:16 │ -58 │ return left - right +75 │ return left - right │ ^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:60:5 + ┌─ checked_arithmetic.fe:78:5 │ -60 │ ╭ pub fn sub_i128(left: i128, right: i128) -> i128: -61 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 1332431709112937827 +78 │ ╭ pub fn sub_i128(left: i128, right: i128) -> i128 { +79 │ │ return left - right +80 │ │ } + │ ╰─────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, @@ -1130,25 +1150,26 @@ note: } note: - ┌─ checked_arithmetic.fe:61:16 + ┌─ checked_arithmetic.fe:79:16 │ -61 │ return left - right +79 │ return left - right │ ^^^^ ^^^^^ i128: Value │ │ │ i128: Value note: - ┌─ checked_arithmetic.fe:61:16 + ┌─ checked_arithmetic.fe:79:16 │ -61 │ return left - right +79 │ return left - right │ ^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:63:5 + ┌─ checked_arithmetic.fe:82:5 │ -63 │ ╭ pub fn sub_i64(left: i64, right: i64) -> i64: -64 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 3549113083347694903 +82 │ ╭ pub fn sub_i64(left: i64, right: i64) -> i64 { +83 │ │ return left - right +84 │ │ } + │ ╰─────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, @@ -1187,25 +1208,26 @@ note: } note: - ┌─ checked_arithmetic.fe:64:16 + ┌─ checked_arithmetic.fe:83:16 │ -64 │ return left - right +83 │ return left - right │ ^^^^ ^^^^^ i64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:64:16 + ┌─ checked_arithmetic.fe:83:16 │ -64 │ return left - right +83 │ return left - right │ ^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:66:5 + ┌─ checked_arithmetic.fe:86:5 │ -66 │ ╭ pub fn sub_i32(left: i32, right: i32) -> i32: -67 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 15117649447142800500 +86 │ ╭ pub fn sub_i32(left: i32, right: i32) -> i32 { +87 │ │ return left - right +88 │ │ } + │ ╰─────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, @@ -1244,25 +1266,26 @@ note: } note: - ┌─ checked_arithmetic.fe:67:16 + ┌─ checked_arithmetic.fe:87:16 │ -67 │ return left - right +87 │ return left - right │ ^^^^ ^^^^^ i32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:67:16 + ┌─ checked_arithmetic.fe:87:16 │ -67 │ return left - right +87 │ return left - right │ ^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:69:5 + ┌─ checked_arithmetic.fe:90:5 │ -69 │ ╭ pub fn sub_i16(left: i16, right: i16) -> i16: -70 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 16520261699954225452 +90 │ ╭ pub fn sub_i16(left: i16, right: i16) -> i16 { +91 │ │ return left - right +92 │ │ } + │ ╰─────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, @@ -1301,25 +1324,26 @@ note: } note: - ┌─ checked_arithmetic.fe:70:16 + ┌─ checked_arithmetic.fe:91:16 │ -70 │ return left - right +91 │ return left - right │ ^^^^ ^^^^^ i16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:70:16 + ┌─ checked_arithmetic.fe:91:16 │ -70 │ return left - right +91 │ return left - right │ ^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:72:5 + ┌─ checked_arithmetic.fe:94:5 │ -72 │ ╭ pub fn sub_i8(left: i8, right: i8) -> i8: -73 │ │ return left - right - │ ╰───────────────────────────^ attributes hash: 2984879578165475690 +94 │ ╭ pub fn sub_i8(left: i8, right: i8) -> i8 { +95 │ │ return left - right +96 │ │ } + │ ╰─────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, @@ -1358,481 +1382,490 @@ note: } note: - ┌─ checked_arithmetic.fe:73:16 + ┌─ checked_arithmetic.fe:95:16 │ -73 │ return left - right +95 │ return left - right │ ^^^^ ^^^^^ i8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:73:16 + ┌─ checked_arithmetic.fe:95:16 │ -73 │ return left - right +95 │ return left - right │ ^^^^^^^^^^^^ i8: Value note: - ┌─ checked_arithmetic.fe:75:5 - │ -75 │ ╭ pub fn div_u256(left: u256, right: u256) -> u256: -76 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 8877497213208027149 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:98:5 + │ + 98 │ ╭ pub fn div_u256(left: u256, right: u256) -> u256 { + 99 │ │ return left / right +100 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:76:16 + ┌─ checked_arithmetic.fe:99:16 │ -76 │ return left / right +99 │ return left / right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:76:16 + ┌─ checked_arithmetic.fe:99:16 │ -76 │ return left / right +99 │ return left / right │ ^^^^^^^^^^^^ u256: Value note: - ┌─ checked_arithmetic.fe:78:5 - │ -78 │ ╭ pub fn div_u128(left: u128, right: u128) -> u128: -79 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 11187416061572591496 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U128, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U128, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U128, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:102:5 + │ +102 │ ╭ pub fn div_u128(left: u128, right: u128) -> u128 { +103 │ │ return left / right +104 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U128, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U128, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U128, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:79:16 - │ -79 │ return left / right - │ ^^^^ ^^^^^ u128: Value - │ │ - │ u128: Value + ┌─ checked_arithmetic.fe:103:16 + │ +103 │ return left / right + │ ^^^^ ^^^^^ u128: Value + │ │ + │ u128: Value note: - ┌─ checked_arithmetic.fe:79:16 - │ -79 │ return left / right - │ ^^^^^^^^^^^^ u128: Value + ┌─ checked_arithmetic.fe:103:16 + │ +103 │ return left / right + │ ^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:81:5 - │ -81 │ ╭ pub fn div_u64(left: u64, right: u64) -> u64: -82 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 9316585824156398552 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U64, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U64, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U64, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:106:5 + │ +106 │ ╭ pub fn div_u64(left: u64, right: u64) -> u64 { +107 │ │ return left / right +108 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U64, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U64, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U64, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:82:16 - │ -82 │ return left / right - │ ^^^^ ^^^^^ u64: Value - │ │ - │ u64: Value + ┌─ checked_arithmetic.fe:107:16 + │ +107 │ return left / right + │ ^^^^ ^^^^^ u64: Value + │ │ + │ u64: Value note: - ┌─ checked_arithmetic.fe:82:16 - │ -82 │ return left / right - │ ^^^^^^^^^^^^ u64: Value + ┌─ checked_arithmetic.fe:107:16 + │ +107 │ return left / right + │ ^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:84:5 - │ -84 │ ╭ pub fn div_u32(left: u32, right: u32) -> u32: -85 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 6948562809403003686 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U32, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U32, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U32, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:110:5 + │ +110 │ ╭ pub fn div_u32(left: u32, right: u32) -> u32 { +111 │ │ return left / right +112 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U32, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U32, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U32, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:85:16 - │ -85 │ return left / right - │ ^^^^ ^^^^^ u32: Value - │ │ - │ u32: Value + ┌─ checked_arithmetic.fe:111:16 + │ +111 │ return left / right + │ ^^^^ ^^^^^ u32: Value + │ │ + │ u32: Value note: - ┌─ checked_arithmetic.fe:85:16 - │ -85 │ return left / right - │ ^^^^^^^^^^^^ u32: Value + ┌─ checked_arithmetic.fe:111:16 + │ +111 │ return left / right + │ ^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:87:5 - │ -87 │ ╭ pub fn div_u16(left: u16, right: u16) -> u16: -88 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 4214429573900255413 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U16, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U16, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U16, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:114:5 + │ +114 │ ╭ pub fn div_u16(left: u16, right: u16) -> u16 { +115 │ │ return left / right +116 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U16, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U16, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U16, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:88:16 - │ -88 │ return left / right - │ ^^^^ ^^^^^ u16: Value - │ │ - │ u16: Value + ┌─ checked_arithmetic.fe:115:16 + │ +115 │ return left / right + │ ^^^^ ^^^^^ u16: Value + │ │ + │ u16: Value note: - ┌─ checked_arithmetic.fe:88:16 - │ -88 │ return left / right - │ ^^^^^^^^^^^^ u16: Value + ┌─ checked_arithmetic.fe:115:16 + │ +115 │ return left / right + │ ^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:90:5 - │ -90 │ ╭ pub fn div_u8(left: u8, right: u8) -> u8: -91 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 3749617961046563034 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - U8, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - U8, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - U8, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:118:5 + │ +118 │ ╭ pub fn div_u8(left: u8, right: u8) -> u8 { +119 │ │ return left / right +120 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + U8, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + U8, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + U8, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:91:16 - │ -91 │ return left / right - │ ^^^^ ^^^^^ u8: Value - │ │ - │ u8: Value + ┌─ checked_arithmetic.fe:119:16 + │ +119 │ return left / right + │ ^^^^ ^^^^^ u8: Value + │ │ + │ u8: Value note: - ┌─ checked_arithmetic.fe:91:16 - │ -91 │ return left / right - │ ^^^^^^^^^^^^ u8: Value + ┌─ checked_arithmetic.fe:119:16 + │ +119 │ return left / right + │ ^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:93:5 - │ -93 │ ╭ pub fn div_i256(left: i256, right: i256) -> i256: -94 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 17908204859155721295 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - I256, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - I256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - I256, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:122:5 + │ +122 │ ╭ pub fn div_i256(left: i256, right: i256) -> i256 { +123 │ │ return left / right +124 │ │ } + │ ╰─────^ attributes hash: 17908204859155721295 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + I256, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + I256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + I256, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:94:16 - │ -94 │ return left / right - │ ^^^^ ^^^^^ i256: Value - │ │ - │ i256: Value + ┌─ checked_arithmetic.fe:123:16 + │ +123 │ return left / right + │ ^^^^ ^^^^^ i256: Value + │ │ + │ i256: Value note: - ┌─ checked_arithmetic.fe:94:16 - │ -94 │ return left / right - │ ^^^^^^^^^^^^ i256: Value + ┌─ checked_arithmetic.fe:123:16 + │ +123 │ return left / right + │ ^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:96:5 - │ -96 │ ╭ pub fn div_i128(left: i128, right: i128) -> i128: -97 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 1332431709112937827 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "left", - typ: Ok( - Base( - Numeric( - I128, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "right", - typ: Ok( - Base( - Numeric( - I128, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Numeric( - I128, - ), - ), - ), - } + ┌─ checked_arithmetic.fe:126:5 + │ +126 │ ╭ pub fn div_i128(left: i128, right: i128) -> i128 { +127 │ │ return left / right +128 │ │ } + │ ╰─────^ attributes hash: 1332431709112937827 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "left", + typ: Ok( + Base( + Numeric( + I128, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "right", + typ: Ok( + Base( + Numeric( + I128, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Numeric( + I128, + ), + ), + ), + } note: - ┌─ checked_arithmetic.fe:97:16 - │ -97 │ return left / right - │ ^^^^ ^^^^^ i128: Value - │ │ - │ i128: Value + ┌─ checked_arithmetic.fe:127:16 + │ +127 │ return left / right + │ ^^^^ ^^^^^ i128: Value + │ │ + │ i128: Value note: - ┌─ checked_arithmetic.fe:97:16 - │ -97 │ return left / right - │ ^^^^^^^^^^^^ i128: Value + ┌─ checked_arithmetic.fe:127:16 + │ +127 │ return left / right + │ ^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:99:5 + ┌─ checked_arithmetic.fe:130:5 │ - 99 │ ╭ pub fn div_i64(left: i64, right: i64) -> i64: -100 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 3549113083347694903 +130 │ ╭ pub fn div_i64(left: i64, right: i64) -> i64 { +131 │ │ return left / right +132 │ │ } + │ ╰─────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, @@ -1871,25 +1904,26 @@ note: } note: - ┌─ checked_arithmetic.fe:100:16 + ┌─ checked_arithmetic.fe:131:16 │ -100 │ return left / right +131 │ return left / right │ ^^^^ ^^^^^ i64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:100:16 + ┌─ checked_arithmetic.fe:131:16 │ -100 │ return left / right +131 │ return left / right │ ^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:102:5 + ┌─ checked_arithmetic.fe:134:5 │ -102 │ ╭ pub fn div_i32(left: i32, right: i32) -> i32: -103 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 15117649447142800500 +134 │ ╭ pub fn div_i32(left: i32, right: i32) -> i32 { +135 │ │ return left / right +136 │ │ } + │ ╰─────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, @@ -1928,25 +1962,26 @@ note: } note: - ┌─ checked_arithmetic.fe:103:16 + ┌─ checked_arithmetic.fe:135:16 │ -103 │ return left / right +135 │ return left / right │ ^^^^ ^^^^^ i32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:103:16 + ┌─ checked_arithmetic.fe:135:16 │ -103 │ return left / right +135 │ return left / right │ ^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:105:5 + ┌─ checked_arithmetic.fe:138:5 │ -105 │ ╭ pub fn div_i16(left: i16, right: i16) -> i16: -106 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 16520261699954225452 +138 │ ╭ pub fn div_i16(left: i16, right: i16) -> i16 { +139 │ │ return left / right +140 │ │ } + │ ╰─────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, @@ -1985,25 +2020,26 @@ note: } note: - ┌─ checked_arithmetic.fe:106:16 + ┌─ checked_arithmetic.fe:139:16 │ -106 │ return left / right +139 │ return left / right │ ^^^^ ^^^^^ i16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:106:16 + ┌─ checked_arithmetic.fe:139:16 │ -106 │ return left / right +139 │ return left / right │ ^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:108:5 + ┌─ checked_arithmetic.fe:142:5 │ -108 │ ╭ pub fn div_i8(left: i8, right: i8) -> i8: -109 │ │ return left / right - │ ╰───────────────────────────^ attributes hash: 2984879578165475690 +142 │ ╭ pub fn div_i8(left: i8, right: i8) -> i8 { +143 │ │ return left / right +144 │ │ } + │ ╰─────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, @@ -2042,25 +2078,26 @@ note: } note: - ┌─ checked_arithmetic.fe:109:16 + ┌─ checked_arithmetic.fe:143:16 │ -109 │ return left / right +143 │ return left / right │ ^^^^ ^^^^^ i8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:109:16 + ┌─ checked_arithmetic.fe:143:16 │ -109 │ return left / right +143 │ return left / right │ ^^^^^^^^^^^^ i8: Value note: - ┌─ checked_arithmetic.fe:111:5 + ┌─ checked_arithmetic.fe:146:5 │ -111 │ ╭ pub fn mul_u256(left: u256, right: u256) -> u256: -112 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 8877497213208027149 +146 │ ╭ pub fn mul_u256(left: u256, right: u256) -> u256 { +147 │ │ return left * right +148 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, @@ -2099,25 +2136,26 @@ note: } note: - ┌─ checked_arithmetic.fe:112:16 + ┌─ checked_arithmetic.fe:147:16 │ -112 │ return left * right +147 │ return left * right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:112:16 + ┌─ checked_arithmetic.fe:147:16 │ -112 │ return left * right +147 │ return left * right │ ^^^^^^^^^^^^ u256: Value note: - ┌─ checked_arithmetic.fe:114:5 + ┌─ checked_arithmetic.fe:150:5 │ -114 │ ╭ pub fn mul_u128(left: u128, right: u128) -> u128: -115 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 11187416061572591496 +150 │ ╭ pub fn mul_u128(left: u128, right: u128) -> u128 { +151 │ │ return left * right +152 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, @@ -2156,25 +2194,26 @@ note: } note: - ┌─ checked_arithmetic.fe:115:16 + ┌─ checked_arithmetic.fe:151:16 │ -115 │ return left * right +151 │ return left * right │ ^^^^ ^^^^^ u128: Value │ │ │ u128: Value note: - ┌─ checked_arithmetic.fe:115:16 + ┌─ checked_arithmetic.fe:151:16 │ -115 │ return left * right +151 │ return left * right │ ^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:117:5 + ┌─ checked_arithmetic.fe:154:5 │ -117 │ ╭ pub fn mul_u64(left: u64, right: u64) -> u64: -118 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 9316585824156398552 +154 │ ╭ pub fn mul_u64(left: u64, right: u64) -> u64 { +155 │ │ return left * right +156 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, @@ -2213,25 +2252,26 @@ note: } note: - ┌─ checked_arithmetic.fe:118:16 + ┌─ checked_arithmetic.fe:155:16 │ -118 │ return left * right +155 │ return left * right │ ^^^^ ^^^^^ u64: Value │ │ │ u64: Value note: - ┌─ checked_arithmetic.fe:118:16 + ┌─ checked_arithmetic.fe:155:16 │ -118 │ return left * right +155 │ return left * right │ ^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:120:5 + ┌─ checked_arithmetic.fe:158:5 │ -120 │ ╭ pub fn mul_u32(left: u32, right: u32) -> u32: -121 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 6948562809403003686 +158 │ ╭ pub fn mul_u32(left: u32, right: u32) -> u32 { +159 │ │ return left * right +160 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, @@ -2270,25 +2310,26 @@ note: } note: - ┌─ checked_arithmetic.fe:121:16 + ┌─ checked_arithmetic.fe:159:16 │ -121 │ return left * right +159 │ return left * right │ ^^^^ ^^^^^ u32: Value │ │ │ u32: Value note: - ┌─ checked_arithmetic.fe:121:16 + ┌─ checked_arithmetic.fe:159:16 │ -121 │ return left * right +159 │ return left * right │ ^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:123:5 + ┌─ checked_arithmetic.fe:162:5 │ -123 │ ╭ pub fn mul_u16(left: u16, right: u16) -> u16: -124 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 4214429573900255413 +162 │ ╭ pub fn mul_u16(left: u16, right: u16) -> u16 { +163 │ │ return left * right +164 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, @@ -2327,25 +2368,26 @@ note: } note: - ┌─ checked_arithmetic.fe:124:16 + ┌─ checked_arithmetic.fe:163:16 │ -124 │ return left * right +163 │ return left * right │ ^^^^ ^^^^^ u16: Value │ │ │ u16: Value note: - ┌─ checked_arithmetic.fe:124:16 + ┌─ checked_arithmetic.fe:163:16 │ -124 │ return left * right +163 │ return left * right │ ^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:126:5 + ┌─ checked_arithmetic.fe:166:5 │ -126 │ ╭ pub fn mul_u8(left: u8, right: u8) -> u8: -127 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 3749617961046563034 +166 │ ╭ pub fn mul_u8(left: u8, right: u8) -> u8 { +167 │ │ return left * right +168 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, @@ -2384,25 +2426,26 @@ note: } note: - ┌─ checked_arithmetic.fe:127:16 + ┌─ checked_arithmetic.fe:167:16 │ -127 │ return left * right +167 │ return left * right │ ^^^^ ^^^^^ u8: Value │ │ │ u8: Value note: - ┌─ checked_arithmetic.fe:127:16 + ┌─ checked_arithmetic.fe:167:16 │ -127 │ return left * right +167 │ return left * right │ ^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:129:5 + ┌─ checked_arithmetic.fe:170:5 │ -129 │ ╭ pub fn mul_i256(left: i256, right: i256) -> i256: -130 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 17908204859155721295 +170 │ ╭ pub fn mul_i256(left: i256, right: i256) -> i256 { +171 │ │ return left * right +172 │ │ } + │ ╰─────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, @@ -2441,25 +2484,26 @@ note: } note: - ┌─ checked_arithmetic.fe:130:16 + ┌─ checked_arithmetic.fe:171:16 │ -130 │ return left * right +171 │ return left * right │ ^^^^ ^^^^^ i256: Value │ │ │ i256: Value note: - ┌─ checked_arithmetic.fe:130:16 + ┌─ checked_arithmetic.fe:171:16 │ -130 │ return left * right +171 │ return left * right │ ^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:132:5 + ┌─ checked_arithmetic.fe:174:5 │ -132 │ ╭ pub fn mul_i128(left: i128, right: i128) -> i128: -133 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 1332431709112937827 +174 │ ╭ pub fn mul_i128(left: i128, right: i128) -> i128 { +175 │ │ return left * right +176 │ │ } + │ ╰─────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, @@ -2498,25 +2542,26 @@ note: } note: - ┌─ checked_arithmetic.fe:133:16 + ┌─ checked_arithmetic.fe:175:16 │ -133 │ return left * right +175 │ return left * right │ ^^^^ ^^^^^ i128: Value │ │ │ i128: Value note: - ┌─ checked_arithmetic.fe:133:16 + ┌─ checked_arithmetic.fe:175:16 │ -133 │ return left * right +175 │ return left * right │ ^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:135:5 + ┌─ checked_arithmetic.fe:178:5 │ -135 │ ╭ pub fn mul_i64(left: i64, right: i64) -> i64: -136 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 3549113083347694903 +178 │ ╭ pub fn mul_i64(left: i64, right: i64) -> i64 { +179 │ │ return left * right +180 │ │ } + │ ╰─────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, @@ -2555,25 +2600,26 @@ note: } note: - ┌─ checked_arithmetic.fe:136:16 + ┌─ checked_arithmetic.fe:179:16 │ -136 │ return left * right +179 │ return left * right │ ^^^^ ^^^^^ i64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:136:16 + ┌─ checked_arithmetic.fe:179:16 │ -136 │ return left * right +179 │ return left * right │ ^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:138:5 + ┌─ checked_arithmetic.fe:182:5 │ -138 │ ╭ pub fn mul_i32(left: i32, right: i32) -> i32: -139 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 15117649447142800500 +182 │ ╭ pub fn mul_i32(left: i32, right: i32) -> i32 { +183 │ │ return left * right +184 │ │ } + │ ╰─────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, @@ -2612,25 +2658,26 @@ note: } note: - ┌─ checked_arithmetic.fe:139:16 + ┌─ checked_arithmetic.fe:183:16 │ -139 │ return left * right +183 │ return left * right │ ^^^^ ^^^^^ i32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:139:16 + ┌─ checked_arithmetic.fe:183:16 │ -139 │ return left * right +183 │ return left * right │ ^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:141:5 + ┌─ checked_arithmetic.fe:186:5 │ -141 │ ╭ pub fn mul_i16(left: i16, right: i16) -> i16: -142 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 16520261699954225452 +186 │ ╭ pub fn mul_i16(left: i16, right: i16) -> i16 { +187 │ │ return left * right +188 │ │ } + │ ╰─────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, @@ -2669,25 +2716,26 @@ note: } note: - ┌─ checked_arithmetic.fe:142:16 + ┌─ checked_arithmetic.fe:187:16 │ -142 │ return left * right +187 │ return left * right │ ^^^^ ^^^^^ i16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:142:16 + ┌─ checked_arithmetic.fe:187:16 │ -142 │ return left * right +187 │ return left * right │ ^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:144:5 + ┌─ checked_arithmetic.fe:190:5 │ -144 │ ╭ pub fn mul_i8(left: i8, right: i8) -> i8: -145 │ │ return left * right - │ ╰───────────────────────────^ attributes hash: 2984879578165475690 +190 │ ╭ pub fn mul_i8(left: i8, right: i8) -> i8 { +191 │ │ return left * right +192 │ │ } + │ ╰─────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, @@ -2726,25 +2774,26 @@ note: } note: - ┌─ checked_arithmetic.fe:145:16 + ┌─ checked_arithmetic.fe:191:16 │ -145 │ return left * right +191 │ return left * right │ ^^^^ ^^^^^ i8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:145:16 + ┌─ checked_arithmetic.fe:191:16 │ -145 │ return left * right +191 │ return left * right │ ^^^^^^^^^^^^ i8: Value note: - ┌─ checked_arithmetic.fe:147:5 + ┌─ checked_arithmetic.fe:194:5 │ -147 │ ╭ pub fn mod_u256(left: u256, right: u256) -> u256: -148 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 8877497213208027149 +194 │ ╭ pub fn mod_u256(left: u256, right: u256) -> u256 { +195 │ │ return left % right +196 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, @@ -2783,25 +2832,26 @@ note: } note: - ┌─ checked_arithmetic.fe:148:16 + ┌─ checked_arithmetic.fe:195:16 │ -148 │ return left % right +195 │ return left % right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:148:16 + ┌─ checked_arithmetic.fe:195:16 │ -148 │ return left % right +195 │ return left % right │ ^^^^^^^^^^^^ u256: Value note: - ┌─ checked_arithmetic.fe:150:5 + ┌─ checked_arithmetic.fe:198:5 │ -150 │ ╭ pub fn mod_u128(left: u128, right: u128) -> u128: -151 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 11187416061572591496 +198 │ ╭ pub fn mod_u128(left: u128, right: u128) -> u128 { +199 │ │ return left % right +200 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, @@ -2840,25 +2890,26 @@ note: } note: - ┌─ checked_arithmetic.fe:151:16 + ┌─ checked_arithmetic.fe:199:16 │ -151 │ return left % right +199 │ return left % right │ ^^^^ ^^^^^ u128: Value │ │ │ u128: Value note: - ┌─ checked_arithmetic.fe:151:16 + ┌─ checked_arithmetic.fe:199:16 │ -151 │ return left % right +199 │ return left % right │ ^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:153:5 + ┌─ checked_arithmetic.fe:202:5 │ -153 │ ╭ pub fn mod_u64(left: u64, right: u64) -> u64: -154 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 9316585824156398552 +202 │ ╭ pub fn mod_u64(left: u64, right: u64) -> u64 { +203 │ │ return left % right +204 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, @@ -2897,25 +2948,26 @@ note: } note: - ┌─ checked_arithmetic.fe:154:16 + ┌─ checked_arithmetic.fe:203:16 │ -154 │ return left % right +203 │ return left % right │ ^^^^ ^^^^^ u64: Value │ │ │ u64: Value note: - ┌─ checked_arithmetic.fe:154:16 + ┌─ checked_arithmetic.fe:203:16 │ -154 │ return left % right +203 │ return left % right │ ^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:156:5 + ┌─ checked_arithmetic.fe:206:5 │ -156 │ ╭ pub fn mod_u32(left: u32, right: u32) -> u32: -157 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 6948562809403003686 +206 │ ╭ pub fn mod_u32(left: u32, right: u32) -> u32 { +207 │ │ return left % right +208 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, @@ -2954,25 +3006,26 @@ note: } note: - ┌─ checked_arithmetic.fe:157:16 + ┌─ checked_arithmetic.fe:207:16 │ -157 │ return left % right +207 │ return left % right │ ^^^^ ^^^^^ u32: Value │ │ │ u32: Value note: - ┌─ checked_arithmetic.fe:157:16 + ┌─ checked_arithmetic.fe:207:16 │ -157 │ return left % right +207 │ return left % right │ ^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:159:5 + ┌─ checked_arithmetic.fe:210:5 │ -159 │ ╭ pub fn mod_u16(left: u16, right: u16) -> u16: -160 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 4214429573900255413 +210 │ ╭ pub fn mod_u16(left: u16, right: u16) -> u16 { +211 │ │ return left % right +212 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, @@ -3011,25 +3064,26 @@ note: } note: - ┌─ checked_arithmetic.fe:160:16 + ┌─ checked_arithmetic.fe:211:16 │ -160 │ return left % right +211 │ return left % right │ ^^^^ ^^^^^ u16: Value │ │ │ u16: Value note: - ┌─ checked_arithmetic.fe:160:16 + ┌─ checked_arithmetic.fe:211:16 │ -160 │ return left % right +211 │ return left % right │ ^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:162:5 + ┌─ checked_arithmetic.fe:214:5 │ -162 │ ╭ pub fn mod_u8(left: u8, right: u8) -> u8: -163 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 3749617961046563034 +214 │ ╭ pub fn mod_u8(left: u8, right: u8) -> u8 { +215 │ │ return left % right +216 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, @@ -3068,25 +3122,26 @@ note: } note: - ┌─ checked_arithmetic.fe:163:16 + ┌─ checked_arithmetic.fe:215:16 │ -163 │ return left % right +215 │ return left % right │ ^^^^ ^^^^^ u8: Value │ │ │ u8: Value note: - ┌─ checked_arithmetic.fe:163:16 + ┌─ checked_arithmetic.fe:215:16 │ -163 │ return left % right +215 │ return left % right │ ^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:165:5 + ┌─ checked_arithmetic.fe:218:5 │ -165 │ ╭ pub fn mod_i256(left: i256, right: i256) -> i256: -166 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 17908204859155721295 +218 │ ╭ pub fn mod_i256(left: i256, right: i256) -> i256 { +219 │ │ return left % right +220 │ │ } + │ ╰─────^ attributes hash: 17908204859155721295 │ = FunctionSignature { self_decl: None, @@ -3125,25 +3180,26 @@ note: } note: - ┌─ checked_arithmetic.fe:166:16 + ┌─ checked_arithmetic.fe:219:16 │ -166 │ return left % right +219 │ return left % right │ ^^^^ ^^^^^ i256: Value │ │ │ i256: Value note: - ┌─ checked_arithmetic.fe:166:16 + ┌─ checked_arithmetic.fe:219:16 │ -166 │ return left % right +219 │ return left % right │ ^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:168:5 + ┌─ checked_arithmetic.fe:222:5 │ -168 │ ╭ pub fn mod_i128(left: i128, right: i128) -> i128: -169 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 1332431709112937827 +222 │ ╭ pub fn mod_i128(left: i128, right: i128) -> i128 { +223 │ │ return left % right +224 │ │ } + │ ╰─────^ attributes hash: 1332431709112937827 │ = FunctionSignature { self_decl: None, @@ -3182,25 +3238,26 @@ note: } note: - ┌─ checked_arithmetic.fe:169:16 + ┌─ checked_arithmetic.fe:223:16 │ -169 │ return left % right +223 │ return left % right │ ^^^^ ^^^^^ i128: Value │ │ │ i128: Value note: - ┌─ checked_arithmetic.fe:169:16 + ┌─ checked_arithmetic.fe:223:16 │ -169 │ return left % right +223 │ return left % right │ ^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:171:5 + ┌─ checked_arithmetic.fe:226:5 │ -171 │ ╭ pub fn mod_i64(left: i64, right: i64) -> i64: -172 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 3549113083347694903 +226 │ ╭ pub fn mod_i64(left: i64, right: i64) -> i64 { +227 │ │ return left % right +228 │ │ } + │ ╰─────^ attributes hash: 3549113083347694903 │ = FunctionSignature { self_decl: None, @@ -3239,25 +3296,26 @@ note: } note: - ┌─ checked_arithmetic.fe:172:16 + ┌─ checked_arithmetic.fe:227:16 │ -172 │ return left % right +227 │ return left % right │ ^^^^ ^^^^^ i64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:172:16 + ┌─ checked_arithmetic.fe:227:16 │ -172 │ return left % right +227 │ return left % right │ ^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:174:5 + ┌─ checked_arithmetic.fe:230:5 │ -174 │ ╭ pub fn mod_i32(left: i32, right: i32) -> i32: -175 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 15117649447142800500 +230 │ ╭ pub fn mod_i32(left: i32, right: i32) -> i32 { +231 │ │ return left % right +232 │ │ } + │ ╰─────^ attributes hash: 15117649447142800500 │ = FunctionSignature { self_decl: None, @@ -3296,25 +3354,26 @@ note: } note: - ┌─ checked_arithmetic.fe:175:16 + ┌─ checked_arithmetic.fe:231:16 │ -175 │ return left % right +231 │ return left % right │ ^^^^ ^^^^^ i32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:175:16 + ┌─ checked_arithmetic.fe:231:16 │ -175 │ return left % right +231 │ return left % right │ ^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:177:5 + ┌─ checked_arithmetic.fe:234:5 │ -177 │ ╭ pub fn mod_i16(left: i16, right: i16) -> i16: -178 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 16520261699954225452 +234 │ ╭ pub fn mod_i16(left: i16, right: i16) -> i16 { +235 │ │ return left % right +236 │ │ } + │ ╰─────^ attributes hash: 16520261699954225452 │ = FunctionSignature { self_decl: None, @@ -3353,25 +3412,26 @@ note: } note: - ┌─ checked_arithmetic.fe:178:16 + ┌─ checked_arithmetic.fe:235:16 │ -178 │ return left % right +235 │ return left % right │ ^^^^ ^^^^^ i16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:178:16 + ┌─ checked_arithmetic.fe:235:16 │ -178 │ return left % right +235 │ return left % right │ ^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:180:5 + ┌─ checked_arithmetic.fe:238:5 │ -180 │ ╭ pub fn mod_i8(left: i8, right: i8) -> i8: -181 │ │ return left % right - │ ╰───────────────────────────^ attributes hash: 2984879578165475690 +238 │ ╭ pub fn mod_i8(left: i8, right: i8) -> i8 { +239 │ │ return left % right +240 │ │ } + │ ╰─────^ attributes hash: 2984879578165475690 │ = FunctionSignature { self_decl: None, @@ -3410,25 +3470,26 @@ note: } note: - ┌─ checked_arithmetic.fe:181:16 + ┌─ checked_arithmetic.fe:239:16 │ -181 │ return left % right +239 │ return left % right │ ^^^^ ^^^^^ i8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:181:16 + ┌─ checked_arithmetic.fe:239:16 │ -181 │ return left % right +239 │ return left % right │ ^^^^^^^^^^^^ i8: Value note: - ┌─ checked_arithmetic.fe:183:5 + ┌─ checked_arithmetic.fe:242:5 │ -183 │ ╭ pub fn pow_u256(left: u256, right: u256) -> u256: -184 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 8877497213208027149 +242 │ ╭ pub fn pow_u256(left: u256, right: u256) -> u256 { +243 │ │ return left ** right +244 │ │ } + │ ╰─────^ attributes hash: 8877497213208027149 │ = FunctionSignature { self_decl: None, @@ -3467,25 +3528,26 @@ note: } note: - ┌─ checked_arithmetic.fe:184:16 + ┌─ checked_arithmetic.fe:243:16 │ -184 │ return left ** right +243 │ return left ** right │ ^^^^ ^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ checked_arithmetic.fe:184:16 + ┌─ checked_arithmetic.fe:243:16 │ -184 │ return left ** right +243 │ return left ** right │ ^^^^^^^^^^^^^ u256: Value note: - ┌─ checked_arithmetic.fe:186:5 + ┌─ checked_arithmetic.fe:246:5 │ -186 │ ╭ pub fn pow_u128(left: u128, right: u128) -> u128: -187 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 11187416061572591496 +246 │ ╭ pub fn pow_u128(left: u128, right: u128) -> u128 { +247 │ │ return left ** right +248 │ │ } + │ ╰─────^ attributes hash: 11187416061572591496 │ = FunctionSignature { self_decl: None, @@ -3524,25 +3586,26 @@ note: } note: - ┌─ checked_arithmetic.fe:187:16 + ┌─ checked_arithmetic.fe:247:16 │ -187 │ return left ** right +247 │ return left ** right │ ^^^^ ^^^^^ u128: Value │ │ │ u128: Value note: - ┌─ checked_arithmetic.fe:187:16 + ┌─ checked_arithmetic.fe:247:16 │ -187 │ return left ** right +247 │ return left ** right │ ^^^^^^^^^^^^^ u128: Value note: - ┌─ checked_arithmetic.fe:189:5 + ┌─ checked_arithmetic.fe:250:5 │ -189 │ ╭ pub fn pow_u64(left: u64, right: u64) -> u64: -190 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 9316585824156398552 +250 │ ╭ pub fn pow_u64(left: u64, right: u64) -> u64 { +251 │ │ return left ** right +252 │ │ } + │ ╰─────^ attributes hash: 9316585824156398552 │ = FunctionSignature { self_decl: None, @@ -3581,25 +3644,26 @@ note: } note: - ┌─ checked_arithmetic.fe:190:16 + ┌─ checked_arithmetic.fe:251:16 │ -190 │ return left ** right +251 │ return left ** right │ ^^^^ ^^^^^ u64: Value │ │ │ u64: Value note: - ┌─ checked_arithmetic.fe:190:16 + ┌─ checked_arithmetic.fe:251:16 │ -190 │ return left ** right +251 │ return left ** right │ ^^^^^^^^^^^^^ u64: Value note: - ┌─ checked_arithmetic.fe:192:5 + ┌─ checked_arithmetic.fe:254:5 │ -192 │ ╭ pub fn pow_u32(left: u32, right: u32) -> u32: -193 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 6948562809403003686 +254 │ ╭ pub fn pow_u32(left: u32, right: u32) -> u32 { +255 │ │ return left ** right +256 │ │ } + │ ╰─────^ attributes hash: 6948562809403003686 │ = FunctionSignature { self_decl: None, @@ -3638,25 +3702,26 @@ note: } note: - ┌─ checked_arithmetic.fe:193:16 + ┌─ checked_arithmetic.fe:255:16 │ -193 │ return left ** right +255 │ return left ** right │ ^^^^ ^^^^^ u32: Value │ │ │ u32: Value note: - ┌─ checked_arithmetic.fe:193:16 + ┌─ checked_arithmetic.fe:255:16 │ -193 │ return left ** right +255 │ return left ** right │ ^^^^^^^^^^^^^ u32: Value note: - ┌─ checked_arithmetic.fe:195:5 + ┌─ checked_arithmetic.fe:258:5 │ -195 │ ╭ pub fn pow_u16(left: u16, right: u16) -> u16: -196 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 4214429573900255413 +258 │ ╭ pub fn pow_u16(left: u16, right: u16) -> u16 { +259 │ │ return left ** right +260 │ │ } + │ ╰─────^ attributes hash: 4214429573900255413 │ = FunctionSignature { self_decl: None, @@ -3695,25 +3760,26 @@ note: } note: - ┌─ checked_arithmetic.fe:196:16 + ┌─ checked_arithmetic.fe:259:16 │ -196 │ return left ** right +259 │ return left ** right │ ^^^^ ^^^^^ u16: Value │ │ │ u16: Value note: - ┌─ checked_arithmetic.fe:196:16 + ┌─ checked_arithmetic.fe:259:16 │ -196 │ return left ** right +259 │ return left ** right │ ^^^^^^^^^^^^^ u16: Value note: - ┌─ checked_arithmetic.fe:198:5 + ┌─ checked_arithmetic.fe:262:5 │ -198 │ ╭ pub fn pow_u8(left: u8, right: u8) -> u8: -199 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 3749617961046563034 +262 │ ╭ pub fn pow_u8(left: u8, right: u8) -> u8 { +263 │ │ return left ** right +264 │ │ } + │ ╰─────^ attributes hash: 3749617961046563034 │ = FunctionSignature { self_decl: None, @@ -3752,25 +3818,26 @@ note: } note: - ┌─ checked_arithmetic.fe:199:16 + ┌─ checked_arithmetic.fe:263:16 │ -199 │ return left ** right +263 │ return left ** right │ ^^^^ ^^^^^ u8: Value │ │ │ u8: Value note: - ┌─ checked_arithmetic.fe:199:16 + ┌─ checked_arithmetic.fe:263:16 │ -199 │ return left ** right +263 │ return left ** right │ ^^^^^^^^^^^^^ u8: Value note: - ┌─ checked_arithmetic.fe:201:5 + ┌─ checked_arithmetic.fe:266:5 │ -201 │ ╭ pub fn pow_i256(left: i256, right: u256) -> i256: -202 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 10218838230504849711 +266 │ ╭ pub fn pow_i256(left: i256, right: u256) -> i256 { +267 │ │ return left ** right +268 │ │ } + │ ╰─────^ attributes hash: 10218838230504849711 │ = FunctionSignature { self_decl: None, @@ -3809,25 +3876,26 @@ note: } note: - ┌─ checked_arithmetic.fe:202:16 + ┌─ checked_arithmetic.fe:267:16 │ -202 │ return left ** right +267 │ return left ** right │ ^^^^ ^^^^^ u256: Value │ │ │ i256: Value note: - ┌─ checked_arithmetic.fe:202:16 + ┌─ checked_arithmetic.fe:267:16 │ -202 │ return left ** right +267 │ return left ** right │ ^^^^^^^^^^^^^ i256: Value note: - ┌─ checked_arithmetic.fe:204:5 + ┌─ checked_arithmetic.fe:270:5 │ -204 │ ╭ pub fn pow_i128(left: i128, right: u128) -> i128: -205 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 8492300797170107874 +270 │ ╭ pub fn pow_i128(left: i128, right: u128) -> i128 { +271 │ │ return left ** right +272 │ │ } + │ ╰─────^ attributes hash: 8492300797170107874 │ = FunctionSignature { self_decl: None, @@ -3866,25 +3934,26 @@ note: } note: - ┌─ checked_arithmetic.fe:205:16 + ┌─ checked_arithmetic.fe:271:16 │ -205 │ return left ** right +271 │ return left ** right │ ^^^^ ^^^^^ u128: Value │ │ │ i128: Value note: - ┌─ checked_arithmetic.fe:205:16 + ┌─ checked_arithmetic.fe:271:16 │ -205 │ return left ** right +271 │ return left ** right │ ^^^^^^^^^^^^^ i128: Value note: - ┌─ checked_arithmetic.fe:207:5 + ┌─ checked_arithmetic.fe:274:5 │ -207 │ ╭ pub fn pow_i64(left: i64, right: u64) -> i64: -208 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 8175269888119534907 +274 │ ╭ pub fn pow_i64(left: i64, right: u64) -> i64 { +275 │ │ return left ** right +276 │ │ } + │ ╰─────^ attributes hash: 8175269888119534907 │ = FunctionSignature { self_decl: None, @@ -3923,25 +3992,26 @@ note: } note: - ┌─ checked_arithmetic.fe:208:16 + ┌─ checked_arithmetic.fe:275:16 │ -208 │ return left ** right +275 │ return left ** right │ ^^^^ ^^^^^ u64: Value │ │ │ i64: Value note: - ┌─ checked_arithmetic.fe:208:16 + ┌─ checked_arithmetic.fe:275:16 │ -208 │ return left ** right +275 │ return left ** right │ ^^^^^^^^^^^^^ i64: Value note: - ┌─ checked_arithmetic.fe:210:5 + ┌─ checked_arithmetic.fe:278:5 │ -210 │ ╭ pub fn pow_i32(left: i32, right: u32) -> i32: -211 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 9388330002377862662 +278 │ ╭ pub fn pow_i32(left: i32, right: u32) -> i32 { +279 │ │ return left ** right +280 │ │ } + │ ╰─────^ attributes hash: 9388330002377862662 │ = FunctionSignature { self_decl: None, @@ -3980,25 +4050,26 @@ note: } note: - ┌─ checked_arithmetic.fe:211:16 + ┌─ checked_arithmetic.fe:279:16 │ -211 │ return left ** right +279 │ return left ** right │ ^^^^ ^^^^^ u32: Value │ │ │ i32: Value note: - ┌─ checked_arithmetic.fe:211:16 + ┌─ checked_arithmetic.fe:279:16 │ -211 │ return left ** right +279 │ return left ** right │ ^^^^^^^^^^^^^ i32: Value note: - ┌─ checked_arithmetic.fe:213:5 + ┌─ checked_arithmetic.fe:282:5 │ -213 │ ╭ pub fn pow_i16(left: i16, right: u16) -> i16: -214 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 8172583117888506116 +282 │ ╭ pub fn pow_i16(left: i16, right: u16) -> i16 { +283 │ │ return left ** right +284 │ │ } + │ ╰─────^ attributes hash: 8172583117888506116 │ = FunctionSignature { self_decl: None, @@ -4037,25 +4108,26 @@ note: } note: - ┌─ checked_arithmetic.fe:214:16 + ┌─ checked_arithmetic.fe:283:16 │ -214 │ return left ** right +283 │ return left ** right │ ^^^^ ^^^^^ u16: Value │ │ │ i16: Value note: - ┌─ checked_arithmetic.fe:214:16 + ┌─ checked_arithmetic.fe:283:16 │ -214 │ return left ** right +283 │ return left ** right │ ^^^^^^^^^^^^^ i16: Value note: - ┌─ checked_arithmetic.fe:216:5 + ┌─ checked_arithmetic.fe:286:5 │ -216 │ ╭ pub fn pow_i8(left: i8, right: u8) -> i8: -217 │ │ return left ** right - │ ╰────────────────────────────^ attributes hash: 783967907920544100 +286 │ ╭ pub fn pow_i8(left: i8, right: u8) -> i8 { +287 │ │ return left ** right +288 │ │ } + │ ╰─────^ attributes hash: 783967907920544100 │ = FunctionSignature { self_decl: None, @@ -4094,17 +4166,17 @@ note: } note: - ┌─ checked_arithmetic.fe:217:16 + ┌─ checked_arithmetic.fe:287:16 │ -217 │ return left ** right +287 │ return left ** right │ ^^^^ ^^^^^ u8: Value │ │ │ i8: Value note: - ┌─ checked_arithmetic.fe:217:16 + ┌─ checked_arithmetic.fe:287:16 │ -217 │ return left ** right +287 │ return left ** right │ ^^^^^^^^^^^^^ i8: Value diff --git a/crates/analyzer/tests/snapshots/analysis__const_generics.snap b/crates/analyzer/tests/snapshots/analysis__const_generics.snap index 475d450cb2..6ba16ef208 100644 --- a/crates/analyzer/tests/snapshots/analysis__const_generics.snap +++ b/crates/analyzer/tests/snapshots/analysis__const_generics.snap @@ -6,14 +6,14 @@ expression: "build_snapshot(&db, module)" note: ┌─ const_generics.fe:2:5 │ - 2 │ ╭ pub fn bar(): + 2 │ ╭ pub fn bar() { 3 │ │ # const generics with literal. 4 │ │ let array_lit: Array 5 │ │ let array_lit2: Array · │ -45 │ │ 46 │ │ let array_with_const: Array - │ ╰───────────────────────────────────────────────────────────────────────^ attributes hash: 8319796915330632390 +47 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -37,9 +37,9 @@ note: 8 │ let array_ternary: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array · -11 │ let array_logical_or: Array +11 │ let array_logical_or: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -12 │ let array_logical_and: Array +12 │ let array_logical_and: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array · 15 │ let array_add: Array @@ -120,7 +120,7 @@ note: 8 │ let array_ternary: Array │ ^^^^^^^^^^^^^^^^^ u256: Value · -11 │ let array_logical_or: Array +11 │ let array_logical_or: Array │ ^^^^ ^^^^^ bool: Value │ │ │ bool: Value @@ -128,7 +128,7 @@ note: note: ┌─ const_generics.fe:11:44 │ -11 │ let array_logical_or: Array +11 │ let array_logical_or: Array │ ^ ^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ │ │ bool: Value @@ -137,9 +137,9 @@ note: note: ┌─ const_generics.fe:11:44 │ -11 │ let array_logical_or: Array +11 │ let array_logical_or: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -12 │ let array_logical_and: Array +12 │ let array_logical_and: Array │ ^^^^ ^^^^^ bool: Value │ │ │ bool: Value @@ -147,7 +147,7 @@ note: note: ┌─ const_generics.fe:12:45 │ -12 │ let array_logical_and: Array +12 │ let array_logical_and: Array │ ^ ^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ │ │ bool: Value @@ -156,7 +156,7 @@ note: note: ┌─ const_generics.fe:12:45 │ -12 │ let array_logical_and: Array +12 │ let array_logical_and: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value · 15 │ let array_add: Array diff --git a/crates/analyzer/tests/snapshots/analysis__const_local.snap b/crates/analyzer/tests/snapshots/analysis__const_local.snap index d267226625..dd7bce88e7 100644 --- a/crates/analyzer/tests/snapshots/analysis__const_local.snap +++ b/crates/analyzer/tests/snapshots/analysis__const_local.snap @@ -6,14 +6,14 @@ expression: "build_snapshot(&db, module)" note: ┌─ const_local.fe:2:5 │ - 2 │ ╭ pub fn bar() -> u256: + 2 │ ╭ pub fn bar() -> u256 { 3 │ │ const C1: i64 = 1 4 │ │ const C2: i64 = 2 5 │ │ const C3: i64 = 10 · │ -14 │ │ let _arr: Array 15 │ │ return C10 - │ ╰──────────────────^ attributes hash: 6115314201970082834 +16 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__constructor.snap b/crates/analyzer/tests/snapshots/analysis__constructor.snap index 358905bf39..e43d7fc5fb 100644 --- a/crates/analyzer/tests/snapshots/analysis__constructor.snap +++ b/crates/analyzer/tests/snapshots/analysis__constructor.snap @@ -10,45 +10,46 @@ note: │ ^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ constructor.fe:7:5 - │ -7 │ ╭ pub fn read_bar(self) -> u256: -8 │ │ return self.bar[42] - │ ╰───────────────────────────^ attributes hash: 11773348765973600208 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ constructor.fe:8:5 + │ + 8 │ ╭ pub fn read_bar(self) -> u256 { + 9 │ │ return self.bar[42] +10 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ constructor.fe:8:16 + ┌─ constructor.fe:9:16 │ -8 │ return self.bar[42] +9 │ return self.bar[42] │ ^^^^ Foo: Value note: - ┌─ constructor.fe:8:16 + ┌─ constructor.fe:9:16 │ -8 │ return self.bar[42] +9 │ return self.bar[42] │ ^^^^^^^^ ^^ u256: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ constructor.fe:8:16 + ┌─ constructor.fe:9:16 │ -8 │ return self.bar[42] +9 │ return self.bar[42] │ ^^^^^^^^^^^^ u256: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap index 16c82d9569..3ffbafc8d3 100644 --- a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ create2_contract.fe:4:5 │ -4 │ ╭ pub fn get_my_num() -> u256: +4 │ ╭ pub fn get_my_num() -> u256 { 5 │ │ return 42 - │ ╰─────────────────^ attributes hash: 6115314201970082834 +6 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -30,13 +31,13 @@ note: │ ^^ u256: Value note: - ┌─ create2_contract.fe:8:5 + ┌─ create2_contract.fe:10:5 │ - 8 │ ╭ pub fn create2_foo(ctx: Context) -> address: - 9 │ │ # value and salt -10 │ │ let foo: Foo = Foo.create2(ctx, 0, 52) -11 │ │ return address(foo) - │ ╰───────────────────────────^ attributes hash: 9364783648076633772 +10 │ ╭ pub fn create2_foo(ctx: Context) -> address { +11 │ │ let foo: Foo = Foo.create2(ctx, 0, 52) +12 │ │ return address(foo) +13 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -65,32 +66,32 @@ note: } note: - ┌─ create2_contract.fe:10:18 + ┌─ create2_contract.fe:11:18 │ -10 │ let foo: Foo = Foo.create2(ctx, 0, 52) +11 │ let foo: Foo = Foo.create2(ctx, 0, 52) │ ^^^ Foo note: - ┌─ create2_contract.fe:10:36 + ┌─ create2_contract.fe:11:36 │ -10 │ let foo: Foo = Foo.create2(ctx, 0, 52) +11 │ let foo: Foo = Foo.create2(ctx, 0, 52) │ ^^^ ^ ^^ u256: Value │ │ │ │ │ u256: Value │ Context: Memory note: - ┌─ create2_contract.fe:10:24 + ┌─ create2_contract.fe:11:24 │ -10 │ let foo: Foo = Foo.create2(ctx, 0, 52) +11 │ let foo: Foo = Foo.create2(ctx, 0, 52) │ ^^^^^^^^^^^^^^^^^^^^^^^ Foo: Value -11 │ return address(foo) +12 │ return address(foo) │ ^^^ Foo: Value note: - ┌─ create2_contract.fe:11:16 + ┌─ create2_contract.fe:12:16 │ -11 │ return address(foo) +12 │ return address(foo) │ ^^^^^^^^^^^^ address: Value diff --git a/crates/analyzer/tests/snapshots/analysis__create_contract.snap b/crates/analyzer/tests/snapshots/analysis__create_contract.snap index 5ab77847ae..6e242395fe 100644 --- a/crates/analyzer/tests/snapshots/analysis__create_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create_contract.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ create_contract.fe:4:5 │ -4 │ ╭ pub fn get_my_num() -> u256: +4 │ ╭ pub fn get_my_num() -> u256 { 5 │ │ return 42 - │ ╰─────────────────^ attributes hash: 6115314201970082834 +6 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -30,12 +31,13 @@ note: │ ^^ u256: Value note: - ┌─ create_contract.fe:8:5 + ┌─ create_contract.fe:10:5 │ - 8 │ ╭ pub fn create_foo(ctx: Context) -> address: - 9 │ │ let foo: Foo = Foo.create(ctx, 0) -10 │ │ return address(foo) - │ ╰───────────────────────────^ attributes hash: 9364783648076633772 +10 │ ╭ pub fn create_foo(ctx: Context) -> address { +11 │ │ let foo: Foo = Foo.create(ctx, 0) +12 │ │ return address(foo) +13 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -64,31 +66,31 @@ note: } note: - ┌─ create_contract.fe:9:18 - │ -9 │ let foo: Foo = Foo.create(ctx, 0) - │ ^^^ Foo + ┌─ create_contract.fe:11:18 + │ +11 │ let foo: Foo = Foo.create(ctx, 0) + │ ^^^ Foo note: - ┌─ create_contract.fe:9:35 - │ -9 │ let foo: Foo = Foo.create(ctx, 0) - │ ^^^ ^ u256: Value - │ │ - │ Context: Memory + ┌─ create_contract.fe:11:35 + │ +11 │ let foo: Foo = Foo.create(ctx, 0) + │ ^^^ ^ u256: Value + │ │ + │ Context: Memory note: - ┌─ create_contract.fe:9:24 + ┌─ create_contract.fe:11:24 │ - 9 │ let foo: Foo = Foo.create(ctx, 0) +11 │ let foo: Foo = Foo.create(ctx, 0) │ ^^^^^^^^^^^^^^^^^^ Foo: Value -10 │ return address(foo) +12 │ return address(foo) │ ^^^ Foo: Value note: - ┌─ create_contract.fe:10:16 + ┌─ create_contract.fe:12:16 │ -10 │ return address(foo) +12 │ return address(foo) │ ^^^^^^^^^^^^ address: Value diff --git a/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap b/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap index 9d6fc40bcf..e06d4c7e3e 100644 --- a/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap +++ b/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ create_contract_from_init.fe:4:5 │ -4 │ ╭ pub fn get_my_num() -> u256: +4 │ ╭ pub fn get_my_num() -> u256 { 5 │ │ return 42 - │ ╰─────────────────^ attributes hash: 6115314201970082834 +6 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -30,17 +31,18 @@ note: │ ^^ u256: Value note: - ┌─ create_contract_from_init.fe:8:5 - │ -8 │ foo_addr: address - │ ^^^^^^^^^^^^^^^^^ address + ┌─ create_contract_from_init.fe:10:5 + │ +10 │ foo_addr: address + │ ^^^^^^^^^^^^^^^^^ address note: - ┌─ create_contract_from_init.fe:13:5 + ┌─ create_contract_from_init.fe:16:5 │ -13 │ ╭ pub fn get_foo_addr(self) -> address: -14 │ │ return self.foo_addr - │ ╰────────────────────────────^ attributes hash: 227275695522088782 +16 │ ╭ pub fn get_foo_addr(self) -> address { +17 │ │ return self.foo_addr +18 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -56,15 +58,15 @@ note: } note: - ┌─ create_contract_from_init.fe:14:16 + ┌─ create_contract_from_init.fe:17:16 │ -14 │ return self.foo_addr +17 │ return self.foo_addr │ ^^^^ FooFactory: Value note: - ┌─ create_contract_from_init.fe:14:16 + ┌─ create_contract_from_init.fe:17:16 │ -14 │ return self.foo_addr +17 │ return self.foo_addr │ ^^^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap index 924b089d46..f43d1803b8 100644 --- a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap @@ -4,43 +4,39 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ data_copying_stress.fe:4:5 - │ - 4 │ my_string: String<42> - │ ^^^^^^^^^^^^^^^^^^^^^ String<42> - 5 │ my_other_string: String<42> - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<42> - 6 │ - 7 │ my_u256: u256 - │ ^^^^^^^^^^^^^ u256 - 8 │ my_other_u256: u256 - │ ^^^^^^^^^^^^^^^^^^^ u256 - 9 │ -10 │ my_nums: Array - │ ^^^^^^^^^^^^^^^^^^^^^^^ Array -11 │ -12 │ my_addrs: Array - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array - -note: - ┌─ data_copying_stress.fe:15:9 - │ -15 │ my_string: String<42> + ┌─ data_copying_stress.fe:4:5 + │ +4 │ my_string: String<42> + │ ^^^^^^^^^^^^^^^^^^^^^ String<42> +5 │ my_other_string: String<42> + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<42> +6 │ my_u256: u256 + │ ^^^^^^^^^^^^^ u256 +7 │ my_other_u256: u256 + │ ^^^^^^^^^^^^^^^^^^^ u256 +8 │ my_nums: Array + │ ^^^^^^^^^^^^^^^^^^^^^^^ Array +9 │ my_addrs: Array + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array + +note: + ┌─ data_copying_stress.fe:12:9 + │ +12 │ my_string: String<42> │ ^^^^^^^^^^^^^^^^^^^^^ String<42> -16 │ my_u256: u256 +13 │ my_u256: u256 │ ^^^^^^^^^^^^^ u256 note: - ┌─ data_copying_stress.fe:18:5 + ┌─ data_copying_stress.fe:16:5 │ -18 │ ╭ pub fn set_my_vals( -19 │ │ self, -20 │ │ my_string: String<42>, -21 │ │ my_other_string: String<42>, - · │ -27 │ │ self.my_u256 = my_u256 -28 │ │ self.my_other_u256 = my_other_u256 - │ ╰──────────────────────────────────────────^ attributes hash: 8414520425977761339 +16 │ ╭ pub fn set_my_vals(self, my_string: String<42>, my_other_string: String<42>, my_u256: u256, my_other_u256: u256) { +17 │ │ self.my_string = my_string +18 │ │ self.my_other_string = my_other_string +19 │ │ self.my_u256 = my_u256 +20 │ │ self.my_other_u256 = my_other_u256 +21 │ │ } + │ ╰─────^ attributes hash: 8414520425977761339 │ = FunctionSignature { self_decl: Some( @@ -101,56 +97,57 @@ note: } note: - ┌─ data_copying_stress.fe:25:9 + ┌─ data_copying_stress.fe:17:9 │ -25 │ self.my_string = my_string +17 │ self.my_string = my_string │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:25:9 + ┌─ data_copying_stress.fe:17:9 │ -25 │ self.my_string = my_string +17 │ self.my_string = my_string │ ^^^^^^^^^^^^^^ ^^^^^^^^^ String<42>: Memory │ │ │ String<42>: Storage { nonce: Some(0) } -26 │ self.my_other_string = my_other_string +18 │ self.my_other_string = my_other_string │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:26:9 + ┌─ data_copying_stress.fe:18:9 │ -26 │ self.my_other_string = my_other_string +18 │ self.my_other_string = my_other_string │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ String<42>: Memory │ │ │ String<42>: Storage { nonce: Some(1) } -27 │ self.my_u256 = my_u256 +19 │ self.my_u256 = my_u256 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:27:9 + ┌─ data_copying_stress.fe:19:9 │ -27 │ self.my_u256 = my_u256 +19 │ self.my_u256 = my_u256 │ ^^^^^^^^^^^^ ^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } -28 │ self.my_other_u256 = my_other_u256 +20 │ self.my_other_u256 = my_other_u256 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:28:9 + ┌─ data_copying_stress.fe:20:9 │ -28 │ self.my_other_u256 = my_other_u256 +20 │ self.my_other_u256 = my_other_u256 │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(3) } note: - ┌─ data_copying_stress.fe:30:5 + ┌─ data_copying_stress.fe:23:5 │ -30 │ ╭ pub fn set_to_my_other_vals(self): -31 │ │ self.my_string = self.my_other_string -32 │ │ self.my_u256 = self.my_other_u256 - │ ╰─────────────────────────────────────────^ attributes hash: 18235041182630809162 +23 │ ╭ pub fn set_to_my_other_vals(self) { +24 │ │ self.my_string = self.my_other_string +25 │ │ self.my_u256 = self.my_other_u256 +26 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -166,52 +163,52 @@ note: } note: - ┌─ data_copying_stress.fe:31:9 + ┌─ data_copying_stress.fe:24:9 │ -31 │ self.my_string = self.my_other_string +24 │ self.my_string = self.my_other_string │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:31:9 + ┌─ data_copying_stress.fe:24:9 │ -31 │ self.my_string = self.my_other_string +24 │ self.my_string = self.my_other_string │ ^^^^^^^^^^^^^^ ^^^^ Foo: Value │ │ │ String<42>: Storage { nonce: Some(0) } note: - ┌─ data_copying_stress.fe:31:26 + ┌─ data_copying_stress.fe:24:26 │ -31 │ self.my_string = self.my_other_string +24 │ self.my_string = self.my_other_string │ ^^^^^^^^^^^^^^^^^^^^ String<42>: Storage { nonce: Some(1) } -32 │ self.my_u256 = self.my_other_u256 +25 │ self.my_u256 = self.my_other_u256 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:32:9 + ┌─ data_copying_stress.fe:25:9 │ -32 │ self.my_u256 = self.my_other_u256 +25 │ self.my_u256 = self.my_other_u256 │ ^^^^^^^^^^^^ ^^^^ Foo: Value │ │ │ u256: Storage { nonce: Some(2) } note: - ┌─ data_copying_stress.fe:32:24 + ┌─ data_copying_stress.fe:25:24 │ -32 │ self.my_u256 = self.my_other_u256 +25 │ self.my_u256 = self.my_other_u256 │ ^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } note: - ┌─ data_copying_stress.fe:34:5 + ┌─ data_copying_stress.fe:28:5 │ -34 │ ╭ pub fn multiple_references_shared_memory(my_array: Array): -35 │ │ let my_2nd_array: Array = my_array -36 │ │ let my_3rd_array: Array = my_2nd_array -37 │ │ +28 │ ╭ pub fn multiple_references_shared_memory(my_array: Array) { +29 │ │ let my_2nd_array: Array = my_array +30 │ │ let my_3rd_array: Array = my_2nd_array +31 │ │ assert my_array[3] != 5 · │ -46 │ │ assert my_2nd_array[3] == 50 -47 │ │ assert my_3rd_array[3] == 50 - │ ╰────────────────────────────────────^ attributes hash: 16237067187800993503 +39 │ │ assert my_3rd_array[3] == 50 +40 │ │ } + │ ╰─────^ attributes hash: 16237067187800993503 │ = FunctionSignature { self_decl: None, @@ -240,180 +237,179 @@ note: } note: - ┌─ data_copying_stress.fe:35:27 + ┌─ data_copying_stress.fe:29:27 │ -35 │ let my_2nd_array: Array = my_array +29 │ let my_2nd_array: Array = my_array │ ^^^^^^^^^^^^^^^ Array -36 │ let my_3rd_array: Array = my_2nd_array +30 │ let my_3rd_array: Array = my_2nd_array │ ^^^^^^^^^^^^^^^ Array note: - ┌─ data_copying_stress.fe:35:45 + ┌─ data_copying_stress.fe:29:45 │ -35 │ let my_2nd_array: Array = my_array +29 │ let my_2nd_array: Array = my_array │ ^^^^^^^^ Array: Memory -36 │ let my_3rd_array: Array = my_2nd_array +30 │ let my_3rd_array: Array = my_2nd_array │ ^^^^^^^^^^^^ Array: Memory -37 │ -38 │ assert my_array[3] != 5 +31 │ assert my_array[3] != 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:38:16 + ┌─ data_copying_stress.fe:31:16 │ -38 │ assert my_array[3] != 5 +31 │ assert my_array[3] != 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:38:16 + ┌─ data_copying_stress.fe:31:16 │ -38 │ assert my_array[3] != 5 +31 │ assert my_array[3] != 5 │ ^^^^^^^^^^^^^^^^ bool: Value -39 │ my_array[3] = 5 +32 │ my_array[3] = 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:39:9 + ┌─ data_copying_stress.fe:32:9 │ -39 │ my_array[3] = 5 +32 │ my_array[3] = 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -40 │ assert my_array[3] == 5 +33 │ assert my_array[3] == 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:40:16 + ┌─ data_copying_stress.fe:33:16 │ -40 │ assert my_array[3] == 5 +33 │ assert my_array[3] == 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:40:16 + ┌─ data_copying_stress.fe:33:16 │ -40 │ assert my_array[3] == 5 +33 │ assert my_array[3] == 5 │ ^^^^^^^^^^^^^^^^ bool: Value -41 │ assert my_2nd_array[3] == 5 +34 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:41:16 + ┌─ data_copying_stress.fe:34:16 │ -41 │ assert my_2nd_array[3] == 5 +34 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:41:16 + ┌─ data_copying_stress.fe:34:16 │ -41 │ assert my_2nd_array[3] == 5 +34 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -42 │ assert my_3rd_array[3] == 5 +35 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:42:16 + ┌─ data_copying_stress.fe:35:16 │ -42 │ assert my_3rd_array[3] == 5 +35 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:42:16 + ┌─ data_copying_stress.fe:35:16 │ -42 │ assert my_3rd_array[3] == 5 +35 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -43 │ -44 │ my_3rd_array[3] = 50 +36 │ my_3rd_array[3] = 50 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:44:9 + ┌─ data_copying_stress.fe:36:9 │ -44 │ my_3rd_array[3] = 50 +36 │ my_3rd_array[3] = 50 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory -45 │ assert my_array[3] == 50 +37 │ assert my_array[3] == 50 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:45:16 + ┌─ data_copying_stress.fe:37:16 │ -45 │ assert my_array[3] == 50 +37 │ assert my_array[3] == 50 │ ^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:45:16 + ┌─ data_copying_stress.fe:37:16 │ -45 │ assert my_array[3] == 50 +37 │ assert my_array[3] == 50 │ ^^^^^^^^^^^^^^^^^ bool: Value -46 │ assert my_2nd_array[3] == 50 +38 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:46:16 + ┌─ data_copying_stress.fe:38:16 │ -46 │ assert my_2nd_array[3] == 50 +38 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:46:16 + ┌─ data_copying_stress.fe:38:16 │ -46 │ assert my_2nd_array[3] == 50 +38 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -47 │ assert my_3rd_array[3] == 50 +39 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:47:16 + ┌─ data_copying_stress.fe:39:16 │ -47 │ assert my_3rd_array[3] == 50 +39 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ data_copying_stress.fe:47:16 + ┌─ data_copying_stress.fe:39:16 │ -47 │ assert my_3rd_array[3] == 50 +39 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ data_copying_stress.fe:49:5 + ┌─ data_copying_stress.fe:42:5 │ -49 │ ╭ pub fn mutate_and_return(my_array: Array) -> Array: -50 │ │ my_array[3] = 5 -51 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 15461468619504661037 +42 │ ╭ pub fn mutate_and_return(my_array: Array) -> Array { +43 │ │ my_array[3] = 5 +44 │ │ return my_array +45 │ │ } + │ ╰─────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, @@ -447,29 +443,30 @@ note: } note: - ┌─ data_copying_stress.fe:50:9 + ┌─ data_copying_stress.fe:43:9 │ -50 │ my_array[3] = 5 +43 │ my_array[3] = 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:50:9 + ┌─ data_copying_stress.fe:43:9 │ -50 │ my_array[3] = 5 +43 │ my_array[3] = 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -51 │ return my_array +44 │ return my_array │ ^^^^^^^^ Array: Memory note: - ┌─ data_copying_stress.fe:53:5 + ┌─ data_copying_stress.fe:47:5 │ -53 │ ╭ pub fn clone_and_return(my_array: Array) -> Array: -54 │ │ return my_array.clone() - │ ╰───────────────────────────────^ attributes hash: 15461468619504661037 +47 │ ╭ pub fn clone_and_return(my_array: Array) -> Array { +48 │ │ return my_array.clone() +49 │ │ } + │ ╰─────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, @@ -503,24 +500,25 @@ note: } note: - ┌─ data_copying_stress.fe:54:16 + ┌─ data_copying_stress.fe:48:16 │ -54 │ return my_array.clone() +48 │ return my_array.clone() │ ^^^^^^^^ Array: Memory note: - ┌─ data_copying_stress.fe:54:16 + ┌─ data_copying_stress.fe:48:16 │ -54 │ return my_array.clone() +48 │ return my_array.clone() │ ^^^^^^^^^^^^^^^^ Array: Memory => Memory note: - ┌─ data_copying_stress.fe:56:5 + ┌─ data_copying_stress.fe:51:5 │ -56 │ ╭ pub fn clone_mutate_and_return(my_array: Array) -> Array: -57 │ │ my_array.clone()[3] = 5 -58 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 15461468619504661037 +51 │ ╭ pub fn clone_mutate_and_return(my_array: Array) -> Array { +52 │ │ my_array.clone()[3] = 5 +53 │ │ return my_array +54 │ │ } + │ ╰─────^ attributes hash: 15461468619504661037 │ = FunctionSignature { self_decl: None, @@ -554,40 +552,40 @@ note: } note: - ┌─ data_copying_stress.fe:57:9 + ┌─ data_copying_stress.fe:52:9 │ -57 │ my_array.clone()[3] = 5 +52 │ my_array.clone()[3] = 5 │ ^^^^^^^^ Array: Memory note: - ┌─ data_copying_stress.fe:57:9 + ┌─ data_copying_stress.fe:52:9 │ -57 │ my_array.clone()[3] = 5 +52 │ my_array.clone()[3] = 5 │ ^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory => Memory note: - ┌─ data_copying_stress.fe:57:9 + ┌─ data_copying_stress.fe:52:9 │ -57 │ my_array.clone()[3] = 5 +52 │ my_array.clone()[3] = 5 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -58 │ return my_array +53 │ return my_array │ ^^^^^^^^ Array: Memory note: - ┌─ data_copying_stress.fe:60:5 + ┌─ data_copying_stress.fe:56:5 │ -60 │ ╭ pub fn assign_my_nums_and_return(self) -> Array: -61 │ │ let my_nums_mem: Array -62 │ │ self.my_nums[0] = 42 -63 │ │ self.my_nums[1] = 26 +56 │ ╭ pub fn assign_my_nums_and_return(self) -> Array { +57 │ │ let my_nums_mem: Array +58 │ │ self.my_nums[0] = 42 +59 │ │ self.my_nums[1] = 26 · │ -67 │ │ my_nums_mem = self.my_nums.to_mem() -68 │ │ return my_nums_mem - │ ╰──────────────────────────^ attributes hash: 13146367689365512086 +64 │ │ return my_nums_mem +65 │ │ } + │ ╰─────^ attributes hash: 13146367689365512086 │ = FunctionSignature { self_decl: Some( @@ -608,133 +606,130 @@ note: } note: - ┌─ data_copying_stress.fe:61:26 + ┌─ data_copying_stress.fe:57:26 │ -61 │ let my_nums_mem: Array +57 │ let my_nums_mem: Array │ ^^^^^^^^^^^^^^ Array note: - ┌─ data_copying_stress.fe:62:9 + ┌─ data_copying_stress.fe:58:9 │ -62 │ self.my_nums[0] = 42 +58 │ self.my_nums[0] = 42 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:62:9 + ┌─ data_copying_stress.fe:58:9 │ -62 │ self.my_nums[0] = 42 +58 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:62:9 + ┌─ data_copying_stress.fe:58:9 │ -62 │ self.my_nums[0] = 42 +58 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: None } -63 │ self.my_nums[1] = 26 +59 │ self.my_nums[1] = 26 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:63:9 + ┌─ data_copying_stress.fe:59:9 │ -63 │ self.my_nums[1] = 26 +59 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:63:9 + ┌─ data_copying_stress.fe:59:9 │ -63 │ self.my_nums[1] = 26 +59 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: None } -64 │ self.my_nums[2] = 0 +60 │ self.my_nums[2] = 0 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:64:9 + ┌─ data_copying_stress.fe:60:9 │ -64 │ self.my_nums[2] = 0 +60 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:64:9 + ┌─ data_copying_stress.fe:60:9 │ -64 │ self.my_nums[2] = 0 +60 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } -65 │ self.my_nums[3] = 1 +61 │ self.my_nums[3] = 1 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:65:9 + ┌─ data_copying_stress.fe:61:9 │ -65 │ self.my_nums[3] = 1 +61 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:65:9 + ┌─ data_copying_stress.fe:61:9 │ -65 │ self.my_nums[3] = 1 +61 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } -66 │ self.my_nums[4] = 255 +62 │ self.my_nums[4] = 255 │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:66:9 + ┌─ data_copying_stress.fe:62:9 │ -66 │ self.my_nums[4] = 255 +62 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:66:9 + ┌─ data_copying_stress.fe:62:9 │ -66 │ self.my_nums[4] = 255 +62 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Storage { nonce: None } -67 │ my_nums_mem = self.my_nums.to_mem() +63 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^ ^^^^ Foo: Value │ │ │ Array: Memory note: - ┌─ data_copying_stress.fe:67:23 + ┌─ data_copying_stress.fe:63:23 │ -67 │ my_nums_mem = self.my_nums.to_mem() +63 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^^ Array: Storage { nonce: Some(4) } note: - ┌─ data_copying_stress.fe:67:23 + ┌─ data_copying_stress.fe:63:23 │ -67 │ my_nums_mem = self.my_nums.to_mem() +63 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(4) } => Memory -68 │ return my_nums_mem +64 │ return my_nums_mem │ ^^^^^^^^^^^ Array: Memory note: - ┌─ data_copying_stress.fe:70:5 + ┌─ data_copying_stress.fe:67:5 │ -70 │ ╭ pub fn emit_my_event(self, ctx: Context): -71 │ │ emit_my_event_internal( -72 │ │ ctx, -73 │ │ self.my_string.to_mem(), -74 │ │ self.my_u256.to_mem() -75 │ │ ) - │ ╰─────────^ attributes hash: 1731341862738941170 +67 │ ╭ pub fn emit_my_event(self, ctx: Context) { +68 │ │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) +69 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -765,55 +760,52 @@ note: } note: - ┌─ data_copying_stress.fe:72:13 + ┌─ data_copying_stress.fe:68:32 │ -72 │ ctx, - │ ^^^ Context: Memory -73 │ self.my_string.to_mem(), - │ ^^^^ Foo: Value +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^ ^^^^ Foo: Value + │ │ + │ Context: Memory note: - ┌─ data_copying_stress.fe:73:13 + ┌─ data_copying_stress.fe:68:37 │ -73 │ self.my_string.to_mem(), - │ ^^^^^^^^^^^^^^ String<42>: Storage { nonce: Some(0) } +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^^^^^^^^^^^^ String<42>: Storage { nonce: Some(0) } note: - ┌─ data_copying_stress.fe:73:13 + ┌─ data_copying_stress.fe:68:37 │ -73 │ self.my_string.to_mem(), - │ ^^^^^^^^^^^^^^^^^^^^^^^ String<42>: Storage { nonce: Some(0) } => Memory -74 │ self.my_u256.to_mem() - │ ^^^^ Foo: Value +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ String<42>: Storage { nonce: Some(0) } => Memory note: - ┌─ data_copying_stress.fe:74:13 + ┌─ data_copying_stress.fe:68:62 │ -74 │ self.my_u256.to_mem() - │ ^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } note: - ┌─ data_copying_stress.fe:74:13 + ┌─ data_copying_stress.fe:68:62 │ -74 │ self.my_u256.to_mem() - │ ^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value note: - ┌─ data_copying_stress.fe:71:9 - │ -71 │ ╭ emit_my_event_internal( -72 │ │ ctx, -73 │ │ self.my_string.to_mem(), -74 │ │ self.my_u256.to_mem() -75 │ │ ) - │ ╰─────────^ (): Value + ┌─ data_copying_stress.fe:68:9 + │ +68 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: - ┌─ data_copying_stress.fe:77:5 + ┌─ data_copying_stress.fe:71:5 │ -77 │ ╭ fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256): -78 │ │ emit MyEvent(ctx, my_string, my_u256) - │ ╰─────────────────────────────────────────────^ attributes hash: 15658342901286022244 +71 │ ╭ fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256) { +72 │ │ emit MyEvent(ctx, my_string, my_u256) +73 │ │ } + │ ╰─────^ attributes hash: 15658342901286022244 │ = FunctionSignature { self_decl: None, @@ -868,18 +860,18 @@ note: } note: - ┌─ data_copying_stress.fe:78:22 + ┌─ data_copying_stress.fe:72:22 │ -78 │ emit MyEvent(ctx, my_string, my_u256) +72 │ emit MyEvent(ctx, my_string, my_u256) │ ^^^ ^^^^^^^^^ ^^^^^^^ u256: Value │ │ │ │ │ String<42>: Memory │ Context: Memory note: - ┌─ data_copying_stress.fe:78:9 + ┌─ data_copying_stress.fe:72:9 │ -78 │ emit MyEvent(ctx, my_string, my_u256) +72 │ emit MyEvent(ctx, my_string, my_u256) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 595206297963940250 │ = Event { @@ -911,11 +903,12 @@ note: } note: - ┌─ data_copying_stress.fe:80:5 + ┌─ data_copying_stress.fe:75:5 │ -80 │ ╭ pub fn set_my_addrs(self, my_addrs: Array): -81 │ │ self.my_addrs = my_addrs - │ ╰────────────────────────────────^ attributes hash: 1347763946351267085 +75 │ ╭ pub fn set_my_addrs(self, my_addrs: Array) { +76 │ │ self.my_addrs = my_addrs +77 │ │ } + │ ╰─────^ attributes hash: 1347763946351267085 │ = FunctionSignature { self_decl: Some( @@ -944,25 +937,26 @@ note: } note: - ┌─ data_copying_stress.fe:81:9 + ┌─ data_copying_stress.fe:76:9 │ -81 │ self.my_addrs = my_addrs +76 │ self.my_addrs = my_addrs │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:81:9 + ┌─ data_copying_stress.fe:76:9 │ -81 │ self.my_addrs = my_addrs +76 │ self.my_addrs = my_addrs │ ^^^^^^^^^^^^^ ^^^^^^^^ Array: Memory │ │ │ Array: Storage { nonce: Some(5) } note: - ┌─ data_copying_stress.fe:83:5 + ┌─ data_copying_stress.fe:79:5 │ -83 │ ╭ pub fn get_my_second_addr(self) -> address: -84 │ │ return self.my_addrs[1] - │ ╰───────────────────────────────^ attributes hash: 227275695522088782 +79 │ ╭ pub fn get_my_second_addr(self) -> address { +80 │ │ return self.my_addrs[1] +81 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -978,23 +972,23 @@ note: } note: - ┌─ data_copying_stress.fe:84:16 + ┌─ data_copying_stress.fe:80:16 │ -84 │ return self.my_addrs[1] +80 │ return self.my_addrs[1] │ ^^^^ Foo: Value note: - ┌─ data_copying_stress.fe:84:16 + ┌─ data_copying_stress.fe:80:16 │ -84 │ return self.my_addrs[1] +80 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(5) } note: - ┌─ data_copying_stress.fe:84:16 + ┌─ data_copying_stress.fe:80:16 │ -84 │ return self.my_addrs[1] +80 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^^^^ address: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__empty.snap b/crates/analyzer/tests/snapshots/analysis__empty.snap index 7fcab83a3c..1c42536e4a 100644 --- a/crates/analyzer/tests/snapshots/analysis__empty.snap +++ b/crates/analyzer/tests/snapshots/analysis__empty.snap @@ -4,9 +4,9 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ empty.fe:2:3 + ┌─ empty.fe:2:5 │ -2 │ lonely: u256 - │ ^^^^^^^^^^^^ u256 +2 │ lonely: u256 + │ ^^^^^^^^^^^^ u256 diff --git a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap index 7021b3f67a..e0f2aa6e45 100644 --- a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap +++ b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap @@ -30,21 +30,22 @@ note: │ ^^^^^^^^^^^ u256 note: - ┌─ erc20_token.fe:17:9 + ┌─ erc20_token.fe:18:9 │ -17 │ idx from: address +18 │ idx from: address │ ^^^^^^^^^^^^^^^^^ address -18 │ idx to: address +19 │ idx to: address │ ^^^^^^^^^^^^^^^ address -19 │ value: u256 +20 │ value: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ erc20_token.fe:27:5 + ┌─ erc20_token.fe:30:5 │ -27 │ ╭ pub fn name(self) -> String<100>: -28 │ │ return self._name.to_mem() - │ ╰──────────────────────────────────^ attributes hash: 2936475649167061923 +30 │ ╭ pub fn name(self) -> String<100> { +31 │ │ return self._name.to_mem() +32 │ │ } + │ ╰─────^ attributes hash: 2936475649167061923 │ = FunctionSignature { self_decl: Some( @@ -62,29 +63,30 @@ note: } note: - ┌─ erc20_token.fe:28:16 + ┌─ erc20_token.fe:31:16 │ -28 │ return self._name.to_mem() +31 │ return self._name.to_mem() │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:28:16 + ┌─ erc20_token.fe:31:16 │ -28 │ return self._name.to_mem() +31 │ return self._name.to_mem() │ ^^^^^^^^^^ String<100>: Storage { nonce: Some(3) } note: - ┌─ erc20_token.fe:28:16 + ┌─ erc20_token.fe:31:16 │ -28 │ return self._name.to_mem() +31 │ return self._name.to_mem() │ ^^^^^^^^^^^^^^^^^^^ String<100>: Storage { nonce: Some(3) } => Memory note: - ┌─ erc20_token.fe:30:5 + ┌─ erc20_token.fe:34:5 │ -30 │ ╭ pub fn symbol(self) -> String<100>: -31 │ │ return self._symbol.to_mem() - │ ╰────────────────────────────────────^ attributes hash: 2936475649167061923 +34 │ ╭ pub fn symbol(self) -> String<100> { +35 │ │ return self._symbol.to_mem() +36 │ │ } + │ ╰─────^ attributes hash: 2936475649167061923 │ = FunctionSignature { self_decl: Some( @@ -102,29 +104,30 @@ note: } note: - ┌─ erc20_token.fe:31:16 + ┌─ erc20_token.fe:35:16 │ -31 │ return self._symbol.to_mem() +35 │ return self._symbol.to_mem() │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:31:16 + ┌─ erc20_token.fe:35:16 │ -31 │ return self._symbol.to_mem() +35 │ return self._symbol.to_mem() │ ^^^^^^^^^^^^ String<100>: Storage { nonce: Some(4) } note: - ┌─ erc20_token.fe:31:16 + ┌─ erc20_token.fe:35:16 │ -31 │ return self._symbol.to_mem() +35 │ return self._symbol.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^ String<100>: Storage { nonce: Some(4) } => Memory note: - ┌─ erc20_token.fe:33:5 + ┌─ erc20_token.fe:38:5 │ -33 │ ╭ pub fn decimals(self) -> u8: -34 │ │ return self._decimals - │ ╰─────────────────────────────^ attributes hash: 11864308689780915279 +38 │ ╭ pub fn decimals(self) -> u8 { +39 │ │ return self._decimals +40 │ │ } + │ ╰─────^ attributes hash: 11864308689780915279 │ = FunctionSignature { self_decl: Some( @@ -142,23 +145,24 @@ note: } note: - ┌─ erc20_token.fe:34:16 + ┌─ erc20_token.fe:39:16 │ -34 │ return self._decimals +39 │ return self._decimals │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:34:16 + ┌─ erc20_token.fe:39:16 │ -34 │ return self._decimals +39 │ return self._decimals │ ^^^^^^^^^^^^^^ u8: Storage { nonce: Some(5) } => Value note: - ┌─ erc20_token.fe:36:5 + ┌─ erc20_token.fe:42:5 │ -36 │ ╭ pub fn totalSupply(self) -> u256: -37 │ │ return self._total_supply - │ ╰─────────────────────────────────^ attributes hash: 11773348765973600208 +42 │ ╭ pub fn totalSupply(self) -> u256 { +43 │ │ return self._total_supply +44 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -176,23 +180,24 @@ note: } note: - ┌─ erc20_token.fe:37:16 + ┌─ erc20_token.fe:43:16 │ -37 │ return self._total_supply +43 │ return self._total_supply │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:37:16 + ┌─ erc20_token.fe:43:16 │ -37 │ return self._total_supply +43 │ return self._total_supply │ ^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value note: - ┌─ erc20_token.fe:39:5 + ┌─ erc20_token.fe:46:5 │ -39 │ ╭ pub fn balanceOf(self, _ account: address) -> u256: -40 │ │ return self._balances[account] - │ ╰──────────────────────────────────────^ attributes hash: 5993653573135321647 +46 │ ╭ pub fn balanceOf(self, _ account: address) -> u256 { +47 │ │ return self._balances[account] +48 │ │ } + │ ╰─────^ attributes hash: 5993653573135321647 │ = FunctionSignature { self_decl: Some( @@ -222,32 +227,33 @@ note: } note: - ┌─ erc20_token.fe:40:16 + ┌─ erc20_token.fe:47:16 │ -40 │ return self._balances[account] +47 │ return self._balances[account] │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:40:16 + ┌─ erc20_token.fe:47:16 │ -40 │ return self._balances[account] +47 │ return self._balances[account] │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:40:16 + ┌─ erc20_token.fe:47:16 │ -40 │ return self._balances[account] +47 │ return self._balances[account] │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:42:5 + ┌─ erc20_token.fe:50:5 │ -42 │ ╭ pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool: -43 │ │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) -44 │ │ return true - │ ╰───────────────────^ attributes hash: 9700541873563816287 +50 │ ╭ pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool { +51 │ │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) +52 │ │ return true +53 │ │ } + │ ╰─────^ attributes hash: 9700541873563816287 │ = FunctionSignature { self_decl: Some( @@ -298,37 +304,38 @@ note: } note: - ┌─ erc20_token.fe:43:9 + ┌─ erc20_token.fe:51:9 │ -43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) +51 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:43:37 + ┌─ erc20_token.fe:51:37 │ -43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) +51 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:43:9 + ┌─ erc20_token.fe:51:9 │ -43 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) +51 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -44 │ return true +52 │ return true │ ^^^^ bool: Value note: - ┌─ erc20_token.fe:46:5 + ┌─ erc20_token.fe:55:5 │ -46 │ ╭ pub fn allowance(self, owner: address, spender: address) -> u256: -47 │ │ return self._allowances[owner][spender] - │ ╰───────────────────────────────────────────────^ attributes hash: 3316599995530573429 +55 │ ╭ pub fn allowance(self, owner: address, spender: address) -> u256 { +56 │ │ return self._allowances[owner][spender] +57 │ │ } + │ ╰─────^ attributes hash: 3316599995530573429 │ = FunctionSignature { self_decl: Some( @@ -365,40 +372,41 @@ note: } note: - ┌─ erc20_token.fe:47:16 + ┌─ erc20_token.fe:56:16 │ -47 │ return self._allowances[owner][spender] +56 │ return self._allowances[owner][spender] │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:47:16 + ┌─ erc20_token.fe:56:16 │ -47 │ return self._allowances[owner][spender] +56 │ return self._allowances[owner][spender] │ ^^^^^^^^^^^^^^^^ ^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:47:16 + ┌─ erc20_token.fe:56:16 │ -47 │ return self._allowances[owner][spender] +56 │ return self._allowances[owner][spender] │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:47:16 + ┌─ erc20_token.fe:56:16 │ -47 │ return self._allowances[owner][spender] +56 │ return self._allowances[owner][spender] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:49:5 + ┌─ erc20_token.fe:59:5 │ -49 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: -50 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) -51 │ │ return true - │ ╰───────────────────^ attributes hash: 8309406699454253603 +59 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { +60 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +61 │ │ return true +62 │ │ } + │ ╰─────^ attributes hash: 8309406699454253603 │ = FunctionSignature { self_decl: Some( @@ -449,40 +457,41 @@ note: } note: - ┌─ erc20_token.fe:50:9 + ┌─ erc20_token.fe:60:9 │ -50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:50:35 + ┌─ erc20_token.fe:60:35 │ -50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:50:9 + ┌─ erc20_token.fe:60:9 │ -50 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -51 │ return true +61 │ return true │ ^^^^ bool: Value note: - ┌─ erc20_token.fe:53:5 + ┌─ erc20_token.fe:64:5 │ -53 │ ╭ pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool: -54 │ │ assert self._allowances[sender][ctx.msg_sender()] >= value -55 │ │ self._transfer(ctx, sender, recipient, value) -56 │ │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) -57 │ │ return true - │ ╰───────────────────^ attributes hash: 14464733394183378558 +64 │ ╭ pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool { +65 │ │ assert self._allowances[sender][ctx.msg_sender()] >= value +66 │ │ self._transfer(ctx, sender, recipient, value) +67 │ │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +68 │ │ return true +69 │ │ } + │ ╰─────^ attributes hash: 14464733394183378558 │ = FunctionSignature { self_decl: Some( @@ -542,47 +551,47 @@ note: } note: - ┌─ erc20_token.fe:54:16 + ┌─ erc20_token.fe:65:16 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:54:16 + ┌─ erc20_token.fe:65:16 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:54:16 + ┌─ erc20_token.fe:65:16 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:54:41 + ┌─ erc20_token.fe:65:41 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:54:16 + ┌─ erc20_token.fe:65:16 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:54:16 + ┌─ erc20_token.fe:65:16 │ -54 │ assert self._allowances[sender][ctx.msg_sender()] >= value +65 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -55 │ self._transfer(ctx, sender, recipient, value) +66 │ self._transfer(ctx, sender, recipient, value) │ ^^^^ ^^^ ^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ │ │ │ │ address: Value @@ -591,11 +600,11 @@ note: │ ERC20: Value note: - ┌─ erc20_token.fe:55:9 + ┌─ erc20_token.fe:66:9 │ -55 │ self._transfer(ctx, sender, recipient, value) +66 │ self._transfer(ctx, sender, recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^ ^^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ │ │ address: Value @@ -603,64 +612,65 @@ note: │ ERC20: Value note: - ┌─ erc20_token.fe:56:52 + ┌─ erc20_token.fe:67:52 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value │ │ │ address: Value note: - ┌─ erc20_token.fe:56:77 + ┌─ erc20_token.fe:67:77 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:56:77 + ┌─ erc20_token.fe:67:77 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:56:102 + ┌─ erc20_token.fe:67:102 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:56:77 + ┌─ erc20_token.fe:67:77 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:56:77 + ┌─ erc20_token.fe:67:77 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ erc20_token.fe:56:9 + ┌─ erc20_token.fe:67:9 │ -56 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) +67 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -57 │ return true +68 │ return true │ ^^^^ bool: Value note: - ┌─ erc20_token.fe:59:5 + ┌─ erc20_token.fe:71:5 │ -59 │ ╭ pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool: -60 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) -61 │ │ return true - │ ╰───────────────────^ attributes hash: 14606848714789380929 +71 │ ╭ pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool { +72 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +73 │ │ return true +74 │ │ } + │ ╰─────^ attributes hash: 14606848714789380929 │ = FunctionSignature { self_decl: Some( @@ -711,74 +721,75 @@ note: } note: - ┌─ erc20_token.fe:60:9 + ┌─ erc20_token.fe:72:9 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:60:35 + ┌─ erc20_token.fe:72:35 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:60:69 + ┌─ erc20_token.fe:72:69 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:60:86 + ┌─ erc20_token.fe:72:86 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:60:69 + ┌─ erc20_token.fe:72:69 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:60:69 + ┌─ erc20_token.fe:72:69 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:60:69 + ┌─ erc20_token.fe:72:69 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ erc20_token.fe:60:9 + ┌─ erc20_token.fe:72:9 │ -60 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) +72 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -61 │ return true +73 │ return true │ ^^^^ bool: Value note: - ┌─ erc20_token.fe:63:5 + ┌─ erc20_token.fe:76:5 │ -63 │ ╭ pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool: -64 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) -65 │ │ return true - │ ╰───────────────────^ attributes hash: 9154612140799800808 +76 │ ╭ pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool { +77 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +78 │ │ return true +79 │ │ } + │ ╰─────^ attributes hash: 9154612140799800808 │ = FunctionSignature { self_decl: Some( @@ -829,78 +840,78 @@ note: } note: - ┌─ erc20_token.fe:64:9 + ┌─ erc20_token.fe:77:9 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ ERC20: Value note: - ┌─ erc20_token.fe:64:35 + ┌─ erc20_token.fe:77:35 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:64:69 + ┌─ erc20_token.fe:77:69 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ erc20_token.fe:64:86 + ┌─ erc20_token.fe:77:86 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:64:69 + ┌─ erc20_token.fe:77:69 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ erc20_token.fe:64:69 + ┌─ erc20_token.fe:77:69 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:64:69 + ┌─ erc20_token.fe:77:69 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ erc20_token.fe:64:9 + ┌─ erc20_token.fe:77:9 │ -64 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) +77 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -65 │ return true +78 │ return true │ ^^^^ bool: Value note: - ┌─ erc20_token.fe:67:5 + ┌─ erc20_token.fe:81:5 │ -67 │ ╭ fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256): -68 │ │ assert sender != address(0) -69 │ │ assert recipient != address(0) -70 │ │ _before_token_transfer(from: sender, to: recipient, value) -71 │ │ self._balances[sender] = self._balances[sender] - value -72 │ │ self._balances[recipient] = self._balances[recipient] + value -73 │ │ emit Transfer(ctx, from: sender, to: recipient, value) - │ ╰──────────────────────────────────────────────────────────────^ attributes hash: 10648262769466339085 +81 │ ╭ fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256) { +82 │ │ assert sender != address(0) +83 │ │ assert recipient != address(0) +84 │ │ _before_token_transfer(from: sender, to: recipient, value) + · │ +87 │ │ emit Transfer(ctx, from: sender, to: recipient, value) +88 │ │ } + │ ╰─────^ attributes hash: 10648262769466339085 │ = FunctionSignature { self_decl: Some( @@ -960,132 +971,132 @@ note: } note: - ┌─ erc20_token.fe:68:16 + ┌─ erc20_token.fe:82:16 │ -68 │ assert sender != address(0) +82 │ assert sender != address(0) │ ^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ erc20_token.fe:68:26 + ┌─ erc20_token.fe:82:26 │ -68 │ assert sender != address(0) +82 │ assert sender != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:68:16 + ┌─ erc20_token.fe:82:16 │ -68 │ assert sender != address(0) +82 │ assert sender != address(0) │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -69 │ assert recipient != address(0) +83 │ assert recipient != address(0) │ ^^^^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ erc20_token.fe:69:29 + ┌─ erc20_token.fe:83:29 │ -69 │ assert recipient != address(0) +83 │ assert recipient != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:69:16 + ┌─ erc20_token.fe:83:16 │ -69 │ assert recipient != address(0) +83 │ assert recipient != address(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -70 │ _before_token_transfer(from: sender, to: recipient, value) +84 │ _before_token_transfer(from: sender, to: recipient, value) │ ^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:70:9 + ┌─ erc20_token.fe:84:9 │ -70 │ _before_token_transfer(from: sender, to: recipient, value) +84 │ _before_token_transfer(from: sender, to: recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:71:9 + ┌─ erc20_token.fe:85:9 │ -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:71:9 + ┌─ erc20_token.fe:85:9 │ -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ erc20_token.fe:71:34 + ┌─ erc20_token.fe:85:34 │ -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:71:34 + ┌─ erc20_token.fe:85:34 │ -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:71:34 + ┌─ erc20_token.fe:85:34 │ -71 │ self._balances[sender] = self._balances[sender] - value +85 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:72:9 + ┌─ erc20_token.fe:86:9 │ -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^ ^^^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:72:9 + ┌─ erc20_token.fe:86:9 │ -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ erc20_token.fe:72:37 + ┌─ erc20_token.fe:86:37 │ -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^ ^^^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:72:37 + ┌─ erc20_token.fe:86:37 │ -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:72:37 + ┌─ erc20_token.fe:86:37 │ -72 │ self._balances[recipient] = self._balances[recipient] + value +86 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -73 │ emit Transfer(ctx, from: sender, to: recipient, value) +87 │ emit Transfer(ctx, from: sender, to: recipient, value) │ ^^^ ^^^^^^ ^^^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ │ │ address: Value @@ -1093,9 +1104,9 @@ note: │ Context: Memory note: - ┌─ erc20_token.fe:73:9 + ┌─ erc20_token.fe:87:9 │ -73 │ emit Transfer(ctx, from: sender, to: recipient, value) +87 │ emit Transfer(ctx, from: sender, to: recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 │ = Event { @@ -1134,15 +1145,16 @@ note: } note: - ┌─ erc20_token.fe:75:5 + ┌─ erc20_token.fe:90:5 │ -75 │ ╭ fn _mint(self, ctx: Context, account: address, value: u256): -76 │ │ assert account != address(0) -77 │ │ _before_token_transfer(from: address(0), to: account, value) -78 │ │ self._total_supply = self._total_supply + value -79 │ │ self._balances[account] = self._balances[account] + value -80 │ │ emit Transfer(ctx, from: address(0), to: account, value) - │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 6502254374233415580 +90 │ ╭ fn _mint(self, ctx: Context, account: address, value: u256) { +91 │ │ assert account != address(0) +92 │ │ _before_token_transfer(from: address(0), to: account, value) +93 │ │ self._total_supply = self._total_supply + value +94 │ │ self._balances[account] = self._balances[account] + value +95 │ │ emit Transfer(ctx, from: address(0), to: account, value) +96 │ │ } + │ ╰─────^ attributes hash: 6502254374233415580 │ = FunctionSignature { self_decl: Some( @@ -1193,338 +1205,123 @@ note: } note: - ┌─ erc20_token.fe:76:16 + ┌─ erc20_token.fe:91:16 │ -76 │ assert account != address(0) +91 │ assert account != address(0) │ ^^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ erc20_token.fe:76:27 + ┌─ erc20_token.fe:91:27 │ -76 │ assert account != address(0) +91 │ assert account != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:76:16 + ┌─ erc20_token.fe:91:16 │ -76 │ assert account != address(0) +91 │ assert account != address(0) │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -77 │ _before_token_transfer(from: address(0), to: account, value) +92 │ _before_token_transfer(from: address(0), to: account, value) │ ^ u256: Value note: - ┌─ erc20_token.fe:77:38 + ┌─ erc20_token.fe:92:38 │ -77 │ _before_token_transfer(from: address(0), to: account, value) +92 │ _before_token_transfer(from: address(0), to: account, value) │ ^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:77:9 + ┌─ erc20_token.fe:92:9 │ -77 │ _before_token_transfer(from: address(0), to: account, value) +92 │ _before_token_transfer(from: address(0), to: account, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -78 │ self._total_supply = self._total_supply + value +93 │ self._total_supply = self._total_supply + value │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:78:9 + ┌─ erc20_token.fe:93:9 │ -78 │ self._total_supply = self._total_supply + value +93 │ self._total_supply = self._total_supply + value │ ^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value │ │ │ u256: Storage { nonce: Some(2) } note: - ┌─ erc20_token.fe:78:30 + ┌─ erc20_token.fe:93:30 │ -78 │ self._total_supply = self._total_supply + value +93 │ self._total_supply = self._total_supply + value │ ^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } => Value note: - ┌─ erc20_token.fe:78:30 + ┌─ erc20_token.fe:93:30 │ -78 │ self._total_supply = self._total_supply + value +93 │ self._total_supply = self._total_supply + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^ ERC20: Value note: - ┌─ erc20_token.fe:79:9 + ┌─ erc20_token.fe:94:9 │ -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:79:9 + ┌─ erc20_token.fe:94:9 │ -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ erc20_token.fe:79:35 + ┌─ erc20_token.fe:94:35 │ -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ erc20_token.fe:79:35 + ┌─ erc20_token.fe:94:35 │ -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ erc20_token.fe:79:35 + ┌─ erc20_token.fe:94:35 │ -79 │ self._balances[account] = self._balances[account] + value +94 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -80 │ emit Transfer(ctx, from: address(0), to: account, value) +95 │ emit Transfer(ctx, from: address(0), to: account, value) │ ^^^ ^ u256: Value │ │ │ Context: Memory note: - ┌─ erc20_token.fe:80:34 + ┌─ erc20_token.fe:95:34 │ -80 │ emit Transfer(ctx, from: address(0), to: account, value) +95 │ emit Transfer(ctx, from: address(0), to: account, value) │ ^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ erc20_token.fe:80:9 - │ -80 │ emit Transfer(ctx, from: address(0), to: account, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 - │ - = Event { - name: "Transfer", - fields: [ - EventField { - name: "from", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "to", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - is_indexed: false, - }, - ], - } - -note: - ┌─ erc20_token.fe:82:5 - │ -82 │ ╭ fn _burn(self, ctx: Context, account: address, value: u256): -83 │ │ assert account != address(0) -84 │ │ _before_token_transfer(from: account, to: address(0), value) -85 │ │ self._balances[account] = self._balances[account] - value -86 │ │ self._total_supply = self._total_supply - value -87 │ │ emit Transfer(ctx, from: account, to: address(0), value) - │ ╰────────────────────────────────────────────────────────────────^ attributes hash: 6502254374233415580 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "account", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } - -note: - ┌─ erc20_token.fe:83:16 - │ -83 │ assert account != address(0) - │ ^^^^^^^ ^ u256: Value - │ │ - │ address: Value - -note: - ┌─ erc20_token.fe:83:27 - │ -83 │ assert account != address(0) - │ ^^^^^^^^^^ address: Value - -note: - ┌─ erc20_token.fe:83:16 - │ -83 │ assert account != address(0) - │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -84 │ _before_token_transfer(from: account, to: address(0), value) - │ ^^^^^^^ ^ u256: Value - │ │ - │ address: Value - -note: - ┌─ erc20_token.fe:84:51 - │ -84 │ _before_token_transfer(from: account, to: address(0), value) - │ ^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ address: Value - -note: - ┌─ erc20_token.fe:84:9 - │ -84 │ _before_token_transfer(from: account, to: address(0), value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^ ERC20: Value - -note: - ┌─ erc20_token.fe:85:9 - │ -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } - -note: - ┌─ erc20_token.fe:85:9 - │ -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value - │ │ - │ u256: Storage { nonce: None } - -note: - ┌─ erc20_token.fe:85:35 - │ -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } - -note: - ┌─ erc20_token.fe:85:35 - │ -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value - -note: - ┌─ erc20_token.fe:85:35 - │ -85 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -86 │ self._total_supply = self._total_supply - value - │ ^^^^ ERC20: Value - -note: - ┌─ erc20_token.fe:86:9 - │ -86 │ self._total_supply = self._total_supply - value - │ ^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value - │ │ - │ u256: Storage { nonce: Some(2) } - -note: - ┌─ erc20_token.fe:86:30 - │ -86 │ self._total_supply = self._total_supply - value - │ ^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: Some(2) } => Value - -note: - ┌─ erc20_token.fe:86:30 - │ -86 │ self._total_supply = self._total_supply - value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -87 │ emit Transfer(ctx, from: account, to: address(0), value) - │ ^^^ ^^^^^^^ ^ u256: Value - │ │ │ - │ │ address: Value - │ Context: Memory - -note: - ┌─ erc20_token.fe:87:47 - │ -87 │ emit Transfer(ctx, from: account, to: address(0), value) - │ ^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ address: Value - -note: - ┌─ erc20_token.fe:87:9 + ┌─ erc20_token.fe:95:9 │ -87 │ emit Transfer(ctx, from: account, to: address(0), value) +95 │ emit Transfer(ctx, from: address(0), to: account, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 │ = Event { @@ -1563,277 +1360,494 @@ note: } note: - ┌─ erc20_token.fe:89:5 - │ -89 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256): -90 │ │ assert owner != address(0) -91 │ │ assert spender != address(0) -92 │ │ self._allowances[owner][spender] = value -93 │ │ emit Approval(ctx, owner, spender, value) - │ ╰─────────────────────────────────────────────────^ attributes hash: 1630416716014819616 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "owner", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "spender", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } - -note: - ┌─ erc20_token.fe:90:16 - │ -90 │ assert owner != address(0) - │ ^^^^^ ^ u256: Value - │ │ - │ address: Value - -note: - ┌─ erc20_token.fe:90:25 - │ -90 │ assert owner != address(0) - │ ^^^^^^^^^^ address: Value - -note: - ┌─ erc20_token.fe:90:16 - │ -90 │ assert owner != address(0) - │ ^^^^^^^^^^^^^^^^^^^ bool: Value -91 │ assert spender != address(0) + ┌─ erc20_token.fe:98:5 + │ + 98 │ ╭ fn _burn(self, ctx: Context, account: address, value: u256) { + 99 │ │ assert account != address(0) +100 │ │ _before_token_transfer(from: account, to: address(0), value) +101 │ │ self._balances[account] = self._balances[account] - value +102 │ │ self._total_supply = self._total_supply - value +103 │ │ emit Transfer(ctx, from: account, to: address(0), value) +104 │ │ } + │ ╰─────^ attributes hash: 6502254374233415580 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "account", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } + +note: + ┌─ erc20_token.fe:99:16 + │ +99 │ assert account != address(0) │ ^^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ erc20_token.fe:91:27 + ┌─ erc20_token.fe:99:27 │ -91 │ assert spender != address(0) +99 │ assert account != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ erc20_token.fe:91:16 - │ -91 │ assert spender != address(0) - │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -92 │ self._allowances[owner][spender] = value - │ ^^^^ ERC20: Value - -note: - ┌─ erc20_token.fe:92:9 - │ -92 │ self._allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^^ ^^^^^ address: Value - │ │ - │ Map>: Storage { nonce: Some(1) } - -note: - ┌─ erc20_token.fe:92:9 - │ -92 │ self._allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: None } - -note: - ┌─ erc20_token.fe:92:9 - │ -92 │ self._allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } -93 │ emit Approval(ctx, owner, spender, value) - │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ │ - │ │ │ address: Value - │ │ address: Value - │ Context: Memory - -note: - ┌─ erc20_token.fe:93:9 - │ -93 │ emit Approval(ctx, owner, spender, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8893313742751514912 - │ - = Event { - name: "Approval", - fields: [ - EventField { - name: "owner", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "spender", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - is_indexed: false, - }, - ], - } - -note: - ┌─ erc20_token.fe:95:5 - │ -95 │ ╭ fn _setup_decimals(self, _ decimals_: u8): -96 │ │ self._decimals = decimals_ - │ ╰──────────────────────────────────^ attributes hash: 2241116105643912660 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: Some( - "_", - ), - name: "decimals_", - typ: Ok( - Base( - Numeric( - U8, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } - -note: - ┌─ erc20_token.fe:96:9 - │ -96 │ self._decimals = decimals_ - │ ^^^^ ERC20: Value - -note: - ┌─ erc20_token.fe:96:9 - │ -96 │ self._decimals = decimals_ - │ ^^^^^^^^^^^^^^ ^^^^^^^^^ u8: Value - │ │ - │ u8: Storage { nonce: Some(5) } - -note: - ┌─ erc20_token.fe:98:5 - │ -98 │ ╭ fn _before_token_transfer(from: address, to: address, _ value: u256): -99 │ │ pass - │ ╰────────────^ attributes hash: 10552855728897650120 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "from", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "to", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: Some( - "_", - ), - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ erc20_token.fe:99:16 + │ + 99 │ assert account != address(0) + │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value +100 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^ ^ u256: Value + │ │ + │ address: Value + +note: + ┌─ erc20_token.fe:100:51 + │ +100 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ address: Value + +note: + ┌─ erc20_token.fe:100:9 + │ +100 │ _before_token_transfer(from: account, to: address(0), value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^ ERC20: Value + +note: + ┌─ erc20_token.fe:101:9 + │ +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } + +note: + ┌─ erc20_token.fe:101:9 + │ +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value + │ │ + │ u256: Storage { nonce: None } + +note: + ┌─ erc20_token.fe:101:35 + │ +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } + +note: + ┌─ erc20_token.fe:101:35 + │ +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value + +note: + ┌─ erc20_token.fe:101:35 + │ +101 │ self._balances[account] = self._balances[account] - value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +102 │ self._total_supply = self._total_supply - value + │ ^^^^ ERC20: Value + +note: + ┌─ erc20_token.fe:102:9 + │ +102 │ self._total_supply = self._total_supply - value + │ ^^^^^^^^^^^^^^^^^^ ^^^^ ERC20: Value + │ │ + │ u256: Storage { nonce: Some(2) } + +note: + ┌─ erc20_token.fe:102:30 + │ +102 │ self._total_supply = self._total_supply - value + │ ^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: Some(2) } => Value + +note: + ┌─ erc20_token.fe:102:30 + │ +102 │ self._total_supply = self._total_supply - value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +103 │ emit Transfer(ctx, from: account, to: address(0), value) + │ ^^^ ^^^^^^^ ^ u256: Value + │ │ │ + │ │ address: Value + │ Context: Memory + +note: + ┌─ erc20_token.fe:103:47 + │ +103 │ emit Transfer(ctx, from: account, to: address(0), value) + │ ^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ address: Value + +note: + ┌─ erc20_token.fe:103:9 + │ +103 │ emit Transfer(ctx, from: account, to: address(0), value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 + │ + = Event { + name: "Transfer", + fields: [ + EventField { + name: "from", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "to", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + is_indexed: false, + }, + ], + } + +note: + ┌─ erc20_token.fe:106:5 + │ +106 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { +107 │ │ assert owner != address(0) +108 │ │ assert spender != address(0) +109 │ │ self._allowances[owner][spender] = value +110 │ │ emit Approval(ctx, owner, spender, value) +111 │ │ } + │ ╰─────^ attributes hash: 1630416716014819616 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "owner", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "spender", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } + +note: + ┌─ erc20_token.fe:107:16 + │ +107 │ assert owner != address(0) + │ ^^^^^ ^ u256: Value + │ │ + │ address: Value + +note: + ┌─ erc20_token.fe:107:25 + │ +107 │ assert owner != address(0) + │ ^^^^^^^^^^ address: Value + +note: + ┌─ erc20_token.fe:107:16 + │ +107 │ assert owner != address(0) + │ ^^^^^^^^^^^^^^^^^^^ bool: Value +108 │ assert spender != address(0) + │ ^^^^^^^ ^ u256: Value + │ │ + │ address: Value + +note: + ┌─ erc20_token.fe:108:27 + │ +108 │ assert spender != address(0) + │ ^^^^^^^^^^ address: Value + +note: + ┌─ erc20_token.fe:108:16 + │ +108 │ assert spender != address(0) + │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value +109 │ self._allowances[owner][spender] = value + │ ^^^^ ERC20: Value + +note: + ┌─ erc20_token.fe:109:9 + │ +109 │ self._allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^^ ^^^^^ address: Value + │ │ + │ Map>: Storage { nonce: Some(1) } + +note: + ┌─ erc20_token.fe:109:9 + │ +109 │ self._allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: None } + +note: + ┌─ erc20_token.fe:109:9 + │ +109 │ self._allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } +110 │ emit Approval(ctx, owner, spender, value) + │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ │ + │ │ │ address: Value + │ │ address: Value + │ Context: Memory + +note: + ┌─ erc20_token.fe:110:9 + │ +110 │ emit Approval(ctx, owner, spender, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8893313742751514912 + │ + = Event { + name: "Approval", + fields: [ + EventField { + name: "owner", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "spender", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + is_indexed: false, + }, + ], + } + +note: + ┌─ erc20_token.fe:113:5 + │ +113 │ ╭ fn _setup_decimals(self, _ decimals_: u8) { +114 │ │ self._decimals = decimals_ +115 │ │ } + │ ╰─────^ attributes hash: 2241116105643912660 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: Some( + "_", + ), + name: "decimals_", + typ: Ok( + Base( + Numeric( + U8, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } + +note: + ┌─ erc20_token.fe:114:9 + │ +114 │ self._decimals = decimals_ + │ ^^^^ ERC20: Value + +note: + ┌─ erc20_token.fe:114:9 + │ +114 │ self._decimals = decimals_ + │ ^^^^^^^^^^^^^^ ^^^^^^^^^ u8: Value + │ │ + │ u8: Storage { nonce: Some(5) } + +note: + ┌─ erc20_token.fe:117:5 + │ +117 │ fn _before_token_transfer(from: address, to: address, _ value: u256) {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 10552855728897650120 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "from", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "to", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: Some( + "_", + ), + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } diff --git a/crates/analyzer/tests/snapshots/analysis__events.snap b/crates/analyzer/tests/snapshots/analysis__events.snap index fc6dc41b1e..b8b4b0633d 100644 --- a/crates/analyzer/tests/snapshots/analysis__events.snap +++ b/crates/analyzer/tests/snapshots/analysis__events.snap @@ -12,37 +12,38 @@ note: │ ^^^^^^^^^^ u256 note: - ┌─ events.fe:9:9 + ┌─ events.fe:10:9 │ - 9 │ num: u256 +10 │ num: u256 │ ^^^^^^^^^ u256 -10 │ addr: address +11 │ addr: address │ ^^^^^^^^^^^^^ address note: - ┌─ events.fe:13:9 + ┌─ events.fe:15:9 │ -13 │ num1: u256 +15 │ num1: u256 │ ^^^^^^^^^^ u256 -14 │ idx addr: address +16 │ idx addr: address │ ^^^^^^^^^^^^^^^^^ address -15 │ num2: u256 +17 │ num2: u256 │ ^^^^^^^^^^ u256 -16 │ my_bytes: Array +18 │ my_bytes: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ events.fe:19:9 + ┌─ events.fe:22:9 │ -19 │ addrs: Array +22 │ addrs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ events.fe:21:5 + ┌─ events.fe:25:5 │ -21 │ ╭ pub fn emit_nums(ctx: Context): -22 │ │ emit Nums(ctx, num1: 26, num2: 42) - │ ╰──────────────────────────────────────────^ attributes hash: 5519676733853656531 +25 │ ╭ pub fn emit_nums(ctx: Context) { +26 │ │ emit Nums(ctx, num1: 26, num2: 42) +27 │ │ } + │ ╰─────^ attributes hash: 5519676733853656531 │ = FunctionSignature { self_decl: None, @@ -71,18 +72,18 @@ note: } note: - ┌─ events.fe:22:19 + ┌─ events.fe:26:19 │ -22 │ emit Nums(ctx, num1: 26, num2: 42) +26 │ emit Nums(ctx, num1: 26, num2: 42) │ ^^^ ^^ ^^ u256: Value │ │ │ │ │ u256: Value │ Context: Memory note: - ┌─ events.fe:22:9 + ┌─ events.fe:26:9 │ -22 │ emit Nums(ctx, num1: 26, num2: 42) +26 │ emit Nums(ctx, num1: 26, num2: 42) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 4681095448721924839 │ = Event { @@ -114,11 +115,12 @@ note: } note: - ┌─ events.fe:24:5 + ┌─ events.fe:29:5 │ -24 │ ╭ pub fn emit_bases(ctx: Context, addr: address): -25 │ │ emit Bases(ctx, num: 26, addr) - │ ╰──────────────────────────────────────^ attributes hash: 15383426943610850221 +29 │ ╭ pub fn emit_bases(ctx: Context, addr: address) { +30 │ │ emit Bases(ctx, num: 26, addr) +31 │ │ } + │ ╰─────^ attributes hash: 15383426943610850221 │ = FunctionSignature { self_decl: None, @@ -156,18 +158,18 @@ note: } note: - ┌─ events.fe:25:20 + ┌─ events.fe:30:20 │ -25 │ emit Bases(ctx, num: 26, addr) +30 │ emit Bases(ctx, num: 26, addr) │ ^^^ ^^ ^^^^ address: Value │ │ │ │ │ u256: Value │ Context: Memory note: - ┌─ events.fe:25:9 + ┌─ events.fe:30:9 │ -25 │ emit Bases(ctx, num: 26, addr) +30 │ emit Bases(ctx, num: 26, addr) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 4407350417102602838 │ = Event { @@ -197,11 +199,12 @@ note: } note: - ┌─ events.fe:27:5 + ┌─ events.fe:33:5 │ -27 │ ╭ pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array): -28 │ │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) - │ ╰─────────────────────────────────────────────────────────^ attributes hash: 9652612436637375041 +33 │ ╭ pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array) { +34 │ │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) +35 │ │ } + │ ╰─────^ attributes hash: 9652612436637375041 │ = FunctionSignature { self_decl: None, @@ -253,9 +256,9 @@ note: } note: - ┌─ events.fe:28:18 + ┌─ events.fe:34:18 │ -28 │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) +34 │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) │ ^^^ ^^ ^^^^ ^^ ^^^^^^^^ Array: Memory │ │ │ │ │ │ │ │ │ u256: Value @@ -264,9 +267,9 @@ note: │ Context: Memory note: - ┌─ events.fe:28:9 + ┌─ events.fe:34:9 │ -28 │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) +34 │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12006518826467385253 │ = Event { @@ -321,14 +324,15 @@ note: } note: - ┌─ events.fe:30:5 + ┌─ events.fe:37:5 │ -30 │ ╭ pub fn emit_addresses(ctx: Context, addr1: address, addr2: address): -31 │ │ let addrs: Array -32 │ │ addrs[0] = addr1 -33 │ │ addrs[1] = addr2 -34 │ │ emit Addresses(ctx, addrs) - │ ╰──────────────────────────────────^ attributes hash: 18438233211486921531 +37 │ ╭ pub fn emit_addresses(ctx: Context, addr1: address, addr2: address) { +38 │ │ let addrs: Array +39 │ │ addrs[0] = addr1 +40 │ │ addrs[1] = addr2 +41 │ │ emit Addresses(ctx, addrs) +42 │ │ } + │ ╰─────^ attributes hash: 18438233211486921531 │ = FunctionSignature { self_decl: None, @@ -375,47 +379,47 @@ note: } note: - ┌─ events.fe:31:20 + ┌─ events.fe:38:20 │ -31 │ let addrs: Array +38 │ let addrs: Array │ ^^^^^^^^^^^^^^^^^ Array note: - ┌─ events.fe:32:9 + ┌─ events.fe:39:9 │ -32 │ addrs[0] = addr1 +39 │ addrs[0] = addr1 │ ^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ events.fe:32:9 + ┌─ events.fe:39:9 │ -32 │ addrs[0] = addr1 +39 │ addrs[0] = addr1 │ ^^^^^^^^ ^^^^^ address: Value │ │ │ address: Memory -33 │ addrs[1] = addr2 +40 │ addrs[1] = addr2 │ ^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ events.fe:33:9 + ┌─ events.fe:40:9 │ -33 │ addrs[1] = addr2 +40 │ addrs[1] = addr2 │ ^^^^^^^^ ^^^^^ address: Value │ │ │ address: Memory -34 │ emit Addresses(ctx, addrs) +41 │ emit Addresses(ctx, addrs) │ ^^^ ^^^^^ Array: Memory │ │ │ Context: Memory note: - ┌─ events.fe:34:9 + ┌─ events.fe:41:9 │ -34 │ emit Addresses(ctx, addrs) +41 │ emit Addresses(ctx, addrs) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 17766225573703958283 │ = Event { diff --git a/crates/analyzer/tests/snapshots/analysis__external_contract.snap b/crates/analyzer/tests/snapshots/analysis__external_contract.snap index 49f62b9758..10037f97cc 100644 --- a/crates/analyzer/tests/snapshots/analysis__external_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__external_contract.snap @@ -14,11 +14,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^ String<11> note: - ┌─ external_contract.fe:9:5 + ┌─ external_contract.fe:10:5 │ - 9 │ ╭ pub fn emit_event(ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>): -10 │ │ emit MyEvent(ctx, my_num, my_addrs, my_string) - │ ╰──────────────────────────────────────────────────────^ attributes hash: 14584319691445179306 +10 │ ╭ pub fn emit_event(ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>) { +11 │ │ emit MyEvent(ctx, my_num, my_addrs, my_string) +12 │ │ } + │ ╰─────^ attributes hash: 14584319691445179306 │ = FunctionSignature { self_decl: None, @@ -81,9 +82,9 @@ note: } note: - ┌─ external_contract.fe:10:22 + ┌─ external_contract.fe:11:22 │ -10 │ emit MyEvent(ctx, my_num, my_addrs, my_string) +11 │ emit MyEvent(ctx, my_num, my_addrs, my_string) │ ^^^ ^^^^^^ ^^^^^^^^ ^^^^^^^^^ String<11>: Memory │ │ │ │ │ │ │ Array: Memory @@ -91,9 +92,9 @@ note: │ Context: Memory note: - ┌─ external_contract.fe:10:9 + ┌─ external_contract.fe:11:9 │ -10 │ emit MyEvent(ctx, my_num, my_addrs, my_string) +11 │ emit MyEvent(ctx, my_num, my_addrs, my_string) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 3872046667435269452 │ = Event { @@ -137,15 +138,16 @@ note: } note: - ┌─ external_contract.fe:12:5 + ┌─ external_contract.fe:14:5 │ -12 │ ╭ pub fn build_array(a: u256, b: u256) -> Array: -13 │ │ let my_array: Array -14 │ │ my_array[0] = a -15 │ │ my_array[1] = a * b -16 │ │ my_array[2] = b -17 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 14276910879408601208 +14 │ ╭ pub fn build_array(a: u256, b: u256) -> Array { +15 │ │ let my_array: Array +16 │ │ my_array[0] = a +17 │ │ my_array[1] = a * b +18 │ │ my_array[2] = b +19 │ │ return my_array +20 │ │ } + │ ╰─────^ attributes hash: 14276910879408601208 │ = FunctionSignature { self_decl: None, @@ -187,71 +189,68 @@ note: } note: - ┌─ external_contract.fe:13:23 + ┌─ external_contract.fe:15:23 │ -13 │ let my_array: Array +15 │ let my_array: Array │ ^^^^^^^^^^^^^^ Array note: - ┌─ external_contract.fe:14:9 + ┌─ external_contract.fe:16:9 │ -14 │ my_array[0] = a +16 │ my_array[0] = a │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ external_contract.fe:14:9 + ┌─ external_contract.fe:16:9 │ -14 │ my_array[0] = a +16 │ my_array[0] = a │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -15 │ my_array[1] = a * b +17 │ my_array[1] = a * b │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ external_contract.fe:15:9 + ┌─ external_contract.fe:17:9 │ -15 │ my_array[1] = a * b +17 │ my_array[1] = a * b │ ^^^^^^^^^^^ ^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Memory note: - ┌─ external_contract.fe:15:23 + ┌─ external_contract.fe:17:23 │ -15 │ my_array[1] = a * b +17 │ my_array[1] = a * b │ ^^^^^ u256: Value -16 │ my_array[2] = b +18 │ my_array[2] = b │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ external_contract.fe:16:9 + ┌─ external_contract.fe:18:9 │ -16 │ my_array[2] = b +18 │ my_array[2] = b │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -17 │ return my_array +19 │ return my_array │ ^^^^^^^^ Array: Memory note: - ┌─ external_contract.fe:20:5 + ┌─ external_contract.fe:24:5 │ -20 │ ╭ pub fn call_emit_event( -21 │ │ ctx: Context, -22 │ │ foo_address: address, -23 │ │ my_num: u256, - · │ -27 │ │ let foo: Foo = Foo(ctx, foo_address) -28 │ │ foo.emit_event(my_num, my_addrs, my_string) - │ ╰───────────────────────────────────────────────────^ attributes hash: 11744736773867210426 +24 │ ╭ pub fn call_emit_event(ctx: Context, foo_address: address, my_num: u256, my_addrs: Array, my_string: String<11>) { +25 │ │ let foo: Foo = Foo(ctx, foo_address) +26 │ │ foo.emit_event(my_num, my_addrs, my_string) +27 │ │ } + │ ╰─────^ attributes hash: 11744736773867210426 │ = FunctionSignature { self_decl: None, @@ -323,25 +322,25 @@ note: } note: - ┌─ external_contract.fe:27:18 + ┌─ external_contract.fe:25:18 │ -27 │ let foo: Foo = Foo(ctx, foo_address) +25 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^ Foo note: - ┌─ external_contract.fe:27:28 + ┌─ external_contract.fe:25:28 │ -27 │ let foo: Foo = Foo(ctx, foo_address) +25 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^ ^^^^^^^^^^^ address: Value │ │ │ Context: Memory note: - ┌─ external_contract.fe:27:24 + ┌─ external_contract.fe:25:24 │ -27 │ let foo: Foo = Foo(ctx, foo_address) +25 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^^^^^^^^^^^^^^^^^^^ Foo: Value -28 │ foo.emit_event(my_num, my_addrs, my_string) +26 │ foo.emit_event(my_num, my_addrs, my_string) │ ^^^ ^^^^^^ ^^^^^^^^ ^^^^^^^^^ String<11>: Memory │ │ │ │ │ │ │ Array: Memory @@ -349,22 +348,19 @@ note: │ Foo: Value note: - ┌─ external_contract.fe:28:9 + ┌─ external_contract.fe:26:9 │ -28 │ foo.emit_event(my_num, my_addrs, my_string) +26 │ foo.emit_event(my_num, my_addrs, my_string) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: - ┌─ external_contract.fe:30:5 + ┌─ external_contract.fe:29:5 │ -30 │ ╭ pub fn call_build_array( -31 │ │ ctx: Context, -32 │ │ foo_address: address, -33 │ │ a: u256, - · │ -36 │ │ let foo: Foo = Foo(ctx, foo_address) -37 │ │ return foo.build_array(a, b) - │ ╰────────────────────────────────────^ attributes hash: 14801245347360386258 +29 │ ╭ pub fn call_build_array(ctx: Context, foo_address: address, a: u256, b: u256) -> Array { +30 │ │ let foo: Foo = Foo(ctx, foo_address) +31 │ │ return foo.build_array(a, b) +32 │ │ } + │ ╰─────^ attributes hash: 14801245347360386258 │ = FunctionSignature { self_decl: None, @@ -429,34 +425,34 @@ note: } note: - ┌─ external_contract.fe:36:18 + ┌─ external_contract.fe:30:18 │ -36 │ let foo: Foo = Foo(ctx, foo_address) +30 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^ Foo note: - ┌─ external_contract.fe:36:28 + ┌─ external_contract.fe:30:28 │ -36 │ let foo: Foo = Foo(ctx, foo_address) +30 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^ ^^^^^^^^^^^ address: Value │ │ │ Context: Memory note: - ┌─ external_contract.fe:36:24 + ┌─ external_contract.fe:30:24 │ -36 │ let foo: Foo = Foo(ctx, foo_address) +30 │ let foo: Foo = Foo(ctx, foo_address) │ ^^^^^^^^^^^^^^^^^^^^^ Foo: Value -37 │ return foo.build_array(a, b) +31 │ return foo.build_array(a, b) │ ^^^ ^ ^ u256: Value │ │ │ │ │ u256: Value │ Foo: Value note: - ┌─ external_contract.fe:37:16 + ┌─ external_contract.fe:31:16 │ -37 │ return foo.build_array(a, b) +31 │ return foo.build_array(a, b) │ ^^^^^^^^^^^^^^^^^^^^^ Array: Memory diff --git a/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap b/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap index 87eb86c651..56783e6d60 100644 --- a/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap +++ b/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap @@ -4,16 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ for_loop_with_break.fe:3:5 + ┌─ for_loop_with_break.fe:2:5 │ - 3 │ ╭ pub fn bar() -> u256: - 4 │ │ let my_array: Array - 5 │ │ my_array[0] = 5 - 6 │ │ my_array[1] = 10 + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ let my_array: Array + 4 │ │ my_array[0] = 5 + 5 │ │ my_array[1] = 10 · │ -12 │ │ break -13 │ │ return sum - │ ╰──────────────────^ attributes hash: 6115314201970082834 +14 │ │ return sum +15 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -29,80 +29,80 @@ note: } note: - ┌─ for_loop_with_break.fe:4:23 + ┌─ for_loop_with_break.fe:3:23 │ -4 │ let my_array: Array +3 │ let my_array: Array │ ^^^^^^^^^^^^^^ Array · -8 │ let sum: u256 = 0 +7 │ let sum: u256 = 0 │ ^^^^ u256 note: - ┌─ for_loop_with_break.fe:5:9 + ┌─ for_loop_with_break.fe:4:9 │ -5 │ my_array[0] = 5 +4 │ my_array[0] = 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_break.fe:5:9 + ┌─ for_loop_with_break.fe:4:9 │ -5 │ my_array[0] = 5 +4 │ my_array[0] = 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -6 │ my_array[1] = 10 +5 │ my_array[1] = 10 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_break.fe:6:9 + ┌─ for_loop_with_break.fe:5:9 │ -6 │ my_array[1] = 10 +5 │ my_array[1] = 10 │ ^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory -7 │ my_array[2] = 15 +6 │ my_array[2] = 15 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_break.fe:7:9 - │ - 7 │ my_array[2] = 15 - │ ^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory - 8 │ let sum: u256 = 0 - │ ^ u256: Value - 9 │ for i in my_array: - │ ^^^^^^^^ Array: Memory -10 │ sum = sum + i - │ ^^^ ^^^ ^ u256: Value - │ │ │ - │ │ u256: Value - │ u256: Value + ┌─ for_loop_with_break.fe:6:9 + │ +6 │ my_array[2] = 15 + │ ^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory +7 │ let sum: u256 = 0 + │ ^ u256: Value +8 │ for i in my_array { + │ ^^^^^^^^ Array: Memory +9 │ sum = sum + i + │ ^^^ ^^^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ for_loop_with_break.fe:10:19 + ┌─ for_loop_with_break.fe:9:19 │ -10 │ sum = sum + i + 9 │ sum = sum + i │ ^^^^^^^ u256: Value -11 │ if sum == 15: +10 │ if sum == 15 { │ ^^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ for_loop_with_break.fe:11:16 + ┌─ for_loop_with_break.fe:10:16 │ -11 │ if sum == 15: +10 │ if sum == 15 { │ ^^^^^^^^^ bool: Value -12 │ break -13 │ return sum + · +14 │ return sum │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap b/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap index 8cda06acd2..35eb020247 100644 --- a/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap +++ b/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap @@ -4,16 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ for_loop_with_continue.fe:3:5 + ┌─ for_loop_with_continue.fe:2:5 │ - 3 │ ╭ pub fn bar() -> u256: - 4 │ │ let my_array: Array - 5 │ │ my_array[0] = 2 - 6 │ │ my_array[1] = 3 + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ let my_array: Array + 4 │ │ my_array[0] = 2 + 5 │ │ my_array[1] = 3 · │ -14 │ │ sum = sum + i -15 │ │ return sum - │ ╰──────────────────^ attributes hash: 6115314201970082834 +16 │ │ return sum +17 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -29,100 +29,100 @@ note: } note: - ┌─ for_loop_with_continue.fe:4:23 - │ - 4 │ let my_array: Array - │ ^^^^^^^^^^^^^^ Array - · -10 │ let sum: u256 = 0 - │ ^^^^ u256 + ┌─ for_loop_with_continue.fe:3:23 + │ +3 │ let my_array: Array + │ ^^^^^^^^^^^^^^ Array + · +9 │ let sum: u256 = 0 + │ ^^^^ u256 note: - ┌─ for_loop_with_continue.fe:5:9 + ┌─ for_loop_with_continue.fe:4:9 │ -5 │ my_array[0] = 2 +4 │ my_array[0] = 2 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_continue.fe:5:9 + ┌─ for_loop_with_continue.fe:4:9 │ -5 │ my_array[0] = 2 +4 │ my_array[0] = 2 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -6 │ my_array[1] = 3 +5 │ my_array[1] = 3 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_continue.fe:6:9 + ┌─ for_loop_with_continue.fe:5:9 │ -6 │ my_array[1] = 3 +5 │ my_array[1] = 3 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -7 │ my_array[2] = 5 +6 │ my_array[2] = 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_continue.fe:7:9 + ┌─ for_loop_with_continue.fe:6:9 │ -7 │ my_array[2] = 5 +6 │ my_array[2] = 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -8 │ my_array[3] = 6 +7 │ my_array[3] = 6 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_continue.fe:8:9 + ┌─ for_loop_with_continue.fe:7:9 │ -8 │ my_array[3] = 6 +7 │ my_array[3] = 6 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -9 │ my_array[4] = 9 +8 │ my_array[4] = 9 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_continue.fe:9:9 + ┌─ for_loop_with_continue.fe:8:9 │ - 9 │ my_array[4] = 9 + 8 │ my_array[4] = 9 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -10 │ let sum: u256 = 0 + 9 │ let sum: u256 = 0 │ ^ u256: Value -11 │ for i in my_array: +10 │ for i in my_array { │ ^^^^^^^^ Array: Memory -12 │ if i % 2 == 0: +11 │ if i % 2 == 0 { │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ for_loop_with_continue.fe:12:16 + ┌─ for_loop_with_continue.fe:11:16 │ -12 │ if i % 2 == 0: +11 │ if i % 2 == 0 { │ ^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ for_loop_with_continue.fe:12:16 + ┌─ for_loop_with_continue.fe:11:16 │ -12 │ if i % 2 == 0: +11 │ if i % 2 == 0 { │ ^^^^^^^^^^ bool: Value -13 │ continue + · 14 │ sum = sum + i │ ^^^ ^^^ ^ u256: Value │ │ │ @@ -134,7 +134,8 @@ note: │ 14 │ sum = sum + i │ ^^^^^^^ u256: Value -15 │ return sum +15 │ } +16 │ return sum │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__for_loop_with_static_array.snap b/crates/analyzer/tests/snapshots/analysis__for_loop_with_static_array.snap index baf2f9b2f3..e7618187d7 100644 --- a/crates/analyzer/tests/snapshots/analysis__for_loop_with_static_array.snap +++ b/crates/analyzer/tests/snapshots/analysis__for_loop_with_static_array.snap @@ -4,16 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ for_loop_with_static_array.fe:3:5 + ┌─ for_loop_with_static_array.fe:2:5 │ - 3 │ ╭ pub fn bar() -> u256: - 4 │ │ let my_array: Array - 5 │ │ my_array[0] = 5 - 6 │ │ my_array[1] = 10 + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ let my_array: Array + 4 │ │ my_array[0] = 5 + 5 │ │ my_array[1] = 10 · │ -10 │ │ sum = sum + i 11 │ │ return sum - │ ╰──────────────────^ attributes hash: 6115314201970082834 +12 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -29,68 +29,69 @@ note: } note: - ┌─ for_loop_with_static_array.fe:4:23 + ┌─ for_loop_with_static_array.fe:3:23 │ -4 │ let my_array: Array +3 │ let my_array: Array │ ^^^^^^^^^^^^^^ Array · -8 │ let sum: u256 = 0 +7 │ let sum: u256 = 0 │ ^^^^ u256 note: - ┌─ for_loop_with_static_array.fe:5:9 + ┌─ for_loop_with_static_array.fe:4:9 │ -5 │ my_array[0] = 5 +4 │ my_array[0] = 5 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_static_array.fe:5:9 + ┌─ for_loop_with_static_array.fe:4:9 │ -5 │ my_array[0] = 5 +4 │ my_array[0] = 5 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -6 │ my_array[1] = 10 +5 │ my_array[1] = 10 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_static_array.fe:6:9 + ┌─ for_loop_with_static_array.fe:5:9 │ -6 │ my_array[1] = 10 +5 │ my_array[1] = 10 │ ^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory -7 │ my_array[2] = 15 +6 │ my_array[2] = 15 │ ^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ for_loop_with_static_array.fe:7:9 - │ - 7 │ my_array[2] = 15 - │ ^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory - 8 │ let sum: u256 = 0 - │ ^ u256: Value - 9 │ for i in my_array: - │ ^^^^^^^^ Array: Memory -10 │ sum = sum + i - │ ^^^ ^^^ ^ u256: Value - │ │ │ - │ │ u256: Value - │ u256: Value + ┌─ for_loop_with_static_array.fe:6:9 + │ +6 │ my_array[2] = 15 + │ ^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory +7 │ let sum: u256 = 0 + │ ^ u256: Value +8 │ for i in my_array { + │ ^^^^^^^^ Array: Memory +9 │ sum = sum + i + │ ^^^ ^^^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ for_loop_with_static_array.fe:10:19 + ┌─ for_loop_with_static_array.fe:9:19 │ -10 │ sum = sum + i + 9 │ sum = sum + i │ ^^^^^^^ u256: Value +10 │ } 11 │ return sum │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__guest_book.snap b/crates/analyzer/tests/snapshots/analysis__guest_book.snap index d3f469144b..11bf5cb11f 100644 --- a/crates/analyzer/tests/snapshots/analysis__guest_book.snap +++ b/crates/analyzer/tests/snapshots/analysis__guest_book.snap @@ -16,15 +16,16 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^ String<100> note: - ┌─ guest_book.fe:13:5 + ┌─ guest_book.fe:14:5 │ -13 │ ╭ pub fn sign(self, ctx: Context, book_msg: String<100>): -14 │ │ # All storage access is explicit using `self.` -15 │ │ self.messages[ctx.msg_sender()] = book_msg -16 │ │ -17 │ │ # Emit the `Signed` event -18 │ │ emit Signed(ctx, book_msg) - │ ╰──────────────────────────────────^ attributes hash: 12497999579229810685 +14 │ ╭ pub fn sign(self, ctx: Context, book_msg: String<100>) { +15 │ │ # All storage access is explicit using `self.` +16 │ │ self.messages[ctx.msg_sender()] = book_msg +17 │ │ +18 │ │ # Emit the `Signed` event +19 │ │ emit Signed(ctx, book_msg) +20 │ │ } + │ ╰─────^ attributes hash: 12497999579229810685 │ = FunctionSignature { self_decl: Some( @@ -66,42 +67,42 @@ note: } note: - ┌─ guest_book.fe:15:9 + ┌─ guest_book.fe:16:9 │ -15 │ self.messages[ctx.msg_sender()] = book_msg +16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^ GuestBook: Value note: - ┌─ guest_book.fe:15:9 + ┌─ guest_book.fe:16:9 │ -15 │ self.messages[ctx.msg_sender()] = book_msg +16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map>: Storage { nonce: Some(0) } note: - ┌─ guest_book.fe:15:23 + ┌─ guest_book.fe:16:23 │ -15 │ self.messages[ctx.msg_sender()] = book_msg +16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ guest_book.fe:15:9 + ┌─ guest_book.fe:16:9 │ -15 │ self.messages[ctx.msg_sender()] = book_msg +16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ String<100>: Memory │ │ │ String<100>: Storage { nonce: None } · -18 │ emit Signed(ctx, book_msg) +19 │ emit Signed(ctx, book_msg) │ ^^^ ^^^^^^^^ String<100>: Memory │ │ │ Context: Memory note: - ┌─ guest_book.fe:18:9 + ┌─ guest_book.fe:19:9 │ -18 │ emit Signed(ctx, book_msg) +19 │ emit Signed(ctx, book_msg) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 3840771212935086148 │ = Event { @@ -122,13 +123,14 @@ note: } note: - ┌─ guest_book.fe:20:5 + ┌─ guest_book.fe:22:5 │ -20 │ ╭ pub fn get_msg(self, addr: address) -> String<100>: -21 │ │ # Copying data from storage to memory -22 │ │ # has to be done explicitly via `to_mem()` -23 │ │ return self.messages[addr].to_mem() - │ ╰───────────────────────────────────────────^ attributes hash: 3325224293767249368 +22 │ ╭ pub fn get_msg(self, addr: address) -> String<100> { +23 │ │ # Copying data from storage to memory +24 │ │ # has to be done explicitly via `to_mem()` +25 │ │ return self.messages[addr].to_mem() +26 │ │ } + │ ╰─────^ attributes hash: 3325224293767249368 │ = FunctionSignature { self_decl: Some( @@ -156,29 +158,29 @@ note: } note: - ┌─ guest_book.fe:23:16 + ┌─ guest_book.fe:25:16 │ -23 │ return self.messages[addr].to_mem() +25 │ return self.messages[addr].to_mem() │ ^^^^ GuestBook: Value note: - ┌─ guest_book.fe:23:16 + ┌─ guest_book.fe:25:16 │ -23 │ return self.messages[addr].to_mem() +25 │ return self.messages[addr].to_mem() │ ^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(0) } note: - ┌─ guest_book.fe:23:16 + ┌─ guest_book.fe:25:16 │ -23 │ return self.messages[addr].to_mem() +25 │ return self.messages[addr].to_mem() │ ^^^^^^^^^^^^^^^^^^^ String<100>: Storage { nonce: None } note: - ┌─ guest_book.fe:23:16 + ┌─ guest_book.fe:25:16 │ -23 │ return self.messages[addr].to_mem() +25 │ return self.messages[addr].to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<100>: Storage { nonce: None } => Memory diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement.snap b/crates/analyzer/tests/snapshots/analysis__if_statement.snap index 29a6a0cbad..47bb9f2829 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement.snap @@ -4,14 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ if_statement.fe:3:5 + ┌─ if_statement.fe:2:5 │ -3 │ ╭ pub fn bar(input: u256) -> u256: -4 │ │ if input > 5: -5 │ │ return 1 -6 │ │ else: -7 │ │ return 0 - │ ╰────────────────────^ attributes hash: 10660199954095577886 +2 │ ╭ pub fn bar(input: u256) -> u256 { +3 │ │ if input > 5 { +4 │ │ return 1 +5 │ │ } else { +6 │ │ return 0 +7 │ │ } +8 │ │ } + │ ╰─────^ attributes hash: 10660199954095577886 │ = FunctionSignature { self_decl: None, @@ -39,22 +41,22 @@ note: } note: - ┌─ if_statement.fe:4:12 + ┌─ if_statement.fe:3:12 │ -4 │ if input > 5: +3 │ if input > 5 { │ ^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ if_statement.fe:4:12 + ┌─ if_statement.fe:3:12 │ -4 │ if input > 5: +3 │ if input > 5 { │ ^^^^^^^^^ bool: Value -5 │ return 1 +4 │ return 1 │ ^ u256: Value -6 │ else: -7 │ return 0 +5 │ } else { +6 │ return 0 │ ^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap index 325dfca1c3..5528c27edb 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap @@ -4,16 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ if_statement_2.fe:3:5 + ┌─ if_statement_2.fe:2:5 │ -3 │ ╭ pub fn bar(val: u256) -> u256: -4 │ │ if val > 5: -5 │ │ return 1 -6 │ │ else: -7 │ │ assert true -8 │ │ -9 │ │ return 0 - │ ╰────────────────^ attributes hash: 12367727332255217641 +2 │ ╭ pub fn bar(val: u256) -> u256 { +3 │ │ if val > 5 { +4 │ │ return 1 +5 │ │ } else { + · │ +8 │ │ return 0 +9 │ │ } + │ ╰─────^ attributes hash: 12367727332255217641 │ = FunctionSignature { self_decl: None, @@ -41,25 +41,25 @@ note: } note: - ┌─ if_statement_2.fe:4:12 + ┌─ if_statement_2.fe:3:12 │ -4 │ if val > 5: +3 │ if val > 5 { │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ if_statement_2.fe:4:12 + ┌─ if_statement_2.fe:3:12 │ -4 │ if val > 5: +3 │ if val > 5 { │ ^^^^^^^ bool: Value -5 │ return 1 +4 │ return 1 │ ^ u256: Value -6 │ else: -7 │ assert true +5 │ } else { +6 │ assert true │ ^^^^ bool: Value -8 │ -9 │ return 0 +7 │ } +8 │ return 0 │ ^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement_with_block_declaration.snap b/crates/analyzer/tests/snapshots/analysis__if_statement_with_block_declaration.snap index f8168eb92c..ed62510981 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement_with_block_declaration.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement_with_block_declaration.snap @@ -4,52 +4,52 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ if_statement_with_block_declaration.fe:3:5 - │ -3 │ ╭ pub fn bar() -> u256: -4 │ │ if true: -5 │ │ let y: u256 = 1 -6 │ │ return y -7 │ │ else: -8 │ │ let y: u256 = 1 -9 │ │ return y - │ ╰────────────────────^ attributes hash: 6115314201970082834 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ if_statement_with_block_declaration.fe:2:5 + │ + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ if true { + 4 │ │ let y: u256 = 1 + 5 │ │ return y + · │ + 9 │ │ } +10 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ if_statement_with_block_declaration.fe:5:20 + ┌─ if_statement_with_block_declaration.fe:4:20 │ -5 │ let y: u256 = 1 +4 │ let y: u256 = 1 │ ^^^^ u256 · -8 │ let y: u256 = 1 +7 │ let y: u256 = 1 │ ^^^^ u256 note: - ┌─ if_statement_with_block_declaration.fe:4:12 + ┌─ if_statement_with_block_declaration.fe:3:12 │ -4 │ if true: +3 │ if true { │ ^^^^ bool: Value -5 │ let y: u256 = 1 +4 │ let y: u256 = 1 │ ^ u256: Value -6 │ return y +5 │ return y │ ^ u256: Value -7 │ else: -8 │ let y: u256 = 1 +6 │ } else { +7 │ let y: u256 = 1 │ ^ u256: Value -9 │ return y +8 │ return y │ ^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__keccak.snap b/crates/analyzer/tests/snapshots/analysis__keccak.snap index d51510ad62..0710b6ac1d 100644 --- a/crates/analyzer/tests/snapshots/analysis__keccak.snap +++ b/crates/analyzer/tests/snapshots/analysis__keccak.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ keccak.fe:3:5 + ┌─ keccak.fe:2:5 │ -3 │ ╭ pub fn return_hash_from_u8(val: Array) -> u256: -4 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 6936681782057010951 +2 │ ╭ pub fn return_hash_from_u8(val: Array) -> u256 { +3 │ │ return keccak256(val) +4 │ │ } + │ ╰─────^ attributes hash: 6936681782057010951 │ = FunctionSignature { self_decl: None, @@ -39,23 +40,24 @@ note: } note: - ┌─ keccak.fe:4:26 + ┌─ keccak.fe:3:26 │ -4 │ return keccak256(val) +3 │ return keccak256(val) │ ^^^ Array: Memory note: - ┌─ keccak.fe:4:16 + ┌─ keccak.fe:3:16 │ -4 │ return keccak256(val) +3 │ return keccak256(val) │ ^^^^^^^^^^^^^^ u256: Value note: ┌─ keccak.fe:6:5 │ -6 │ ╭ pub fn return_hash_from_foo(val: Array) -> u256: +6 │ ╭ pub fn return_hash_from_foo(val: Array) -> u256 { 7 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 10874278598381710302 +8 │ │ } + │ ╰─────^ attributes hash: 10874278598381710302 │ = FunctionSignature { self_decl: None, @@ -98,11 +100,12 @@ note: │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ keccak.fe:9:5 + ┌─ keccak.fe:10:5 │ - 9 │ ╭ pub fn return_hash_from_u256(val: Array) -> u256: -10 │ │ return keccak256(val) - │ ╰─────────────────────────────^ attributes hash: 1385099984461119772 +10 │ ╭ pub fn return_hash_from_u256(val: Array) -> u256 { +11 │ │ return keccak256(val) +12 │ │ } + │ ╰─────^ attributes hash: 1385099984461119772 │ = FunctionSignature { self_decl: None, @@ -133,15 +136,15 @@ note: } note: - ┌─ keccak.fe:10:26 + ┌─ keccak.fe:11:26 │ -10 │ return keccak256(val) +11 │ return keccak256(val) │ ^^^ Array: Memory note: - ┌─ keccak.fe:10:16 + ┌─ keccak.fe:11:16 │ -10 │ return keccak256(val) +11 │ return keccak256(val) │ ^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__math.snap b/crates/analyzer/tests/snapshots/analysis__math.snap index 7a5b23f73a..85a771acf5 100644 --- a/crates/analyzer/tests/snapshots/analysis__math.snap +++ b/crates/analyzer/tests/snapshots/analysis__math.snap @@ -4,16 +4,16 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ math.fe:4:5 + ┌─ math.fe:2:5 │ - 4 │ ╭ pub fn sqrt(val: u256) -> u256: - 5 │ │ let z: u256 - 6 │ │ if (val > 3): - 7 │ │ z = val + 2 │ ╭ pub fn sqrt(val: u256) -> u256 { + 3 │ │ let z: u256 + 4 │ │ if val > 3 { + 5 │ │ z = val · │ -13 │ │ z = 1 14 │ │ return z - │ ╰────────────────^ attributes hash: 12367727332255217641 +15 │ │ } + │ ╰─────^ attributes hash: 12367727332255217641 │ = FunctionSignature { self_decl: None, @@ -41,113 +41,116 @@ note: } note: - ┌─ math.fe:5:16 + ┌─ math.fe:3:16 │ -5 │ let z: u256 +3 │ let z: u256 │ ^^^^ u256 · -8 │ let x: u256 = val / 2 + 1 +6 │ let x: u256 = val / 2 + 1 │ ^^^^ u256 note: - ┌─ math.fe:6:13 + ┌─ math.fe:4:12 │ -6 │ if (val > 3): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value +4 │ if val > 3 { + │ ^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ math.fe:6:12 + ┌─ math.fe:4:12 │ -6 │ if (val > 3): - │ ^^^^^^^^^ bool: Value -7 │ z = val +4 │ if val > 3 { + │ ^^^^^^^ bool: Value +5 │ z = val │ ^ ^^^ u256: Value │ │ │ u256: Value -8 │ let x: u256 = val / 2 + 1 +6 │ let x: u256 = val / 2 + 1 │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ math.fe:8:27 + ┌─ math.fe:6:27 │ -8 │ let x: u256 = val / 2 + 1 +6 │ let x: u256 = val / 2 + 1 │ ^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ math.fe:8:27 + ┌─ math.fe:6:27 │ -8 │ let x: u256 = val / 2 + 1 +6 │ let x: u256 = val / 2 + 1 │ ^^^^^^^^^^^ u256: Value -9 │ while (x < z): - │ ^ ^ u256: Value - │ │ - │ u256: Value +7 │ while x < z { + │ ^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ math.fe:9:19 - │ - 9 │ while (x < z): - │ ^^^^^^^ bool: Value -10 │ z = x - │ ^ ^ u256: Value - │ │ - │ u256: Value -11 │ x = (val / x + x) / 2 - │ ^ ^^^ ^ u256: Value - │ │ │ - │ │ u256: Value - │ u256: Value + ┌─ math.fe:7:19 + │ +7 │ while x < z { + │ ^^^^^ bool: Value +8 │ z = x + │ ^ ^ u256: Value + │ │ + │ u256: Value +9 │ x = (val / x + x) / 2 + │ ^ ^^^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ math.fe:11:22 - │ -11 │ x = (val / x + x) / 2 - │ ^^^^^^^ ^ u256: Value - │ │ - │ u256: Value + ┌─ math.fe:9:22 + │ +9 │ x = (val / x + x) / 2 + │ ^^^^^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ math.fe:11:21 - │ -11 │ x = (val / x + x) / 2 - │ ^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ u256: Value + ┌─ math.fe:9:21 + │ +9 │ x = (val / x + x) / 2 + │ ^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ math.fe:11:21 + ┌─ math.fe:9:21 │ -11 │ x = (val / x + x) / 2 + 9 │ x = (val / x + x) / 2 │ ^^^^^^^^^^^^^^^^^ u256: Value -12 │ elif (val != 0): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value +10 │ } +11 │ } else if val != 0 { + │ ^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ math.fe:12:14 + ┌─ math.fe:11:19 │ -12 │ elif (val != 0): - │ ^^^^^^^^^^ bool: Value -13 │ z = 1 +11 │ } else if val != 0 { + │ ^^^^^^^^ bool: Value +12 │ z = 1 │ ^ ^ u256: Value │ │ │ u256: Value +13 │ } 14 │ return z │ ^ u256: Value note: - ┌─ math.fe:16:5 + ┌─ math.fe:17:5 │ -16 │ ╭ pub fn min(x: u256, y: u256) -> u256: -17 │ │ return x if x < y else y - │ ╰────────────────────────────────^ attributes hash: 6847926207878778580 +17 │ ╭ pub fn min(x: u256, y: u256) -> u256 { +18 │ │ return x if x < y else y +19 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, @@ -186,26 +189,26 @@ note: } note: - ┌─ math.fe:17:21 + ┌─ math.fe:18:21 │ -17 │ return x if x < y else y +18 │ return x if x < y else y │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ math.fe:17:16 + ┌─ math.fe:18:16 │ -17 │ return x if x < y else y +18 │ return x if x < y else y │ ^ ^^^^^ ^ u256: Value │ │ │ │ │ bool: Value │ u256: Value note: - ┌─ math.fe:17:16 + ┌─ math.fe:18:16 │ -17 │ return x if x < y else y +18 │ return x if x < y else y │ ^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__module_const.snap b/crates/analyzer/tests/snapshots/analysis__module_const.snap index 566e0b03c4..a499742650 100644 --- a/crates/analyzer/tests/snapshots/analysis__module_const.snap +++ b/crates/analyzer/tests/snapshots/analysis__module_const.snap @@ -10,39 +10,40 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ module_const.fe:2:1 + ┌─ module_const.fe:3:1 │ -2 │ const C1: i32 = 1 +3 │ const C1: i32 = 1 │ ^^^^^^^^^^^^^^^^^ i32 note: - ┌─ module_const.fe:3:1 + ┌─ module_const.fe:4:1 │ -3 │ const C2: i32 = C1 * 3 +4 │ const C2: i32 = C1 * 3 │ ^^^^^^^^^^^^^^^^^^^^^^ i32 note: - ┌─ module_const.fe:4:1 + ┌─ module_const.fe:5:1 │ -4 │ const C3: i32 = C4 + 2 +5 │ const C3: i32 = C4 + 2 │ ^^^^^^^^^^^^^^^^^^^^^^ i32 note: - ┌─ module_const.fe:5:1 + ┌─ module_const.fe:6:1 │ -5 │ const C4: i32 = 42 +6 │ const C4: i32 = 42 │ ^^^^^^^^^^^^^^^^^^ i32 note: - ┌─ module_const.fe:8:5 + ┌─ module_const.fe:9:5 │ - 8 │ ╭ fn bar() -> i32: - 9 │ │ const LOCAL_CONST: i32 = C3 * 2 -10 │ │ let _arr1: Array -11 │ │ let _arr2: Array -12 │ │ let _my_array: MY_ARRAY -13 │ │ return C4 - │ ╰─────────────────^ attributes hash: 18058099208132403133 + 9 │ ╭ fn bar() -> i32 { +10 │ │ const LOCAL_CONST: i32 = C3 * 2 +11 │ │ let _arr1: Array +12 │ │ let _arr2: Array +13 │ │ let _my_array: MY_ARRAY +14 │ │ return C4 +15 │ │ } + │ ╰─────^ attributes hash: 18058099208132403133 │ = FunctionSignature { self_decl: None, @@ -58,36 +59,36 @@ note: } note: - ┌─ module_const.fe:9:28 + ┌─ module_const.fe:10:28 │ - 9 │ const LOCAL_CONST: i32 = C3 * 2 +10 │ const LOCAL_CONST: i32 = C3 * 2 │ ^^^ i32 -10 │ let _arr1: Array +11 │ let _arr1: Array │ ^^^^^^^^^^^^^^^^^^ Array -11 │ let _arr2: Array +12 │ let _arr2: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -12 │ let _my_array: MY_ARRAY +13 │ let _my_array: MY_ARRAY │ ^^^^^^^^ Array note: - ┌─ module_const.fe:9:34 - │ -9 │ const LOCAL_CONST: i32 = C3 * 2 - │ ^^ ^ i32: Value - │ │ - │ i32: Value + ┌─ module_const.fe:10:34 + │ +10 │ const LOCAL_CONST: i32 = C3 * 2 + │ ^^ ^ i32: Value + │ │ + │ i32: Value note: - ┌─ module_const.fe:9:34 + ┌─ module_const.fe:10:34 │ - 9 │ const LOCAL_CONST: i32 = C3 * 2 +10 │ const LOCAL_CONST: i32 = C3 * 2 │ ^^^^^^ i32: Value -10 │ let _arr1: Array +11 │ let _arr1: Array │ ^^ i32: Value -11 │ let _arr2: Array +12 │ let _arr2: Array │ ^^^^^^^^^^^ i32: Value -12 │ let _my_array: MY_ARRAY -13 │ return C4 +13 │ let _my_array: MY_ARRAY +14 │ return C4 │ ^^ i32: Value diff --git a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap index 895ccdde7c..e18a99628b 100644 --- a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap +++ b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap @@ -14,11 +14,12 @@ note: │ ^^^^^^^^^^^ u256 note: - ┌─ module_level_events.fe:9:5 + ┌─ module_level_events.fe:10:5 │ - 9 │ ╭ fn transfer(ctx: Context, to : address, value : u256): -10 │ │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) - │ ╰─────────────────────────────────────────────────────────────────────────^ attributes hash: 10847004199357482546 +10 │ ╭ fn transfer(ctx: Context, to: address, value: u256) { +11 │ │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) +12 │ │ } + │ ╰─────^ attributes hash: 10847004199357482546 │ = FunctionSignature { self_decl: None, @@ -67,26 +68,26 @@ note: } note: - ┌─ module_level_events.fe:10:23 + ┌─ module_level_events.fe:11:23 │ -10 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) +11 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ module_level_events.fe:10:36 + ┌─ module_level_events.fe:11:36 │ -10 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) +11 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) │ ^^^^^^^^^^^^^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ module_level_events.fe:10:9 + ┌─ module_level_events.fe:11:9 │ -10 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) +11 │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 17986960071624595337 │ = Event { diff --git a/crates/analyzer/tests/snapshots/analysis__multi_param.snap b/crates/analyzer/tests/snapshots/analysis__multi_param.snap index 40a6081d92..a36902db78 100644 --- a/crates/analyzer/tests/snapshots/analysis__multi_param.snap +++ b/crates/analyzer/tests/snapshots/analysis__multi_param.snap @@ -6,13 +6,14 @@ expression: "build_snapshot(&db, module)" note: ┌─ multi_param.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256, z: u256) -> Array: +2 │ ╭ pub fn bar(x: u256, y: u256, z: u256) -> Array { 3 │ │ let my_array: Array 4 │ │ my_array[0] = x 5 │ │ my_array[1] = y 6 │ │ my_array[2] = z 7 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 10778435134172267300 +8 │ │ } + │ ╰─────^ attributes hash: 10778435134172267300 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__nested_map.snap b/crates/analyzer/tests/snapshots/analysis__nested_map.snap index 306a6f5f19..7dc9adc672 100644 --- a/crates/analyzer/tests/snapshots/analysis__nested_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__nested_map.snap @@ -14,9 +14,10 @@ note: note: ┌─ nested_map.fe:5:5 │ -5 │ ╭ pub fn read_bar(self, a: address, b: address) -> u256: +5 │ ╭ pub fn read_bar(self, a: address, b: address) -> u256 { 6 │ │ return self.bar[a][b] - │ ╰─────────────────────────────^ attributes hash: 17216960098647945084 +7 │ │ } + │ ╰─────^ attributes hash: 17216960098647945084 │ = FunctionSignature { self_decl: Some( @@ -81,91 +82,93 @@ note: │ ^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ nested_map.fe:8:5 - │ -8 │ ╭ pub fn write_bar(self, a: address, b: address, value: u256): -9 │ │ self.bar[a][b] = value - │ ╰──────────────────────────────^ attributes hash: 1717293224155577849 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "a", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "b", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ nested_map.fe:9:5 + │ + 9 │ ╭ pub fn write_bar(self, a: address, b: address, value: u256) { +10 │ │ self.bar[a][b] = value +11 │ │ } + │ ╰─────^ attributes hash: 1717293224155577849 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "a", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "b", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ nested_map.fe:9:9 - │ -9 │ self.bar[a][b] = value - │ ^^^^ Foo: Value + ┌─ nested_map.fe:10:9 + │ +10 │ self.bar[a][b] = value + │ ^^^^ Foo: Value note: - ┌─ nested_map.fe:9:9 - │ -9 │ self.bar[a][b] = value - │ ^^^^^^^^ ^ address: Value - │ │ - │ Map>: Storage { nonce: Some(0) } + ┌─ nested_map.fe:10:9 + │ +10 │ self.bar[a][b] = value + │ ^^^^^^^^ ^ address: Value + │ │ + │ Map>: Storage { nonce: Some(0) } note: - ┌─ nested_map.fe:9:9 - │ -9 │ self.bar[a][b] = value - │ ^^^^^^^^^^^ ^ address: Value - │ │ - │ Map: Storage { nonce: None } + ┌─ nested_map.fe:10:9 + │ +10 │ self.bar[a][b] = value + │ ^^^^^^^^^^^ ^ address: Value + │ │ + │ Map: Storage { nonce: None } note: - ┌─ nested_map.fe:9:9 - │ -9 │ self.bar[a][b] = value - │ ^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } + ┌─ nested_map.fe:10:9 + │ +10 │ self.bar[a][b] = value + │ ^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } note: - ┌─ nested_map.fe:11:5 + ┌─ nested_map.fe:13:5 │ -11 │ ╭ pub fn read_baz(self, a: address, b: u256) -> bool: -12 │ │ return self.baz[a][b] - │ ╰─────────────────────────────^ attributes hash: 13548986453815092160 +13 │ ╭ pub fn read_baz(self, a: address, b: u256) -> bool { +14 │ │ return self.baz[a][b] +15 │ │ } + │ ╰─────^ attributes hash: 13548986453815092160 │ = FunctionSignature { self_decl: Some( @@ -202,39 +205,40 @@ note: } note: - ┌─ nested_map.fe:12:16 + ┌─ nested_map.fe:14:16 │ -12 │ return self.baz[a][b] +14 │ return self.baz[a][b] │ ^^^^ Foo: Value note: - ┌─ nested_map.fe:12:16 + ┌─ nested_map.fe:14:16 │ -12 │ return self.baz[a][b] +14 │ return self.baz[a][b] │ ^^^^^^^^ ^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ nested_map.fe:12:16 + ┌─ nested_map.fe:14:16 │ -12 │ return self.baz[a][b] +14 │ return self.baz[a][b] │ ^^^^^^^^^^^ ^ u256: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ nested_map.fe:12:16 + ┌─ nested_map.fe:14:16 │ -12 │ return self.baz[a][b] +14 │ return self.baz[a][b] │ ^^^^^^^^^^^^^^ bool: Storage { nonce: None } => Value note: - ┌─ nested_map.fe:14:5 + ┌─ nested_map.fe:17:5 │ -14 │ ╭ pub fn write_baz(self, a: address, b: u256, value: bool): -15 │ │ self.baz[a][b] = value - │ ╰──────────────────────────────^ attributes hash: 6442389777288668179 +17 │ ╭ pub fn write_baz(self, a: address, b: u256, value: bool) { +18 │ │ self.baz[a][b] = value +19 │ │ } + │ ╰─────^ attributes hash: 6442389777288668179 │ = FunctionSignature { self_decl: Some( @@ -280,31 +284,31 @@ note: } note: - ┌─ nested_map.fe:15:9 + ┌─ nested_map.fe:18:9 │ -15 │ self.baz[a][b] = value +18 │ self.baz[a][b] = value │ ^^^^ Foo: Value note: - ┌─ nested_map.fe:15:9 + ┌─ nested_map.fe:18:9 │ -15 │ self.baz[a][b] = value +18 │ self.baz[a][b] = value │ ^^^^^^^^ ^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ nested_map.fe:15:9 + ┌─ nested_map.fe:18:9 │ -15 │ self.baz[a][b] = value +18 │ self.baz[a][b] = value │ ^^^^^^^^^^^ ^ u256: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ nested_map.fe:15:9 + ┌─ nested_map.fe:18:9 │ -15 │ self.baz[a][b] = value +18 │ self.baz[a][b] = value │ ^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap b/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap index 1520eb3894..16b5b39c33 100644 --- a/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap +++ b/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ numeric_sizes.fe:3:5 + ┌─ numeric_sizes.fe:2:5 │ -3 │ ╭ pub fn get_u8_min() -> u8: -4 │ │ return u8(0) - │ ╰────────────────────^ attributes hash: 18193502560299416939 +2 │ ╭ pub fn get_u8_min() -> u8 { +3 │ │ return u8(0) +4 │ │ } + │ ╰─────^ attributes hash: 18193502560299416939 │ = FunctionSignature { self_decl: None, @@ -24,23 +25,24 @@ note: } note: - ┌─ numeric_sizes.fe:4:19 + ┌─ numeric_sizes.fe:3:19 │ -4 │ return u8(0) +3 │ return u8(0) │ ^ u8: Value note: - ┌─ numeric_sizes.fe:4:16 + ┌─ numeric_sizes.fe:3:16 │ -4 │ return u8(0) +3 │ return u8(0) │ ^^^^^ u8: Value note: ┌─ numeric_sizes.fe:6:5 │ -6 │ ╭ pub fn get_u16_min() -> u16: +6 │ ╭ pub fn get_u16_min() -> u16 { 7 │ │ return u16(0) - │ ╰─────────────────────^ attributes hash: 3086088635989474166 +8 │ │ } + │ ╰─────^ attributes hash: 3086088635989474166 │ = FunctionSignature { self_decl: None, @@ -68,11 +70,12 @@ note: │ ^^^^^^ u16: Value note: - ┌─ numeric_sizes.fe:9:5 + ┌─ numeric_sizes.fe:10:5 │ - 9 │ ╭ pub fn get_u32_min() -> u32: -10 │ │ return u32(0) - │ ╰─────────────────────^ attributes hash: 1978352585063323439 +10 │ ╭ pub fn get_u32_min() -> u32 { +11 │ │ return u32(0) +12 │ │ } + │ ╰─────^ attributes hash: 1978352585063323439 │ = FunctionSignature { self_decl: None, @@ -88,23 +91,24 @@ note: } note: - ┌─ numeric_sizes.fe:10:20 + ┌─ numeric_sizes.fe:11:20 │ -10 │ return u32(0) +11 │ return u32(0) │ ^ u32: Value note: - ┌─ numeric_sizes.fe:10:16 + ┌─ numeric_sizes.fe:11:16 │ -10 │ return u32(0) +11 │ return u32(0) │ ^^^^^^ u32: Value note: - ┌─ numeric_sizes.fe:12:5 + ┌─ numeric_sizes.fe:14:5 │ -12 │ ╭ pub fn get_u64_min() -> u64: -13 │ │ return u64(0) - │ ╰─────────────────────^ attributes hash: 3966212821348382963 +14 │ ╭ pub fn get_u64_min() -> u64 { +15 │ │ return u64(0) +16 │ │ } + │ ╰─────^ attributes hash: 3966212821348382963 │ = FunctionSignature { self_decl: None, @@ -120,23 +124,24 @@ note: } note: - ┌─ numeric_sizes.fe:13:20 + ┌─ numeric_sizes.fe:15:20 │ -13 │ return u64(0) +15 │ return u64(0) │ ^ u64: Value note: - ┌─ numeric_sizes.fe:13:16 + ┌─ numeric_sizes.fe:15:16 │ -13 │ return u64(0) +15 │ return u64(0) │ ^^^^^^ u64: Value note: - ┌─ numeric_sizes.fe:15:5 + ┌─ numeric_sizes.fe:18:5 │ -15 │ ╭ pub fn get_u128_min() -> u128: -16 │ │ return u128(0) - │ ╰──────────────────────^ attributes hash: 104322826323649285 +18 │ ╭ pub fn get_u128_min() -> u128 { +19 │ │ return u128(0) +20 │ │ } + │ ╰─────^ attributes hash: 104322826323649285 │ = FunctionSignature { self_decl: None, @@ -152,23 +157,24 @@ note: } note: - ┌─ numeric_sizes.fe:16:21 + ┌─ numeric_sizes.fe:19:21 │ -16 │ return u128(0) +19 │ return u128(0) │ ^ u128: Value note: - ┌─ numeric_sizes.fe:16:16 + ┌─ numeric_sizes.fe:19:16 │ -16 │ return u128(0) +19 │ return u128(0) │ ^^^^^^^ u128: Value note: - ┌─ numeric_sizes.fe:18:5 + ┌─ numeric_sizes.fe:22:5 │ -18 │ ╭ pub fn get_u256_min() -> u256: -19 │ │ return u256(0) - │ ╰──────────────────────^ attributes hash: 6115314201970082834 +22 │ ╭ pub fn get_u256_min() -> u256 { +23 │ │ return u256(0) +24 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -184,23 +190,24 @@ note: } note: - ┌─ numeric_sizes.fe:19:21 + ┌─ numeric_sizes.fe:23:21 │ -19 │ return u256(0) +23 │ return u256(0) │ ^ u256: Value note: - ┌─ numeric_sizes.fe:19:16 + ┌─ numeric_sizes.fe:23:16 │ -19 │ return u256(0) +23 │ return u256(0) │ ^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:21:5 + ┌─ numeric_sizes.fe:26:5 │ -21 │ ╭ pub fn get_i8_min() -> i8: -22 │ │ return i8(-128) - │ ╰───────────────────────^ attributes hash: 15762448841602984320 +26 │ ╭ pub fn get_i8_min() -> i8 { +27 │ │ return i8(-128) +28 │ │ } + │ ╰─────^ attributes hash: 15762448841602984320 │ = FunctionSignature { self_decl: None, @@ -216,29 +223,30 @@ note: } note: - ┌─ numeric_sizes.fe:22:20 + ┌─ numeric_sizes.fe:27:20 │ -22 │ return i8(-128) +27 │ return i8(-128) │ ^^^ u256: Value note: - ┌─ numeric_sizes.fe:22:19 + ┌─ numeric_sizes.fe:27:19 │ -22 │ return i8(-128) +27 │ return i8(-128) │ ^^^^ i8: Value note: - ┌─ numeric_sizes.fe:22:16 + ┌─ numeric_sizes.fe:27:16 │ -22 │ return i8(-128) +27 │ return i8(-128) │ ^^^^^^^^ i8: Value note: - ┌─ numeric_sizes.fe:24:5 + ┌─ numeric_sizes.fe:30:5 │ -24 │ ╭ pub fn get_i16_min() -> i16: -25 │ │ return i16(-32768) - │ ╰──────────────────────────^ attributes hash: 1032717434757427850 +30 │ ╭ pub fn get_i16_min() -> i16 { +31 │ │ return i16(-32768) +32 │ │ } + │ ╰─────^ attributes hash: 1032717434757427850 │ = FunctionSignature { self_decl: None, @@ -254,29 +262,30 @@ note: } note: - ┌─ numeric_sizes.fe:25:21 + ┌─ numeric_sizes.fe:31:21 │ -25 │ return i16(-32768) +31 │ return i16(-32768) │ ^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:25:20 + ┌─ numeric_sizes.fe:31:20 │ -25 │ return i16(-32768) +31 │ return i16(-32768) │ ^^^^^^ i16: Value note: - ┌─ numeric_sizes.fe:25:16 + ┌─ numeric_sizes.fe:31:16 │ -25 │ return i16(-32768) +31 │ return i16(-32768) │ ^^^^^^^^^^^ i16: Value note: - ┌─ numeric_sizes.fe:27:5 + ┌─ numeric_sizes.fe:34:5 │ -27 │ ╭ pub fn get_i32_min() -> i32: -28 │ │ return i32(-2147483648) - │ ╰───────────────────────────────^ attributes hash: 18058099208132403133 +34 │ ╭ pub fn get_i32_min() -> i32 { +35 │ │ return i32(-2147483648) +36 │ │ } + │ ╰─────^ attributes hash: 18058099208132403133 │ = FunctionSignature { self_decl: None, @@ -292,29 +301,30 @@ note: } note: - ┌─ numeric_sizes.fe:28:21 + ┌─ numeric_sizes.fe:35:21 │ -28 │ return i32(-2147483648) +35 │ return i32(-2147483648) │ ^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:28:20 + ┌─ numeric_sizes.fe:35:20 │ -28 │ return i32(-2147483648) +35 │ return i32(-2147483648) │ ^^^^^^^^^^^ i32: Value note: - ┌─ numeric_sizes.fe:28:16 + ┌─ numeric_sizes.fe:35:16 │ -28 │ return i32(-2147483648) +35 │ return i32(-2147483648) │ ^^^^^^^^^^^^^^^^ i32: Value note: - ┌─ numeric_sizes.fe:30:5 + ┌─ numeric_sizes.fe:38:5 │ -30 │ ╭ pub fn get_i64_min() -> i64: -31 │ │ return i64(-9223372036854775808) - │ ╰────────────────────────────────────────^ attributes hash: 6774734901144681103 +38 │ ╭ pub fn get_i64_min() -> i64 { +39 │ │ return i64(-9223372036854775808) +40 │ │ } + │ ╰─────^ attributes hash: 6774734901144681103 │ = FunctionSignature { self_decl: None, @@ -330,29 +340,30 @@ note: } note: - ┌─ numeric_sizes.fe:31:21 + ┌─ numeric_sizes.fe:39:21 │ -31 │ return i64(-9223372036854775808) +39 │ return i64(-9223372036854775808) │ ^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:31:20 + ┌─ numeric_sizes.fe:39:20 │ -31 │ return i64(-9223372036854775808) +39 │ return i64(-9223372036854775808) │ ^^^^^^^^^^^^^^^^^^^^ i64: Value note: - ┌─ numeric_sizes.fe:31:16 + ┌─ numeric_sizes.fe:39:16 │ -31 │ return i64(-9223372036854775808) +39 │ return i64(-9223372036854775808) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ i64: Value note: - ┌─ numeric_sizes.fe:33:5 + ┌─ numeric_sizes.fe:42:5 │ -33 │ ╭ pub fn get_i128_min() -> i128: -34 │ │ return i128(-170141183460469231731687303715884105728) - │ ╰─────────────────────────────────────────────────────────────^ attributes hash: 155533728466856391 +42 │ ╭ pub fn get_i128_min() -> i128 { +43 │ │ return i128(-170141183460469231731687303715884105728) +44 │ │ } + │ ╰─────^ attributes hash: 155533728466856391 │ = FunctionSignature { self_decl: None, @@ -368,29 +379,30 @@ note: } note: - ┌─ numeric_sizes.fe:34:22 + ┌─ numeric_sizes.fe:43:22 │ -34 │ return i128(-170141183460469231731687303715884105728) +43 │ return i128(-170141183460469231731687303715884105728) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:34:21 + ┌─ numeric_sizes.fe:43:21 │ -34 │ return i128(-170141183460469231731687303715884105728) +43 │ return i128(-170141183460469231731687303715884105728) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i128: Value note: - ┌─ numeric_sizes.fe:34:16 + ┌─ numeric_sizes.fe:43:16 │ -34 │ return i128(-170141183460469231731687303715884105728) +43 │ return i128(-170141183460469231731687303715884105728) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i128: Value note: - ┌─ numeric_sizes.fe:36:5 + ┌─ numeric_sizes.fe:46:5 │ -36 │ ╭ pub fn get_i256_min() -> i256: -37 │ │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) - │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 8116994679119332188 +46 │ ╭ pub fn get_i256_min() -> i256 { +47 │ │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) +48 │ │ } + │ ╰─────^ attributes hash: 8116994679119332188 │ = FunctionSignature { self_decl: None, @@ -406,29 +418,30 @@ note: } note: - ┌─ numeric_sizes.fe:37:22 + ┌─ numeric_sizes.fe:47:22 │ -37 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) +47 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:37:21 + ┌─ numeric_sizes.fe:47:21 │ -37 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) +47 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i256: Value note: - ┌─ numeric_sizes.fe:37:16 + ┌─ numeric_sizes.fe:47:16 │ -37 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) +47 │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i256: Value note: - ┌─ numeric_sizes.fe:39:5 + ┌─ numeric_sizes.fe:50:5 │ -39 │ ╭ pub fn get_u8_max() -> u8: -40 │ │ return u8(255) - │ ╰──────────────────────^ attributes hash: 18193502560299416939 +50 │ ╭ pub fn get_u8_max() -> u8 { +51 │ │ return u8(255) +52 │ │ } + │ ╰─────^ attributes hash: 18193502560299416939 │ = FunctionSignature { self_decl: None, @@ -444,23 +457,24 @@ note: } note: - ┌─ numeric_sizes.fe:40:19 + ┌─ numeric_sizes.fe:51:19 │ -40 │ return u8(255) +51 │ return u8(255) │ ^^^ u8: Value note: - ┌─ numeric_sizes.fe:40:16 + ┌─ numeric_sizes.fe:51:16 │ -40 │ return u8(255) +51 │ return u8(255) │ ^^^^^^^ u8: Value note: - ┌─ numeric_sizes.fe:42:5 + ┌─ numeric_sizes.fe:54:5 │ -42 │ ╭ pub fn get_u16_max() -> u16: -43 │ │ return u16(65535) - │ ╰─────────────────────────^ attributes hash: 3086088635989474166 +54 │ ╭ pub fn get_u16_max() -> u16 { +55 │ │ return u16(65535) +56 │ │ } + │ ╰─────^ attributes hash: 3086088635989474166 │ = FunctionSignature { self_decl: None, @@ -476,23 +490,24 @@ note: } note: - ┌─ numeric_sizes.fe:43:20 + ┌─ numeric_sizes.fe:55:20 │ -43 │ return u16(65535) +55 │ return u16(65535) │ ^^^^^ u16: Value note: - ┌─ numeric_sizes.fe:43:16 + ┌─ numeric_sizes.fe:55:16 │ -43 │ return u16(65535) +55 │ return u16(65535) │ ^^^^^^^^^^ u16: Value note: - ┌─ numeric_sizes.fe:45:5 + ┌─ numeric_sizes.fe:58:5 │ -45 │ ╭ pub fn get_u32_max() -> u32: -46 │ │ return u32(4294967295) - │ ╰──────────────────────────────^ attributes hash: 1978352585063323439 +58 │ ╭ pub fn get_u32_max() -> u32 { +59 │ │ return u32(4294967295) +60 │ │ } + │ ╰─────^ attributes hash: 1978352585063323439 │ = FunctionSignature { self_decl: None, @@ -508,23 +523,24 @@ note: } note: - ┌─ numeric_sizes.fe:46:20 + ┌─ numeric_sizes.fe:59:20 │ -46 │ return u32(4294967295) +59 │ return u32(4294967295) │ ^^^^^^^^^^ u32: Value note: - ┌─ numeric_sizes.fe:46:16 + ┌─ numeric_sizes.fe:59:16 │ -46 │ return u32(4294967295) +59 │ return u32(4294967295) │ ^^^^^^^^^^^^^^^ u32: Value note: - ┌─ numeric_sizes.fe:48:5 + ┌─ numeric_sizes.fe:62:5 │ -48 │ ╭ pub fn get_u64_max() -> u64: -49 │ │ return u64(18446744073709551615) - │ ╰────────────────────────────────────────^ attributes hash: 3966212821348382963 +62 │ ╭ pub fn get_u64_max() -> u64 { +63 │ │ return u64(18446744073709551615) +64 │ │ } + │ ╰─────^ attributes hash: 3966212821348382963 │ = FunctionSignature { self_decl: None, @@ -540,23 +556,24 @@ note: } note: - ┌─ numeric_sizes.fe:49:20 + ┌─ numeric_sizes.fe:63:20 │ -49 │ return u64(18446744073709551615) +63 │ return u64(18446744073709551615) │ ^^^^^^^^^^^^^^^^^^^^ u64: Value note: - ┌─ numeric_sizes.fe:49:16 + ┌─ numeric_sizes.fe:63:16 │ -49 │ return u64(18446744073709551615) +63 │ return u64(18446744073709551615) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u64: Value note: - ┌─ numeric_sizes.fe:51:5 + ┌─ numeric_sizes.fe:66:5 │ -51 │ ╭ pub fn get_u128_max() -> u128: -52 │ │ return u128(340282366920938463463374607431768211455) - │ ╰────────────────────────────────────────────────────────────^ attributes hash: 104322826323649285 +66 │ ╭ pub fn get_u128_max() -> u128 { +67 │ │ return u128(340282366920938463463374607431768211455) +68 │ │ } + │ ╰─────^ attributes hash: 104322826323649285 │ = FunctionSignature { self_decl: None, @@ -572,23 +589,24 @@ note: } note: - ┌─ numeric_sizes.fe:52:21 + ┌─ numeric_sizes.fe:67:21 │ -52 │ return u128(340282366920938463463374607431768211455) +67 │ return u128(340282366920938463463374607431768211455) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u128: Value note: - ┌─ numeric_sizes.fe:52:16 + ┌─ numeric_sizes.fe:67:16 │ -52 │ return u128(340282366920938463463374607431768211455) +67 │ return u128(340282366920938463463374607431768211455) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u128: Value note: - ┌─ numeric_sizes.fe:54:5 + ┌─ numeric_sizes.fe:70:5 │ -54 │ ╭ pub fn get_u256_max() -> u256: -55 │ │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) - │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 6115314201970082834 +70 │ ╭ pub fn get_u256_max() -> u256 { +71 │ │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) +72 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -604,23 +622,24 @@ note: } note: - ┌─ numeric_sizes.fe:55:21 + ┌─ numeric_sizes.fe:71:21 │ -55 │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) +71 │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:55:16 + ┌─ numeric_sizes.fe:71:16 │ -55 │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) +71 │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ numeric_sizes.fe:57:5 + ┌─ numeric_sizes.fe:74:5 │ -57 │ ╭ pub fn get_i8_max() -> i8: -58 │ │ return i8(127) - │ ╰──────────────────────^ attributes hash: 15762448841602984320 +74 │ ╭ pub fn get_i8_max() -> i8 { +75 │ │ return i8(127) +76 │ │ } + │ ╰─────^ attributes hash: 15762448841602984320 │ = FunctionSignature { self_decl: None, @@ -636,23 +655,24 @@ note: } note: - ┌─ numeric_sizes.fe:58:19 + ┌─ numeric_sizes.fe:75:19 │ -58 │ return i8(127) +75 │ return i8(127) │ ^^^ i8: Value note: - ┌─ numeric_sizes.fe:58:16 + ┌─ numeric_sizes.fe:75:16 │ -58 │ return i8(127) +75 │ return i8(127) │ ^^^^^^^ i8: Value note: - ┌─ numeric_sizes.fe:60:5 + ┌─ numeric_sizes.fe:78:5 │ -60 │ ╭ pub fn get_i16_max() -> i16: -61 │ │ return i16(32767) - │ ╰─────────────────────────^ attributes hash: 1032717434757427850 +78 │ ╭ pub fn get_i16_max() -> i16 { +79 │ │ return i16(32767) +80 │ │ } + │ ╰─────^ attributes hash: 1032717434757427850 │ = FunctionSignature { self_decl: None, @@ -668,23 +688,24 @@ note: } note: - ┌─ numeric_sizes.fe:61:20 + ┌─ numeric_sizes.fe:79:20 │ -61 │ return i16(32767) +79 │ return i16(32767) │ ^^^^^ i16: Value note: - ┌─ numeric_sizes.fe:61:16 + ┌─ numeric_sizes.fe:79:16 │ -61 │ return i16(32767) +79 │ return i16(32767) │ ^^^^^^^^^^ i16: Value note: - ┌─ numeric_sizes.fe:63:5 + ┌─ numeric_sizes.fe:82:5 │ -63 │ ╭ pub fn get_i32_max() -> i32: -64 │ │ return i32(2147483647) - │ ╰──────────────────────────────^ attributes hash: 18058099208132403133 +82 │ ╭ pub fn get_i32_max() -> i32 { +83 │ │ return i32(2147483647) +84 │ │ } + │ ╰─────^ attributes hash: 18058099208132403133 │ = FunctionSignature { self_decl: None, @@ -700,23 +721,24 @@ note: } note: - ┌─ numeric_sizes.fe:64:20 + ┌─ numeric_sizes.fe:83:20 │ -64 │ return i32(2147483647) +83 │ return i32(2147483647) │ ^^^^^^^^^^ i32: Value note: - ┌─ numeric_sizes.fe:64:16 + ┌─ numeric_sizes.fe:83:16 │ -64 │ return i32(2147483647) +83 │ return i32(2147483647) │ ^^^^^^^^^^^^^^^ i32: Value note: - ┌─ numeric_sizes.fe:66:5 + ┌─ numeric_sizes.fe:86:5 │ -66 │ ╭ pub fn get_i64_max() -> i64: -67 │ │ return i64(9223372036854775807) - │ ╰───────────────────────────────────────^ attributes hash: 6774734901144681103 +86 │ ╭ pub fn get_i64_max() -> i64 { +87 │ │ return i64(9223372036854775807) +88 │ │ } + │ ╰─────^ attributes hash: 6774734901144681103 │ = FunctionSignature { self_decl: None, @@ -732,23 +754,24 @@ note: } note: - ┌─ numeric_sizes.fe:67:20 + ┌─ numeric_sizes.fe:87:20 │ -67 │ return i64(9223372036854775807) +87 │ return i64(9223372036854775807) │ ^^^^^^^^^^^^^^^^^^^ i64: Value note: - ┌─ numeric_sizes.fe:67:16 + ┌─ numeric_sizes.fe:87:16 │ -67 │ return i64(9223372036854775807) +87 │ return i64(9223372036854775807) │ ^^^^^^^^^^^^^^^^^^^^^^^^ i64: Value note: - ┌─ numeric_sizes.fe:69:5 + ┌─ numeric_sizes.fe:90:5 │ -69 │ ╭ pub fn get_i128_max() -> i128: -70 │ │ return i128(170141183460469231731687303715884105727) - │ ╰────────────────────────────────────────────────────────────^ attributes hash: 155533728466856391 +90 │ ╭ pub fn get_i128_max() -> i128 { +91 │ │ return i128(170141183460469231731687303715884105727) +92 │ │ } + │ ╰─────^ attributes hash: 155533728466856391 │ = FunctionSignature { self_decl: None, @@ -764,23 +787,24 @@ note: } note: - ┌─ numeric_sizes.fe:70:21 + ┌─ numeric_sizes.fe:91:21 │ -70 │ return i128(170141183460469231731687303715884105727) +91 │ return i128(170141183460469231731687303715884105727) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i128: Value note: - ┌─ numeric_sizes.fe:70:16 + ┌─ numeric_sizes.fe:91:16 │ -70 │ return i128(170141183460469231731687303715884105727) +91 │ return i128(170141183460469231731687303715884105727) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i128: Value note: - ┌─ numeric_sizes.fe:72:5 + ┌─ numeric_sizes.fe:94:5 │ -72 │ ╭ pub fn get_i256_max() -> i256: -73 │ │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) - │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 8116994679119332188 +94 │ ╭ pub fn get_i256_max() -> i256 { +95 │ │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) +96 │ │ } + │ ╰─────^ attributes hash: 8116994679119332188 │ = FunctionSignature { self_decl: None, @@ -796,15 +820,15 @@ note: } note: - ┌─ numeric_sizes.fe:73:21 + ┌─ numeric_sizes.fe:95:21 │ -73 │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) +95 │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i256: Value note: - ┌─ numeric_sizes.fe:73:16 + ┌─ numeric_sizes.fe:95:16 │ -73 │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) +95 │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ i256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__ownable.snap b/crates/analyzer/tests/snapshots/analysis__ownable.snap index 16db4871b8..196108b701 100644 --- a/crates/analyzer/tests/snapshots/analysis__ownable.snap +++ b/crates/analyzer/tests/snapshots/analysis__ownable.snap @@ -4,25 +4,26 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ ownable.fe:4:3 + ┌─ ownable.fe:4:5 │ -4 │ _owner: address - │ ^^^^^^^^^^^^^^^ address +4 │ _owner: address + │ ^^^^^^^^^^^^^^^ address note: - ┌─ ownable.fe:7:5 + ┌─ ownable.fe:7:9 │ -7 │ idx previousOwner: address - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ address -8 │ idx newOwner: address - │ ^^^^^^^^^^^^^^^^^^^^^ address +7 │ idx previousOwner: address + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ address +8 │ idx newOwner: address + │ ^^^^^^^^^^^^^^^^^^^^^ address note: - ┌─ ownable.fe:13:3 + ┌─ ownable.fe:15:5 │ -13 │ ╭ pub fn owner(self) -> address: -14 │ │ return self._owner - │ ╰──────────────────────^ attributes hash: 227275695522088782 +15 │ ╭ pub fn owner(self) -> address { +16 │ │ return self._owner +17 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -38,25 +39,26 @@ note: } note: - ┌─ ownable.fe:14:12 + ┌─ ownable.fe:16:16 │ -14 │ return self._owner - │ ^^^^ Ownable: Value +16 │ return self._owner + │ ^^^^ Ownable: Value note: - ┌─ ownable.fe:14:12 + ┌─ ownable.fe:16:16 │ -14 │ return self._owner - │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value +16 │ return self._owner + │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value note: - ┌─ ownable.fe:16:3 + ┌─ ownable.fe:19:5 │ -16 │ ╭ pub fn renounceOwnership(self, ctx: Context): -17 │ │ assert ctx.msg_sender() == self._owner -18 │ │ self._owner = address(0) -19 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ╰─────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 1731341862738941170 +19 │ ╭ pub fn renounceOwnership(self, ctx: Context) { +20 │ │ assert ctx.msg_sender() == self._owner +21 │ │ self._owner = address(0) +22 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) +23 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -87,70 +89,70 @@ note: } note: - ┌─ ownable.fe:17:12 + ┌─ ownable.fe:20:16 │ -17 │ assert ctx.msg_sender() == self._owner - │ ^^^ Context: Memory +20 │ assert ctx.msg_sender() == self._owner + │ ^^^ Context: Memory note: - ┌─ ownable.fe:17:12 + ┌─ ownable.fe:20:16 │ -17 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable: Value - │ │ - │ address: Value +20 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable: Value + │ │ + │ address: Value note: - ┌─ ownable.fe:17:32 + ┌─ ownable.fe:20:36 │ -17 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value +20 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value note: - ┌─ ownable.fe:17:12 + ┌─ ownable.fe:20:16 │ -17 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -18 │ self._owner = address(0) - │ ^^^^ Ownable: Value +20 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value +21 │ self._owner = address(0) + │ ^^^^ Ownable: Value note: - ┌─ ownable.fe:18:5 + ┌─ ownable.fe:21:9 │ -18 │ self._owner = address(0) - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ address: Storage { nonce: Some(0) } +21 │ self._owner = address(0) + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ address: Storage { nonce: Some(0) } note: - ┌─ ownable.fe:18:19 + ┌─ ownable.fe:21:23 │ -18 │ self._owner = address(0) - │ ^^^^^^^^^^ address: Value -19 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ^^^ ^^^ Context: Memory - │ │ - │ Context: Memory +21 │ self._owner = address(0) + │ ^^^^^^^^^^ address: Value +22 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + │ ^^^ ^^^ Context: Memory + │ │ + │ Context: Memory note: - ┌─ ownable.fe:19:51 + ┌─ ownable.fe:22:55 │ -19 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ^^^^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ address: Value +22 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + │ ^^^^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ address: Value note: - ┌─ ownable.fe:19:79 + ┌─ ownable.fe:22:83 │ -19 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ^^^^^^^^^^ address: Value +22 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + │ ^^^^^^^^^^ address: Value note: - ┌─ ownable.fe:19:5 + ┌─ ownable.fe:22:9 │ -19 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12166912587337306484 +22 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12166912587337306484 │ = Event { name: "OwnershipTransferred", @@ -177,14 +179,15 @@ note: } note: - ┌─ ownable.fe:21:3 + ┌─ ownable.fe:25:5 │ -21 │ ╭ pub fn transferOwnership(self, ctx: Context, newOwner: address): -22 │ │ assert ctx.msg_sender() == self._owner -23 │ │ assert newOwner != address(0) -24 │ │ self._owner = newOwner -25 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ╰─────────────────────────────────────────────────────────────────────────────^ attributes hash: 5690910393288515862 +25 │ ╭ pub fn transferOwnership(self, ctx: Context, newOwner: address) { +26 │ │ assert ctx.msg_sender() == self._owner +27 │ │ assert newOwner != address(0) +28 │ │ self._owner = newOwner +29 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) +30 │ │ } + │ ╰─────^ attributes hash: 5690910393288515862 │ = FunctionSignature { self_decl: Some( @@ -224,74 +227,74 @@ note: } note: - ┌─ ownable.fe:22:12 + ┌─ ownable.fe:26:16 │ -22 │ assert ctx.msg_sender() == self._owner - │ ^^^ Context: Memory +26 │ assert ctx.msg_sender() == self._owner + │ ^^^ Context: Memory note: - ┌─ ownable.fe:22:12 + ┌─ ownable.fe:26:16 │ -22 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable: Value - │ │ - │ address: Value +26 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable: Value + │ │ + │ address: Value note: - ┌─ ownable.fe:22:32 + ┌─ ownable.fe:26:36 │ -22 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value +26 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value note: - ┌─ ownable.fe:22:12 + ┌─ ownable.fe:26:16 │ -22 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -23 │ assert newOwner != address(0) - │ ^^^^^^^^ ^ u256: Value - │ │ - │ address: Value +26 │ assert ctx.msg_sender() == self._owner + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value +27 │ assert newOwner != address(0) + │ ^^^^^^^^ ^ u256: Value + │ │ + │ address: Value note: - ┌─ ownable.fe:23:24 + ┌─ ownable.fe:27:28 │ -23 │ assert newOwner != address(0) - │ ^^^^^^^^^^ address: Value +27 │ assert newOwner != address(0) + │ ^^^^^^^^^^ address: Value note: - ┌─ ownable.fe:23:12 + ┌─ ownable.fe:27:16 │ -23 │ assert newOwner != address(0) - │ ^^^^^^^^^^^^^^^^^^^^^^ bool: Value -24 │ self._owner = newOwner - │ ^^^^ Ownable: Value +27 │ assert newOwner != address(0) + │ ^^^^^^^^^^^^^^^^^^^^^^ bool: Value +28 │ self._owner = newOwner + │ ^^^^ Ownable: Value note: - ┌─ ownable.fe:24:5 + ┌─ ownable.fe:28:9 │ -24 │ self._owner = newOwner - │ ^^^^^^^^^^^ ^^^^^^^^ address: Value - │ │ - │ address: Storage { nonce: Some(0) } -25 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ^^^ ^^^ Context: Memory - │ │ - │ Context: Memory +28 │ self._owner = newOwner + │ ^^^^^^^^^^^ ^^^^^^^^ address: Value + │ │ + │ address: Storage { nonce: Some(0) } +29 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) + │ ^^^ ^^^ Context: Memory + │ │ + │ Context: Memory note: - ┌─ ownable.fe:25:51 + ┌─ ownable.fe:29:55 │ -25 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ address: Value - │ │ - │ address: Value +29 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ address: Value + │ │ + │ address: Value note: - ┌─ ownable.fe:25:5 + ┌─ ownable.fe:29:9 │ -25 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12166912587337306484 +29 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12166912587337306484 │ = Event { name: "OwnershipTransferred", diff --git a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap index 65447c8bd1..9aaae04129 100644 --- a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap +++ b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ pure_fn_standalone.fe:2:1 + ┌─ pure_fn_standalone.fe:1:1 │ -2 │ ╭ fn add_bonus(_ x: u256) -> u256: -3 │ │ return x + 10 - │ ╰─────────────────^ attributes hash: 4402553917254279762 +1 │ ╭ fn add_bonus(_ x: u256) -> u256 { +2 │ │ return x + 10 +3 │ │ } + │ ╰─^ attributes hash: 4402553917254279762 │ = FunctionSignature { self_decl: None, @@ -38,17 +39,17 @@ note: } note: - ┌─ pure_fn_standalone.fe:3:12 + ┌─ pure_fn_standalone.fe:2:12 │ -3 │ return x + 10 +2 │ return x + 10 │ ^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ pure_fn_standalone.fe:3:12 + ┌─ pure_fn_standalone.fe:2:12 │ -3 │ return x + 10 +2 │ return x + 10 │ ^^^^^^ u256: Value note: @@ -62,12 +63,14 @@ note: note: ┌─ pure_fn_standalone.fe:9:5 │ - 9 │ ╭ fn add_points(self, _ user: address, _ val: u256): -10 │ │ if self.cool_users[user]: + 9 │ ╭ fn add_points(self, _ user: address, _ val: u256) { +10 │ │ if self.cool_users[user] { 11 │ │ self.points[user] += add_bonus(val) -12 │ │ else: +12 │ │ } else { 13 │ │ self.points[user] += val - │ ╰────────────────────────────────────^ attributes hash: 11016307003570025576 +14 │ │ } +15 │ │ } + │ ╰─────^ attributes hash: 11016307003570025576 │ = FunctionSignature { self_decl: Some( @@ -110,13 +113,13 @@ note: note: ┌─ pure_fn_standalone.fe:10:12 │ -10 │ if self.cool_users[user]: +10 │ if self.cool_users[user] { │ ^^^^ Foo: Value note: ┌─ pure_fn_standalone.fe:10:12 │ -10 │ if self.cool_users[user]: +10 │ if self.cool_users[user] { │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } @@ -124,7 +127,7 @@ note: note: ┌─ pure_fn_standalone.fe:10:12 │ -10 │ if self.cool_users[user]: +10 │ if self.cool_users[user] { │ ^^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: None } => Value 11 │ self.points[user] += add_bonus(val) │ ^^^^ Foo: Value @@ -150,7 +153,7 @@ note: │ 11 │ self.points[user] += add_bonus(val) │ ^^^^^^^^^^^^^^ u256: Value -12 │ else: +12 │ } else { 13 │ self.points[user] += val │ ^^^^ Foo: Value @@ -171,15 +174,16 @@ note: │ u256: Storage { nonce: None } note: - ┌─ pure_fn_standalone.fe:15:5 + ┌─ pure_fn_standalone.fe:17:5 │ -15 │ ╭ pub fn bar(self, _ x: u256) -> u256: -16 │ │ let a: address = address(x) -17 │ │ self.add_points(a, 100) -18 │ │ self.cool_users[a] = true +17 │ ╭ pub fn bar(self, _ x: u256) -> u256 { +18 │ │ let a: address = address(x) 19 │ │ self.add_points(a, 100) -20 │ │ return self.points[a] - │ ╰─────────────────────────────^ attributes hash: 15237606768598971644 +20 │ │ self.cool_users[a] = true +21 │ │ self.add_points(a, 100) +22 │ │ return self.points[a] +23 │ │ } + │ ╰─────^ attributes hash: 15237606768598971644 │ = FunctionSignature { self_decl: Some( @@ -211,77 +215,77 @@ note: } note: - ┌─ pure_fn_standalone.fe:16:16 + ┌─ pure_fn_standalone.fe:18:16 │ -16 │ let a: address = address(x) +18 │ let a: address = address(x) │ ^^^^^^^ address note: - ┌─ pure_fn_standalone.fe:16:34 + ┌─ pure_fn_standalone.fe:18:34 │ -16 │ let a: address = address(x) +18 │ let a: address = address(x) │ ^ u256: Value note: - ┌─ pure_fn_standalone.fe:16:26 + ┌─ pure_fn_standalone.fe:18:26 │ -16 │ let a: address = address(x) +18 │ let a: address = address(x) │ ^^^^^^^^^^ address: Value -17 │ self.add_points(a, 100) +19 │ self.add_points(a, 100) │ ^^^^ ^ ^^^ u256: Value │ │ │ │ │ address: Value │ Foo: Value note: - ┌─ pure_fn_standalone.fe:17:9 + ┌─ pure_fn_standalone.fe:19:9 │ -17 │ self.add_points(a, 100) +19 │ self.add_points(a, 100) │ ^^^^^^^^^^^^^^^^^^^^^^^ (): Value -18 │ self.cool_users[a] = true +20 │ self.cool_users[a] = true │ ^^^^ Foo: Value note: - ┌─ pure_fn_standalone.fe:18:9 + ┌─ pure_fn_standalone.fe:20:9 │ -18 │ self.cool_users[a] = true +20 │ self.cool_users[a] = true │ ^^^^^^^^^^^^^^^ ^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ pure_fn_standalone.fe:18:9 + ┌─ pure_fn_standalone.fe:20:9 │ -18 │ self.cool_users[a] = true +20 │ self.cool_users[a] = true │ ^^^^^^^^^^^^^^^^^^ ^^^^ bool: Value │ │ │ bool: Storage { nonce: None } -19 │ self.add_points(a, 100) +21 │ self.add_points(a, 100) │ ^^^^ ^ ^^^ u256: Value │ │ │ │ │ address: Value │ Foo: Value note: - ┌─ pure_fn_standalone.fe:19:9 + ┌─ pure_fn_standalone.fe:21:9 │ -19 │ self.add_points(a, 100) +21 │ self.add_points(a, 100) │ ^^^^^^^^^^^^^^^^^^^^^^^ (): Value -20 │ return self.points[a] +22 │ return self.points[a] │ ^^^^ Foo: Value note: - ┌─ pure_fn_standalone.fe:20:16 + ┌─ pure_fn_standalone.fe:22:16 │ -20 │ return self.points[a] +22 │ return self.points[a] │ ^^^^^^^^^^^ ^ address: Value │ │ │ Map: Storage { nonce: Some(1) } note: - ┌─ pure_fn_standalone.fe:20:16 + ┌─ pure_fn_standalone.fe:22:16 │ -20 │ return self.points[a] +22 │ return self.points[a] │ ^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap index caa43e4a8c..8d310d4a9a 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_addition_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 6924216180113238234 +4 │ │ } + │ ╰─────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap index 931b6131fd..8c9e62ff12 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_addition_u128.fe:2:5 │ -2 │ ╭ pub fn bar(x: u128, y: u128) -> u128: +2 │ ╭ pub fn bar(x: u128, y: u128) -> u128 { 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 233274078014721184 +4 │ │ } + │ ╰─────^ attributes hash: 233274078014721184 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap index 677863d0a9..7d75cce26d 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_addition_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x + y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_array.snap b/crates/analyzer/tests/snapshots/analysis__return_array.snap index 0ba625ef27..116f206e1b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_array.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_array.snap @@ -6,11 +6,12 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_array.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256) -> Array: -3 │ │ let my_array: Array +2 │ ╭ pub fn bar(x: u256) -> Array { +3 │ │ let my_array: Array 4 │ │ my_array[3] = x 5 │ │ return my_array - │ ╰───────────────────────^ attributes hash: 5752237891839439208 +6 │ │ } + │ ╰─────^ attributes hash: 5752237891839439208 │ = FunctionSignature { self_decl: None, @@ -43,8 +44,8 @@ note: note: ┌─ return_array.fe:3:23 │ -3 │ let my_array: Array - │ ^^^^^^^^^^^^^ Array +3 │ let my_array: Array + │ ^^^^^^^^^^^^^^ Array note: ┌─ return_array.fe:4:9 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap index 61ab4d7179..b17725ad29 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseand_u128.fe:2:5 │ -2 │ ╭ pub fn bar(x: u128, y: u128) -> u128: +2 │ ╭ pub fn bar(x: u128, y: u128) -> u128 { 3 │ │ return x & y - │ ╰────────────────────^ attributes hash: 233274078014721184 +4 │ │ } + │ ╰─────^ attributes hash: 233274078014721184 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap index 496036ae09..d381fd8335 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseand_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x & y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap index 24504f7376..e12bd3c574 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseor_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x | y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap index 99c184973e..48f2db15f3 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseshl_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x << y - │ ╰─────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap index eee6feaa6f..0629d6d210 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseshr_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: u256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: u256) -> i256 { 3 │ │ return x >> y - │ ╰─────────────────────^ attributes hash: 12518870770702615859 +4 │ │ } + │ ╰─────^ attributes hash: 12518870770702615859 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap index 39cac35ae8..ece7a0fffa 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwiseshr_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x >> y - │ ╰─────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap index 3572bbabcf..c7ddf9c5d1 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bitwisexor_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x ^ y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap index 1b61b301c4..d801e75048 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bool_false.fe:2:5 │ -2 │ ╭ pub fn bar() -> bool: +2 │ ╭ pub fn bar() -> bool { 3 │ │ return false - │ ╰────────────────────^ attributes hash: 5583437014632790429 +4 │ │ } + │ ╰─────^ attributes hash: 5583437014632790429 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap index f35d2e1f2a..7078c985be 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bool_inverted.fe:2:5 │ -2 │ ╭ pub fn bar(some_condition: bool) -> bool: +2 │ ╭ pub fn bar(some_condition: bool) -> bool { 3 │ │ return not some_condition - │ ╰─────────────────────────────────^ attributes hash: 9793001524182520011 +4 │ │ } + │ ╰─────^ attributes hash: 9793001524182520011 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap index 7799556e72..509378f776 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bool_op_and.fe:2:5 │ -2 │ ╭ pub fn bar(x: bool, y: bool) -> bool: +2 │ ╭ pub fn bar(x: bool, y: bool) -> bool { 3 │ │ return x and y - │ ╰──────────────────────^ attributes hash: 3532809531490166398 +4 │ │ } + │ ╰─────^ attributes hash: 3532809531490166398 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap index 99ec8939a3..4aa2835080 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bool_op_or.fe:2:5 │ -2 │ ╭ pub fn bar(x: bool, y: bool) -> bool: +2 │ ╭ pub fn bar(x: bool, y: bool) -> bool { 3 │ │ return x or y - │ ╰─────────────────────^ attributes hash: 3532809531490166398 +4 │ │ } + │ ╰─────^ attributes hash: 3532809531490166398 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap index e2be7bc30b..edaec429dc 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_bool_true.fe:2:5 │ -2 │ ╭ pub fn bar() -> bool: +2 │ ╭ pub fn bar() -> bool { 3 │ │ return true - │ ╰───────────────────^ attributes hash: 5583437014632790429 +4 │ │ } + │ ╰─────^ attributes hash: 5583437014632790429 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap index c2f39b2404..c23f50a552 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ return_builtin_attributes.fe:5:5 + ┌─ return_builtin_attributes.fe:4:5 │ -5 │ ╭ pub fn base_fee(ctx: Context) -> u256: -6 │ │ return ctx.base_fee() - │ ╰─────────────────────────────^ attributes hash: 10526263819290319263 +4 │ ╭ pub fn base_fee(ctx: Context) -> u256 { +5 │ │ return ctx.base_fee() +6 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -39,49 +40,50 @@ note: } note: - ┌─ return_builtin_attributes.fe:6:16 + ┌─ return_builtin_attributes.fe:5:16 │ -6 │ return ctx.base_fee() +5 │ return ctx.base_fee() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:6:16 + ┌─ return_builtin_attributes.fe:5:16 │ -6 │ return ctx.base_fee() +5 │ return ctx.base_fee() │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:8:5 - │ -8 │ ╭ pub fn coinbase(ctx: Context) -> address: -9 │ │ return ctx.block_coinbase() - │ ╰───────────────────────────────────^ attributes hash: 9364783648076633772 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - ], - return_type: Ok( - Base( - Address, - ), - ), - } + ┌─ return_builtin_attributes.fe:8:5 + │ + 8 │ ╭ pub fn coinbase(ctx: Context) -> address { + 9 │ │ return ctx.block_coinbase() +10 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + ], + return_type: Ok( + Base( + Address, + ), + ), + } note: ┌─ return_builtin_attributes.fe:9:16 @@ -96,11 +98,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ return_builtin_attributes.fe:11:5 + ┌─ return_builtin_attributes.fe:12:5 │ -11 │ ╭ pub fn difficulty(ctx: Context) -> u256: -12 │ │ return ctx.block_difficulty() - │ ╰─────────────────────────────────────^ attributes hash: 10526263819290319263 +12 │ ╭ pub fn difficulty(ctx: Context) -> u256 { +13 │ │ return ctx.block_difficulty() +14 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -131,23 +134,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:12:16 + ┌─ return_builtin_attributes.fe:13:16 │ -12 │ return ctx.block_difficulty() +13 │ return ctx.block_difficulty() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:12:16 + ┌─ return_builtin_attributes.fe:13:16 │ -12 │ return ctx.block_difficulty() +13 │ return ctx.block_difficulty() │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:14:5 + ┌─ return_builtin_attributes.fe:16:5 │ -14 │ ╭ pub fn number(ctx: Context) -> u256: -15 │ │ return ctx.block_number() - │ ╰─────────────────────────────────^ attributes hash: 10526263819290319263 +16 │ ╭ pub fn number(ctx: Context) -> u256 { +17 │ │ return ctx.block_number() +18 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -178,23 +182,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:15:16 + ┌─ return_builtin_attributes.fe:17:16 │ -15 │ return ctx.block_number() +17 │ return ctx.block_number() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:15:16 + ┌─ return_builtin_attributes.fe:17:16 │ -15 │ return ctx.block_number() +17 │ return ctx.block_number() │ ^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:17:5 + ┌─ return_builtin_attributes.fe:20:5 │ -17 │ ╭ pub fn timestamp(ctx: Context) -> u256: -18 │ │ return ctx.block_timestamp() - │ ╰────────────────────────────────────^ attributes hash: 10526263819290319263 +20 │ ╭ pub fn timestamp(ctx: Context) -> u256 { +21 │ │ return ctx.block_timestamp() +22 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -225,23 +230,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:18:16 + ┌─ return_builtin_attributes.fe:21:16 │ -18 │ return ctx.block_timestamp() +21 │ return ctx.block_timestamp() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:18:16 + ┌─ return_builtin_attributes.fe:21:16 │ -18 │ return ctx.block_timestamp() +21 │ return ctx.block_timestamp() │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:20:5 + ┌─ return_builtin_attributes.fe:24:5 │ -20 │ ╭ pub fn chainid(ctx: Context) -> u256: -21 │ │ return ctx.chain_id() - │ ╰─────────────────────────────^ attributes hash: 10526263819290319263 +24 │ ╭ pub fn chainid(ctx: Context) -> u256 { +25 │ │ return ctx.chain_id() +26 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -272,23 +278,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:21:16 + ┌─ return_builtin_attributes.fe:25:16 │ -21 │ return ctx.chain_id() +25 │ return ctx.chain_id() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:21:16 + ┌─ return_builtin_attributes.fe:25:16 │ -21 │ return ctx.chain_id() +25 │ return ctx.chain_id() │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:23:5 + ┌─ return_builtin_attributes.fe:28:5 │ -23 │ ╭ pub fn sender(ctx: Context) -> address: -24 │ │ return ctx.msg_sender() - │ ╰───────────────────────────────^ attributes hash: 9364783648076633772 +28 │ ╭ pub fn sender(ctx: Context) -> address { +29 │ │ return ctx.msg_sender() +30 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -317,23 +324,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:24:16 + ┌─ return_builtin_attributes.fe:29:16 │ -24 │ return ctx.msg_sender() +29 │ return ctx.msg_sender() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:24:16 + ┌─ return_builtin_attributes.fe:29:16 │ -24 │ return ctx.msg_sender() +29 │ return ctx.msg_sender() │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ return_builtin_attributes.fe:26:5 + ┌─ return_builtin_attributes.fe:32:5 │ -26 │ ╭ pub fn value(ctx: Context) -> u256: -27 │ │ return ctx.msg_value() - │ ╰──────────────────────────────^ attributes hash: 10526263819290319263 +32 │ ╭ pub fn value(ctx: Context) -> u256 { +33 │ │ return ctx.msg_value() +34 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -364,23 +372,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:27:16 + ┌─ return_builtin_attributes.fe:33:16 │ -27 │ return ctx.msg_value() +33 │ return ctx.msg_value() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:27:16 + ┌─ return_builtin_attributes.fe:33:16 │ -27 │ return ctx.msg_value() +33 │ return ctx.msg_value() │ ^^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_builtin_attributes.fe:29:5 + ┌─ return_builtin_attributes.fe:36:5 │ -29 │ ╭ pub fn origin(ctx: Context) -> address: -30 │ │ return ctx.tx_origin() - │ ╰──────────────────────────────^ attributes hash: 9364783648076633772 +36 │ ╭ pub fn origin(ctx: Context) -> address { +37 │ │ return ctx.tx_origin() +38 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, @@ -409,23 +418,24 @@ note: } note: - ┌─ return_builtin_attributes.fe:30:16 + ┌─ return_builtin_attributes.fe:37:16 │ -30 │ return ctx.tx_origin() +37 │ return ctx.tx_origin() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:30:16 + ┌─ return_builtin_attributes.fe:37:16 │ -30 │ return ctx.tx_origin() +37 │ return ctx.tx_origin() │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ return_builtin_attributes.fe:32:5 + ┌─ return_builtin_attributes.fe:40:5 │ -32 │ ╭ pub fn gas_price(ctx: Context) -> u256: -33 │ │ return ctx.tx_gas_price() - │ ╰─────────────────────────────────^ attributes hash: 10526263819290319263 +40 │ ╭ pub fn gas_price(ctx: Context) -> u256 { +41 │ │ return ctx.tx_gas_price() +42 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, @@ -456,15 +466,15 @@ note: } note: - ┌─ return_builtin_attributes.fe:33:16 + ┌─ return_builtin_attributes.fe:41:16 │ -33 │ return ctx.tx_gas_price() +41 │ return ctx.tx_gas_price() │ ^^^ Context: Memory note: - ┌─ return_builtin_attributes.fe:33:16 + ┌─ return_builtin_attributes.fe:41:16 │ -33 │ return ctx.tx_gas_price() +41 │ return ctx.tx_gas_price() │ ^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap index 9eaf889600..af84a0f319 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_division_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x / y - │ ╰────────────────────^ attributes hash: 6924216180113238234 +4 │ │ } + │ ╰─────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap index e12004a300..36546f2c8e 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_division_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x / y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap b/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap index 998348cdb1..fa0ab24158 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ return_unit.fe:3:3 + ┌─ return_unit.fe:2:5 │ -3 │ ╭ pub fn explicit_return_a1(): -4 │ │ return - │ ╰──────────^ attributes hash: 8319796915330632390 +2 │ ╭ pub fn explicit_return_a1() { +3 │ │ return +4 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -22,11 +23,12 @@ note: } note: - ┌─ return_unit.fe:6:3 + ┌─ return_unit.fe:6:5 │ -6 │ ╭ pub fn explicit_return_a2(): -7 │ │ return () - │ ╰─────────────^ attributes hash: 8319796915330632390 +6 │ ╭ pub fn explicit_return_a2() { +7 │ │ return () +8 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -40,17 +42,18 @@ note: } note: - ┌─ return_unit.fe:7:12 + ┌─ return_unit.fe:7:16 │ -7 │ return () - │ ^^ (): Value +7 │ return () + │ ^^ (): Value note: - ┌─ return_unit.fe:9:3 + ┌─ return_unit.fe:10:5 │ - 9 │ ╭ pub fn explicit_return_b1() -> (): -10 │ │ return - │ ╰──────────^ attributes hash: 8319796915330632390 +10 │ ╭ pub fn explicit_return_b1() -> () { +11 │ │ return +12 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -64,11 +67,12 @@ note: } note: - ┌─ return_unit.fe:12:3 + ┌─ return_unit.fe:14:5 │ -12 │ ╭ pub fn explicit_return_b2() -> (): -13 │ │ return () - │ ╰─────────────^ attributes hash: 8319796915330632390 +14 │ ╭ pub fn explicit_return_b2() -> () { +15 │ │ return () +16 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -82,18 +86,17 @@ note: } note: - ┌─ return_unit.fe:13:12 + ┌─ return_unit.fe:15:16 │ -13 │ return () - │ ^^ (): Value +15 │ return () + │ ^^ (): Value note: - ┌─ return_unit.fe:15:3 - │ -15 │ ╭ pub fn implicit_a1(): -16 │ │ pass - │ ╰────────^ attributes hash: 8319796915330632390 - │ + ┌─ return_unit.fe:18:5 + │ +18 │ pub fn implicit_a1() {} + │ ^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8319796915330632390 + │ = FunctionSignature { self_decl: None, ctx_decl: None, @@ -106,12 +109,11 @@ note: } note: - ┌─ return_unit.fe:18:3 - │ -18 │ ╭ pub fn implicit_a2() -> (): -19 │ │ pass - │ ╰────────^ attributes hash: 8319796915330632390 - │ + ┌─ return_unit.fe:20:5 + │ +20 │ pub fn implicit_a2() -> () {} + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8319796915330632390 + │ = FunctionSignature { self_decl: None, ctx_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap index d42dabb586..a7290cd713 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_eq_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x == y - │ ╰─────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap index 056d0ca01c..a2f896ae14 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_gt_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: +2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x > y - │ ╰────────────────────^ attributes hash: 7978284628773169348 +4 │ │ } + │ ╰─────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap index bf7cae70fe..1a8a9d3f82 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_gt_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x > y - │ ╰────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap index 38550ab176..cd51e66fc1 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_gte_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: +2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x >= y - │ ╰─────────────────────^ attributes hash: 7978284628773169348 +4 │ │ } + │ ╰─────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap index 9c3b542dd6..7d1b501f57 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_gte_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x >= y - │ ╰─────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap b/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap index c7e3bc3928..12f602d687 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_i128_cast.fe:2:5 │ -2 │ ╭ pub fn bar() -> i128: +2 │ ╭ pub fn bar() -> i128 { 3 │ │ return i128(-3) - │ ╰───────────────────────^ attributes hash: 155533728466856391 +4 │ │ } + │ ╰─────^ attributes hash: 155533728466856391 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_i256.snap index 9a0951ef95..731b95fa88 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_i256.fe:2:5 │ -2 │ ╭ pub fn bar() -> i256: +2 │ ╭ pub fn bar() -> i256 { 3 │ │ return -3 - │ ╰─────────────────^ attributes hash: 8116994679119332188 +4 │ │ } + │ ╰─────^ attributes hash: 8116994679119332188 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap index 245373e856..9c397d3bb1 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u128.fe:2:5 │ -2 │ ╭ pub fn bar(x: u128) -> u128: +2 │ ╭ pub fn bar(x: u128) -> u128 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 8882570074302111953 +4 │ │ } + │ ╰─────^ attributes hash: 8882570074302111953 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap index 5f5818895a..a229da26c4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u16.fe:2:5 │ -2 │ ╭ pub fn bar(x: u16) -> u16: +2 │ ╭ pub fn bar(x: u16) -> u16 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 12880247899747575992 +4 │ │ } + │ ╰─────^ attributes hash: 12880247899747575992 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap index 0833b7041b..12f99ca768 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256) -> u256: +2 │ ╭ pub fn bar(x: u256) -> u256 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 6622018637299644818 +4 │ │ } + │ ╰─────^ attributes hash: 6622018637299644818 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap index 2047c1edf1..8a31db838f 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u32.fe:2:5 │ -2 │ ╭ pub fn bar(x: u32) -> u32: +2 │ ╭ pub fn bar(x: u32) -> u32 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 3053189841811312763 +4 │ │ } + │ ╰─────^ attributes hash: 3053189841811312763 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap index 1e637433c9..8693495b09 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u64.fe:2:5 │ -2 │ ╭ pub fn bar(x: u64) -> u64: +2 │ ╭ pub fn bar(x: u64) -> u64 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 14360693544116809530 +4 │ │ } + │ ╰─────^ attributes hash: 14360693544116809530 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap index 20d8b5765b..3b62b044ae 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_identity_u8.fe:2:5 │ -2 │ ╭ pub fn bar(x: u8) -> u8: +2 │ ╭ pub fn bar(x: u8) -> u8 { 3 │ │ return x - │ ╰────────────────^ attributes hash: 4472501580732693210 +4 │ │ } + │ ╰─────^ attributes hash: 4472501580732693210 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap index 9cae37e632..308e699576 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_lt_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: +2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 7978284628773169348 +4 │ │ } + │ ╰─────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap index 4a156f79f3..32867706f8 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_lt_u128.fe:2:5 │ -2 │ ╭ pub fn bar(x: u128, y: u128) -> bool: +2 │ ╭ pub fn bar(x: u128, y: u128) -> bool { 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 4640755342958234471 +4 │ │ } + │ ╰─────^ attributes hash: 4640755342958234471 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap index c4f15fcd3f..1d05310d69 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_lt_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x < y - │ ╰────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap index 7f6eb1b897..d89d6916ab 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_lte_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> bool: +2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x <= y - │ ╰─────────────────────^ attributes hash: 7978284628773169348 +4 │ │ } + │ ╰─────^ attributes hash: 7978284628773169348 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap index c5ea29f2c8..6a9b88f4a9 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_lte_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x <= y - │ ╰─────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap index 7503f7dde5..b13326c05b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_mod_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x % y - │ ╰────────────────────^ attributes hash: 6924216180113238234 +4 │ │ } + │ ╰─────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap index d2273564d4..cef3907a2b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_mod_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x % y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap index 2f80620711..f1c7b27d82 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_msg_sig.fe:4:5 │ -4 │ ╭ pub fn bar(ctx: Context) -> u256: +4 │ ╭ pub fn bar(ctx: Context) -> u256 { 5 │ │ return ctx.msg_sig() - │ ╰────────────────────────────^ attributes hash: 10526263819290319263 +6 │ │ } + │ ╰─────^ attributes hash: 10526263819290319263 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap index 8ccb5dcc42..dccf128f50 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_multiplication_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x * y - │ ╰────────────────────^ attributes hash: 6924216180113238234 +4 │ │ } + │ ╰─────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap index ba224bfcb8..e7f35f9fef 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_multiplication_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x * y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap index 4e0fa94bdb..90cf30a944 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_noteq_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> bool: +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x != y - │ ╰─────────────────────^ attributes hash: 3021624743158907825 +4 │ │ } + │ ╰─────^ attributes hash: 3021624743158907825 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap index 22c531e55d..59ce547820 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_pow_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i8, y: u8) -> i8: +2 │ ╭ pub fn bar(x: i8, y: u8) -> i8 { 3 │ │ return x ** y - │ ╰─────────────────────^ attributes hash: 14588309679488297104 +4 │ │ } + │ ╰─────^ attributes hash: 14588309679488297104 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap index 8840ad7b1d..0a790cf373 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_pow_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x ** y - │ ╰─────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap index 25f8762ece..9cdf0116b9 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_subtraction_i256.fe:2:5 │ -2 │ ╭ pub fn bar(x: i256, y: i256) -> i256: +2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x - y - │ ╰────────────────────^ attributes hash: 6924216180113238234 +4 │ │ } + │ ╰─────^ attributes hash: 6924216180113238234 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap index d2bacb4c69..1562abed2b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_subtraction_u256.fe:2:5 │ -2 │ ╭ pub fn bar(x: u256, y: u256) -> u256: +2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x - y - │ ╰────────────────────^ attributes hash: 6847926207878778580 +4 │ │ } + │ ╰─────^ attributes hash: 6847926207878778580 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap b/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap index d6dee7147e..e26658bc68 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_u128_cast.fe:2:5 │ -2 │ ╭ pub fn bar() -> u128: +2 │ ╭ pub fn bar() -> u128 { 3 │ │ return u128(42) - │ ╰───────────────────────^ attributes hash: 104322826323649285 +4 │ │ } + │ ╰─────^ attributes hash: 104322826323649285 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_u256.snap index fbb35d1bca..ff29d6dd41 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u256.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ return_u256.fe:2:5 │ -2 │ ╭ pub fn bar() -> u256: +2 │ ╭ pub fn bar() -> u256 { 3 │ │ return 42 - │ ╰─────────────────^ attributes hash: 6115314201970082834 +4 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn.snap b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn.snap index 6a2f62167e..606e6bcbe3 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ return_u256_from_called_fn.fe:4:5 + ┌─ return_u256_from_called_fn.fe:2:5 │ -4 │ ╭ pub fn bar(self) -> u256: -5 │ │ return foo() - │ ╰────────────────────^ attributes hash: 11773348765973600208 +2 │ ╭ pub fn bar(self) -> u256 { +3 │ │ return foo() +4 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -26,17 +27,18 @@ note: } note: - ┌─ return_u256_from_called_fn.fe:5:16 + ┌─ return_u256_from_called_fn.fe:3:16 │ -5 │ return foo() +3 │ return foo() │ ^^^^^ u256: Value note: - ┌─ return_u256_from_called_fn.fe:7:5 + ┌─ return_u256_from_called_fn.fe:6:5 │ -7 │ ╭ pub fn foo() -> u256: -8 │ │ return 42 - │ ╰─────────────────^ attributes hash: 6115314201970082834 +6 │ ╭ pub fn foo() -> u256 { +7 │ │ return 42 +8 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -52,9 +54,9 @@ note: } note: - ┌─ return_u256_from_called_fn.fe:8:16 + ┌─ return_u256_from_called_fn.fe:7:16 │ -8 │ return 42 +7 │ return 42 │ ^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap index 1be0097720..b463097ea4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u256_from_called_fn_with_args.snap @@ -10,11 +10,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ return_u256_from_called_fn_with_args.fe:3:5 + ┌─ return_u256_from_called_fn_with_args.fe:4:5 │ -3 │ ╭ pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256: -4 │ │ return v1 + v2 + v3 + v4 + v5 - │ ╰─────────────────────────────────────^ attributes hash: 1504347162142127509 +4 │ ╭ pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256 { +5 │ │ return v1 + v2 + v3 + v4 + v5 +6 │ │ } + │ ╰─────^ attributes hash: 1504347162142127509 │ = FunctionSignature { self_decl: None, @@ -96,76 +97,78 @@ note: } note: - ┌─ return_u256_from_called_fn_with_args.fe:4:16 + ┌─ return_u256_from_called_fn_with_args.fe:5:16 │ -4 │ return v1 + v2 + v3 + v4 + v5 +5 │ return v1 + v2 + v3 + v4 + v5 │ ^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:4:16 + ┌─ return_u256_from_called_fn_with_args.fe:5:16 │ -4 │ return v1 + v2 + v3 + v4 + v5 +5 │ return v1 + v2 + v3 + v4 + v5 │ ^^^^^^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:4:16 + ┌─ return_u256_from_called_fn_with_args.fe:5:16 │ -4 │ return v1 + v2 + v3 + v4 + v5 +5 │ return v1 + v2 + v3 + v4 + v5 │ ^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:4:16 + ┌─ return_u256_from_called_fn_with_args.fe:5:16 │ -4 │ return v1 + v2 + v3 + v4 + v5 +5 │ return v1 + v2 + v3 + v4 + v5 │ ^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:4:16 + ┌─ return_u256_from_called_fn_with_args.fe:5:16 │ -4 │ return v1 + v2 + v3 + v4 + v5 +5 │ return v1 + v2 + v3 + v4 + v5 │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:6:5 - │ -6 │ ╭ pub fn cem() -> u256: -7 │ │ return 100 - │ ╰──────────────────^ attributes hash: 6115314201970082834 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ return_u256_from_called_fn_with_args.fe:8:5 + │ + 8 │ ╭ pub fn cem() -> u256 { + 9 │ │ return 100 +10 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: - ┌─ return_u256_from_called_fn_with_args.fe:7:16 + ┌─ return_u256_from_called_fn_with_args.fe:9:16 │ -7 │ return 100 +9 │ return 100 │ ^^^ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:9:5 + ┌─ return_u256_from_called_fn_with_args.fe:12:5 │ - 9 │ ╭ pub fn bar(self) -> u256: -10 │ │ self.baz[0] = 43 -11 │ │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) - │ ╰─────────────────────────────────────────────────────^ attributes hash: 11773348765973600208 +12 │ ╭ pub fn bar(self) -> u256 { +13 │ │ self.baz[0] = 43 +14 │ │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +15 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -183,27 +186,27 @@ note: } note: - ┌─ return_u256_from_called_fn_with_args.fe:10:9 + ┌─ return_u256_from_called_fn_with_args.fe:13:9 │ -10 │ self.baz[0] = 43 +13 │ self.baz[0] = 43 │ ^^^^ Foo: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:10:9 + ┌─ return_u256_from_called_fn_with_args.fe:13:9 │ -10 │ self.baz[0] = 43 +13 │ self.baz[0] = 43 │ ^^^^^^^^ ^ u256: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ return_u256_from_called_fn_with_args.fe:10:9 + ┌─ return_u256_from_called_fn_with_args.fe:13:9 │ -10 │ self.baz[0] = 43 +13 │ self.baz[0] = 43 │ ^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: None } -11 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^ ^ ^^^^^ ^^ ^^ u256: Value │ │ │ │ │ │ │ │ │ u256: Value @@ -212,31 +215,31 @@ note: │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:11:33 + ┌─ return_u256_from_called_fn_with_args.fe:14:33 │ -11 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^^^^^^^ ^^^^ Foo: Value │ │ │ u256: Value note: - ┌─ return_u256_from_called_fn_with_args.fe:11:42 + ┌─ return_u256_from_called_fn_with_args.fe:14:42 │ -11 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^^^^^^^^ ^ u256: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ return_u256_from_called_fn_with_args.fe:11:42 + ┌─ return_u256_from_called_fn_with_args.fe:14:42 │ -11 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ return_u256_from_called_fn_with_args.fe:11:16 + ┌─ return_u256_from_called_fn_with_args.fe:14:16 │ -11 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) +14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__revert.snap b/crates/analyzer/tests/snapshots/analysis__revert.snap index 5a3c52b381..5217aabc83 100644 --- a/crates/analyzer/tests/snapshots/analysis__revert.snap +++ b/crates/analyzer/tests/snapshots/analysis__revert.snap @@ -12,17 +12,18 @@ note: │ ^^^^^^^^^^^^^ bool note: - ┌─ revert.fe:8:5 + ┌─ revert.fe:9:5 │ -8 │ my_other_error: OtherError +9 │ my_other_error: OtherError │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ OtherError note: - ┌─ revert.fe:10:5 + ┌─ revert.fe:11:5 │ -10 │ ╭ pub fn bar() -> u256: -11 │ │ revert - │ ╰──────────────^ attributes hash: 6115314201970082834 +11 │ ╭ pub fn bar() -> u256 { +12 │ │ revert +13 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -38,11 +39,12 @@ note: } note: - ┌─ revert.fe:13:5 + ┌─ revert.fe:15:5 │ -13 │ ╭ pub fn revert_custom_error(ctx: Context): -14 │ │ ctx.send_value(to: address(0), wei: 100) - │ ╰────────────────────────────────────────────────^ attributes hash: 5519676733853656531 +15 │ ╭ pub fn revert_custom_error(ctx: Context) { +16 │ │ ctx.send_value(to: address(0), wei: 100) +17 │ │ } + │ ╰─────^ attributes hash: 5519676733853656531 │ = FunctionSignature { self_decl: None, @@ -71,33 +73,34 @@ note: } note: - ┌─ revert.fe:14:9 + ┌─ revert.fe:16:9 │ -14 │ ctx.send_value(to: address(0), wei: 100) +16 │ ctx.send_value(to: address(0), wei: 100) │ ^^^ ^ u256: Value │ │ │ Context: Memory note: - ┌─ revert.fe:14:28 + ┌─ revert.fe:16:28 │ -14 │ ctx.send_value(to: address(0), wei: 100) +16 │ ctx.send_value(to: address(0), wei: 100) │ ^^^^^^^^^^ ^^^ u256: Value │ │ │ address: Value note: - ┌─ revert.fe:14:9 + ┌─ revert.fe:16:9 │ -14 │ ctx.send_value(to: address(0), wei: 100) +16 │ ctx.send_value(to: address(0), wei: 100) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: - ┌─ revert.fe:16:5 + ┌─ revert.fe:19:5 │ -16 │ ╭ pub fn revert_other_error(): -17 │ │ revert OtherError(msg: 1, val: true) - │ ╰────────────────────────────────────────────^ attributes hash: 8319796915330632390 +19 │ ╭ pub fn revert_other_error() { +20 │ │ revert OtherError(msg: 1, val: true) +21 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -111,26 +114,27 @@ note: } note: - ┌─ revert.fe:17:32 + ┌─ revert.fe:20:32 │ -17 │ revert OtherError(msg: 1, val: true) +20 │ revert OtherError(msg: 1, val: true) │ ^ ^^^^ bool: Value │ │ │ u256: Value note: - ┌─ revert.fe:17:16 + ┌─ revert.fe:20:16 │ -17 │ revert OtherError(msg: 1, val: true) +20 │ revert OtherError(msg: 1, val: true) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OtherError: Memory note: - ┌─ revert.fe:19:5 + ┌─ revert.fe:23:5 │ -19 │ ╭ pub fn revert_other_error_from_sto(self): -20 │ │ self.my_other_error = OtherError(msg: 1, val: true) -21 │ │ revert self.my_other_error.to_mem() - │ ╰───────────────────────────────────────────^ attributes hash: 18235041182630809162 +23 │ ╭ pub fn revert_other_error_from_sto(self) { +24 │ │ self.my_other_error = OtherError(msg: 1, val: true) +25 │ │ revert self.my_other_error.to_mem() +26 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -146,38 +150,38 @@ note: } note: - ┌─ revert.fe:20:9 + ┌─ revert.fe:24:9 │ -20 │ self.my_other_error = OtherError(msg: 1, val: true) +24 │ self.my_other_error = OtherError(msg: 1, val: true) │ ^^^^ Foo: Value note: - ┌─ revert.fe:20:9 + ┌─ revert.fe:24:9 │ -20 │ self.my_other_error = OtherError(msg: 1, val: true) +24 │ self.my_other_error = OtherError(msg: 1, val: true) │ ^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool: Value │ │ │ │ │ u256: Value │ OtherError: Storage { nonce: Some(0) } note: - ┌─ revert.fe:20:31 + ┌─ revert.fe:24:31 │ -20 │ self.my_other_error = OtherError(msg: 1, val: true) +24 │ self.my_other_error = OtherError(msg: 1, val: true) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OtherError: Memory -21 │ revert self.my_other_error.to_mem() +25 │ revert self.my_other_error.to_mem() │ ^^^^ Foo: Value note: - ┌─ revert.fe:21:16 + ┌─ revert.fe:25:16 │ -21 │ revert self.my_other_error.to_mem() +25 │ revert self.my_other_error.to_mem() │ ^^^^^^^^^^^^^^^^^^^ OtherError: Storage { nonce: Some(0) } note: - ┌─ revert.fe:21:16 + ┌─ revert.fe:25:16 │ -21 │ revert self.my_other_error.to_mem() +25 │ revert self.my_other_error.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OtherError: Storage { nonce: Some(0) } => Memory diff --git a/crates/analyzer/tests/snapshots/analysis__self_address.snap b/crates/analyzer/tests/snapshots/analysis__self_address.snap index b6fbafc821..f2ea18b791 100644 --- a/crates/analyzer/tests/snapshots/analysis__self_address.snap +++ b/crates/analyzer/tests/snapshots/analysis__self_address.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ self_address.fe:4:5 │ -4 │ ╭ pub fn my_address(ctx: Context) -> address: +4 │ ╭ pub fn my_address(ctx: Context) -> address { 5 │ │ return ctx.self_address() - │ ╰─────────────────────────────────^ attributes hash: 9364783648076633772 +6 │ │ } + │ ╰─────^ attributes hash: 9364783648076633772 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__send_value.snap b/crates/analyzer/tests/snapshots/analysis__send_value.snap index c9758ad977..cd2a48be20 100644 --- a/crates/analyzer/tests/snapshots/analysis__send_value.snap +++ b/crates/analyzer/tests/snapshots/analysis__send_value.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ send_value.fe:4:5 │ -4 │ ╭ pub fn send_them_wei(ctx: Context, to: address, wei: u256): +4 │ ╭ pub fn send_them_wei(ctx: Context, to: address, wei: u256) { 5 │ │ ctx.send_value(to, wei) - │ ╰───────────────────────────────^ attributes hash: 14069636423119281176 +6 │ │ } + │ ╰─────^ attributes hash: 14069636423119281176 │ = FunctionSignature { self_decl: None, diff --git a/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap b/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap index 7c3ad83a8b..d324eb003c 100644 --- a/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap +++ b/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap @@ -1,59 +1,60 @@ --- source: crates/analyzer/tests/analysis.rs expression: "build_snapshot(&db, module)" + --- note: - ┌─ simple_open_auction.fe:8:5 + ┌─ simple_open_auction.fe:9:5 │ -8 │ pub highest_bid: u256 +9 │ pub highest_bid: u256 │ ^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ simple_open_auction.fe:18:5 + ┌─ simple_open_auction.fe:14:5 │ -18 │ auction_end_time: u256 +14 │ auction_end_time: u256 │ ^^^^^^^^^^^^^^^^^^^^^^ u256 -19 │ beneficiary: address +15 │ beneficiary: address │ ^^^^^^^^^^^^^^^^^^^^ address -20 │ -21 │ highest_bidder: address +16 │ +17 │ highest_bidder: address │ ^^^^^^^^^^^^^^^^^^^^^^^ address -22 │ highest_bid: u256 +18 │ highest_bid: u256 │ ^^^^^^^^^^^^^^^^^ u256 -23 │ -24 │ pending_returns: Map +19 │ +20 │ pending_returns: Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map -25 │ -26 │ ended: bool +21 │ +22 │ ended: bool │ ^^^^^^^^^^^ bool note: - ┌─ simple_open_auction.fe:30:9 + ┌─ simple_open_auction.fe:26:9 │ -30 │ idx bidder: address +26 │ idx bidder: address │ ^^^^^^^^^^^^^^^^^^^ address -31 │ amount: u256 +27 │ amount: u256 │ ^^^^^^^^^^^^ u256 note: - ┌─ simple_open_auction.fe:34:9 + ┌─ simple_open_auction.fe:31:9 │ -34 │ idx winner: address +31 │ idx winner: address │ ^^^^^^^^^^^^^^^^^^^ address -35 │ amount: u256 +32 │ amount: u256 │ ^^^^^^^^^^^^ u256 note: - ┌─ simple_open_auction.fe:43:5 + ┌─ simple_open_auction.fe:42:5 │ -43 │ ╭ pub fn bid(self, ctx: Context): -44 │ │ if ctx.block_timestamp() > self.auction_end_time: -45 │ │ revert AuctionAlreadyEnded() -46 │ │ +42 │ ╭ pub fn bid(self, ctx: Context) { +43 │ │ if ctx.block_timestamp() > self.auction_end_time { +44 │ │ revert AuctionAlreadyEnded() +45 │ │ } · │ -55 │ │ -56 │ │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) - │ ╰────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 1731341862738941170 +55 │ │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) +56 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -84,173 +85,173 @@ note: } note: - ┌─ simple_open_auction.fe:44:12 + ┌─ simple_open_auction.fe:43:12 │ -44 │ if ctx.block_timestamp() > self.auction_end_time: +43 │ if ctx.block_timestamp() > self.auction_end_time { │ ^^^ Context: Memory note: - ┌─ simple_open_auction.fe:44:12 + ┌─ simple_open_auction.fe:43:12 │ -44 │ if ctx.block_timestamp() > self.auction_end_time: +43 │ if ctx.block_timestamp() > self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ u256: Value note: - ┌─ simple_open_auction.fe:44:36 + ┌─ simple_open_auction.fe:43:36 │ -44 │ if ctx.block_timestamp() > self.auction_end_time: +43 │ if ctx.block_timestamp() > self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value note: - ┌─ simple_open_auction.fe:44:12 + ┌─ simple_open_auction.fe:43:12 │ -44 │ if ctx.block_timestamp() > self.auction_end_time: +43 │ if ctx.block_timestamp() > self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -45 │ revert AuctionAlreadyEnded() +44 │ revert AuctionAlreadyEnded() │ ^^^^^^^^^^^^^^^^^^^^^ AuctionAlreadyEnded: Memory -46 │ -47 │ if ctx.msg_value() <= self.highest_bid: +45 │ } +46 │ if ctx.msg_value() <= self.highest_bid { │ ^^^ Context: Memory note: - ┌─ simple_open_auction.fe:47:12 + ┌─ simple_open_auction.fe:46:12 │ -47 │ if ctx.msg_value() <= self.highest_bid: +46 │ if ctx.msg_value() <= self.highest_bid { │ ^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ u256: Value note: - ┌─ simple_open_auction.fe:47:31 + ┌─ simple_open_auction.fe:46:31 │ -47 │ if ctx.msg_value() <= self.highest_bid: +46 │ if ctx.msg_value() <= self.highest_bid { │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } => Value note: - ┌─ simple_open_auction.fe:47:12 + ┌─ simple_open_auction.fe:46:12 │ -47 │ if ctx.msg_value() <= self.highest_bid: +46 │ if ctx.msg_value() <= self.highest_bid { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -48 │ revert BidNotHighEnough(highest_bid: self.highest_bid) +47 │ revert BidNotHighEnough(highest_bid: self.highest_bid) │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:48:50 + ┌─ simple_open_auction.fe:47:50 │ -48 │ revert BidNotHighEnough(highest_bid: self.highest_bid) +47 │ revert BidNotHighEnough(highest_bid: self.highest_bid) │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } => Value note: - ┌─ simple_open_auction.fe:48:20 + ┌─ simple_open_auction.fe:47:20 │ -48 │ revert BidNotHighEnough(highest_bid: self.highest_bid) +47 │ revert BidNotHighEnough(highest_bid: self.highest_bid) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BidNotHighEnough: Memory -49 │ -50 │ if self.highest_bid != 0: +48 │ } +49 │ if self.highest_bid != 0 { │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:50:12 + ┌─ simple_open_auction.fe:49:12 │ -50 │ if self.highest_bid != 0: +49 │ if self.highest_bid != 0 { │ ^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(3) } => Value note: - ┌─ simple_open_auction.fe:50:12 + ┌─ simple_open_auction.fe:49:12 │ -50 │ if self.highest_bid != 0: +49 │ if self.highest_bid != 0 { │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -51 │ self.pending_returns[self.highest_bidder] += self.highest_bid +50 │ self.pending_returns[self.highest_bidder] += self.highest_bid │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:51:13 + ┌─ simple_open_auction.fe:50:13 │ -51 │ self.pending_returns[self.highest_bidder] += self.highest_bid +50 │ self.pending_returns[self.highest_bidder] += self.highest_bid │ ^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ Map: Storage { nonce: Some(4) } note: - ┌─ simple_open_auction.fe:51:34 + ┌─ simple_open_auction.fe:50:34 │ -51 │ self.pending_returns[self.highest_bidder] += self.highest_bid +50 │ self.pending_returns[self.highest_bidder] += self.highest_bid │ ^^^^^^^^^^^^^^^^^^^ address: Storage { nonce: Some(2) } => Value note: - ┌─ simple_open_auction.fe:51:13 + ┌─ simple_open_auction.fe:50:13 │ -51 │ self.pending_returns[self.highest_bidder] += self.highest_bid +50 │ self.pending_returns[self.highest_bidder] += self.highest_bid │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ simple_open_auction.fe:51:58 + ┌─ simple_open_auction.fe:50:58 │ -51 │ self.pending_returns[self.highest_bidder] += self.highest_bid +50 │ self.pending_returns[self.highest_bidder] += self.highest_bid │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } -52 │ -53 │ self.highest_bidder = ctx.msg_sender() +51 │ } +52 │ self.highest_bidder = ctx.msg_sender() │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:53:9 + ┌─ simple_open_auction.fe:52:9 │ -53 │ self.highest_bidder = ctx.msg_sender() +52 │ self.highest_bidder = ctx.msg_sender() │ ^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ address: Storage { nonce: Some(2) } note: - ┌─ simple_open_auction.fe:53:31 + ┌─ simple_open_auction.fe:52:31 │ -53 │ self.highest_bidder = ctx.msg_sender() +52 │ self.highest_bidder = ctx.msg_sender() │ ^^^^^^^^^^^^^^^^ address: Value -54 │ self.highest_bid = ctx.msg_value() +53 │ self.highest_bid = ctx.msg_value() │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:54:9 + ┌─ simple_open_auction.fe:53:9 │ -54 │ self.highest_bid = ctx.msg_value() +53 │ self.highest_bid = ctx.msg_value() │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ u256: Storage { nonce: Some(3) } note: - ┌─ simple_open_auction.fe:54:28 + ┌─ simple_open_auction.fe:53:28 │ -54 │ self.highest_bid = ctx.msg_value() +53 │ self.highest_bid = ctx.msg_value() │ ^^^^^^^^^^^^^^^ u256: Value -55 │ -56 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) +54 │ +55 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ simple_open_auction.fe:56:47 + ┌─ simple_open_auction.fe:55:47 │ -56 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) +55 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) │ ^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ address: Value note: - ┌─ simple_open_auction.fe:56:73 + ┌─ simple_open_auction.fe:55:73 │ -56 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) +55 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) │ ^^^^^^^^^^^^^^^ u256: Value note: - ┌─ simple_open_auction.fe:56:9 + ┌─ simple_open_auction.fe:55:9 │ -56 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) +55 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 4299305322532183383 │ = Event { @@ -282,14 +283,14 @@ note: note: ┌─ simple_open_auction.fe:58:5 │ -58 │ ╭ pub fn withdraw(self, ctx: Context) -> bool: +58 │ ╭ pub fn withdraw(self, ctx: Context) -> bool { 59 │ │ let amount: u256 = self.pending_returns[ctx.msg_sender()] 60 │ │ -61 │ │ if amount > 0: +61 │ │ if amount > 0 { · │ -64 │ │ 65 │ │ return true - │ ╰───────────────────^ attributes hash: 2616212654540170552 +66 │ │ } + │ ╰─────^ attributes hash: 2616212654540170552 │ = FunctionSignature { self_decl: Some( @@ -351,7 +352,7 @@ note: 59 │ let amount: u256 = self.pending_returns[ctx.msg_sender()] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value 60 │ -61 │ if amount > 0: +61 │ if amount > 0 { │ ^^^^^^ ^ u256: Value │ │ │ u256: Value @@ -359,7 +360,7 @@ note: note: ┌─ simple_open_auction.fe:61:12 │ -61 │ if amount > 0: +61 │ if amount > 0 { │ ^^^^^^^^^^ bool: Value 62 │ self.pending_returns[ctx.msg_sender()] = 0 │ ^^^^ SimpleOpenAuction: Value @@ -403,21 +404,21 @@ note: │ 63 │ ctx.send_value(to: ctx.msg_sender(), wei: amount) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -64 │ +64 │ } 65 │ return true │ ^^^^ bool: Value note: - ┌─ simple_open_auction.fe:67:5 + ┌─ simple_open_auction.fe:68:5 │ -67 │ ╭ pub fn action_end(self, ctx: Context): -68 │ │ if ctx.block_timestamp() <= self.auction_end_time: -69 │ │ revert AuctionNotYetEnded() -70 │ │ +68 │ ╭ pub fn action_end(self, ctx: Context) { +69 │ │ if ctx.block_timestamp() <= self.auction_end_time { +70 │ │ revert AuctionNotYetEnded() +71 │ │ } · │ -76 │ │ -77 │ │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) - │ ╰───────────────────────────────────────────────────────────────────^ attributes hash: 1731341862738941170 +78 │ │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) +79 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -448,102 +449,102 @@ note: } note: - ┌─ simple_open_auction.fe:68:12 + ┌─ simple_open_auction.fe:69:12 │ -68 │ if ctx.block_timestamp() <= self.auction_end_time: +69 │ if ctx.block_timestamp() <= self.auction_end_time { │ ^^^ Context: Memory note: - ┌─ simple_open_auction.fe:68:12 + ┌─ simple_open_auction.fe:69:12 │ -68 │ if ctx.block_timestamp() <= self.auction_end_time: +69 │ if ctx.block_timestamp() <= self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ u256: Value note: - ┌─ simple_open_auction.fe:68:37 + ┌─ simple_open_auction.fe:69:37 │ -68 │ if ctx.block_timestamp() <= self.auction_end_time: +69 │ if ctx.block_timestamp() <= self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value note: - ┌─ simple_open_auction.fe:68:12 + ┌─ simple_open_auction.fe:69:12 │ -68 │ if ctx.block_timestamp() <= self.auction_end_time: +69 │ if ctx.block_timestamp() <= self.auction_end_time { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -69 │ revert AuctionNotYetEnded() +70 │ revert AuctionNotYetEnded() │ ^^^^^^^^^^^^^^^^^^^^ AuctionNotYetEnded: Memory -70 │ -71 │ if self.ended: +71 │ } +72 │ if self.ended { │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:71:12 + ┌─ simple_open_auction.fe:72:12 │ -71 │ if self.ended: +72 │ if self.ended { │ ^^^^^^^^^^ bool: Storage { nonce: Some(5) } => Value -72 │ revert AuctionEndAlreadyCalled() +73 │ revert AuctionEndAlreadyCalled() │ ^^^^^^^^^^^^^^^^^^^^^^^^^ AuctionEndAlreadyCalled: Memory -73 │ -74 │ self.ended = true +74 │ } +75 │ self.ended = true │ ^^^^ SimpleOpenAuction: Value note: - ┌─ simple_open_auction.fe:74:9 + ┌─ simple_open_auction.fe:75:9 │ -74 │ self.ended = true +75 │ self.ended = true │ ^^^^^^^^^^ ^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(5) } -75 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) +76 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) │ ^^^ ^^^^ SimpleOpenAuction: Value │ │ │ Context: Memory note: - ┌─ simple_open_auction.fe:75:40 + ┌─ simple_open_auction.fe:76:40 │ -75 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) +76 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) │ ^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ address: Storage { nonce: Some(2) } => Value note: - ┌─ simple_open_auction.fe:75:69 + ┌─ simple_open_auction.fe:76:69 │ -75 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) +76 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } => Value -76 │ -77 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) +77 │ +78 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) │ ^^^ ^^^^ SimpleOpenAuction: Value │ │ │ Context: Memory note: - ┌─ simple_open_auction.fe:77:28 + ┌─ simple_open_auction.fe:78:28 │ -77 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) +78 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) │ ^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction: Value │ │ │ address: Storage { nonce: Some(1) } => Value note: - ┌─ simple_open_auction.fe:77:51 + ┌─ simple_open_auction.fe:78:51 │ -77 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) +78 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) │ ^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(3) } => Value note: - ┌─ simple_open_auction.fe:77:9 + ┌─ simple_open_auction.fe:78:9 │ -77 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) +78 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: - ┌─ simple_open_auction.fe:75:9 + ┌─ simple_open_auction.fe:76:9 │ -75 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) +76 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 10704971219741987245 │ = Event { diff --git a/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap b/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap index afafa383f8..dd6564ec72 100644 --- a/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap +++ b/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap @@ -24,11 +24,12 @@ note: │ ^^^^^^^^^^^^^^^ String<26> note: - ┌─ sized_vals_in_sto.fe:13:5 + ┌─ sized_vals_in_sto.fe:14:5 │ -13 │ ╭ pub fn write_num(self, x: u256): -14 │ │ self.num = x - │ ╰────────────────────^ attributes hash: 4582507849783874218 +14 │ ╭ pub fn write_num(self, x: u256) { +15 │ │ self.num = x +16 │ │ } + │ ╰─────^ attributes hash: 4582507849783874218 │ = FunctionSignature { self_decl: Some( @@ -56,25 +57,26 @@ note: } note: - ┌─ sized_vals_in_sto.fe:14:9 + ┌─ sized_vals_in_sto.fe:15:9 │ -14 │ self.num = x +15 │ self.num = x │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:14:9 + ┌─ sized_vals_in_sto.fe:15:9 │ -14 │ self.num = x +15 │ self.num = x │ ^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } note: - ┌─ sized_vals_in_sto.fe:16:5 + ┌─ sized_vals_in_sto.fe:18:5 │ -16 │ ╭ pub fn read_num(self) -> u256: -17 │ │ return self.num - │ ╰───────────────────────^ attributes hash: 11773348765973600208 +18 │ ╭ pub fn read_num(self) -> u256 { +19 │ │ return self.num +20 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -92,23 +94,24 @@ note: } note: - ┌─ sized_vals_in_sto.fe:17:16 + ┌─ sized_vals_in_sto.fe:19:16 │ -17 │ return self.num +19 │ return self.num │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:17:16 + ┌─ sized_vals_in_sto.fe:19:16 │ -17 │ return self.num +19 │ return self.num │ ^^^^^^^^ u256: Storage { nonce: Some(0) } => Value note: - ┌─ sized_vals_in_sto.fe:19:5 + ┌─ sized_vals_in_sto.fe:22:5 │ -19 │ ╭ pub fn write_nums(self, x: Array): -20 │ │ self.nums = x - │ ╰─────────────────────^ attributes hash: 15243923981938152137 +22 │ ╭ pub fn write_nums(self, x: Array) { +23 │ │ self.nums = x +24 │ │ } + │ ╰─────^ attributes hash: 15243923981938152137 │ = FunctionSignature { self_decl: Some( @@ -139,25 +142,26 @@ note: } note: - ┌─ sized_vals_in_sto.fe:20:9 + ┌─ sized_vals_in_sto.fe:23:9 │ -20 │ self.nums = x +23 │ self.nums = x │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:20:9 + ┌─ sized_vals_in_sto.fe:23:9 │ -20 │ self.nums = x +23 │ self.nums = x │ ^^^^^^^^^ ^ Array: Memory │ │ │ Array: Storage { nonce: Some(1) } note: - ┌─ sized_vals_in_sto.fe:22:5 + ┌─ sized_vals_in_sto.fe:26:5 │ -22 │ ╭ pub fn read_nums(self) -> Array: -23 │ │ return self.nums.to_mem() - │ ╰─────────────────────────────────^ attributes hash: 7235961322057554817 +26 │ ╭ pub fn read_nums(self) -> Array { +27 │ │ return self.nums.to_mem() +28 │ │ } + │ ╰─────^ attributes hash: 7235961322057554817 │ = FunctionSignature { self_decl: Some( @@ -178,29 +182,30 @@ note: } note: - ┌─ sized_vals_in_sto.fe:23:16 + ┌─ sized_vals_in_sto.fe:27:16 │ -23 │ return self.nums.to_mem() +27 │ return self.nums.to_mem() │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:23:16 + ┌─ sized_vals_in_sto.fe:27:16 │ -23 │ return self.nums.to_mem() +27 │ return self.nums.to_mem() │ ^^^^^^^^^ Array: Storage { nonce: Some(1) } note: - ┌─ sized_vals_in_sto.fe:23:16 + ┌─ sized_vals_in_sto.fe:27:16 │ -23 │ return self.nums.to_mem() +27 │ return self.nums.to_mem() │ ^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(1) } => Memory note: - ┌─ sized_vals_in_sto.fe:25:5 + ┌─ sized_vals_in_sto.fe:30:5 │ -25 │ ╭ pub fn write_str(self, x: String<26>): -26 │ │ self.str = x - │ ╰────────────────────^ attributes hash: 3874088449945578306 +30 │ ╭ pub fn write_str(self, x: String<26>) { +31 │ │ self.str = x +32 │ │ } + │ ╰─────^ attributes hash: 3874088449945578306 │ = FunctionSignature { self_decl: Some( @@ -228,25 +233,26 @@ note: } note: - ┌─ sized_vals_in_sto.fe:26:9 + ┌─ sized_vals_in_sto.fe:31:9 │ -26 │ self.str = x +31 │ self.str = x │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:26:9 + ┌─ sized_vals_in_sto.fe:31:9 │ -26 │ self.str = x +31 │ self.str = x │ ^^^^^^^^ ^ String<26>: Memory │ │ │ String<26>: Storage { nonce: Some(2) } note: - ┌─ sized_vals_in_sto.fe:28:5 + ┌─ sized_vals_in_sto.fe:34:5 │ -28 │ ╭ pub fn read_str(self) -> String<26>: -29 │ │ return self.str.to_mem() - │ ╰────────────────────────────────^ attributes hash: 3487383639176435631 +34 │ ╭ pub fn read_str(self) -> String<26> { +35 │ │ return self.str.to_mem() +36 │ │ } + │ ╰─────^ attributes hash: 3487383639176435631 │ = FunctionSignature { self_decl: Some( @@ -264,34 +270,30 @@ note: } note: - ┌─ sized_vals_in_sto.fe:29:16 + ┌─ sized_vals_in_sto.fe:35:16 │ -29 │ return self.str.to_mem() +35 │ return self.str.to_mem() │ ^^^^ Foo: Value note: - ┌─ sized_vals_in_sto.fe:29:16 + ┌─ sized_vals_in_sto.fe:35:16 │ -29 │ return self.str.to_mem() +35 │ return self.str.to_mem() │ ^^^^^^^^ String<26>: Storage { nonce: Some(2) } note: - ┌─ sized_vals_in_sto.fe:29:16 + ┌─ sized_vals_in_sto.fe:35:16 │ -29 │ return self.str.to_mem() +35 │ return self.str.to_mem() │ ^^^^^^^^^^^^^^^^^ String<26>: Storage { nonce: Some(2) } => Memory note: - ┌─ sized_vals_in_sto.fe:31:5 + ┌─ sized_vals_in_sto.fe:38:5 │ -31 │ ╭ pub fn emit_event(self, ctx: Context): -32 │ │ emit MyEvent( -33 │ │ ctx, -34 │ │ num: self.num, -35 │ │ nums: self.nums.to_mem(), -36 │ │ str: self.str.to_mem() -37 │ │ ) - │ ╰─────────^ attributes hash: 1731341862738941170 +38 │ ╭ pub fn emit_event(self, ctx: Context) { +39 │ │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) +40 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -322,58 +324,53 @@ note: } note: - ┌─ sized_vals_in_sto.fe:33:13 + ┌─ sized_vals_in_sto.fe:39:22 │ -33 │ ctx, - │ ^^^ Context: Memory -34 │ num: self.num, - │ ^^^^ Foo: Value +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^ ^^^^ Foo: Value + │ │ + │ Context: Memory note: - ┌─ sized_vals_in_sto.fe:34:18 + ┌─ sized_vals_in_sto.fe:39:32 │ -34 │ num: self.num, - │ ^^^^^^^^ u256: Storage { nonce: Some(0) } => Value -35 │ nums: self.nums.to_mem(), - │ ^^^^ Foo: Value +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^ ^^^^ Foo: Value + │ │ + │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ sized_vals_in_sto.fe:35:19 + ┌─ sized_vals_in_sto.fe:39:48 │ -35 │ nums: self.nums.to_mem(), - │ ^^^^^^^^^ Array: Storage { nonce: Some(1) } +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^^ Array: Storage { nonce: Some(1) } note: - ┌─ sized_vals_in_sto.fe:35:19 + ┌─ sized_vals_in_sto.fe:39:48 │ -35 │ nums: self.nums.to_mem(), - │ ^^^^^^^^^^^^^^^^^^ Array: Storage { nonce: Some(1) } => Memory -36 │ str: self.str.to_mem() - │ ^^^^ Foo: Value +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value + │ │ + │ Array: Storage { nonce: Some(1) } => Memory note: - ┌─ sized_vals_in_sto.fe:36:18 + ┌─ sized_vals_in_sto.fe:39:73 │ -36 │ str: self.str.to_mem() - │ ^^^^^^^^ String<26>: Storage { nonce: Some(2) } +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^ String<26>: Storage { nonce: Some(2) } note: - ┌─ sized_vals_in_sto.fe:36:18 + ┌─ sized_vals_in_sto.fe:39:73 │ -36 │ str: self.str.to_mem() - │ ^^^^^^^^^^^^^^^^^ String<26>: Storage { nonce: Some(2) } => Memory +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^^^^^^^^^^ String<26>: Storage { nonce: Some(2) } => Memory note: - ┌─ sized_vals_in_sto.fe:32:9 - │ -32 │ ╭ emit MyEvent( -33 │ │ ctx, -34 │ │ num: self.num, -35 │ │ nums: self.nums.to_mem(), -36 │ │ str: self.str.to_mem() -37 │ │ ) - │ ╰─────────^ attributes hash: 9998967556022527347 - │ + ┌─ sized_vals_in_sto.fe:39:9 + │ +39 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 9998967556022527347 + │ = Event { name: "MyEvent", fields: [ diff --git a/crates/analyzer/tests/snapshots/analysis__strings.snap b/crates/analyzer/tests/snapshots/analysis__strings.snap index a4210929db..b902f24584 100644 --- a/crates/analyzer/tests/snapshots/analysis__strings.snap +++ b/crates/analyzer/tests/snapshots/analysis__strings.snap @@ -22,11 +22,12 @@ note: │ ^^^^^^^^^^^^^^^ String<100> note: - ┌─ strings.fe:16:5 + ┌─ strings.fe:18:5 │ -16 │ ╭ pub fn bar(s1: String<100>, s2: String<100>) -> String<100>: -17 │ │ return s2 - │ ╰─────────────────^ attributes hash: 4992726103398710247 +18 │ ╭ pub fn bar(s1: String<100>, s2: String<100>) -> String<100> { +19 │ │ return s2 +20 │ │ } + │ ╰─────^ attributes hash: 4992726103398710247 │ = FunctionSignature { self_decl: None, @@ -65,17 +66,18 @@ note: } note: - ┌─ strings.fe:17:16 + ┌─ strings.fe:19:16 │ -17 │ return s2 +19 │ return s2 │ ^^ String<100>: Memory note: - ┌─ strings.fe:19:5 + ┌─ strings.fe:22:5 │ -19 │ ╭ pub fn return_static_string() -> String<43>: -20 │ │ return "The quick brown fox jumps over the lazy dog" - │ ╰────────────────────────────────────────────────────────────^ attributes hash: 16859220121746101219 +22 │ ╭ pub fn return_static_string() -> String<43> { +23 │ │ return "The quick brown fox jumps over the lazy dog" +24 │ │ } + │ ╰─────^ attributes hash: 16859220121746101219 │ = FunctionSignature { self_decl: None, @@ -91,17 +93,18 @@ note: } note: - ┌─ strings.fe:20:16 + ┌─ strings.fe:23:16 │ -20 │ return "The quick brown fox jumps over the lazy dog" +23 │ return "The quick brown fox jumps over the lazy dog" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<43>: Memory note: - ┌─ strings.fe:22:5 + ┌─ strings.fe:26:5 │ -22 │ ╭ pub fn return_casted_static_string() -> String<100>: -23 │ │ return String<100>("foo") - │ ╰─────────────────────────────────^ attributes hash: 11555139189894875514 +26 │ ╭ pub fn return_casted_static_string() -> String<100> { +27 │ │ return String<100>("foo") +28 │ │ } + │ ╰─────^ attributes hash: 11555139189894875514 │ = FunctionSignature { self_decl: None, @@ -117,23 +120,24 @@ note: } note: - ┌─ strings.fe:23:28 + ┌─ strings.fe:27:28 │ -23 │ return String<100>("foo") +27 │ return String<100>("foo") │ ^^^^^ String<3>: Memory note: - ┌─ strings.fe:23:16 + ┌─ strings.fe:27:16 │ -23 │ return String<100>("foo") +27 │ return String<100>("foo") │ ^^^^^^^^^^^^^^^^^^ String<100>: Memory note: - ┌─ strings.fe:25:5 + ┌─ strings.fe:30:5 │ -25 │ ╭ pub fn shorter_string_assign(): -26 │ │ let s: String<18> = "fe" - │ ╰────────────────────────────────^ attributes hash: 8319796915330632390 +30 │ ╭ pub fn shorter_string_assign() { +31 │ │ let s: String<18> = "fe" +32 │ │ } + │ ╰─────^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -147,24 +151,25 @@ note: } note: - ┌─ strings.fe:26:16 + ┌─ strings.fe:31:16 │ -26 │ let s: String<18> = "fe" +31 │ let s: String<18> = "fe" │ ^^^^^^^^^^ String<18> note: - ┌─ strings.fe:26:29 + ┌─ strings.fe:31:29 │ -26 │ let s: String<18> = "fe" +31 │ let s: String<18> = "fe" │ ^^^^ String<18>: Memory note: - ┌─ strings.fe:28:5 + ┌─ strings.fe:34:5 │ -28 │ ╭ pub fn return_special_chars() -> String<18>: -29 │ │ return "\n\"'\r\t -30 │ │ foo\\" - │ ╰──────────────^ attributes hash: 15142206137302311439 +34 │ ╭ pub fn return_special_chars() -> String<18> { +35 │ │ return "\n\"'\r\t +36 │ │ foo\\" +37 │ │ } + │ ╰─────^ attributes hash: 15142206137302311439 │ = FunctionSignature { self_decl: None, @@ -180,11 +185,11 @@ note: } note: - ┌─ strings.fe:29:16 + ┌─ strings.fe:35:16 │ -29 │ return "\n\"'\r\t +35 │ return "\n\"'\r\t │ ╭────────────────^ -30 │ │ foo\\" +36 │ │ foo\\" │ ╰──────────────^ String<18>: Memory diff --git a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap index 214b205b2c..9bdccbb095 100644 --- a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap @@ -4,19 +4,20 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ struct_fns.fe:2:3 + ┌─ struct_fns.fe:2:5 │ -2 │ pub x: u64 - │ ^^^^^^^^^^ u64 -3 │ pub y: u64 - │ ^^^^^^^^^^ u64 +2 │ pub x: u64 + │ ^^^^^^^^^^ u64 +3 │ pub y: u64 + │ ^^^^^^^^^^ u64 note: - ┌─ struct_fns.fe:5:3 + ┌─ struct_fns.fe:5:5 │ -5 │ ╭ pub fn new(x: u64, y: u64) -> Point: -6 │ │ return Point(x, y) - │ ╰──────────────────────^ attributes hash: 16588628800633378656 +5 │ ╭ pub fn new(x: u64, y: u64) -> Point { +6 │ │ return Point(x, y) +7 │ │ } + │ ╰─────^ attributes hash: 16588628800633378656 │ = FunctionSignature { self_decl: None, @@ -56,60 +57,62 @@ note: } note: - ┌─ struct_fns.fe:6:18 + ┌─ struct_fns.fe:6:22 │ -6 │ return Point(x, y) - │ ^ ^ u64: Value - │ │ - │ u64: Value +6 │ return Point(x, y) + │ ^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:6:12 + ┌─ struct_fns.fe:6:16 │ -6 │ return Point(x, y) - │ ^^^^^^^^^^^ Point: Memory +6 │ return Point(x, y) + │ ^^^^^^^^^^^ Point: Memory note: - ┌─ struct_fns.fe:8:3 - │ -8 │ ╭ pub fn origin() -> Point: -9 │ │ return Point(x: 0, y: 0) - │ ╰────────────────────────────^ attributes hash: 6013258294670043138 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Struct( - Struct { - name: "Point", - field_count: 2, - }, - ), - ), - } + ┌─ struct_fns.fe:9:5 + │ + 9 │ ╭ pub fn origin() -> Point { +10 │ │ return Point(x: 0, y: 0) +11 │ │ } + │ ╰─────^ attributes hash: 6013258294670043138 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Struct( + Struct { + name: "Point", + field_count: 2, + }, + ), + ), + } note: - ┌─ struct_fns.fe:9:21 - │ -9 │ return Point(x: 0, y: 0) - │ ^ ^ u64: Value - │ │ - │ u64: Value + ┌─ struct_fns.fe:10:25 + │ +10 │ return Point(x: 0, y: 0) + │ ^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:9:12 - │ -9 │ return Point(x: 0, y: 0) - │ ^^^^^^^^^^^^^^^^^ Point: Memory + ┌─ struct_fns.fe:10:16 + │ +10 │ return Point(x: 0, y: 0) + │ ^^^^^^^^^^^^^^^^^ Point: Memory note: - ┌─ struct_fns.fe:12:3 + ┌─ struct_fns.fe:13:5 │ -12 │ ╭ pub fn x(self) -> u64: -13 │ │ return self.x - │ ╰─────────────────^ attributes hash: 10117872852848404071 +13 │ ╭ pub fn x(self) -> u64 { +14 │ │ return self.x +15 │ │ } + │ ╰─────^ attributes hash: 10117872852848404071 │ = FunctionSignature { self_decl: Some( @@ -127,25 +130,26 @@ note: } note: - ┌─ struct_fns.fe:13:12 + ┌─ struct_fns.fe:14:16 │ -13 │ return self.x - │ ^^^^ Point: Memory +14 │ return self.x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:13:12 + ┌─ struct_fns.fe:14:16 │ -13 │ return self.x - │ ^^^^^^ u64: Memory => Value +14 │ return self.x + │ ^^^^^^ u64: Memory => Value note: - ┌─ struct_fns.fe:15:3 + ┌─ struct_fns.fe:17:5 │ -15 │ ╭ pub fn set_x(self, _ x: u64) -> u64: -16 │ │ let old: u64 = self.x -17 │ │ self.x = x -18 │ │ return old - │ ╰──────────────^ attributes hash: 9776752757917359734 +17 │ ╭ pub fn set_x(self, _ x: u64) -> u64 { +18 │ │ let old: u64 = self.x +19 │ │ self.x = x +20 │ │ return old +21 │ │ } + │ ╰─────^ attributes hash: 9776752757917359734 │ = FunctionSignature { self_decl: Some( @@ -177,45 +181,45 @@ note: } note: - ┌─ struct_fns.fe:16:14 + ┌─ struct_fns.fe:18:18 │ -16 │ let old: u64 = self.x - │ ^^^ u64 +18 │ let old: u64 = self.x + │ ^^^ u64 note: - ┌─ struct_fns.fe:16:20 + ┌─ struct_fns.fe:18:24 │ -16 │ let old: u64 = self.x - │ ^^^^ Point: Memory +18 │ let old: u64 = self.x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:16:20 + ┌─ struct_fns.fe:18:24 │ -16 │ let old: u64 = self.x - │ ^^^^^^ u64: Memory => Value -17 │ self.x = x - │ ^^^^ Point: Memory +18 │ let old: u64 = self.x + │ ^^^^^^ u64: Memory => Value +19 │ self.x = x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:17:5 + ┌─ struct_fns.fe:19:9 │ -17 │ self.x = x - │ ^^^^^^ ^ u64: Value - │ │ - │ u64: Memory -18 │ return old - │ ^^^ u64: Value +19 │ self.x = x + │ ^^^^^^ ^ u64: Value + │ │ + │ u64: Memory +20 │ return old + │ ^^^ u64: Value note: - ┌─ struct_fns.fe:20:3 + ┌─ struct_fns.fe:23:5 │ -20 │ ╭ pub fn reflect(self): -21 │ │ let x: u64 = self.x -22 │ │ let y: u64 = self.y -23 │ │ # self.x = self.y panics. see issue #590 -24 │ │ self.x = y -25 │ │ self.y = x - │ ╰──────────────^ attributes hash: 18235041182630809162 +23 │ ╭ pub fn reflect(self) { +24 │ │ let x: u64 = self.x +25 │ │ let y: u64 = self.y +26 │ │ self.x = y +27 │ │ self.y = x +28 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -231,61 +235,61 @@ note: } note: - ┌─ struct_fns.fe:21:12 + ┌─ struct_fns.fe:24:16 │ -21 │ let x: u64 = self.x - │ ^^^ u64 -22 │ let y: u64 = self.y - │ ^^^ u64 +24 │ let x: u64 = self.x + │ ^^^ u64 +25 │ let y: u64 = self.y + │ ^^^ u64 note: - ┌─ struct_fns.fe:21:18 + ┌─ struct_fns.fe:24:22 │ -21 │ let x: u64 = self.x - │ ^^^^ Point: Memory +24 │ let x: u64 = self.x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:21:18 + ┌─ struct_fns.fe:24:22 │ -21 │ let x: u64 = self.x - │ ^^^^^^ u64: Memory => Value -22 │ let y: u64 = self.y - │ ^^^^ Point: Memory +24 │ let x: u64 = self.x + │ ^^^^^^ u64: Memory => Value +25 │ let y: u64 = self.y + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:22:18 + ┌─ struct_fns.fe:25:22 │ -22 │ let y: u64 = self.y - │ ^^^^^^ u64: Memory => Value -23 │ # self.x = self.y panics. see issue #590 -24 │ self.x = y - │ ^^^^ Point: Memory +25 │ let y: u64 = self.y + │ ^^^^^^ u64: Memory => Value +26 │ self.x = y + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:24:5 + ┌─ struct_fns.fe:26:9 │ -24 │ self.x = y - │ ^^^^^^ ^ u64: Value - │ │ - │ u64: Memory -25 │ self.y = x - │ ^^^^ Point: Memory +26 │ self.x = y + │ ^^^^^^ ^ u64: Value + │ │ + │ u64: Memory +27 │ self.y = x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:25:5 + ┌─ struct_fns.fe:27:9 │ -25 │ self.y = x - │ ^^^^^^ ^ u64: Value - │ │ - │ u64: Memory +27 │ self.y = x + │ ^^^^^^ ^ u64: Value + │ │ + │ u64: Memory note: - ┌─ struct_fns.fe:27:3 + ┌─ struct_fns.fe:30:5 │ -27 │ ╭ pub fn translate(self, x: u64, y: u64): -28 │ │ self.x += x -29 │ │ self.y += y - │ ╰───────────────^ attributes hash: 7723021135770029200 +30 │ ╭ pub fn translate(self, x: u64, y: u64) { +31 │ │ self.x += x +32 │ │ self.y += y +33 │ │ } + │ ╰─────^ attributes hash: 7723021135770029200 │ = FunctionSignature { self_decl: Some( @@ -324,37 +328,38 @@ note: } note: - ┌─ struct_fns.fe:28:5 + ┌─ struct_fns.fe:31:9 │ -28 │ self.x += x - │ ^^^^ Point: Memory +31 │ self.x += x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:28:5 + ┌─ struct_fns.fe:31:9 │ -28 │ self.x += x - │ ^^^^^^ ^ u64: Value - │ │ - │ u64: Memory -29 │ self.y += y - │ ^^^^ Point: Memory +31 │ self.x += x + │ ^^^^^^ ^ u64: Value + │ │ + │ u64: Memory +32 │ self.y += y + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:29:5 + ┌─ struct_fns.fe:32:9 │ -29 │ self.y += y - │ ^^^^^^ ^ u64: Value - │ │ - │ u64: Memory +32 │ self.y += y + │ ^^^^^^ ^ u64: Value + │ │ + │ u64: Memory note: - ┌─ struct_fns.fe:31:3 + ┌─ struct_fns.fe:35:5 │ -31 │ ╭ pub fn add(self, _ other: Point) -> Point: -32 │ │ let x: u64 = self.x + other.x -33 │ │ let y: u64 = self.y + other.y -34 │ │ return Point(x, y) - │ ╰──────────────────────^ attributes hash: 13368777112318344367 +35 │ ╭ pub fn add(self, _ other: Point) -> Point { +36 │ │ let x: u64 = self.x + other.x +37 │ │ let y: u64 = self.y + other.y +38 │ │ return Point(x, y) +39 │ │ } + │ ╰─────^ attributes hash: 13368777112318344367 │ = FunctionSignature { self_decl: Some( @@ -388,82 +393,82 @@ note: } note: - ┌─ struct_fns.fe:32:12 + ┌─ struct_fns.fe:36:16 │ -32 │ let x: u64 = self.x + other.x - │ ^^^ u64 -33 │ let y: u64 = self.y + other.y - │ ^^^ u64 +36 │ let x: u64 = self.x + other.x + │ ^^^ u64 +37 │ let y: u64 = self.y + other.y + │ ^^^ u64 note: - ┌─ struct_fns.fe:32:18 + ┌─ struct_fns.fe:36:22 │ -32 │ let x: u64 = self.x + other.x - │ ^^^^ Point: Memory +36 │ let x: u64 = self.x + other.x + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:32:18 + ┌─ struct_fns.fe:36:22 │ -32 │ let x: u64 = self.x + other.x - │ ^^^^^^ ^^^^^ Point: Memory - │ │ - │ u64: Memory => Value +36 │ let x: u64 = self.x + other.x + │ ^^^^^^ ^^^^^ Point: Memory + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:32:27 + ┌─ struct_fns.fe:36:31 │ -32 │ let x: u64 = self.x + other.x - │ ^^^^^^^ u64: Memory => Value +36 │ let x: u64 = self.x + other.x + │ ^^^^^^^ u64: Memory => Value note: - ┌─ struct_fns.fe:32:18 + ┌─ struct_fns.fe:36:22 │ -32 │ let x: u64 = self.x + other.x - │ ^^^^^^^^^^^^^^^^ u64: Value -33 │ let y: u64 = self.y + other.y - │ ^^^^ Point: Memory +36 │ let x: u64 = self.x + other.x + │ ^^^^^^^^^^^^^^^^ u64: Value +37 │ let y: u64 = self.y + other.y + │ ^^^^ Point: Memory note: - ┌─ struct_fns.fe:33:18 + ┌─ struct_fns.fe:37:22 │ -33 │ let y: u64 = self.y + other.y - │ ^^^^^^ ^^^^^ Point: Memory - │ │ - │ u64: Memory => Value +37 │ let y: u64 = self.y + other.y + │ ^^^^^^ ^^^^^ Point: Memory + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:33:27 + ┌─ struct_fns.fe:37:31 │ -33 │ let y: u64 = self.y + other.y - │ ^^^^^^^ u64: Memory => Value +37 │ let y: u64 = self.y + other.y + │ ^^^^^^^ u64: Memory => Value note: - ┌─ struct_fns.fe:33:18 + ┌─ struct_fns.fe:37:22 │ -33 │ let y: u64 = self.y + other.y - │ ^^^^^^^^^^^^^^^^ u64: Value -34 │ return Point(x, y) - │ ^ ^ u64: Value - │ │ - │ u64: Value +37 │ let y: u64 = self.y + other.y + │ ^^^^^^^^^^^^^^^^ u64: Value +38 │ return Point(x, y) + │ ^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:34:12 + ┌─ struct_fns.fe:38:16 │ -34 │ return Point(x, y) - │ ^^^^^^^^^^^ Point: Memory +38 │ return Point(x, y) + │ ^^^^^^^^^^^ Point: Memory note: - ┌─ struct_fns.fe:36:1 + ┌─ struct_fns.fe:42:1 │ -36 │ ╭ pub fn do_pointy_things(): -37 │ │ let p1: Point = Point::origin() -38 │ │ p1.translate(x: 5, y: 10) -39 │ │ - · │ -42 │ │ -43 │ │ assert p3.x == 6 and p3.y == 12 - │ ╰─────────────────────────────────^ attributes hash: 8319796915330632390 +42 │ ╭ pub fn do_pointy_things() { +43 │ │ let p1: Point = Point::origin() +44 │ │ p1.translate(x: 5, y: 10) +45 │ │ let p2: Point = Point(x: 1, y: 2) +46 │ │ let p3: Point = p1.add(p2) +47 │ │ assert p3.x == 6 and p3.y == 12 +48 │ │ } + │ ╰─^ attributes hash: 8319796915330632390 │ = FunctionSignature { self_decl: None, @@ -477,104 +482,102 @@ note: } note: - ┌─ struct_fns.fe:37:11 + ┌─ struct_fns.fe:43:13 │ -37 │ let p1: Point = Point::origin() - │ ^^^^^ Point - · -40 │ let p2: Point = Point(x: 1, y: 2) - │ ^^^^^ Point -41 │ let p3: Point = p1.add(p2) - │ ^^^^^ Point +43 │ let p1: Point = Point::origin() + │ ^^^^^ Point +44 │ p1.translate(x: 5, y: 10) +45 │ let p2: Point = Point(x: 1, y: 2) + │ ^^^^^ Point +46 │ let p3: Point = p1.add(p2) + │ ^^^^^ Point note: - ┌─ struct_fns.fe:37:19 + ┌─ struct_fns.fe:43:21 │ -37 │ let p1: Point = Point::origin() - │ ^^^^^^^^^^^^^^^ Point: Memory -38 │ p1.translate(x: 5, y: 10) - │ ^^ ^ ^^ u64: Value - │ │ │ - │ │ u64: Value - │ Point: Memory +43 │ let p1: Point = Point::origin() + │ ^^^^^^^^^^^^^^^ Point: Memory +44 │ p1.translate(x: 5, y: 10) + │ ^^ ^ ^^ u64: Value + │ │ │ + │ │ u64: Value + │ Point: Memory note: - ┌─ struct_fns.fe:38:3 + ┌─ struct_fns.fe:44:5 │ -38 │ p1.translate(x: 5, y: 10) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -39 │ -40 │ let p2: Point = Point(x: 1, y: 2) - │ ^ ^ u64: Value - │ │ - │ u64: Value +44 │ p1.translate(x: 5, y: 10) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value +45 │ let p2: Point = Point(x: 1, y: 2) + │ ^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:40:19 + ┌─ struct_fns.fe:45:21 │ -40 │ let p2: Point = Point(x: 1, y: 2) - │ ^^^^^^^^^^^^^^^^^ Point: Memory -41 │ let p3: Point = p1.add(p2) - │ ^^ ^^ Point: Memory - │ │ - │ Point: Memory +45 │ let p2: Point = Point(x: 1, y: 2) + │ ^^^^^^^^^^^^^^^^^ Point: Memory +46 │ let p3: Point = p1.add(p2) + │ ^^ ^^ Point: Memory + │ │ + │ Point: Memory note: - ┌─ struct_fns.fe:41:19 + ┌─ struct_fns.fe:46:21 │ -41 │ let p3: Point = p1.add(p2) - │ ^^^^^^^^^^ Point: Memory -42 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^ Point: Memory +46 │ let p3: Point = p1.add(p2) + │ ^^^^^^^^^^ Point: Memory +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^ Point: Memory note: - ┌─ struct_fns.fe:43:10 + ┌─ struct_fns.fe:47:12 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^^^ ^ u64: Value - │ │ - │ u64: Memory => Value +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^^^ ^ u64: Value + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:43:10 + ┌─ struct_fns.fe:47:12 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^^^^^^^^ ^^ Point: Memory - │ │ - │ bool: Value +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^^^^^^^^ ^^ Point: Memory + │ │ + │ bool: Value note: - ┌─ struct_fns.fe:43:24 + ┌─ struct_fns.fe:47:26 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^^^ ^^ u64: Value - │ │ - │ u64: Memory => Value +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^^^ ^^ u64: Value + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:43:24 + ┌─ struct_fns.fe:47:26 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^^^^^^^^^ bool: Value +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^^^^^^^^^ bool: Value note: - ┌─ struct_fns.fe:43:10 + ┌─ struct_fns.fe:47:12 │ -43 │ assert p3.x == 6 and p3.y == 12 - │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value +47 │ assert p3.x == 6 and p3.y == 12 + │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ struct_fns.fe:48:3 + ┌─ struct_fns.fe:51:5 │ -48 │ ╭ pub fn bar(x: u64, y: u64) -> u64: -49 │ │ do_pointy_things() -50 │ │ -51 │ │ let p: Point = Point::new(x, y) +51 │ ╭ pub fn bar(x: u64, y: u64) -> u64 { +52 │ │ do_pointy_things() +53 │ │ let p: Point = Point::new(x, y) +54 │ │ assert p.x == x and p.y == y · │ -55 │ │ assert p.x() == y and p.y == 100 -56 │ │ return p.y - │ ╰──────────────^ attributes hash: 14881144643149919691 +58 │ │ return p.y +59 │ │ } + │ ╰─────^ attributes hash: 14881144643149919691 │ = FunctionSignature { self_decl: None, @@ -613,128 +616,127 @@ note: } note: - ┌─ struct_fns.fe:51:12 + ┌─ struct_fns.fe:53:16 │ -51 │ let p: Point = Point::new(x, y) - │ ^^^^^ Point +53 │ let p: Point = Point::new(x, y) + │ ^^^^^ Point note: - ┌─ struct_fns.fe:49:5 + ┌─ struct_fns.fe:52:9 │ -49 │ do_pointy_things() - │ ^^^^^^^^^^^^^^^^^^ (): Value -50 │ -51 │ let p: Point = Point::new(x, y) - │ ^ ^ u64: Value - │ │ - │ u64: Value +52 │ do_pointy_things() + │ ^^^^^^^^^^^^^^^^^^ (): Value +53 │ let p: Point = Point::new(x, y) + │ ^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:51:20 + ┌─ struct_fns.fe:53:24 │ -51 │ let p: Point = Point::new(x, y) - │ ^^^^^^^^^^^^^^^^ Point: Memory -52 │ assert p.x == x and p.y == y - │ ^ Point: Memory +53 │ let p: Point = Point::new(x, y) + │ ^^^^^^^^^^^^^^^^ Point: Memory +54 │ assert p.x == x and p.y == y + │ ^ Point: Memory note: - ┌─ struct_fns.fe:52:12 + ┌─ struct_fns.fe:54:16 │ -52 │ assert p.x == x and p.y == y - │ ^^^ ^ u64: Value - │ │ - │ u64: Memory => Value +54 │ assert p.x == x and p.y == y + │ ^^^ ^ u64: Value + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:52:12 + ┌─ struct_fns.fe:54:16 │ -52 │ assert p.x == x and p.y == y - │ ^^^^^^^^ ^ Point: Memory - │ │ - │ bool: Value +54 │ assert p.x == x and p.y == y + │ ^^^^^^^^ ^ Point: Memory + │ │ + │ bool: Value note: - ┌─ struct_fns.fe:52:25 + ┌─ struct_fns.fe:54:29 │ -52 │ assert p.x == x and p.y == y - │ ^^^ ^ u64: Value - │ │ - │ u64: Memory => Value +54 │ assert p.x == x and p.y == y + │ ^^^ ^ u64: Value + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:52:25 + ┌─ struct_fns.fe:54:29 │ -52 │ assert p.x == x and p.y == y - │ ^^^^^^^^ bool: Value +54 │ assert p.x == x and p.y == y + │ ^^^^^^^^ bool: Value note: - ┌─ struct_fns.fe:52:12 + ┌─ struct_fns.fe:54:16 │ -52 │ assert p.x == x and p.y == y - │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -53 │ p.set_x(100) - │ ^ ^^^ u64: Value - │ │ - │ Point: Memory +54 │ assert p.x == x and p.y == y + │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value +55 │ p.set_x(100) + │ ^ ^^^ u64: Value + │ │ + │ Point: Memory note: - ┌─ struct_fns.fe:53:5 + ┌─ struct_fns.fe:55:9 │ -53 │ p.set_x(100) - │ ^^^^^^^^^^^^ u64: Value -54 │ p.reflect() - │ ^ Point: Memory +55 │ p.set_x(100) + │ ^^^^^^^^^^^^ u64: Value +56 │ p.reflect() + │ ^ Point: Memory note: - ┌─ struct_fns.fe:54:5 + ┌─ struct_fns.fe:56:9 │ -54 │ p.reflect() - │ ^^^^^^^^^^^ (): Value -55 │ assert p.x() == y and p.y == 100 - │ ^ Point: Memory +56 │ p.reflect() + │ ^^^^^^^^^^^ (): Value +57 │ assert p.x() == y and p.y == 100 + │ ^ Point: Memory note: - ┌─ struct_fns.fe:55:12 + ┌─ struct_fns.fe:57:16 │ -55 │ assert p.x() == y and p.y == 100 - │ ^^^^^ ^ u64: Value - │ │ - │ u64: Value +57 │ assert p.x() == y and p.y == 100 + │ ^^^^^ ^ u64: Value + │ │ + │ u64: Value note: - ┌─ struct_fns.fe:55:12 + ┌─ struct_fns.fe:57:16 │ -55 │ assert p.x() == y and p.y == 100 - │ ^^^^^^^^^^ ^ Point: Memory - │ │ - │ bool: Value +57 │ assert p.x() == y and p.y == 100 + │ ^^^^^^^^^^ ^ Point: Memory + │ │ + │ bool: Value note: - ┌─ struct_fns.fe:55:27 + ┌─ struct_fns.fe:57:31 │ -55 │ assert p.x() == y and p.y == 100 - │ ^^^ ^^^ u64: Value - │ │ - │ u64: Memory => Value +57 │ assert p.x() == y and p.y == 100 + │ ^^^ ^^^ u64: Value + │ │ + │ u64: Memory => Value note: - ┌─ struct_fns.fe:55:27 + ┌─ struct_fns.fe:57:31 │ -55 │ assert p.x() == y and p.y == 100 - │ ^^^^^^^^^^ bool: Value +57 │ assert p.x() == y and p.y == 100 + │ ^^^^^^^^^^ bool: Value note: - ┌─ struct_fns.fe:55:12 + ┌─ struct_fns.fe:57:16 │ -55 │ assert p.x() == y and p.y == 100 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -56 │ return p.y - │ ^ Point: Memory +57 │ assert p.x() == y and p.y == 100 + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value +58 │ return p.y + │ ^ Point: Memory note: - ┌─ struct_fns.fe:56:12 + ┌─ struct_fns.fe:58:16 │ -56 │ return p.y - │ ^^^ u64: Memory => Value +58 │ return p.y + │ ^^^ u64: Memory => Value diff --git a/crates/analyzer/tests/snapshots/analysis__structs.snap b/crates/analyzer/tests/snapshots/analysis__structs.snap index 6a7c612e03..3a067ab23f 100644 --- a/crates/analyzer/tests/snapshots/analysis__structs.snap +++ b/crates/analyzer/tests/snapshots/analysis__structs.snap @@ -12,31 +12,32 @@ note: │ ^^^^^^^^^^^ u256 note: - ┌─ structs.fe:6:5 - │ -6 │ pub name: String<3> - │ ^^^^^^^^^^^^^^^^^^^ String<3> -7 │ pub numbers: Array - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -8 │ pub point: Point - │ ^^^^^^^^^^^^^^^^ Point -9 │ pub something: (u256, bool) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, bool) + ┌─ structs.fe:7:5 + │ + 7 │ pub name: String<3> + │ ^^^^^^^^^^^^^^^^^^^ String<3> + 8 │ pub numbers: Array + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array + 9 │ pub point: Point + │ ^^^^^^^^^^^^^^^^ Point +10 │ pub something: (u256, bool) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, bool) note: - ┌─ structs.fe:12:5 + ┌─ structs.fe:14:5 │ -12 │ pub foo: u256 +14 │ pub foo: u256 │ ^^^^^^^^^^^^^ u256 -13 │ bar: bool +15 │ bar: bool │ ^^^^^^^^^ bool note: - ┌─ structs.fe:15:5 + ┌─ structs.fe:17:5 │ -15 │ ╭ pub fn new(val: u256) -> Mixed: -16 │ │ return Mixed(foo: val, bar: false) - │ ╰──────────────────────────────────────────^ attributes hash: 2524938698704972422 +17 │ ╭ pub fn new(val: u256) -> Mixed { +18 │ │ return Mixed(foo: val, bar: false) +19 │ │ } + │ ╰─────^ attributes hash: 2524938698704972422 │ = FunctionSignature { self_decl: None, @@ -65,37 +66,38 @@ note: } note: - ┌─ structs.fe:16:27 + ┌─ structs.fe:18:27 │ -16 │ return Mixed(foo: val, bar: false) +18 │ return Mixed(foo: val, bar: false) │ ^^^ ^^^^^ bool: Value │ │ │ u256: Value note: - ┌─ structs.fe:16:16 + ┌─ structs.fe:18:16 │ -16 │ return Mixed(foo: val, bar: false) +18 │ return Mixed(foo: val, bar: false) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mixed: Memory note: - ┌─ structs.fe:19:5 + ┌─ structs.fe:23:5 │ -19 │ pub price: u256 +23 │ pub price: u256 │ ^^^^^^^^^^^^^^^ u256 -20 │ pub size: u256 +24 │ pub size: u256 │ ^^^^^^^^^^^^^^ u256 -21 │ pub rooms: u8 +25 │ pub rooms: u8 │ ^^^^^^^^^^^^^ u8 -22 │ pub vacant: bool +26 │ pub vacant: bool │ ^^^^^^^^^^^^^^^^ bool note: - ┌─ structs.fe:24:5 + ┌─ structs.fe:28:5 │ -24 │ ╭ pub fn encode(self) -> Array: -25 │ │ return self.abi_encode() - │ ╰────────────────────────────────^ attributes hash: 2052929893622941907 +28 │ ╭ pub fn encode(self) -> Array { +29 │ │ return self.abi_encode() +30 │ │ } + │ ╰─────^ attributes hash: 2052929893622941907 │ = FunctionSignature { self_decl: Some( @@ -116,23 +118,24 @@ note: } note: - ┌─ structs.fe:25:16 + ┌─ structs.fe:29:16 │ -25 │ return self.abi_encode() +29 │ return self.abi_encode() │ ^^^^ House: Memory note: - ┌─ structs.fe:25:16 + ┌─ structs.fe:29:16 │ -25 │ return self.abi_encode() +29 │ return self.abi_encode() │ ^^^^^^^^^^^^^^^^^ Array: Memory note: - ┌─ structs.fe:27:5 + ┌─ structs.fe:32:5 │ -27 │ ╭ pub fn hash(self) -> u256: -28 │ │ return keccak256(self.encode()) - │ ╰───────────────────────────────────────^ attributes hash: 11773348765973600208 +32 │ ╭ pub fn hash(self) -> u256 { +33 │ │ return keccak256(self.encode()) +34 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -150,29 +153,30 @@ note: } note: - ┌─ structs.fe:28:26 + ┌─ structs.fe:33:26 │ -28 │ return keccak256(self.encode()) +33 │ return keccak256(self.encode()) │ ^^^^ House: Memory note: - ┌─ structs.fe:28:26 + ┌─ structs.fe:33:26 │ -28 │ return keccak256(self.encode()) +33 │ return keccak256(self.encode()) │ ^^^^^^^^^^^^^ Array: Memory note: - ┌─ structs.fe:28:16 + ┌─ structs.fe:33:16 │ -28 │ return keccak256(self.encode()) +33 │ return keccak256(self.encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ structs.fe:30:5 + ┌─ structs.fe:36:5 │ -30 │ ╭ pub fn price_per_sqft(self) -> u256: -31 │ │ return self.price / self.size - │ ╰─────────────────────────────────────^ attributes hash: 11773348765973600208 +36 │ ╭ pub fn price_per_sqft(self) -> u256 { +37 │ │ return self.price / self.size +38 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -190,38 +194,39 @@ note: } note: - ┌─ structs.fe:31:16 + ┌─ structs.fe:37:16 │ -31 │ return self.price / self.size +37 │ return self.price / self.size │ ^^^^ House: Memory note: - ┌─ structs.fe:31:16 + ┌─ structs.fe:37:16 │ -31 │ return self.price / self.size +37 │ return self.price / self.size │ ^^^^^^^^^^ ^^^^ House: Memory │ │ │ u256: Memory => Value note: - ┌─ structs.fe:31:29 + ┌─ structs.fe:37:29 │ -31 │ return self.price / self.size +37 │ return self.price / self.size │ ^^^^^^^^^ u256: Memory => Value note: - ┌─ structs.fe:31:16 + ┌─ structs.fe:37:16 │ -31 │ return self.price / self.size +37 │ return self.price / self.size │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ structs.fe:33:5 + ┌─ structs.fe:40:5 │ -33 │ ╭ pub fn expand(self): -34 │ │ self.rooms += 1 -35 │ │ self.size += 100 - │ ╰────────────────────────^ attributes hash: 18235041182630809162 +40 │ ╭ pub fn expand(self) { +41 │ │ self.rooms += 1 +42 │ │ self.size += 100 +43 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -237,48 +242,48 @@ note: } note: - ┌─ structs.fe:34:9 + ┌─ structs.fe:41:9 │ -34 │ self.rooms += 1 +41 │ self.rooms += 1 │ ^^^^ House: Memory note: - ┌─ structs.fe:34:9 + ┌─ structs.fe:41:9 │ -34 │ self.rooms += 1 +41 │ self.rooms += 1 │ ^^^^^^^^^^ ^ u8: Value │ │ │ u8: Memory -35 │ self.size += 100 +42 │ self.size += 100 │ ^^^^ House: Memory note: - ┌─ structs.fe:35:9 + ┌─ structs.fe:42:9 │ -35 │ self.size += 100 +42 │ self.size += 100 │ ^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory note: - ┌─ structs.fe:38:5 + ┌─ structs.fe:47:5 │ -38 │ my_house: House +47 │ my_house: House │ ^^^^^^^^^^^^^^^ House -39 │ my_bar: Bar +48 │ my_bar: Bar │ ^^^^^^^^^^^ Bar note: - ┌─ structs.fe:41:5 + ┌─ structs.fe:50:5 │ -41 │ ╭ pub fn complex_struct_in_storage(self) -> String<3>: -42 │ │ self.my_bar = Bar( -43 │ │ name: "foo", -44 │ │ numbers: [1, 2], +50 │ ╭ pub fn complex_struct_in_storage(self) -> String<3> { +51 │ │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) +52 │ │ assert self.my_bar.numbers[0] == 1 +53 │ │ assert self.my_bar.numbers[1] == 2 · │ -86 │ │ -87 │ │ return self.my_bar.name.to_mem() - │ ╰────────────────────────────────────────^ attributes hash: 7100809906483982919 +79 │ │ return self.my_bar.name.to_mem() +80 │ │ } + │ ╰─────^ attributes hash: 7100809906483982919 │ = FunctionSignature { self_decl: Some( @@ -296,226 +301,214 @@ note: } note: - ┌─ structs.fe:42:9 + ┌─ structs.fe:51:9 │ -42 │ self.my_bar = Bar( +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) │ ^^^^ Foo: Value note: - ┌─ structs.fe:42:9 + ┌─ structs.fe:51:9 │ -42 │ self.my_bar = Bar( - │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } -43 │ name: "foo", - │ ^^^^^ String<3>: Memory -44 │ numbers: [1, 2], - │ ^ ^ u256: Value - │ │ - │ u256: Value +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^ ^^^^^ ^ ^ u256: Value + │ │ │ │ + │ │ │ u256: Value + │ │ String<3>: Memory + │ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:44:22 + ┌─ structs.fe:51:49 │ -44 │ numbers: [1, 2], - │ ^^^^^^ Array: Memory -45 │ point: Point(x: 100, y: 200), - │ ^^^ ^^^ u256: Value - │ │ - │ u256: Value +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^ ^^^ ^^^ u256: Value + │ │ │ + │ │ u256: Value + │ Array: Memory note: - ┌─ structs.fe:45:20 + ┌─ structs.fe:51:64 │ -45 │ point: Point(x: 100, y: 200), - │ ^^^^^^^^^^^^^^^^^^^^^ Point: Memory -46 │ something: (1, true), - │ ^ ^^^^ bool: Value - │ │ - │ u256: Value +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool: Value + │ │ │ + │ │ u256: Value + │ Point: Memory note: - ┌─ structs.fe:46:24 + ┌─ structs.fe:51:98 │ -46 │ something: (1, true), - │ ^^^^^^^^^ (u256, bool): Memory +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:42:23 - │ -42 │ self.my_bar = Bar( - │ ╭───────────────────────^ -43 │ │ name: "foo", -44 │ │ numbers: [1, 2], -45 │ │ point: Point(x: 100, y: 200), -46 │ │ something: (1, true), -47 │ │ ) - │ ╰─────────^ Bar: Memory - · │ -50 │ assert self.my_bar.numbers[0] == 1 - │ ^^^^ Foo: Value + ┌─ structs.fe:51:23 + │ +51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bar: Memory +52 │ assert self.my_bar.numbers[0] == 1 + │ ^^^^ Foo: Value note: - ┌─ structs.fe:50:16 + ┌─ structs.fe:52:16 │ -50 │ assert self.my_bar.numbers[0] == 1 +52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:50:16 + ┌─ structs.fe:52:16 │ -50 │ assert self.my_bar.numbers[0] == 1 +52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(1) } note: - ┌─ structs.fe:50:16 + ┌─ structs.fe:52:16 │ -50 │ assert self.my_bar.numbers[0] == 1 +52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ structs.fe:50:16 + ┌─ structs.fe:52:16 │ -50 │ assert self.my_bar.numbers[0] == 1 +52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -51 │ assert self.my_bar.numbers[1] == 2 +53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^ Foo: Value note: - ┌─ structs.fe:51:16 + ┌─ structs.fe:53:16 │ -51 │ assert self.my_bar.numbers[1] == 2 +53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:51:16 + ┌─ structs.fe:53:16 │ -51 │ assert self.my_bar.numbers[1] == 2 +53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(1) } note: - ┌─ structs.fe:51:16 + ┌─ structs.fe:53:16 │ -51 │ assert self.my_bar.numbers[1] == 2 +53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ structs.fe:51:16 + ┌─ structs.fe:53:16 │ -51 │ assert self.my_bar.numbers[1] == 2 +53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -52 │ assert self.my_bar.point.x == 100 +54 │ assert self.my_bar.point.x == 100 │ ^^^^ Foo: Value note: - ┌─ structs.fe:52:16 + ┌─ structs.fe:54:16 │ -52 │ assert self.my_bar.point.x == 100 +54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:52:16 + ┌─ structs.fe:54:16 │ -52 │ assert self.my_bar.point.x == 100 +54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:52:16 + ┌─ structs.fe:54:16 │ -52 │ assert self.my_bar.point.x == 100 +54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:52:16 + ┌─ structs.fe:54:16 │ -52 │ assert self.my_bar.point.x == 100 +54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -53 │ assert self.my_bar.point.y == 200 +55 │ assert self.my_bar.point.y == 200 │ ^^^^ Foo: Value note: - ┌─ structs.fe:53:16 + ┌─ structs.fe:55:16 │ -53 │ assert self.my_bar.point.y == 200 +55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:53:16 + ┌─ structs.fe:55:16 │ -53 │ assert self.my_bar.point.y == 200 +55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:53:16 + ┌─ structs.fe:55:16 │ -53 │ assert self.my_bar.point.y == 200 +55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:53:16 + ┌─ structs.fe:55:16 │ -53 │ assert self.my_bar.point.y == 200 +55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -54 │ assert self.my_bar.something.item0 == 1 +56 │ assert self.my_bar.something.item0 == 1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:54:16 + ┌─ structs.fe:56:16 │ -54 │ assert self.my_bar.something.item0 == 1 +56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:54:16 + ┌─ structs.fe:56:16 │ -54 │ assert self.my_bar.something.item0 == 1 +56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:54:16 + ┌─ structs.fe:56:16 │ -54 │ assert self.my_bar.something.item0 == 1 +56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:54:16 + ┌─ structs.fe:56:16 │ -54 │ assert self.my_bar.something.item0 == 1 +56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -55 │ assert self.my_bar.something.item1 +57 │ assert self.my_bar.something.item1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:55:16 + ┌─ structs.fe:57:16 │ -55 │ assert self.my_bar.something.item1 +57 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:55:16 + ┌─ structs.fe:57:16 │ -55 │ assert self.my_bar.something.item1 +57 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:55:16 + ┌─ structs.fe:57:16 │ -55 │ assert self.my_bar.something.item1 +57 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: Some(1) } => Value - · 58 │ self.my_bar.numbers[0] = 10 │ ^^^^ Foo: Value @@ -624,475 +617,469 @@ note: │ 61 │ assert self.my_bar.numbers[1] == 20 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -62 │ # We can set the array itself -63 │ self.my_bar.numbers = [1, 2] +62 │ self.my_bar.numbers = [1, 2] │ ^^^^ Foo: Value note: - ┌─ structs.fe:63:9 + ┌─ structs.fe:62:9 │ -63 │ self.my_bar.numbers = [1, 2] +62 │ self.my_bar.numbers = [1, 2] │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:63:9 + ┌─ structs.fe:62:9 │ -63 │ self.my_bar.numbers = [1, 2] +62 │ self.my_bar.numbers = [1, 2] │ ^^^^^^^^^^^^^^^^^^^ ^ ^ u256: Value │ │ │ │ │ u256: Value │ Array: Storage { nonce: Some(1) } note: - ┌─ structs.fe:63:31 + ┌─ structs.fe:62:31 │ -63 │ self.my_bar.numbers = [1, 2] +62 │ self.my_bar.numbers = [1, 2] │ ^^^^^^ Array: Memory -64 │ assert self.my_bar.numbers[0] == 1 +63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:64:16 + ┌─ structs.fe:63:16 │ -64 │ assert self.my_bar.numbers[0] == 1 +63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:64:16 + ┌─ structs.fe:63:16 │ -64 │ assert self.my_bar.numbers[0] == 1 +63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(1) } note: - ┌─ structs.fe:64:16 + ┌─ structs.fe:63:16 │ -64 │ assert self.my_bar.numbers[0] == 1 +63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ structs.fe:64:16 + ┌─ structs.fe:63:16 │ -64 │ assert self.my_bar.numbers[0] == 1 +63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -65 │ assert self.my_bar.numbers[1] == 2 +64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^ Foo: Value note: - ┌─ structs.fe:65:16 + ┌─ structs.fe:64:16 │ -65 │ assert self.my_bar.numbers[1] == 2 +64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:65:16 + ┌─ structs.fe:64:16 │ -65 │ assert self.my_bar.numbers[1] == 2 +64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Storage { nonce: Some(1) } note: - ┌─ structs.fe:65:16 + ┌─ structs.fe:64:16 │ -65 │ assert self.my_bar.numbers[1] == 2 +64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ structs.fe:65:16 + ┌─ structs.fe:64:16 │ -65 │ assert self.my_bar.numbers[1] == 2 +64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value - · -68 │ self.my_bar.point.x = 1000 +65 │ self.my_bar.point.x = 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:68:9 + ┌─ structs.fe:65:9 │ -68 │ self.my_bar.point.x = 1000 +65 │ self.my_bar.point.x = 1000 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:68:9 + ┌─ structs.fe:65:9 │ -68 │ self.my_bar.point.x = 1000 +65 │ self.my_bar.point.x = 1000 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:68:9 + ┌─ structs.fe:65:9 │ -68 │ self.my_bar.point.x = 1000 +65 │ self.my_bar.point.x = 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } -69 │ self.my_bar.point.y = 2000 +66 │ self.my_bar.point.y = 2000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:69:9 + ┌─ structs.fe:66:9 │ -69 │ self.my_bar.point.y = 2000 +66 │ self.my_bar.point.y = 2000 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:69:9 + ┌─ structs.fe:66:9 │ -69 │ self.my_bar.point.y = 2000 +66 │ self.my_bar.point.y = 2000 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:69:9 + ┌─ structs.fe:66:9 │ -69 │ self.my_bar.point.y = 2000 +66 │ self.my_bar.point.y = 2000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } -70 │ assert self.my_bar.point.x == 1000 +67 │ assert self.my_bar.point.x == 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:70:16 + ┌─ structs.fe:67:16 │ -70 │ assert self.my_bar.point.x == 1000 +67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:70:16 + ┌─ structs.fe:67:16 │ -70 │ assert self.my_bar.point.x == 1000 +67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:70:16 + ┌─ structs.fe:67:16 │ -70 │ assert self.my_bar.point.x == 1000 +67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:70:16 + ┌─ structs.fe:67:16 │ -70 │ assert self.my_bar.point.x == 1000 +67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -71 │ assert self.my_bar.point.y == 2000 +68 │ assert self.my_bar.point.y == 2000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:71:16 + ┌─ structs.fe:68:16 │ -71 │ assert self.my_bar.point.y == 2000 +68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:71:16 + ┌─ structs.fe:68:16 │ -71 │ assert self.my_bar.point.y == 2000 +68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:71:16 + ┌─ structs.fe:68:16 │ -71 │ assert self.my_bar.point.y == 2000 +68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:71:16 + ┌─ structs.fe:68:16 │ -71 │ assert self.my_bar.point.y == 2000 +68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -72 │ # We can set the point itself -73 │ self.my_bar.point = Point(x: 100, y: 200) +69 │ self.my_bar.point = Point(x: 100, y: 200) │ ^^^^ Foo: Value note: - ┌─ structs.fe:73:9 + ┌─ structs.fe:69:9 │ -73 │ self.my_bar.point = Point(x: 100, y: 200) +69 │ self.my_bar.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:73:9 + ┌─ structs.fe:69:9 │ -73 │ self.my_bar.point = Point(x: 100, y: 200) +69 │ self.my_bar.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^^^^^^^ ^^^ ^^^ u256: Value │ │ │ │ │ u256: Value │ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:73:29 + ┌─ structs.fe:69:29 │ -73 │ self.my_bar.point = Point(x: 100, y: 200) +69 │ self.my_bar.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^^^^^^^^^^^ Point: Memory -74 │ assert self.my_bar.point.x == 100 +70 │ assert self.my_bar.point.x == 100 │ ^^^^ Foo: Value note: - ┌─ structs.fe:74:16 + ┌─ structs.fe:70:16 │ -74 │ assert self.my_bar.point.x == 100 +70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:74:16 + ┌─ structs.fe:70:16 │ -74 │ assert self.my_bar.point.x == 100 +70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:74:16 + ┌─ structs.fe:70:16 │ -74 │ assert self.my_bar.point.x == 100 +70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:74:16 + ┌─ structs.fe:70:16 │ -74 │ assert self.my_bar.point.x == 100 +70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -75 │ assert self.my_bar.point.y == 200 +71 │ assert self.my_bar.point.y == 200 │ ^^^^ Foo: Value note: - ┌─ structs.fe:75:16 + ┌─ structs.fe:71:16 │ -75 │ assert self.my_bar.point.y == 200 +71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:75:16 + ┌─ structs.fe:71:16 │ -75 │ assert self.my_bar.point.y == 200 +71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^ Point: Storage { nonce: Some(1) } note: - ┌─ structs.fe:75:16 + ┌─ structs.fe:71:16 │ -75 │ assert self.my_bar.point.y == 200 +71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:75:16 + ┌─ structs.fe:71:16 │ -75 │ assert self.my_bar.point.y == 200 +71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value - · -78 │ self.my_bar.something.item0 = 10 +72 │ self.my_bar.something.item0 = 10 │ ^^^^ Foo: Value note: - ┌─ structs.fe:78:9 + ┌─ structs.fe:72:9 │ -78 │ self.my_bar.something.item0 = 10 +72 │ self.my_bar.something.item0 = 10 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:78:9 + ┌─ structs.fe:72:9 │ -78 │ self.my_bar.something.item0 = 10 +72 │ self.my_bar.something.item0 = 10 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:78:9 + ┌─ structs.fe:72:9 │ -78 │ self.my_bar.something.item0 = 10 +72 │ self.my_bar.something.item0 = 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } -79 │ self.my_bar.something.item1 = false +73 │ self.my_bar.something.item1 = false │ ^^^^ Foo: Value note: - ┌─ structs.fe:79:9 + ┌─ structs.fe:73:9 │ -79 │ self.my_bar.something.item1 = false +73 │ self.my_bar.something.item1 = false │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:79:9 + ┌─ structs.fe:73:9 │ -79 │ self.my_bar.something.item1 = false +73 │ self.my_bar.something.item1 = false │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:79:9 + ┌─ structs.fe:73:9 │ -79 │ self.my_bar.something.item1 = false +73 │ self.my_bar.something.item1 = false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(1) } -80 │ assert self.my_bar.something.item0 == 10 +74 │ assert self.my_bar.something.item0 == 10 │ ^^^^ Foo: Value note: - ┌─ structs.fe:80:16 + ┌─ structs.fe:74:16 │ -80 │ assert self.my_bar.something.item0 == 10 +74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:80:16 + ┌─ structs.fe:74:16 │ -80 │ assert self.my_bar.something.item0 == 10 +74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:80:16 + ┌─ structs.fe:74:16 │ -80 │ assert self.my_bar.something.item0 == 10 +74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:80:16 + ┌─ structs.fe:74:16 │ -80 │ assert self.my_bar.something.item0 == 10 +74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -81 │ assert not self.my_bar.something.item1 +75 │ assert not self.my_bar.something.item1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:81:20 + ┌─ structs.fe:75:20 │ -81 │ assert not self.my_bar.something.item1 +75 │ assert not self.my_bar.something.item1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:81:20 + ┌─ structs.fe:75:20 │ -81 │ assert not self.my_bar.something.item1 +75 │ assert not self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:81:20 + ┌─ structs.fe:75:20 │ -81 │ assert not self.my_bar.something.item1 +75 │ assert not self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:81:16 + ┌─ structs.fe:75:16 │ -81 │ assert not self.my_bar.something.item1 +75 │ assert not self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -82 │ # We can set the tuple itself -83 │ self.my_bar.something = (1, true) +76 │ self.my_bar.something = (1, true) │ ^^^^ Foo: Value note: - ┌─ structs.fe:83:9 + ┌─ structs.fe:76:9 │ -83 │ self.my_bar.something = (1, true) +76 │ self.my_bar.something = (1, true) │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:83:9 + ┌─ structs.fe:76:9 │ -83 │ self.my_bar.something = (1, true) +76 │ self.my_bar.something = (1, true) │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool: Value │ │ │ │ │ u256: Value │ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:83:33 + ┌─ structs.fe:76:33 │ -83 │ self.my_bar.something = (1, true) +76 │ self.my_bar.something = (1, true) │ ^^^^^^^^^ (u256, bool): Memory -84 │ assert self.my_bar.something.item0 == 1 +77 │ assert self.my_bar.something.item0 == 1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:84:16 + ┌─ structs.fe:77:16 │ -84 │ assert self.my_bar.something.item0 == 1 +77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:84:16 + ┌─ structs.fe:77:16 │ -84 │ assert self.my_bar.something.item0 == 1 +77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:84:16 + ┌─ structs.fe:77:16 │ -84 │ assert self.my_bar.something.item0 == 1 +77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(1) } => Value note: - ┌─ structs.fe:84:16 + ┌─ structs.fe:77:16 │ -84 │ assert self.my_bar.something.item0 == 1 +77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -85 │ assert self.my_bar.something.item1 +78 │ assert self.my_bar.something.item1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:85:16 + ┌─ structs.fe:78:16 │ -85 │ assert self.my_bar.something.item1 +78 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:85:16 + ┌─ structs.fe:78:16 │ -85 │ assert self.my_bar.something.item1 +78 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool): Storage { nonce: Some(1) } note: - ┌─ structs.fe:85:16 + ┌─ structs.fe:78:16 │ -85 │ assert self.my_bar.something.item1 +78 │ assert self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: Some(1) } => Value -86 │ -87 │ return self.my_bar.name.to_mem() +79 │ return self.my_bar.name.to_mem() │ ^^^^ Foo: Value note: - ┌─ structs.fe:87:16 + ┌─ structs.fe:79:16 │ -87 │ return self.my_bar.name.to_mem() +79 │ return self.my_bar.name.to_mem() │ ^^^^^^^^^^^ Bar: Storage { nonce: Some(1) } note: - ┌─ structs.fe:87:16 + ┌─ structs.fe:79:16 │ -87 │ return self.my_bar.name.to_mem() +79 │ return self.my_bar.name.to_mem() │ ^^^^^^^^^^^^^^^^ String<3>: Storage { nonce: Some(1) } note: - ┌─ structs.fe:87:16 + ┌─ structs.fe:79:16 │ -87 │ return self.my_bar.name.to_mem() +79 │ return self.my_bar.name.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^^^ String<3>: Storage { nonce: Some(1) } => Memory note: - ┌─ structs.fe:89:5 + ┌─ structs.fe:82:5 │ - 89 │ ╭ pub fn complex_struct_in_memory(self) -> String<3>: - 90 │ │ let val: Bar = Bar( - 91 │ │ name: "foo", - 92 │ │ numbers: [1, 2], + 82 │ ╭ pub fn complex_struct_in_memory(self) -> String<3> { + 83 │ │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + 84 │ │ assert val.numbers[0] == 1 + 85 │ │ assert val.numbers[1] == 2 · │ -134 │ │ -135 │ │ return val.name - │ ╰───────────────────────^ attributes hash: 7100809906483982919 +111 │ │ return val.name +112 │ │ } + │ ╰─────^ attributes hash: 7100809906483982919 │ = FunctionSignature { self_decl: Some( @@ -1110,623 +1097,607 @@ note: } note: - ┌─ structs.fe:90:18 + ┌─ structs.fe:83:18 │ -90 │ let val: Bar = Bar( +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) │ ^^^ Bar note: - ┌─ structs.fe:91:19 + ┌─ structs.fe:83:34 │ -91 │ name: "foo", - │ ^^^^^ String<3>: Memory -92 │ numbers: [1, 2], - │ ^ ^ u256: Value - │ │ - │ u256: Value +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^ ^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ String<3>: Memory note: - ┌─ structs.fe:92:22 + ┌─ structs.fe:83:50 │ -92 │ numbers: [1, 2], - │ ^^^^^^ Array: Memory -93 │ point: Point(x: 100, y: 200), - │ ^^^ ^^^ u256: Value - │ │ - │ u256: Value +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^ ^^^ ^^^ u256: Value + │ │ │ + │ │ u256: Value + │ Array: Memory note: - ┌─ structs.fe:93:20 + ┌─ structs.fe:83:65 │ -93 │ point: Point(x: 100, y: 200), - │ ^^^^^^^^^^^^^^^^^^^^^ Point: Memory -94 │ something: (1, true), - │ ^ ^^^^ bool: Value - │ │ - │ u256: Value +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool: Value + │ │ │ + │ │ u256: Value + │ Point: Memory note: - ┌─ structs.fe:94:24 + ┌─ structs.fe:83:99 │ -94 │ something: (1, true), - │ ^^^^^^^^^ (u256, bool): Memory +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:90:24 - │ -90 │ let val: Bar = Bar( - │ ╭────────────────────────^ -91 │ │ name: "foo", -92 │ │ numbers: [1, 2], -93 │ │ point: Point(x: 100, y: 200), -94 │ │ something: (1, true), -95 │ │ ) - │ ╰─────────^ Bar: Memory - · │ -98 │ assert val.numbers[0] == 1 - │ ^^^ Bar: Memory + ┌─ structs.fe:83:24 + │ +83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bar: Memory +84 │ assert val.numbers[0] == 1 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:98:16 + ┌─ structs.fe:84:16 │ -98 │ assert val.numbers[0] == 1 +84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ structs.fe:98:16 + ┌─ structs.fe:84:16 │ -98 │ assert val.numbers[0] == 1 +84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:98:16 + ┌─ structs.fe:84:16 │ -98 │ assert val.numbers[0] == 1 +84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ bool: Value -99 │ assert val.numbers[1] == 2 +85 │ assert val.numbers[1] == 2 │ ^^^ Bar: Memory note: - ┌─ structs.fe:99:16 + ┌─ structs.fe:85:16 │ -99 │ assert val.numbers[1] == 2 +85 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ Array: Memory note: - ┌─ structs.fe:99:16 + ┌─ structs.fe:85:16 │ -99 │ assert val.numbers[1] == 2 +85 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:99:16 - │ - 99 │ assert val.numbers[1] == 2 - │ ^^^^^^^^^^^^^^^^^^^ bool: Value -100 │ assert val.point.x == 100 - │ ^^^ Bar: Memory + ┌─ structs.fe:85:16 + │ +85 │ assert val.numbers[1] == 2 + │ ^^^^^^^^^^^^^^^^^^^ bool: Value +86 │ assert val.point.x == 100 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:100:16 - │ -100 │ assert val.point.x == 100 - │ ^^^^^^^^^ Point: Memory + ┌─ structs.fe:86:16 + │ +86 │ assert val.point.x == 100 + │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:100:16 - │ -100 │ assert val.point.x == 100 - │ ^^^^^^^^^^^ ^^^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:86:16 + │ +86 │ assert val.point.x == 100 + │ ^^^^^^^^^^^ ^^^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:100:16 - │ -100 │ assert val.point.x == 100 - │ ^^^^^^^^^^^^^^^^^^ bool: Value -101 │ assert val.point.y == 200 - │ ^^^ Bar: Memory + ┌─ structs.fe:86:16 + │ +86 │ assert val.point.x == 100 + │ ^^^^^^^^^^^^^^^^^^ bool: Value +87 │ assert val.point.y == 200 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:101:16 - │ -101 │ assert val.point.y == 200 - │ ^^^^^^^^^ Point: Memory + ┌─ structs.fe:87:16 + │ +87 │ assert val.point.y == 200 + │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:101:16 - │ -101 │ assert val.point.y == 200 - │ ^^^^^^^^^^^ ^^^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:87:16 + │ +87 │ assert val.point.y == 200 + │ ^^^^^^^^^^^ ^^^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:101:16 - │ -101 │ assert val.point.y == 200 - │ ^^^^^^^^^^^^^^^^^^ bool: Value -102 │ assert val.something.item0 == 1 - │ ^^^ Bar: Memory + ┌─ structs.fe:87:16 + │ +87 │ assert val.point.y == 200 + │ ^^^^^^^^^^^^^^^^^^ bool: Value +88 │ assert val.something.item0 == 1 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:102:16 - │ -102 │ assert val.something.item0 == 1 - │ ^^^^^^^^^^^^^ (u256, bool): Memory + ┌─ structs.fe:88:16 + │ +88 │ assert val.something.item0 == 1 + │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:102:16 - │ -102 │ assert val.something.item0 == 1 - │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:88:16 + │ +88 │ assert val.something.item0 == 1 + │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:102:16 - │ -102 │ assert val.something.item0 == 1 - │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -103 │ assert val.something.item1 - │ ^^^ Bar: Memory + ┌─ structs.fe:88:16 + │ +88 │ assert val.something.item0 == 1 + │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value +89 │ assert val.something.item1 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:103:16 - │ -103 │ assert val.something.item1 - │ ^^^^^^^^^^^^^ (u256, bool): Memory + ┌─ structs.fe:89:16 + │ +89 │ assert val.something.item1 + │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:103:16 - │ -103 │ assert val.something.item1 - │ ^^^^^^^^^^^^^^^^^^^ bool: Memory => Value - · -106 │ val.numbers[0] = 10 - │ ^^^ Bar: Memory + ┌─ structs.fe:89:16 + │ +89 │ assert val.something.item1 + │ ^^^^^^^^^^^^^^^^^^^ bool: Memory => Value +90 │ val.numbers[0] = 10 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:106:9 - │ -106 │ val.numbers[0] = 10 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:90:9 + │ +90 │ val.numbers[0] = 10 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:106:9 - │ -106 │ val.numbers[0] = 10 - │ ^^^^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory -107 │ val.numbers[1] = 20 - │ ^^^ Bar: Memory + ┌─ structs.fe:90:9 + │ +90 │ val.numbers[0] = 10 + │ ^^^^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory +91 │ val.numbers[1] = 20 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:107:9 - │ -107 │ val.numbers[1] = 20 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:91:9 + │ +91 │ val.numbers[1] = 20 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:107:9 - │ -107 │ val.numbers[1] = 20 - │ ^^^^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory -108 │ assert val.numbers[0] == 10 - │ ^^^ Bar: Memory + ┌─ structs.fe:91:9 + │ +91 │ val.numbers[1] = 20 + │ ^^^^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory +92 │ assert val.numbers[0] == 10 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:108:16 - │ -108 │ assert val.numbers[0] == 10 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:92:16 + │ +92 │ assert val.numbers[0] == 10 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:108:16 - │ -108 │ assert val.numbers[0] == 10 - │ ^^^^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:92:16 + │ +92 │ assert val.numbers[0] == 10 + │ ^^^^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:108:16 - │ -108 │ assert val.numbers[0] == 10 - │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -109 │ assert val.numbers[1] == 20 - │ ^^^ Bar: Memory + ┌─ structs.fe:92:16 + │ +92 │ assert val.numbers[0] == 10 + │ ^^^^^^^^^^^^^^^^^^^^ bool: Value +93 │ assert val.numbers[1] == 20 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:109:16 - │ -109 │ assert val.numbers[1] == 20 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:93:16 + │ +93 │ assert val.numbers[1] == 20 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:109:16 - │ -109 │ assert val.numbers[1] == 20 - │ ^^^^^^^^^^^^^^ ^^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:93:16 + │ +93 │ assert val.numbers[1] == 20 + │ ^^^^^^^^^^^^^^ ^^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:109:16 - │ -109 │ assert val.numbers[1] == 20 - │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -110 │ # We can set the array itself -111 │ val.numbers = [1, 2] - │ ^^^ Bar: Memory + ┌─ structs.fe:93:16 + │ +93 │ assert val.numbers[1] == 20 + │ ^^^^^^^^^^^^^^^^^^^^ bool: Value +94 │ val.numbers = [1, 2] + │ ^^^ Bar: Memory note: - ┌─ structs.fe:111:9 - │ -111 │ val.numbers = [1, 2] - │ ^^^^^^^^^^^ ^ ^ u256: Value - │ │ │ - │ │ u256: Value - │ Array: Memory + ┌─ structs.fe:94:9 + │ +94 │ val.numbers = [1, 2] + │ ^^^^^^^^^^^ ^ ^ u256: Value + │ │ │ + │ │ u256: Value + │ Array: Memory note: - ┌─ structs.fe:111:23 - │ -111 │ val.numbers = [1, 2] - │ ^^^^^^ Array: Memory -112 │ assert val.numbers[0] == 1 - │ ^^^ Bar: Memory + ┌─ structs.fe:94:23 + │ +94 │ val.numbers = [1, 2] + │ ^^^^^^ Array: Memory +95 │ assert val.numbers[0] == 1 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:112:16 - │ -112 │ assert val.numbers[0] == 1 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:95:16 + │ +95 │ assert val.numbers[0] == 1 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:112:16 - │ -112 │ assert val.numbers[0] == 1 - │ ^^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:95:16 + │ +95 │ assert val.numbers[0] == 1 + │ ^^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:112:16 - │ -112 │ assert val.numbers[0] == 1 - │ ^^^^^^^^^^^^^^^^^^^ bool: Value -113 │ assert val.numbers[1] == 2 - │ ^^^ Bar: Memory + ┌─ structs.fe:95:16 + │ +95 │ assert val.numbers[0] == 1 + │ ^^^^^^^^^^^^^^^^^^^ bool: Value +96 │ assert val.numbers[1] == 2 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:113:16 - │ -113 │ assert val.numbers[1] == 2 - │ ^^^^^^^^^^^ ^ u256: Value - │ │ - │ Array: Memory + ┌─ structs.fe:96:16 + │ +96 │ assert val.numbers[1] == 2 + │ ^^^^^^^^^^^ ^ u256: Value + │ │ + │ Array: Memory note: - ┌─ structs.fe:113:16 - │ -113 │ assert val.numbers[1] == 2 - │ ^^^^^^^^^^^^^^ ^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:96:16 + │ +96 │ assert val.numbers[1] == 2 + │ ^^^^^^^^^^^^^^ ^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:113:16 - │ -113 │ assert val.numbers[1] == 2 - │ ^^^^^^^^^^^^^^^^^^^ bool: Value - · -116 │ val.point.x = 1000 - │ ^^^ Bar: Memory + ┌─ structs.fe:96:16 + │ +96 │ assert val.numbers[1] == 2 + │ ^^^^^^^^^^^^^^^^^^^ bool: Value +97 │ val.point.x = 1000 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:116:9 - │ -116 │ val.point.x = 1000 - │ ^^^^^^^^^ Point: Memory + ┌─ structs.fe:97:9 + │ +97 │ val.point.x = 1000 + │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:116:9 - │ -116 │ val.point.x = 1000 - │ ^^^^^^^^^^^ ^^^^ u256: Value - │ │ - │ u256: Memory -117 │ val.point.y = 2000 - │ ^^^ Bar: Memory + ┌─ structs.fe:97:9 + │ +97 │ val.point.x = 1000 + │ ^^^^^^^^^^^ ^^^^ u256: Value + │ │ + │ u256: Memory +98 │ val.point.y = 2000 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:117:9 - │ -117 │ val.point.y = 2000 - │ ^^^^^^^^^ Point: Memory + ┌─ structs.fe:98:9 + │ +98 │ val.point.y = 2000 + │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:117:9 - │ -117 │ val.point.y = 2000 - │ ^^^^^^^^^^^ ^^^^ u256: Value - │ │ - │ u256: Memory -118 │ assert val.point.x == 1000 - │ ^^^ Bar: Memory + ┌─ structs.fe:98:9 + │ +98 │ val.point.y = 2000 + │ ^^^^^^^^^^^ ^^^^ u256: Value + │ │ + │ u256: Memory +99 │ assert val.point.x == 1000 + │ ^^^ Bar: Memory note: - ┌─ structs.fe:118:16 - │ -118 │ assert val.point.x == 1000 - │ ^^^^^^^^^ Point: Memory + ┌─ structs.fe:99:16 + │ +99 │ assert val.point.x == 1000 + │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:118:16 - │ -118 │ assert val.point.x == 1000 - │ ^^^^^^^^^^^ ^^^^ u256: Value - │ │ - │ u256: Memory => Value + ┌─ structs.fe:99:16 + │ +99 │ assert val.point.x == 1000 + │ ^^^^^^^^^^^ ^^^^ u256: Value + │ │ + │ u256: Memory => Value note: - ┌─ structs.fe:118:16 + ┌─ structs.fe:99:16 │ -118 │ assert val.point.x == 1000 + 99 │ assert val.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^ bool: Value -119 │ assert val.point.y == 2000 +100 │ assert val.point.y == 2000 │ ^^^ Bar: Memory note: - ┌─ structs.fe:119:16 + ┌─ structs.fe:100:16 │ -119 │ assert val.point.y == 2000 +100 │ assert val.point.y == 2000 │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:119:16 + ┌─ structs.fe:100:16 │ -119 │ assert val.point.y == 2000 +100 │ assert val.point.y == 2000 │ ^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:119:16 + ┌─ structs.fe:100:16 │ -119 │ assert val.point.y == 2000 +100 │ assert val.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^ bool: Value -120 │ # We can set the point itself -121 │ val.point = Point(x: 100, y: 200) +101 │ val.point = Point(x: 100, y: 200) │ ^^^ Bar: Memory note: - ┌─ structs.fe:121:9 + ┌─ structs.fe:101:9 │ -121 │ val.point = Point(x: 100, y: 200) +101 │ val.point = Point(x: 100, y: 200) │ ^^^^^^^^^ ^^^ ^^^ u256: Value │ │ │ │ │ u256: Value │ Point: Memory note: - ┌─ structs.fe:121:21 + ┌─ structs.fe:101:21 │ -121 │ val.point = Point(x: 100, y: 200) +101 │ val.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^^^^^^^^^^^ Point: Memory -122 │ assert val.point.x == 100 +102 │ assert val.point.x == 100 │ ^^^ Bar: Memory note: - ┌─ structs.fe:122:16 + ┌─ structs.fe:102:16 │ -122 │ assert val.point.x == 100 +102 │ assert val.point.x == 100 │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:122:16 + ┌─ structs.fe:102:16 │ -122 │ assert val.point.x == 100 +102 │ assert val.point.x == 100 │ ^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:122:16 + ┌─ structs.fe:102:16 │ -122 │ assert val.point.x == 100 +102 │ assert val.point.x == 100 │ ^^^^^^^^^^^^^^^^^^ bool: Value -123 │ assert val.point.y == 200 +103 │ assert val.point.y == 200 │ ^^^ Bar: Memory note: - ┌─ structs.fe:123:16 + ┌─ structs.fe:103:16 │ -123 │ assert val.point.y == 200 +103 │ assert val.point.y == 200 │ ^^^^^^^^^ Point: Memory note: - ┌─ structs.fe:123:16 + ┌─ structs.fe:103:16 │ -123 │ assert val.point.y == 200 +103 │ assert val.point.y == 200 │ ^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:123:16 + ┌─ structs.fe:103:16 │ -123 │ assert val.point.y == 200 +103 │ assert val.point.y == 200 │ ^^^^^^^^^^^^^^^^^^ bool: Value - · -126 │ val.something.item0 = 10 +104 │ val.something.item0 = 10 │ ^^^ Bar: Memory note: - ┌─ structs.fe:126:9 + ┌─ structs.fe:104:9 │ -126 │ val.something.item0 = 10 +104 │ val.something.item0 = 10 │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:126:9 + ┌─ structs.fe:104:9 │ -126 │ val.something.item0 = 10 +104 │ val.something.item0 = 10 │ ^^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory -127 │ val.something.item1 = false +105 │ val.something.item1 = false │ ^^^ Bar: Memory note: - ┌─ structs.fe:127:9 + ┌─ structs.fe:105:9 │ -127 │ val.something.item1 = false +105 │ val.something.item1 = false │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:127:9 + ┌─ structs.fe:105:9 │ -127 │ val.something.item1 = false +105 │ val.something.item1 = false │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Memory -128 │ assert val.something.item0 == 10 +106 │ assert val.something.item0 == 10 │ ^^^ Bar: Memory note: - ┌─ structs.fe:128:16 + ┌─ structs.fe:106:16 │ -128 │ assert val.something.item0 == 10 +106 │ assert val.something.item0 == 10 │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:128:16 + ┌─ structs.fe:106:16 │ -128 │ assert val.something.item0 == 10 +106 │ assert val.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:128:16 + ┌─ structs.fe:106:16 │ -128 │ assert val.something.item0 == 10 +106 │ assert val.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -129 │ assert not val.something.item1 +107 │ assert not val.something.item1 │ ^^^ Bar: Memory note: - ┌─ structs.fe:129:20 + ┌─ structs.fe:107:20 │ -129 │ assert not val.something.item1 +107 │ assert not val.something.item1 │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:129:20 + ┌─ structs.fe:107:20 │ -129 │ assert not val.something.item1 +107 │ assert not val.something.item1 │ ^^^^^^^^^^^^^^^^^^^ bool: Memory => Value note: - ┌─ structs.fe:129:16 + ┌─ structs.fe:107:16 │ -129 │ assert not val.something.item1 +107 │ assert not val.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -130 │ # We can set the tuple itself -131 │ val.something = (1, true) +108 │ val.something = (1, true) │ ^^^ Bar: Memory note: - ┌─ structs.fe:131:9 + ┌─ structs.fe:108:9 │ -131 │ val.something = (1, true) +108 │ val.something = (1, true) │ ^^^^^^^^^^^^^ ^ ^^^^ bool: Value │ │ │ │ │ u256: Value │ (u256, bool): Memory note: - ┌─ structs.fe:131:25 + ┌─ structs.fe:108:25 │ -131 │ val.something = (1, true) +108 │ val.something = (1, true) │ ^^^^^^^^^ (u256, bool): Memory -132 │ assert val.something.item0 == 1 +109 │ assert val.something.item0 == 1 │ ^^^ Bar: Memory note: - ┌─ structs.fe:132:16 + ┌─ structs.fe:109:16 │ -132 │ assert val.something.item0 == 1 +109 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:132:16 + ┌─ structs.fe:109:16 │ -132 │ assert val.something.item0 == 1 +109 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:132:16 + ┌─ structs.fe:109:16 │ -132 │ assert val.something.item0 == 1 +109 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -133 │ assert val.something.item1 +110 │ assert val.something.item1 │ ^^^ Bar: Memory note: - ┌─ structs.fe:133:16 + ┌─ structs.fe:110:16 │ -133 │ assert val.something.item1 +110 │ assert val.something.item1 │ ^^^^^^^^^^^^^ (u256, bool): Memory note: - ┌─ structs.fe:133:16 + ┌─ structs.fe:110:16 │ -133 │ assert val.something.item1 +110 │ assert val.something.item1 │ ^^^^^^^^^^^^^^^^^^^ bool: Memory => Value -134 │ -135 │ return val.name +111 │ return val.name │ ^^^ Bar: Memory note: - ┌─ structs.fe:135:16 + ┌─ structs.fe:111:16 │ -135 │ return val.name +111 │ return val.name │ ^^^^^^^^ String<3>: Memory note: - ┌─ structs.fe:137:5 + ┌─ structs.fe:114:5 │ -137 │ ╭ pub fn create_mixed(self) -> u256: -138 │ │ let mixed: Mixed = Mixed::new(val:1) -139 │ │ return mixed.foo - │ ╰────────────────────────^ attributes hash: 11773348765973600208 +114 │ ╭ pub fn create_mixed(self) -> u256 { +115 │ │ let mixed: Mixed = Mixed::new(val: 1) +116 │ │ return mixed.foo +117 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -1744,37 +1715,38 @@ note: } note: - ┌─ structs.fe:138:20 + ┌─ structs.fe:115:20 │ -138 │ let mixed: Mixed = Mixed::new(val:1) +115 │ let mixed: Mixed = Mixed::new(val: 1) │ ^^^^^ Mixed note: - ┌─ structs.fe:138:43 + ┌─ structs.fe:115:44 │ -138 │ let mixed: Mixed = Mixed::new(val:1) - │ ^ u256: Value +115 │ let mixed: Mixed = Mixed::new(val: 1) + │ ^ u256: Value note: - ┌─ structs.fe:138:28 + ┌─ structs.fe:115:28 │ -138 │ let mixed: Mixed = Mixed::new(val:1) - │ ^^^^^^^^^^^^^^^^^ Mixed: Memory -139 │ return mixed.foo +115 │ let mixed: Mixed = Mixed::new(val: 1) + │ ^^^^^^^^^^^^^^^^^^ Mixed: Memory +116 │ return mixed.foo │ ^^^^^ Mixed: Memory note: - ┌─ structs.fe:139:16 + ┌─ structs.fe:116:16 │ -139 │ return mixed.foo +116 │ return mixed.foo │ ^^^^^^^^^ u256: Memory => Value note: - ┌─ structs.fe:141:5 + ┌─ structs.fe:119:5 │ -141 │ ╭ pub fn set_house(self, data: House): -142 │ │ self.my_house = data - │ ╰────────────────────────────^ attributes hash: 571714015924720006 +119 │ ╭ pub fn set_house(self, data: House) { +120 │ │ self.my_house = data +121 │ │ } + │ ╰─────^ attributes hash: 571714015924720006 │ = FunctionSignature { self_decl: Some( @@ -1803,25 +1775,26 @@ note: } note: - ┌─ structs.fe:142:9 + ┌─ structs.fe:120:9 │ -142 │ self.my_house = data +120 │ self.my_house = data │ ^^^^ Foo: Value note: - ┌─ structs.fe:142:9 + ┌─ structs.fe:120:9 │ -142 │ self.my_house = data +120 │ self.my_house = data │ ^^^^^^^^^^^^^ ^^^^ House: Memory │ │ │ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:144:5 + ┌─ structs.fe:123:5 │ -144 │ ╭ pub fn get_house(self) -> House: -145 │ │ return self.my_house.to_mem() - │ ╰─────────────────────────────────────^ attributes hash: 18226871377775469920 +123 │ ╭ pub fn get_house(self) -> House { +124 │ │ return self.my_house.to_mem() +125 │ │ } + │ ╰─────^ attributes hash: 18226871377775469920 │ = FunctionSignature { self_decl: Some( @@ -1840,34 +1813,34 @@ note: } note: - ┌─ structs.fe:145:16 + ┌─ structs.fe:124:16 │ -145 │ return self.my_house.to_mem() +124 │ return self.my_house.to_mem() │ ^^^^ Foo: Value note: - ┌─ structs.fe:145:16 + ┌─ structs.fe:124:16 │ -145 │ return self.my_house.to_mem() +124 │ return self.my_house.to_mem() │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:145:16 + ┌─ structs.fe:124:16 │ -145 │ return self.my_house.to_mem() +124 │ return self.my_house.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } => Memory note: - ┌─ structs.fe:147:5 + ┌─ structs.fe:127:5 │ -147 │ ╭ pub fn create_house(self): -148 │ │ self.my_house = House( -149 │ │ price: 1, -150 │ │ size: 2, +127 │ ╭ pub fn create_house(self) { +128 │ │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) +129 │ │ assert self.my_house.price == 1 +130 │ │ assert self.my_house.size == 2 · │ -178 │ │ assert self.my_house.rooms == u8(100) -179 │ │ assert self.my_house.vacant - │ ╰───────────────────────────────────^ attributes hash: 18235041182630809162 +152 │ │ assert self.my_house.vacant +153 │ │ } + │ ╰─────^ attributes hash: 18235041182630809162 │ = FunctionSignature { self_decl: Some( @@ -1883,580 +1856,570 @@ note: } note: - ┌─ structs.fe:148:9 + ┌─ structs.fe:128:9 │ -148 │ self.my_house = House( +128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) │ ^^^^ Foo: Value note: - ┌─ structs.fe:148:9 + ┌─ structs.fe:128:9 │ -148 │ self.my_house = House( - │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } -149 │ price: 1, - │ ^ u256: Value -150 │ size: 2, - │ ^ u256: Value -151 │ rooms: u8(5), - │ ^ u8: Value +128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) + │ ^^^^^^^^^^^^^ ^ ^ ^ u8: Value + │ │ │ │ + │ │ │ u256: Value + │ │ u256: Value + │ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:151:20 + ┌─ structs.fe:128:57 │ -151 │ rooms: u8(5), - │ ^^^^^ u8: Value -152 │ vacant: false, - │ ^^^^^ bool: Value +128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) + │ ^^^^^ ^^^^^ bool: Value + │ │ + │ u8: Value note: - ┌─ structs.fe:148:25 - │ -148 │ self.my_house = House( - │ ╭─────────────────────────^ -149 │ │ price: 1, -150 │ │ size: 2, -151 │ │ rooms: u8(5), -152 │ │ vacant: false, -153 │ │ ) - │ ╰─────────^ House: Memory -154 │ assert self.my_house.price == 1 - │ ^^^^ Foo: Value + ┌─ structs.fe:128:25 + │ +128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House: Memory +129 │ assert self.my_house.price == 1 + │ ^^^^ Foo: Value note: - ┌─ structs.fe:154:16 + ┌─ structs.fe:129:16 │ -154 │ assert self.my_house.price == 1 +129 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:154:16 + ┌─ structs.fe:129:16 │ -154 │ assert self.my_house.price == 1 +129 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:154:16 + ┌─ structs.fe:129:16 │ -154 │ assert self.my_house.price == 1 +129 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -155 │ assert self.my_house.size == 2 +130 │ assert self.my_house.size == 2 │ ^^^^ Foo: Value note: - ┌─ structs.fe:155:16 + ┌─ structs.fe:130:16 │ -155 │ assert self.my_house.size == 2 +130 │ assert self.my_house.size == 2 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:155:16 + ┌─ structs.fe:130:16 │ -155 │ assert self.my_house.size == 2 +130 │ assert self.my_house.size == 2 │ ^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:155:16 + ┌─ structs.fe:130:16 │ -155 │ assert self.my_house.size == 2 +130 │ assert self.my_house.size == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -156 │ assert self.my_house.rooms == u8(5) +131 │ assert self.my_house.rooms == u8(5) │ ^^^^ Foo: Value note: - ┌─ structs.fe:156:16 + ┌─ structs.fe:131:16 │ -156 │ assert self.my_house.rooms == u8(5) +131 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:156:16 + ┌─ structs.fe:131:16 │ -156 │ assert self.my_house.rooms == u8(5) +131 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:156:39 + ┌─ structs.fe:131:39 │ -156 │ assert self.my_house.rooms == u8(5) +131 │ assert self.my_house.rooms == u8(5) │ ^^^^^ u8: Value note: - ┌─ structs.fe:156:16 + ┌─ structs.fe:131:16 │ -156 │ assert self.my_house.rooms == u8(5) +131 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -157 │ assert self.my_house.vacant == false +132 │ assert self.my_house.vacant == false │ ^^^^ Foo: Value note: - ┌─ structs.fe:157:16 + ┌─ structs.fe:132:16 │ -157 │ assert self.my_house.vacant == false +132 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:157:16 + ┌─ structs.fe:132:16 │ -157 │ assert self.my_house.vacant == false +132 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:157:16 + ┌─ structs.fe:132:16 │ -157 │ assert self.my_house.vacant == false +132 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -158 │ # We change only the size and check other fields are unchanged -159 │ self.my_house.size = 50 +133 │ self.my_house.size = 50 │ ^^^^ Foo: Value note: - ┌─ structs.fe:159:9 + ┌─ structs.fe:133:9 │ -159 │ self.my_house.size = 50 +133 │ self.my_house.size = 50 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:159:9 + ┌─ structs.fe:133:9 │ -159 │ self.my_house.size = 50 +133 │ self.my_house.size = 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } -160 │ assert self.my_house.size == 50 +134 │ assert self.my_house.size == 50 │ ^^^^ Foo: Value note: - ┌─ structs.fe:160:16 + ┌─ structs.fe:134:16 │ -160 │ assert self.my_house.size == 50 +134 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:160:16 + ┌─ structs.fe:134:16 │ -160 │ assert self.my_house.size == 50 +134 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:160:16 + ┌─ structs.fe:134:16 │ -160 │ assert self.my_house.size == 50 +134 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -161 │ assert self.my_house.price == 1 +135 │ assert self.my_house.price == 1 │ ^^^^ Foo: Value note: - ┌─ structs.fe:161:16 + ┌─ structs.fe:135:16 │ -161 │ assert self.my_house.price == 1 +135 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:161:16 + ┌─ structs.fe:135:16 │ -161 │ assert self.my_house.price == 1 +135 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:161:16 + ┌─ structs.fe:135:16 │ -161 │ assert self.my_house.price == 1 +135 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -162 │ assert self.my_house.rooms == u8(5) +136 │ assert self.my_house.rooms == u8(5) │ ^^^^ Foo: Value note: - ┌─ structs.fe:162:16 + ┌─ structs.fe:136:16 │ -162 │ assert self.my_house.rooms == u8(5) +136 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:162:16 + ┌─ structs.fe:136:16 │ -162 │ assert self.my_house.rooms == u8(5) +136 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:162:39 + ┌─ structs.fe:136:39 │ -162 │ assert self.my_house.rooms == u8(5) +136 │ assert self.my_house.rooms == u8(5) │ ^^^^^ u8: Value note: - ┌─ structs.fe:162:16 + ┌─ structs.fe:136:16 │ -162 │ assert self.my_house.rooms == u8(5) +136 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -163 │ assert self.my_house.vacant == false +137 │ assert self.my_house.vacant == false │ ^^^^ Foo: Value note: - ┌─ structs.fe:163:16 + ┌─ structs.fe:137:16 │ -163 │ assert self.my_house.vacant == false +137 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:163:16 + ┌─ structs.fe:137:16 │ -163 │ assert self.my_house.vacant == false +137 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:163:16 + ┌─ structs.fe:137:16 │ -163 │ assert self.my_house.vacant == false +137 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -164 │ # We change only the price and check other fields are unchanged -165 │ self.my_house.price = 1000 +138 │ self.my_house.price = 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:165:9 + ┌─ structs.fe:138:9 │ -165 │ self.my_house.price = 1000 +138 │ self.my_house.price = 1000 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:165:9 + ┌─ structs.fe:138:9 │ -165 │ self.my_house.price = 1000 +138 │ self.my_house.price = 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } -166 │ assert self.my_house.size == 50 +139 │ assert self.my_house.size == 50 │ ^^^^ Foo: Value note: - ┌─ structs.fe:166:16 + ┌─ structs.fe:139:16 │ -166 │ assert self.my_house.size == 50 +139 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:166:16 + ┌─ structs.fe:139:16 │ -166 │ assert self.my_house.size == 50 +139 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:166:16 + ┌─ structs.fe:139:16 │ -166 │ assert self.my_house.size == 50 +139 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -167 │ assert self.my_house.price == 1000 +140 │ assert self.my_house.price == 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:167:16 + ┌─ structs.fe:140:16 │ -167 │ assert self.my_house.price == 1000 +140 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:167:16 + ┌─ structs.fe:140:16 │ -167 │ assert self.my_house.price == 1000 +140 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:167:16 + ┌─ structs.fe:140:16 │ -167 │ assert self.my_house.price == 1000 +140 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -168 │ assert self.my_house.rooms == u8(5) +141 │ assert self.my_house.rooms == u8(5) │ ^^^^ Foo: Value note: - ┌─ structs.fe:168:16 + ┌─ structs.fe:141:16 │ -168 │ assert self.my_house.rooms == u8(5) +141 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:168:16 + ┌─ structs.fe:141:16 │ -168 │ assert self.my_house.rooms == u8(5) +141 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:168:39 + ┌─ structs.fe:141:39 │ -168 │ assert self.my_house.rooms == u8(5) +141 │ assert self.my_house.rooms == u8(5) │ ^^^^^ u8: Value note: - ┌─ structs.fe:168:16 + ┌─ structs.fe:141:16 │ -168 │ assert self.my_house.rooms == u8(5) +141 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -169 │ assert self.my_house.vacant == false +142 │ assert self.my_house.vacant == false │ ^^^^ Foo: Value note: - ┌─ structs.fe:169:16 + ┌─ structs.fe:142:16 │ -169 │ assert self.my_house.vacant == false +142 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:169:16 + ┌─ structs.fe:142:16 │ -169 │ assert self.my_house.vacant == false +142 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:169:16 + ┌─ structs.fe:142:16 │ -169 │ assert self.my_house.vacant == false +142 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -170 │ self.my_house.vacant = true +143 │ self.my_house.vacant = true │ ^^^^ Foo: Value note: - ┌─ structs.fe:170:9 + ┌─ structs.fe:143:9 │ -170 │ self.my_house.vacant = true +143 │ self.my_house.vacant = true │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:170:9 + ┌─ structs.fe:143:9 │ -170 │ self.my_house.vacant = true +143 │ self.my_house.vacant = true │ ^^^^^^^^^^^^^^^^^^^^ ^^^^ bool: Value │ │ │ bool: Storage { nonce: Some(0) } -171 │ assert self.my_house.size == 50 +144 │ assert self.my_house.size == 50 │ ^^^^ Foo: Value note: - ┌─ structs.fe:171:16 + ┌─ structs.fe:144:16 │ -171 │ assert self.my_house.size == 50 +144 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:171:16 + ┌─ structs.fe:144:16 │ -171 │ assert self.my_house.size == 50 +144 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:171:16 + ┌─ structs.fe:144:16 │ -171 │ assert self.my_house.size == 50 +144 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -172 │ assert self.my_house.price == 1000 +145 │ assert self.my_house.price == 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:172:16 + ┌─ structs.fe:145:16 │ -172 │ assert self.my_house.price == 1000 +145 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:172:16 + ┌─ structs.fe:145:16 │ -172 │ assert self.my_house.price == 1000 +145 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:172:16 + ┌─ structs.fe:145:16 │ -172 │ assert self.my_house.price == 1000 +145 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -173 │ assert self.my_house.rooms == u8(5) +146 │ assert self.my_house.rooms == u8(5) │ ^^^^ Foo: Value note: - ┌─ structs.fe:173:16 + ┌─ structs.fe:146:16 │ -173 │ assert self.my_house.rooms == u8(5) +146 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:173:16 + ┌─ structs.fe:146:16 │ -173 │ assert self.my_house.rooms == u8(5) +146 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:173:39 + ┌─ structs.fe:146:39 │ -173 │ assert self.my_house.rooms == u8(5) +146 │ assert self.my_house.rooms == u8(5) │ ^^^^^ u8: Value note: - ┌─ structs.fe:173:16 + ┌─ structs.fe:146:16 │ -173 │ assert self.my_house.rooms == u8(5) +146 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -174 │ assert self.my_house.vacant +147 │ assert self.my_house.vacant │ ^^^^ Foo: Value note: - ┌─ structs.fe:174:16 + ┌─ structs.fe:147:16 │ -174 │ assert self.my_house.vacant +147 │ assert self.my_house.vacant │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:174:16 + ┌─ structs.fe:147:16 │ -174 │ assert self.my_house.vacant +147 │ assert self.my_house.vacant │ ^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: Some(0) } => Value -175 │ self.my_house.rooms = u8(100) +148 │ self.my_house.rooms = u8(100) │ ^^^^ Foo: Value note: - ┌─ structs.fe:175:9 + ┌─ structs.fe:148:9 │ -175 │ self.my_house.rooms = u8(100) +148 │ self.my_house.rooms = u8(100) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:175:9 + ┌─ structs.fe:148:9 │ -175 │ self.my_house.rooms = u8(100) +148 │ self.my_house.rooms = u8(100) │ ^^^^^^^^^^^^^^^^^^^ ^^^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } note: - ┌─ structs.fe:175:31 + ┌─ structs.fe:148:31 │ -175 │ self.my_house.rooms = u8(100) +148 │ self.my_house.rooms = u8(100) │ ^^^^^^^ u8: Value -176 │ assert self.my_house.size == 50 +149 │ assert self.my_house.size == 50 │ ^^^^ Foo: Value note: - ┌─ structs.fe:176:16 + ┌─ structs.fe:149:16 │ -176 │ assert self.my_house.size == 50 +149 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:176:16 + ┌─ structs.fe:149:16 │ -176 │ assert self.my_house.size == 50 +149 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:176:16 + ┌─ structs.fe:149:16 │ -176 │ assert self.my_house.size == 50 +149 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -177 │ assert self.my_house.price == 1000 +150 │ assert self.my_house.price == 1000 │ ^^^^ Foo: Value note: - ┌─ structs.fe:177:16 + ┌─ structs.fe:150:16 │ -177 │ assert self.my_house.price == 1000 +150 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:177:16 + ┌─ structs.fe:150:16 │ -177 │ assert self.my_house.price == 1000 +150 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:177:16 + ┌─ structs.fe:150:16 │ -177 │ assert self.my_house.price == 1000 +150 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -178 │ assert self.my_house.rooms == u8(100) +151 │ assert self.my_house.rooms == u8(100) │ ^^^^ Foo: Value note: - ┌─ structs.fe:178:16 + ┌─ structs.fe:151:16 │ -178 │ assert self.my_house.rooms == u8(100) +151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:178:16 + ┌─ structs.fe:151:16 │ -178 │ assert self.my_house.rooms == u8(100) +151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^^^^^^^^^^^^^ ^^^ u8: Value │ │ │ u8: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:178:39 + ┌─ structs.fe:151:39 │ -178 │ assert self.my_house.rooms == u8(100) +151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^ u8: Value note: - ┌─ structs.fe:178:16 + ┌─ structs.fe:151:16 │ -178 │ assert self.my_house.rooms == u8(100) +151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -179 │ assert self.my_house.vacant +152 │ assert self.my_house.vacant │ ^^^^ Foo: Value note: - ┌─ structs.fe:179:16 + ┌─ structs.fe:152:16 │ -179 │ assert self.my_house.vacant +152 │ assert self.my_house.vacant │ ^^^^^^^^^^^^^ House: Storage { nonce: Some(0) } note: - ┌─ structs.fe:179:16 + ┌─ structs.fe:152:16 │ -179 │ assert self.my_house.vacant +152 │ assert self.my_house.vacant │ ^^^^^^^^^^^^^^^^^^^^ bool: Storage { nonce: Some(0) } => Value note: - ┌─ structs.fe:181:5 + ┌─ structs.fe:155:5 │ -181 │ ╭ pub fn bar() -> u256: -182 │ │ let building: House = House( -183 │ │ price: 300, -184 │ │ size: 500, +155 │ ╭ pub fn bar() -> u256 { +156 │ │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) +157 │ │ assert building.size == 500 +158 │ │ assert building.price == 300 · │ -206 │ │ -207 │ │ return building.size - │ ╰────────────────────────────^ attributes hash: 6115314201970082834 +172 │ │ return building.size +173 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -2472,282 +2435,268 @@ note: } note: - ┌─ structs.fe:182:23 + ┌─ structs.fe:156:23 │ -182 │ let building: House = House( +156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) │ ^^^^^ House note: - ┌─ structs.fe:183:20 + ┌─ structs.fe:156:44 │ -183 │ price: 300, - │ ^^^ u256: Value -184 │ size: 500, - │ ^^^ u256: Value -185 │ rooms: u8(20), - │ ^^ u8: Value +156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^ ^^^ ^^ u8: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ structs.fe:185:20 + ┌─ structs.fe:156:67 │ -185 │ rooms: u8(20), - │ ^^^^^^ u8: Value -186 │ vacant: true, - │ ^^^^ bool: Value +156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^ ^^^^ bool: Value + │ │ + │ u8: Value note: - ┌─ structs.fe:182:31 - │ -182 │ let building: House = House( - │ ╭───────────────────────────────^ -183 │ │ price: 300, -184 │ │ size: 500, -185 │ │ rooms: u8(20), -186 │ │ vacant: true, -187 │ │ ) - │ ╰─────────^ House: Memory -188 │ assert building.size == 500 - │ ^^^^^^^^ House: Memory + ┌─ structs.fe:156:31 + │ +156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House: Memory +157 │ assert building.size == 500 + │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:188:16 + ┌─ structs.fe:157:16 │ -188 │ assert building.size == 500 +157 │ assert building.size == 500 │ ^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:188:16 + ┌─ structs.fe:157:16 │ -188 │ assert building.size == 500 +157 │ assert building.size == 500 │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -189 │ assert building.price == 300 +158 │ assert building.price == 300 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:189:16 + ┌─ structs.fe:158:16 │ -189 │ assert building.price == 300 +158 │ assert building.price == 300 │ ^^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:189:16 + ┌─ structs.fe:158:16 │ -189 │ assert building.price == 300 +158 │ assert building.price == 300 │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value -190 │ assert building.rooms == u8(20) +159 │ assert building.rooms == u8(20) │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:190:16 + ┌─ structs.fe:159:16 │ -190 │ assert building.rooms == u8(20) +159 │ assert building.rooms == u8(20) │ ^^^^^^^^^^^^^^ ^^ u8: Value │ │ │ u8: Memory => Value note: - ┌─ structs.fe:190:34 + ┌─ structs.fe:159:34 │ -190 │ assert building.rooms == u8(20) +159 │ assert building.rooms == u8(20) │ ^^^^^^ u8: Value note: - ┌─ structs.fe:190:16 + ┌─ structs.fe:159:16 │ -190 │ assert building.rooms == u8(20) +159 │ assert building.rooms == u8(20) │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -191 │ assert building.vacant +160 │ assert building.vacant │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:191:16 + ┌─ structs.fe:160:16 │ -191 │ assert building.vacant +160 │ assert building.vacant │ ^^^^^^^^^^^^^^^ bool: Memory => Value -192 │ -193 │ building.vacant = false +161 │ building.vacant = false │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:193:9 + ┌─ structs.fe:161:9 │ -193 │ building.vacant = false +161 │ building.vacant = false │ ^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Memory -194 │ building.price = 1 +162 │ building.price = 1 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:194:9 + ┌─ structs.fe:162:9 │ -194 │ building.price = 1 +162 │ building.price = 1 │ ^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -195 │ building.size = 2 +163 │ building.size = 2 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:195:9 + ┌─ structs.fe:163:9 │ -195 │ building.size = 2 +163 │ building.size = 2 │ ^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory -196 │ building.rooms = u8(10) +164 │ building.rooms = u8(10) │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:196:9 + ┌─ structs.fe:164:9 │ -196 │ building.rooms = u8(10) +164 │ building.rooms = u8(10) │ ^^^^^^^^^^^^^^ ^^ u8: Value │ │ │ u8: Memory note: - ┌─ structs.fe:196:26 + ┌─ structs.fe:164:26 │ -196 │ building.rooms = u8(10) +164 │ building.rooms = u8(10) │ ^^^^^^ u8: Value -197 │ -198 │ assert building.vacant == false +165 │ assert building.vacant == false │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:198:16 + ┌─ structs.fe:165:16 │ -198 │ assert building.vacant == false +165 │ assert building.vacant == false │ ^^^^^^^^^^^^^^^ ^^^^^ bool: Value │ │ │ bool: Memory => Value note: - ┌─ structs.fe:198:16 + ┌─ structs.fe:165:16 │ -198 │ assert building.vacant == false +165 │ assert building.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -199 │ assert building.price == 1 +166 │ assert building.price == 1 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:199:16 + ┌─ structs.fe:166:16 │ -199 │ assert building.price == 1 +166 │ assert building.price == 1 │ ^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:199:16 + ┌─ structs.fe:166:16 │ -199 │ assert building.price == 1 +166 │ assert building.price == 1 │ ^^^^^^^^^^^^^^^^^^^ bool: Value -200 │ assert building.size == 2 +167 │ assert building.size == 2 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:200:16 + ┌─ structs.fe:167:16 │ -200 │ assert building.size == 2 +167 │ assert building.size == 2 │ ^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:200:16 + ┌─ structs.fe:167:16 │ -200 │ assert building.size == 2 +167 │ assert building.size == 2 │ ^^^^^^^^^^^^^^^^^^ bool: Value -201 │ assert building.rooms == u8(10) +168 │ assert building.rooms == u8(10) │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:201:16 + ┌─ structs.fe:168:16 │ -201 │ assert building.rooms == u8(10) +168 │ assert building.rooms == u8(10) │ ^^^^^^^^^^^^^^ ^^ u8: Value │ │ │ u8: Memory => Value note: - ┌─ structs.fe:201:34 + ┌─ structs.fe:168:34 │ -201 │ assert building.rooms == u8(10) +168 │ assert building.rooms == u8(10) │ ^^^^^^ u8: Value note: - ┌─ structs.fe:201:16 + ┌─ structs.fe:168:16 │ -201 │ assert building.rooms == u8(10) +168 │ assert building.rooms == u8(10) │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -202 │ -203 │ building.expand() +169 │ building.expand() │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:203:9 + ┌─ structs.fe:169:9 │ -203 │ building.expand() +169 │ building.expand() │ ^^^^^^^^^^^^^^^^^ (): Value -204 │ assert building.size == 102 +170 │ assert building.size == 102 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:204:16 + ┌─ structs.fe:170:16 │ -204 │ assert building.size == 102 +170 │ assert building.size == 102 │ ^^^^^^^^^^^^^ ^^^ u256: Value │ │ │ u256: Memory => Value note: - ┌─ structs.fe:204:16 + ┌─ structs.fe:170:16 │ -204 │ assert building.size == 102 +170 │ assert building.size == 102 │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -205 │ assert building.rooms == 11 +171 │ assert building.rooms == 11 │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:205:16 + ┌─ structs.fe:171:16 │ -205 │ assert building.rooms == 11 +171 │ assert building.rooms == 11 │ ^^^^^^^^^^^^^^ ^^ u8: Value │ │ │ u8: Memory => Value note: - ┌─ structs.fe:205:16 + ┌─ structs.fe:171:16 │ -205 │ assert building.rooms == 11 +171 │ assert building.rooms == 11 │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -206 │ -207 │ return building.size +172 │ return building.size │ ^^^^^^^^ House: Memory note: - ┌─ structs.fe:207:16 + ┌─ structs.fe:172:16 │ -207 │ return building.size +172 │ return building.size │ ^^^^^^^^^^^^^ u256: Memory => Value note: - ┌─ structs.fe:209:5 + ┌─ structs.fe:175:5 │ -209 │ ╭ pub fn encode_house() -> Array: -210 │ │ let house: House = House( -211 │ │ price: 300, -212 │ │ size: 500, - · │ -215 │ │ ) -216 │ │ return house.encode() - │ ╰─────────────────────────────^ attributes hash: 9174136327042912890 +175 │ ╭ pub fn encode_house() -> Array { +176 │ │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) +177 │ │ return house.encode() +178 │ │ } + │ ╰─────^ attributes hash: 9174136327042912890 │ = FunctionSignature { self_decl: None, @@ -2766,60 +2715,50 @@ note: } note: - ┌─ structs.fe:210:20 + ┌─ structs.fe:176:20 │ -210 │ let house: House = House( +176 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) │ ^^^^^ House note: - ┌─ structs.fe:211:20 + ┌─ structs.fe:176:41 │ -211 │ price: 300, - │ ^^^ u256: Value -212 │ size: 500, - │ ^^^ u256: Value -213 │ rooms: u8(20), - │ ^^ u8: Value +176 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^ ^^^ ^^ u8: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ structs.fe:213:20 + ┌─ structs.fe:176:64 │ -213 │ rooms: u8(20), - │ ^^^^^^ u8: Value -214 │ vacant: true, - │ ^^^^ bool: Value +176 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^ ^^^^ bool: Value + │ │ + │ u8: Value note: - ┌─ structs.fe:210:28 - │ -210 │ let house: House = House( - │ ╭────────────────────────────^ -211 │ │ price: 300, -212 │ │ size: 500, -213 │ │ rooms: u8(20), -214 │ │ vacant: true, -215 │ │ ) - │ ╰─────────^ House: Memory -216 │ return house.encode() - │ ^^^^^ House: Memory + ┌─ structs.fe:176:28 + │ +176 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House: Memory +177 │ return house.encode() + │ ^^^^^ House: Memory note: - ┌─ structs.fe:216:16 + ┌─ structs.fe:177:16 │ -216 │ return house.encode() +177 │ return house.encode() │ ^^^^^^^^^^^^^^ Array: Memory note: - ┌─ structs.fe:218:5 + ┌─ structs.fe:180:5 │ -218 │ ╭ pub fn hashed_house() -> u256: -219 │ │ let house: House = House( -220 │ │ price: 300, -221 │ │ size: 500, - · │ -224 │ │ ) -225 │ │ return house.hash() - │ ╰───────────────────────────^ attributes hash: 6115314201970082834 +180 │ ╭ pub fn hashed_house() -> u256 { +181 │ │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) +182 │ │ return house.hash() +183 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -2835,47 +2774,40 @@ note: } note: - ┌─ structs.fe:219:20 + ┌─ structs.fe:181:20 │ -219 │ let house: House = House( +181 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) │ ^^^^^ House note: - ┌─ structs.fe:220:20 + ┌─ structs.fe:181:41 │ -220 │ price: 300, - │ ^^^ u256: Value -221 │ size: 500, - │ ^^^ u256: Value -222 │ rooms: u8(20), - │ ^^ u8: Value +181 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^ ^^^ ^^ u8: Value + │ │ │ + │ │ u256: Value + │ u256: Value note: - ┌─ structs.fe:222:20 + ┌─ structs.fe:181:64 │ -222 │ rooms: u8(20), - │ ^^^^^^ u8: Value -223 │ vacant: true, - │ ^^^^ bool: Value +181 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^ ^^^^ bool: Value + │ │ + │ u8: Value note: - ┌─ structs.fe:219:28 - │ -219 │ let house: House = House( - │ ╭────────────────────────────^ -220 │ │ price: 300, -221 │ │ size: 500, -222 │ │ rooms: u8(20), -223 │ │ vacant: true, -224 │ │ ) - │ ╰─────────^ House: Memory -225 │ return house.hash() - │ ^^^^^ House: Memory + ┌─ structs.fe:181:28 + │ +181 │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House: Memory +182 │ return house.hash() + │ ^^^^^ House: Memory note: - ┌─ structs.fe:225:16 + ┌─ structs.fe:182:16 │ -225 │ return house.hash() +182 │ return house.hash() │ ^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap index 5fe012325b..4b44929786 100644 --- a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap +++ b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap @@ -4,11 +4,12 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ ternary_expression.fe:3:5 + ┌─ ternary_expression.fe:2:5 │ -3 │ ╭ pub fn bar(input: u256) -> u256: -4 │ │ return 1 if input > 5 else 0 - │ ╰────────────────────────────────────^ attributes hash: 10660199954095577886 +2 │ ╭ pub fn bar(input: u256) -> u256 { +3 │ │ return 1 if input > 5 else 0 +4 │ │ } + │ ╰─────^ attributes hash: 10660199954095577886 │ = FunctionSignature { self_decl: None, @@ -36,26 +37,26 @@ note: } note: - ┌─ ternary_expression.fe:4:21 + ┌─ ternary_expression.fe:3:21 │ -4 │ return 1 if input > 5 else 0 +3 │ return 1 if input > 5 else 0 │ ^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ ternary_expression.fe:4:16 + ┌─ ternary_expression.fe:3:16 │ -4 │ return 1 if input > 5 else 0 +3 │ return 1 if input > 5 else 0 │ ^ ^^^^^^^^^ ^ u256: Value │ │ │ │ │ bool: Value │ u256: Value note: - ┌─ ternary_expression.fe:4:16 + ┌─ ternary_expression.fe:3:16 │ -4 │ return 1 if input > 5 else 0 +3 │ return 1 if input > 5 else 0 │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap index 23d28b5748..aed5bda90e 100644 --- a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap @@ -16,15 +16,12 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, bool, address) note: - ┌─ tuple_stress.fe:9:5 + ┌─ tuple_stress.fe:10:5 │ - 9 │ ╭ pub fn build_my_tuple( -10 │ │ my_num: u256, -11 │ │ my_bool: bool, -12 │ │ my_address: address -13 │ │ ) -> (u256, bool, address): -14 │ │ return (my_num, my_bool, my_address) - │ ╰────────────────────────────────────────────^ attributes hash: 10223738621782129186 +10 │ ╭ pub fn build_my_tuple(my_num: u256, my_bool: bool, my_address: address) -> (u256, bool, address) { +11 │ │ return (my_num, my_bool, my_address) +12 │ │ } + │ ╰─────^ attributes hash: 10223738621782129186 │ = FunctionSignature { self_decl: None, @@ -82,26 +79,27 @@ note: } note: - ┌─ tuple_stress.fe:14:17 + ┌─ tuple_stress.fe:11:17 │ -14 │ return (my_num, my_bool, my_address) +11 │ return (my_num, my_bool, my_address) │ ^^^^^^ ^^^^^^^ ^^^^^^^^^^ address: Value │ │ │ │ │ bool: Value │ u256: Value note: - ┌─ tuple_stress.fe:14:16 + ┌─ tuple_stress.fe:11:16 │ -14 │ return (my_num, my_bool, my_address) +11 │ return (my_num, my_bool, my_address) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, bool, address): Memory note: - ┌─ tuple_stress.fe:16:5 + ┌─ tuple_stress.fe:14:5 │ -16 │ ╭ pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256: -17 │ │ return my_tuple.item0 - │ ╰─────────────────────────────^ attributes hash: 1005385906871296536 +14 │ ╭ pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256 { +15 │ │ return my_tuple.item0 +16 │ │ } + │ ╰─────^ attributes hash: 1005385906871296536 │ = FunctionSignature { self_decl: None, @@ -141,23 +139,24 @@ note: } note: - ┌─ tuple_stress.fe:17:16 + ┌─ tuple_stress.fe:15:16 │ -17 │ return my_tuple.item0 +15 │ return my_tuple.item0 │ ^^^^^^^^ (u256, bool, address): Memory note: - ┌─ tuple_stress.fe:17:16 + ┌─ tuple_stress.fe:15:16 │ -17 │ return my_tuple.item0 +15 │ return my_tuple.item0 │ ^^^^^^^^^^^^^^ u256: Memory => Value note: - ┌─ tuple_stress.fe:19:5 + ┌─ tuple_stress.fe:18:5 │ -19 │ ╭ pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool: -20 │ │ return my_tuple.item1 - │ ╰─────────────────────────────^ attributes hash: 5615774585289781220 +18 │ ╭ pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool { +19 │ │ return my_tuple.item1 +20 │ │ } + │ ╰─────^ attributes hash: 5615774585289781220 │ = FunctionSignature { self_decl: None, @@ -195,23 +194,24 @@ note: } note: - ┌─ tuple_stress.fe:20:16 + ┌─ tuple_stress.fe:19:16 │ -20 │ return my_tuple.item1 +19 │ return my_tuple.item1 │ ^^^^^^^^ (u256, bool, address): Memory note: - ┌─ tuple_stress.fe:20:16 + ┌─ tuple_stress.fe:19:16 │ -20 │ return my_tuple.item1 +19 │ return my_tuple.item1 │ ^^^^^^^^^^^^^^ bool: Memory => Value note: ┌─ tuple_stress.fe:22:5 │ -22 │ ╭ pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address: +22 │ ╭ pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address { 23 │ │ return my_tuple.item2 - │ ╰─────────────────────────────^ attributes hash: 13024428391414866682 +24 │ │ } + │ ╰─────^ attributes hash: 13024428391414866682 │ = FunctionSignature { self_decl: None, @@ -261,11 +261,12 @@ note: │ ^^^^^^^^^^^^^^ address: Memory => Value note: - ┌─ tuple_stress.fe:25:5 + ┌─ tuple_stress.fe:26:5 │ -25 │ ╭ pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address: -26 │ │ return my_tuple.item10 - │ ╰──────────────────────────────^ attributes hash: 11830390438544540912 +26 │ ╭ pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address { +27 │ │ return my_tuple.item10 +28 │ │ } + │ ╰─────^ attributes hash: 11830390438544540912 │ = FunctionSignature { self_decl: None, @@ -345,23 +346,24 @@ note: } note: - ┌─ tuple_stress.fe:26:16 + ┌─ tuple_stress.fe:27:16 │ -26 │ return my_tuple.item10 +27 │ return my_tuple.item10 │ ^^^^^^^^ (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address): Memory note: - ┌─ tuple_stress.fe:26:16 + ┌─ tuple_stress.fe:27:16 │ -26 │ return my_tuple.item10 +27 │ return my_tuple.item10 │ ^^^^^^^^^^^^^^^ address: Memory => Value note: - ┌─ tuple_stress.fe:28:5 + ┌─ tuple_stress.fe:30:5 │ -28 │ ╭ pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)): -29 │ │ emit MyEvent(ctx, my_tuple) - │ ╰───────────────────────────────────^ attributes hash: 10535390144430265813 +30 │ ╭ pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)) { +31 │ │ emit MyEvent(ctx, my_tuple) +32 │ │ } + │ ╰─────^ attributes hash: 10535390144430265813 │ = FunctionSignature { self_decl: None, @@ -413,17 +415,17 @@ note: } note: - ┌─ tuple_stress.fe:29:22 + ┌─ tuple_stress.fe:31:22 │ -29 │ emit MyEvent(ctx, my_tuple) +31 │ emit MyEvent(ctx, my_tuple) │ ^^^ ^^^^^^^^ (u256, bool, address): Memory │ │ │ Context: Memory note: - ┌─ tuple_stress.fe:29:9 + ┌─ tuple_stress.fe:31:9 │ -29 │ emit MyEvent(ctx, my_tuple) +31 │ emit MyEvent(ctx, my_tuple) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 12913536175581177750 │ = Event { @@ -456,12 +458,13 @@ note: } note: - ┌─ tuple_stress.fe:31:5 + ┌─ tuple_stress.fe:34:5 │ -31 │ ╭ pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32): -32 │ │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) -33 │ │ self.my_sto_tuple = (my_u256, my_i32) - │ ╰─────────────────────────────────────────────^ attributes hash: 14404502892103280650 +34 │ ╭ pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32) { +35 │ │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +36 │ │ self.my_sto_tuple = (my_u256, my_i32) +37 │ │ } + │ ╰─────^ attributes hash: 14404502892103280650 │ = FunctionSignature { self_decl: Some( @@ -500,94 +503,95 @@ note: } note: - ┌─ tuple_stress.fe:32:16 + ┌─ tuple_stress.fe:35:16 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^ Foo: Value note: - ┌─ tuple_stress.fe:32:16 + ┌─ tuple_stress.fe:35:16 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:32:16 + ┌─ tuple_stress.fe:35:16 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ tuple_stress.fe:32:43 + ┌─ tuple_stress.fe:35:43 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^ u256: Value note: - ┌─ tuple_stress.fe:32:16 + ┌─ tuple_stress.fe:35:16 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo: Value │ │ │ bool: Value note: - ┌─ tuple_stress.fe:32:55 + ┌─ tuple_stress.fe:35:55 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:32:55 + ┌─ tuple_stress.fe:35:55 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^ i32: Value │ │ │ i32: Storage { nonce: Some(0) } => Value note: - ┌─ tuple_stress.fe:32:82 + ┌─ tuple_stress.fe:35:82 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^ i32: Value note: - ┌─ tuple_stress.fe:32:55 + ┌─ tuple_stress.fe:35:55 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ tuple_stress.fe:32:16 + ┌─ tuple_stress.fe:35:16 │ -32 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) +35 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -33 │ self.my_sto_tuple = (my_u256, my_i32) +36 │ self.my_sto_tuple = (my_u256, my_i32) │ ^^^^ Foo: Value note: - ┌─ tuple_stress.fe:33:9 + ┌─ tuple_stress.fe:36:9 │ -33 │ self.my_sto_tuple = (my_u256, my_i32) +36 │ self.my_sto_tuple = (my_u256, my_i32) │ ^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^ i32: Value │ │ │ │ │ u256: Value │ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:33:29 + ┌─ tuple_stress.fe:36:29 │ -33 │ self.my_sto_tuple = (my_u256, my_i32) +36 │ self.my_sto_tuple = (my_u256, my_i32) │ ^^^^^^^^^^^^^^^^^ (u256, i32): Memory note: - ┌─ tuple_stress.fe:35:5 + ┌─ tuple_stress.fe:39:5 │ -35 │ ╭ pub fn get_my_sto_tuple(self) -> (u256, i32): -36 │ │ return self.my_sto_tuple.to_mem() - │ ╰─────────────────────────────────────────^ attributes hash: 6833980121040096883 +39 │ ╭ pub fn get_my_sto_tuple(self) -> (u256, i32) { +40 │ │ return self.my_sto_tuple.to_mem() +41 │ │ } + │ ╰─────^ attributes hash: 6833980121040096883 │ = FunctionSignature { self_decl: Some( @@ -616,34 +620,32 @@ note: } note: - ┌─ tuple_stress.fe:36:16 + ┌─ tuple_stress.fe:40:16 │ -36 │ return self.my_sto_tuple.to_mem() +40 │ return self.my_sto_tuple.to_mem() │ ^^^^ Foo: Value note: - ┌─ tuple_stress.fe:36:16 + ┌─ tuple_stress.fe:40:16 │ -36 │ return self.my_sto_tuple.to_mem() +40 │ return self.my_sto_tuple.to_mem() │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:36:16 + ┌─ tuple_stress.fe:40:16 │ -36 │ return self.my_sto_tuple.to_mem() +40 │ return self.my_sto_tuple.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } => Memory note: - ┌─ tuple_stress.fe:38:5 + ┌─ tuple_stress.fe:43:5 │ -38 │ ╭ pub fn build_tuple_and_emit(self, ctx: Context): -39 │ │ let my_num: u256 = self.my_sto_tuple.item0 -40 │ │ let my_tuple: (u256, bool, address) = ( -41 │ │ self.my_sto_tuple.item0, - · │ -44 │ │ ) -45 │ │ emit_my_event(ctx, my_tuple) - │ ╰────────────────────────────────────^ attributes hash: 1731341862738941170 +43 │ ╭ pub fn build_tuple_and_emit(self, ctx: Context) { +44 │ │ let my_num: u256 = self.my_sto_tuple.item0 +45 │ │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) +46 │ │ emit_my_event(ctx, my_tuple) +47 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -674,91 +676,85 @@ note: } note: - ┌─ tuple_stress.fe:39:21 + ┌─ tuple_stress.fe:44:21 │ -39 │ let my_num: u256 = self.my_sto_tuple.item0 +44 │ let my_num: u256 = self.my_sto_tuple.item0 │ ^^^^ u256 -40 │ let my_tuple: (u256, bool, address) = ( +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) │ ^^^^^^^^^^^^^^^^^^^^^ (u256, bool, address) note: - ┌─ tuple_stress.fe:39:28 + ┌─ tuple_stress.fe:44:28 │ -39 │ let my_num: u256 = self.my_sto_tuple.item0 +44 │ let my_num: u256 = self.my_sto_tuple.item0 │ ^^^^ Foo: Value note: - ┌─ tuple_stress.fe:39:28 + ┌─ tuple_stress.fe:44:28 │ -39 │ let my_num: u256 = self.my_sto_tuple.item0 +44 │ let my_num: u256 = self.my_sto_tuple.item0 │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:39:28 + ┌─ tuple_stress.fe:44:28 │ -39 │ let my_num: u256 = self.my_sto_tuple.item0 +44 │ let my_num: u256 = self.my_sto_tuple.item0 │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value -40 │ let my_tuple: (u256, bool, address) = ( -41 │ self.my_sto_tuple.item0, - │ ^^^^ Foo: Value +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^ Foo: Value note: - ┌─ tuple_stress.fe:41:13 + ┌─ tuple_stress.fe:45:48 │ -41 │ self.my_sto_tuple.item0, - │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^^^^^^^^^^^^^^ (u256, i32): Storage { nonce: Some(0) } note: - ┌─ tuple_stress.fe:41:13 + ┌─ tuple_stress.fe:45:48 │ -41 │ self.my_sto_tuple.item0, - │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(0) } => Value -42 │ true and false, - │ ^^^^ ^^^^^ bool: Value - │ │ - │ bool: Value +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ^^^^^ bool: Value + │ │ │ + │ │ bool: Value + │ u256: Storage { nonce: Some(0) } => Value note: - ┌─ tuple_stress.fe:42:13 + ┌─ tuple_stress.fe:45:73 │ -42 │ true and false, - │ ^^^^^^^^^^^^^^ bool: Value -43 │ address(26) - │ ^^ u256: Value +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^^^^^^^^^^^ ^^ u256: Value + │ │ + │ bool: Value note: - ┌─ tuple_stress.fe:43:13 + ┌─ tuple_stress.fe:45:89 │ -43 │ address(26) - │ ^^^^^^^^^^^ address: Value +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^^^^^^^^ address: Value note: - ┌─ tuple_stress.fe:40:47 - │ -40 │ let my_tuple: (u256, bool, address) = ( - │ ╭───────────────────────────────────────────────^ -41 │ │ self.my_sto_tuple.item0, -42 │ │ true and false, -43 │ │ address(26) -44 │ │ ) - │ ╰─────────^ (u256, bool, address): Memory -45 │ emit_my_event(ctx, my_tuple) - │ ^^^ ^^^^^^^^ (u256, bool, address): Memory - │ │ - │ Context: Memory - -note: - ┌─ tuple_stress.fe:45:9 - │ -45 │ emit_my_event(ctx, my_tuple) + ┌─ tuple_stress.fe:45:47 + │ +45 │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, bool, address): Memory +46 │ emit_my_event(ctx, my_tuple) + │ ^^^ ^^^^^^^^ (u256, bool, address): Memory + │ │ + │ Context: Memory + +note: + ┌─ tuple_stress.fe:46:9 + │ +46 │ emit_my_event(ctx, my_tuple) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value note: - ┌─ tuple_stress.fe:47:5 + ┌─ tuple_stress.fe:49:5 │ -47 │ ╭ pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array: -48 │ │ return my_tuple.abi_encode() - │ ╰────────────────────────────────────^ attributes hash: 3539305055628398466 +49 │ ╭ pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array { +50 │ │ return my_tuple.abi_encode() +51 │ │ } + │ ╰─────^ attributes hash: 3539305055628398466 │ = FunctionSignature { self_decl: None, @@ -801,15 +797,15 @@ note: } note: - ┌─ tuple_stress.fe:48:16 + ┌─ tuple_stress.fe:50:16 │ -48 │ return my_tuple.abi_encode() +50 │ return my_tuple.abi_encode() │ ^^^^^^^^ (u256, bool, address): Memory note: - ┌─ tuple_stress.fe:48:16 + ┌─ tuple_stress.fe:50:16 │ -48 │ return my_tuple.abi_encode() +50 │ return my_tuple.abi_encode() │ ^^^^^^^^^^^^^^^^^^^^^ Array: Memory diff --git a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap index 47d205afe3..eb5476cbcd 100644 --- a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap +++ b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap @@ -10,12 +10,13 @@ note: │ ^^^^^^^^^^ Bar note: - ┌─ two_contracts.fe:9:5 + ┌─ two_contracts.fe:10:5 │ - 9 │ ╭ pub fn foo(self, ctx: Context) -> u256: -10 │ │ self.other.set_foo_addr(ctx.self_address()) -11 │ │ return self.other.answer() - │ ╰──────────────────────────────────^ attributes hash: 3247318976601732237 +10 │ ╭ pub fn foo(self, ctx: Context) -> u256 { +11 │ │ self.other.set_foo_addr(ctx.self_address()) +12 │ │ return self.other.answer() +13 │ │ } + │ ╰─────^ attributes hash: 3247318976601732237 │ = FunctionSignature { self_decl: Some( @@ -48,51 +49,52 @@ note: } note: - ┌─ two_contracts.fe:10:9 + ┌─ two_contracts.fe:11:9 │ -10 │ self.other.set_foo_addr(ctx.self_address()) +11 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^ Foo: Value note: - ┌─ two_contracts.fe:10:9 + ┌─ two_contracts.fe:11:9 │ -10 │ self.other.set_foo_addr(ctx.self_address()) +11 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^^^^^^^ ^^^ Context: Memory │ │ │ Bar: Storage { nonce: Some(0) } => Value note: - ┌─ two_contracts.fe:10:33 + ┌─ two_contracts.fe:11:33 │ -10 │ self.other.set_foo_addr(ctx.self_address()) +11 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ two_contracts.fe:10:9 + ┌─ two_contracts.fe:11:9 │ -10 │ self.other.set_foo_addr(ctx.self_address()) +11 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -11 │ return self.other.answer() +12 │ return self.other.answer() │ ^^^^ Foo: Value note: - ┌─ two_contracts.fe:11:16 + ┌─ two_contracts.fe:12:16 │ -11 │ return self.other.answer() +12 │ return self.other.answer() │ ^^^^^^^^^^ Bar: Storage { nonce: Some(0) } => Value note: - ┌─ two_contracts.fe:11:16 + ┌─ two_contracts.fe:12:16 │ -11 │ return self.other.answer() +12 │ return self.other.answer() │ ^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ two_contracts.fe:13:5 + ┌─ two_contracts.fe:15:5 │ -13 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256: -14 │ │ return x + y - │ ╰────────────────────^ attributes hash: 4448606202021980030 +15 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256 { +16 │ │ return x + y +17 │ │ } + │ ╰─────^ attributes hash: 4448606202021980030 │ = FunctionSignature { self_decl: None, @@ -135,31 +137,32 @@ note: } note: - ┌─ two_contracts.fe:14:16 + ┌─ two_contracts.fe:16:16 │ -14 │ return x + y +16 │ return x + y │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ two_contracts.fe:14:16 + ┌─ two_contracts.fe:16:16 │ -14 │ return x + y +16 │ return x + y │ ^^^^^ u256: Value note: - ┌─ two_contracts.fe:17:5 + ┌─ two_contracts.fe:21:5 │ -17 │ other: Foo +21 │ other: Foo │ ^^^^^^^^^^ Foo note: - ┌─ two_contracts.fe:19:5 + ┌─ two_contracts.fe:23:5 │ -19 │ ╭ pub fn set_foo_addr(self, ctx: Context, _ addr: address): -20 │ │ self.other = Foo(ctx, addr) - │ ╰───────────────────────────────────^ attributes hash: 736575608159807992 +23 │ ╭ pub fn set_foo_addr(self, ctx: Context, _ addr: address) { +24 │ │ self.other = Foo(ctx, addr) +25 │ │ } + │ ╰─────^ attributes hash: 736575608159807992 │ = FunctionSignature { self_decl: Some( @@ -201,32 +204,33 @@ note: } note: - ┌─ two_contracts.fe:20:9 + ┌─ two_contracts.fe:24:9 │ -20 │ self.other = Foo(ctx, addr) +24 │ self.other = Foo(ctx, addr) │ ^^^^ Bar: Value note: - ┌─ two_contracts.fe:20:9 + ┌─ two_contracts.fe:24:9 │ -20 │ self.other = Foo(ctx, addr) +24 │ self.other = Foo(ctx, addr) │ ^^^^^^^^^^ ^^^ ^^^^ address: Value │ │ │ │ │ Context: Memory │ Foo: Storage { nonce: Some(0) } note: - ┌─ two_contracts.fe:20:22 + ┌─ two_contracts.fe:24:22 │ -20 │ self.other = Foo(ctx, addr) +24 │ self.other = Foo(ctx, addr) │ ^^^^^^^^^^^^^^ Foo: Value note: - ┌─ two_contracts.fe:22:5 + ┌─ two_contracts.fe:27:5 │ -22 │ ╭ pub fn answer(self) -> u256: -23 │ │ return self.other.add(20, 22) - │ ╰─────────────────────────────────────^ attributes hash: 11773348765973600208 +27 │ ╭ pub fn answer(self) -> u256 { +28 │ │ return self.other.add(20, 22) +29 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -244,24 +248,24 @@ note: } note: - ┌─ two_contracts.fe:23:16 + ┌─ two_contracts.fe:28:16 │ -23 │ return self.other.add(20, 22) +28 │ return self.other.add(20, 22) │ ^^^^ Bar: Value note: - ┌─ two_contracts.fe:23:16 + ┌─ two_contracts.fe:28:16 │ -23 │ return self.other.add(20, 22) +28 │ return self.other.add(20, 22) │ ^^^^^^^^^^ ^^ ^^ u256: Value │ │ │ │ │ u256: Value │ Foo: Storage { nonce: Some(0) } => Value note: - ┌─ two_contracts.fe:23:16 + ┌─ two_contracts.fe:28:16 │ -23 │ return self.other.add(20, 22) +28 │ return self.other.add(20, 22) │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap index 9cc8423219..b3aca71cfc 100644 --- a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap +++ b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap @@ -10,61 +10,61 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> note: - ┌─ type_aliases.fe:4:1 + ┌─ type_aliases.fe:5:1 │ -4 │ type Scoreboard = Map +5 │ type Scoreboard = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:5:1 + ┌─ type_aliases.fe:7:1 │ -5 │ type AuthorPosts = Map +7 │ type AuthorPosts = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:7:1 + ┌─ type_aliases.fe:9:1 │ -7 │ type Author = address +9 │ type Author = address │ ^^^^^^^^^^^^^^^^^^^^^ address note: - ┌─ type_aliases.fe:8:1 - │ -8 │ type Score = u64 - │ ^^^^^^^^^^^^^^^^ u64 + ┌─ type_aliases.fe:11:1 + │ +11 │ type Score = u64 + │ ^^^^^^^^^^^^^^^^ u64 note: - ┌─ type_aliases.fe:9:1 - │ -9 │ type PostId = u256 - │ ^^^^^^^^^^^^^^^^^^ u256 + ┌─ type_aliases.fe:13:1 + │ +13 │ type PostId = u256 + │ ^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ type_aliases.fe:10:1 + ┌─ type_aliases.fe:15:1 │ -10 │ type PostBody = String<32> +15 │ type PostBody = String<32> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ String<32> note: - ┌─ type_aliases.fe:13:5 + ┌─ type_aliases.fe:18:5 │ -13 │ posts: Posts +18 │ posts: Posts │ ^^^^^^^^^^^^ Map> -14 │ authors: AuthorPosts +19 │ authors: AuthorPosts │ ^^^^^^^^^^^^^^^^^^^^ Map -15 │ scoreboard: Scoreboard +20 │ scoreboard: Scoreboard │ ^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:17:5 + ┌─ type_aliases.fe:22:5 │ -17 │ ╭ pub fn post(self, ctx: Context, body: PostBody): -18 │ │ # id: PostId = keccak256(body.abi_encode()) -19 │ │ let id: PostId = 0 -20 │ │ self.posts[id] = body -21 │ │ self.authors[ctx.msg_sender()] -22 │ │ self.scoreboard[id] = 0 - │ ╰───────────────────────────────^ attributes hash: 4649056442968527631 +22 │ ╭ pub fn post(self, ctx: Context, body: PostBody) { +23 │ │ let id: PostId = 0 +24 │ │ self.posts[id] = body +25 │ │ self.authors[ctx.msg_sender()] +26 │ │ self.scoreboard[id] = 0 +27 │ │ } + │ ╰─────^ attributes hash: 4649056442968527631 │ = FunctionSignature { self_decl: Some( @@ -106,83 +106,84 @@ note: } note: - ┌─ type_aliases.fe:19:17 + ┌─ type_aliases.fe:23:17 │ -19 │ let id: PostId = 0 +23 │ let id: PostId = 0 │ ^^^^^^ u256 note: - ┌─ type_aliases.fe:19:26 + ┌─ type_aliases.fe:23:26 │ -19 │ let id: PostId = 0 +23 │ let id: PostId = 0 │ ^ u256: Value -20 │ self.posts[id] = body +24 │ self.posts[id] = body │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:20:9 + ┌─ type_aliases.fe:24:9 │ -20 │ self.posts[id] = body +24 │ self.posts[id] = body │ ^^^^^^^^^^ ^^ u256: Value │ │ │ Map>: Storage { nonce: Some(0) } note: - ┌─ type_aliases.fe:20:9 + ┌─ type_aliases.fe:24:9 │ -20 │ self.posts[id] = body +24 │ self.posts[id] = body │ ^^^^^^^^^^^^^^ ^^^^ String<32>: Memory │ │ │ String<32>: Storage { nonce: None } -21 │ self.authors[ctx.msg_sender()] +25 │ self.authors[ctx.msg_sender()] │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:21:9 + ┌─ type_aliases.fe:25:9 │ -21 │ self.authors[ctx.msg_sender()] +25 │ self.authors[ctx.msg_sender()] │ ^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: Some(1) } note: - ┌─ type_aliases.fe:21:22 + ┌─ type_aliases.fe:25:22 │ -21 │ self.authors[ctx.msg_sender()] +25 │ self.authors[ctx.msg_sender()] │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ type_aliases.fe:21:9 + ┌─ type_aliases.fe:25:9 │ -21 │ self.authors[ctx.msg_sender()] +25 │ self.authors[ctx.msg_sender()] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } -22 │ self.scoreboard[id] = 0 +26 │ self.scoreboard[id] = 0 │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:22:9 + ┌─ type_aliases.fe:26:9 │ -22 │ self.scoreboard[id] = 0 +26 │ self.scoreboard[id] = 0 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ Map: Storage { nonce: Some(2) } note: - ┌─ type_aliases.fe:22:9 + ┌─ type_aliases.fe:26:9 │ -22 │ self.scoreboard[id] = 0 +26 │ self.scoreboard[id] = 0 │ ^^^^^^^^^^^^^^^^^^^ ^ u64: Value │ │ │ u64: Storage { nonce: None } note: - ┌─ type_aliases.fe:24:5 + ┌─ type_aliases.fe:29:5 │ -24 │ ╭ pub fn upvote(self, id: PostId) -> Score: -25 │ │ let score: Score = self.scoreboard[id] + 1 -26 │ │ self.scoreboard[id] = score -27 │ │ return score - │ ╰────────────────────^ attributes hash: 4383698668262923633 +29 │ ╭ pub fn upvote(self, id: PostId) -> Score { +30 │ │ let score: Score = self.scoreboard[id] + 1 +31 │ │ self.scoreboard[id] = score +32 │ │ return score +33 │ │ } + │ ╰─────^ attributes hash: 4383698668262923633 │ = FunctionSignature { self_decl: Some( @@ -212,65 +213,66 @@ note: } note: - ┌─ type_aliases.fe:25:20 + ┌─ type_aliases.fe:30:20 │ -25 │ let score: Score = self.scoreboard[id] + 1 +30 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^ u64 note: - ┌─ type_aliases.fe:25:28 + ┌─ type_aliases.fe:30:28 │ -25 │ let score: Score = self.scoreboard[id] + 1 +30 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:25:28 + ┌─ type_aliases.fe:30:28 │ -25 │ let score: Score = self.scoreboard[id] + 1 +30 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ Map: Storage { nonce: Some(2) } note: - ┌─ type_aliases.fe:25:28 + ┌─ type_aliases.fe:30:28 │ -25 │ let score: Score = self.scoreboard[id] + 1 +30 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u64: Value │ │ │ u64: Storage { nonce: None } => Value note: - ┌─ type_aliases.fe:25:28 + ┌─ type_aliases.fe:30:28 │ -25 │ let score: Score = self.scoreboard[id] + 1 +30 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^^^^^^^^^ u64: Value -26 │ self.scoreboard[id] = score +31 │ self.scoreboard[id] = score │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:26:9 + ┌─ type_aliases.fe:31:9 │ -26 │ self.scoreboard[id] = score +31 │ self.scoreboard[id] = score │ ^^^^^^^^^^^^^^^ ^^ u256: Value │ │ │ Map: Storage { nonce: Some(2) } note: - ┌─ type_aliases.fe:26:9 + ┌─ type_aliases.fe:31:9 │ -26 │ self.scoreboard[id] = score +31 │ self.scoreboard[id] = score │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u64: Value │ │ │ u64: Storage { nonce: None } -27 │ return score +32 │ return score │ ^^^^^ u64: Value note: - ┌─ type_aliases.fe:29:5 + ┌─ type_aliases.fe:35:5 │ -29 │ ╭ pub fn get_post(self, id: PostId) -> PostBody: -30 │ │ return self.posts[id].to_mem() - │ ╰──────────────────────────────────────^ attributes hash: 6772945894090223199 +35 │ ╭ pub fn get_post(self, id: PostId) -> PostBody { +36 │ │ return self.posts[id].to_mem() +37 │ │ } + │ ╰─────^ attributes hash: 6772945894090223199 │ = FunctionSignature { self_decl: Some( @@ -300,29 +302,29 @@ note: } note: - ┌─ type_aliases.fe:30:16 + ┌─ type_aliases.fe:36:16 │ -30 │ return self.posts[id].to_mem() +36 │ return self.posts[id].to_mem() │ ^^^^ Forum: Value note: - ┌─ type_aliases.fe:30:16 + ┌─ type_aliases.fe:36:16 │ -30 │ return self.posts[id].to_mem() +36 │ return self.posts[id].to_mem() │ ^^^^^^^^^^ ^^ u256: Value │ │ │ Map>: Storage { nonce: Some(0) } note: - ┌─ type_aliases.fe:30:16 + ┌─ type_aliases.fe:36:16 │ -30 │ return self.posts[id].to_mem() +36 │ return self.posts[id].to_mem() │ ^^^^^^^^^^^^^^ String<32>: Storage { nonce: None } note: - ┌─ type_aliases.fe:30:16 + ┌─ type_aliases.fe:36:16 │ -30 │ return self.posts[id].to_mem() +36 │ return self.posts[id].to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^ String<32>: Storage { nonce: None } => Memory diff --git a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap index 14cc193d04..f35fe0a28b 100644 --- a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u128_u128_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u128) -> u128: +4 │ ╭ pub fn read_bar(self, key: u128) -> u128 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 1939765458140608268 +6 │ │ } + │ ╰─────^ attributes hash: 1939765458140608268 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u128: Storage { nonce: None } => Value note: - ┌─ u128_u128_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u128, value: u128): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 9126735252114279653 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U128, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U128, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u128_u128_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u128, value: u128) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 9126735252114279653 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U128, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U128, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u128_u128_map.fe:8:9 + ┌─ u128_u128_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u128_u128_map.fe:8:9 + ┌─ u128_u128_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u128: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u128_u128_map.fe:8:9 + ┌─ u128_u128_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u128: Value │ │ │ u128: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap index e110cd6f23..2fabdb8920 100644 --- a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u16_u16_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u16) -> u16: +4 │ ╭ pub fn read_bar(self, key: u16) -> u16 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 18312053447303862075 +6 │ │ } + │ ╰─────^ attributes hash: 18312053447303862075 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u16: Storage { nonce: None } => Value note: - ┌─ u16_u16_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u16, value: u16): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 8088868709641766820 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U16, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U16, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u16_u16_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u16, value: u16) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 8088868709641766820 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U16, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U16, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u16_u16_map.fe:8:9 + ┌─ u16_u16_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u16_u16_map.fe:8:9 + ┌─ u16_u16_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u16: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u16_u16_map.fe:8:9 + ┌─ u16_u16_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u16: Value │ │ │ u16: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap index d418f7f77f..c7faa32d20 100644 --- a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u256_u256_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u256) -> u256: +4 │ ╭ pub fn read_bar(self, key: u256) -> u256 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 14897000516975740248 +6 │ │ } + │ ╰─────^ attributes hash: 14897000516975740248 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ u256_u256_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u256, value: u256): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 17030413653610901743 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u256_u256_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u256, value: u256) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 17030413653610901743 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u256_u256_map.fe:8:9 + ┌─ u256_u256_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u256_u256_map.fe:8:9 + ┌─ u256_u256_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u256: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u256_u256_map.fe:8:9 + ┌─ u256_u256_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap index ba117283f7..f8973f21e7 100644 --- a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u32_u32_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u32) -> u32: +4 │ ╭ pub fn read_bar(self, key: u32) -> u32 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 17684751964541454304 +6 │ │ } + │ ╰─────^ attributes hash: 17684751964541454304 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u32: Storage { nonce: None } => Value note: - ┌─ u32_u32_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u32, value: u32): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 9068646997358780798 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U32, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U32, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u32_u32_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u32, value: u32) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 9068646997358780798 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U32, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U32, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u32_u32_map.fe:8:9 + ┌─ u32_u32_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u32_u32_map.fe:8:9 + ┌─ u32_u32_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u32: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u32_u32_map.fe:8:9 + ┌─ u32_u32_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u32: Value │ │ │ u32: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap index 93d44e2ddf..5bebd390a5 100644 --- a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u64_u64_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u64) -> u64: +4 │ ╭ pub fn read_bar(self, key: u64) -> u64 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 5490397784598880129 +6 │ │ } + │ ╰─────^ attributes hash: 5490397784598880129 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u64: Storage { nonce: None } => Value note: - ┌─ u64_u64_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u64, value: u64): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 2182326649216136625 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U64, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U64, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u64_u64_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u64, value: u64) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 2182326649216136625 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U64, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U64, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u64_u64_map.fe:8:9 + ┌─ u64_u64_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u64_u64_map.fe:8:9 + ┌─ u64_u64_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u64: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u64_u64_map.fe:8:9 + ┌─ u64_u64_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u64: Value │ │ │ u64: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap index 09a887aab4..9d0442f2ba 100644 --- a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap @@ -12,9 +12,10 @@ note: note: ┌─ u8_u8_map.fe:4:5 │ -4 │ ╭ pub fn read_bar(self, key: u8) -> u8: +4 │ ╭ pub fn read_bar(self, key: u8) -> u8 { 5 │ │ return self.bar[key] - │ ╰────────────────────────────^ attributes hash: 3828358868158950430 +6 │ │ } + │ ╰─────^ attributes hash: 3828358868158950430 │ = FunctionSignature { self_decl: Some( @@ -64,66 +65,67 @@ note: │ ^^^^^^^^^^^^^ u8: Storage { nonce: None } => Value note: - ┌─ u8_u8_map.fe:7:5 - │ -7 │ ╭ pub fn write_bar(self, key: u8, value: u8): -8 │ │ self.bar[key] = value - │ ╰─────────────────────────────^ attributes hash: 1989504953336313430 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "key", - typ: Ok( - Base( - Numeric( - U8, - ), - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U8, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ u8_u8_map.fe:8:5 + │ + 8 │ ╭ pub fn write_bar(self, key: u8, value: u8) { + 9 │ │ self.bar[key] = value +10 │ │ } + │ ╰─────^ attributes hash: 1989504953336313430 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "key", + typ: Ok( + Base( + Numeric( + U8, + ), + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U8, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ u8_u8_map.fe:8:9 + ┌─ u8_u8_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^ Foo: Value note: - ┌─ u8_u8_map.fe:8:9 + ┌─ u8_u8_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u8: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ u8_u8_map.fe:8:9 + ┌─ u8_u8_map.fe:9:9 │ -8 │ self.bar[key] = value +9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u8: Value │ │ │ u8: Storage { nonce: None } diff --git a/crates/analyzer/tests/snapshots/analysis__uniswap.snap b/crates/analyzer/tests/snapshots/analysis__uniswap.snap index 5b22432f23..8e33374d76 100644 --- a/crates/analyzer/tests/snapshots/analysis__uniswap.snap +++ b/crates/analyzer/tests/snapshots/analysis__uniswap.snap @@ -6,9 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ uniswap.fe:4:5 │ -4 │ ╭ pub fn balanceOf(_ account: address) -> u256: +4 │ ╭ pub fn balanceOf(_ account: address) -> u256 { 5 │ │ return 0 - │ ╰────────────────^ attributes hash: 4709511530683498418 +6 │ │ } + │ ╰─────^ attributes hash: 4709511530683498418 │ = FunctionSignature { self_decl: None, @@ -42,158 +43,160 @@ note: │ ^ u256: Value note: - ┌─ uniswap.fe:7:5 - │ -7 │ ╭ pub fn transfer(to: address, _ amount: u256) -> bool: -8 │ │ return false - │ ╰────────────────────^ attributes hash: 12261720285838819896 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [ - FunctionParam { - label: None, - name: "to", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: Some( - "_", - ), - name: "amount", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Bool, - ), - ), - } + ┌─ uniswap.fe:8:5 + │ + 8 │ ╭ pub fn transfer(to: address, _ amount: u256) -> bool { + 9 │ │ return false +10 │ │ } + │ ╰─────^ attributes hash: 12261720285838819896 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [ + FunctionParam { + label: None, + name: "to", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: Some( + "_", + ), + name: "amount", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Bool, + ), + ), + } note: - ┌─ uniswap.fe:8:16 + ┌─ uniswap.fe:9:16 │ -8 │ return false +9 │ return false │ ^^^^^ bool: Value note: - ┌─ uniswap.fe:14:5 + ┌─ uniswap.fe:17:5 │ -14 │ balances: Map +17 │ balances: Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map -15 │ allowances: Map> +18 │ allowances: Map> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> -16 │ total_supply: u256 +19 │ total_supply: u256 │ ^^^^^^^^^^^^^^^^^^ u256 -17 │ -18 │ nonces: Map +20 │ +21 │ nonces: Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ Map -19 │ -20 │ factory: address +22 │ +23 │ factory: address │ ^^^^^^^^^^^^^^^^ address -21 │ token0: address +24 │ token0: address │ ^^^^^^^^^^^^^^^ address -22 │ token1: address +25 │ token1: address │ ^^^^^^^^^^^^^^^ address -23 │ -24 │ reserve0: u256 +26 │ +27 │ reserve0: u256 │ ^^^^^^^^^^^^^^ u256 -25 │ reserve1: u256 +28 │ reserve1: u256 │ ^^^^^^^^^^^^^^ u256 -26 │ block_timestamp_last: u256 +29 │ block_timestamp_last: u256 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -27 │ -28 │ price0_cumulative_last: u256 +30 │ +31 │ price0_cumulative_last: u256 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -29 │ price1_cumulative_last: u256 +32 │ price1_cumulative_last: u256 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -30 │ k_last: u256 +33 │ k_last: u256 │ ^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:33:9 + ┌─ uniswap.fe:36:9 │ -33 │ idx owner: address +36 │ idx owner: address │ ^^^^^^^^^^^^^^^^^^ address -34 │ idx spender: address +37 │ idx spender: address │ ^^^^^^^^^^^^^^^^^^^^ address -35 │ value: u256 +38 │ value: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:38:9 + ┌─ uniswap.fe:42:9 │ -38 │ idx from: address +42 │ idx from: address │ ^^^^^^^^^^^^^^^^^ address -39 │ idx to: address +43 │ idx to: address │ ^^^^^^^^^^^^^^^ address -40 │ value: u256 +44 │ value: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:43:9 + ┌─ uniswap.fe:48:9 │ -43 │ idx sender: address +48 │ idx sender: address │ ^^^^^^^^^^^^^^^^^^^ address -44 │ amount0: u256 +49 │ amount0: u256 │ ^^^^^^^^^^^^^ u256 -45 │ amount1: u256 +50 │ amount1: u256 │ ^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:48:9 + ┌─ uniswap.fe:54:9 │ -48 │ idx sender: address +54 │ idx sender: address │ ^^^^^^^^^^^^^^^^^^^ address -49 │ amount0: u256 +55 │ amount0: u256 │ ^^^^^^^^^^^^^ u256 -50 │ amount1: u256 +56 │ amount1: u256 │ ^^^^^^^^^^^^^ u256 -51 │ idx to: address +57 │ idx to: address │ ^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:54:9 + ┌─ uniswap.fe:61:9 │ -54 │ idx sender: address +61 │ idx sender: address │ ^^^^^^^^^^^^^^^^^^^ address -55 │ amount0_in: u256 +62 │ amount0_in: u256 │ ^^^^^^^^^^^^^^^^ u256 -56 │ amount1_in: u256 +63 │ amount1_in: u256 │ ^^^^^^^^^^^^^^^^ u256 -57 │ amount0_out: u256 +64 │ amount0_out: u256 │ ^^^^^^^^^^^^^^^^^ u256 -58 │ amount1_out: u256 +65 │ amount1_out: u256 │ ^^^^^^^^^^^^^^^^^ u256 -59 │ idx to: address +66 │ idx to: address │ ^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:62:9 + ┌─ uniswap.fe:70:9 │ -62 │ reserve0: u256 +70 │ reserve0: u256 │ ^^^^^^^^^^^^^^ u256 -63 │ reserve1: u256 +71 │ reserve1: u256 │ ^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:68:5 + ┌─ uniswap.fe:78:5 │ -68 │ ╭ pub fn factory(self) -> address: -69 │ │ return self.factory - │ ╰───────────────────────────^ attributes hash: 227275695522088782 +78 │ ╭ pub fn factory(self) -> address { +79 │ │ return self.factory +80 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -209,23 +212,24 @@ note: } note: - ┌─ uniswap.fe:69:16 + ┌─ uniswap.fe:79:16 │ -69 │ return self.factory +79 │ return self.factory │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:69:16 + ┌─ uniswap.fe:79:16 │ -69 │ return self.factory +79 │ return self.factory │ ^^^^^^^^^^^^ address: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:71:5 + ┌─ uniswap.fe:82:5 │ -71 │ ╭ pub fn token0(self) -> address: -72 │ │ return self.token0 - │ ╰──────────────────────────^ attributes hash: 227275695522088782 +82 │ ╭ pub fn token0(self) -> address { +83 │ │ return self.token0 +84 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -241,23 +245,24 @@ note: } note: - ┌─ uniswap.fe:72:16 + ┌─ uniswap.fe:83:16 │ -72 │ return self.token0 +83 │ return self.token0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:72:16 + ┌─ uniswap.fe:83:16 │ -72 │ return self.token0 +83 │ return self.token0 │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:74:5 + ┌─ uniswap.fe:86:5 │ -74 │ ╭ pub fn token1(self) -> address: -75 │ │ return self.token1 - │ ╰──────────────────────────^ attributes hash: 227275695522088782 +86 │ ╭ pub fn token1(self) -> address { +87 │ │ return self.token1 +88 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -273,25 +278,26 @@ note: } note: - ┌─ uniswap.fe:75:16 + ┌─ uniswap.fe:87:16 │ -75 │ return self.token1 +87 │ return self.token1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:75:16 + ┌─ uniswap.fe:87:16 │ -75 │ return self.token1 +87 │ return self.token1 │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:77:5 + ┌─ uniswap.fe:90:5 │ -77 │ ╭ fn _mint(self, ctx: Context, to: address, value: u256): -78 │ │ self.total_supply = self.total_supply + value -79 │ │ self.balances[to] = self.balances[to] + value -80 │ │ emit Transfer(ctx, from: address(0), to, value) - │ ╰───────────────────────────────────────────────────────^ attributes hash: 12650409809079895726 +90 │ ╭ fn _mint(self, ctx: Context, to: address, value: u256) { +91 │ │ self.total_supply = self.total_supply + value +92 │ │ self.balances[to] = self.balances[to] + value +93 │ │ emit Transfer(ctx, from: address(0), to, value) +94 │ │ } + │ ╰─────^ attributes hash: 12650409809079895726 │ = FunctionSignature { self_decl: Some( @@ -342,90 +348,90 @@ note: } note: - ┌─ uniswap.fe:78:9 + ┌─ uniswap.fe:91:9 │ -78 │ self.total_supply = self.total_supply + value +91 │ self.total_supply = self.total_supply + value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:78:9 + ┌─ uniswap.fe:91:9 │ -78 │ self.total_supply = self.total_supply + value +91 │ self.total_supply = self.total_supply + value │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:78:29 + ┌─ uniswap.fe:91:29 │ -78 │ self.total_supply = self.total_supply + value +91 │ self.total_supply = self.total_supply + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } => Value note: - ┌─ uniswap.fe:78:29 + ┌─ uniswap.fe:91:29 │ -78 │ self.total_supply = self.total_supply + value +91 │ self.total_supply = self.total_supply + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:79:9 + ┌─ uniswap.fe:92:9 │ -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:79:9 + ┌─ uniswap.fe:92:9 │ -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:79:29 + ┌─ uniswap.fe:92:29 │ -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:79:29 + ┌─ uniswap.fe:92:29 │ -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:79:29 + ┌─ uniswap.fe:92:29 │ -79 │ self.balances[to] = self.balances[to] + value +92 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -80 │ emit Transfer(ctx, from: address(0), to, value) +93 │ emit Transfer(ctx, from: address(0), to, value) │ ^^^ ^ u256: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:80:34 + ┌─ uniswap.fe:93:34 │ -80 │ emit Transfer(ctx, from: address(0), to, value) +93 │ emit Transfer(ctx, from: address(0), to, value) │ ^^^^^^^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ uniswap.fe:80:9 + ┌─ uniswap.fe:93:9 │ -80 │ emit Transfer(ctx, from: address(0), to, value) +93 │ emit Transfer(ctx, from: address(0), to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 │ = Event { @@ -464,147 +470,148 @@ note: } note: - ┌─ uniswap.fe:82:5 - │ -82 │ ╭ fn _burn(self, ctx: Context, from: address, value: u256): -83 │ │ self.balances[from] = self.balances[from] - value -84 │ │ self.total_supply = self.total_supply - value -85 │ │ emit Transfer(ctx, from, to: address(0), value) - │ ╰───────────────────────────────────────────────────────^ attributes hash: 16245072311291560743 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "from", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ uniswap.fe:96:5 + │ + 96 │ ╭ fn _burn(self, ctx: Context, from: address, value: u256) { + 97 │ │ self.balances[from] = self.balances[from] - value + 98 │ │ self.total_supply = self.total_supply - value + 99 │ │ emit Transfer(ctx, from, to: address(0), value) +100 │ │ } + │ ╰─────^ attributes hash: 16245072311291560743 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "from", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ uniswap.fe:83:9 + ┌─ uniswap.fe:97:9 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:83:9 + ┌─ uniswap.fe:97:9 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:83:9 + ┌─ uniswap.fe:97:9 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:83:31 + ┌─ uniswap.fe:97:31 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:83:31 + ┌─ uniswap.fe:97:31 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:83:31 + ┌─ uniswap.fe:97:31 │ -83 │ self.balances[from] = self.balances[from] - value +97 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -84 │ self.total_supply = self.total_supply - value +98 │ self.total_supply = self.total_supply - value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:84:9 + ┌─ uniswap.fe:98:9 │ -84 │ self.total_supply = self.total_supply - value +98 │ self.total_supply = self.total_supply - value │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:84:29 + ┌─ uniswap.fe:98:29 │ -84 │ self.total_supply = self.total_supply - value +98 │ self.total_supply = self.total_supply - value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } => Value note: - ┌─ uniswap.fe:84:29 + ┌─ uniswap.fe:98:29 │ -84 │ self.total_supply = self.total_supply - value +98 │ self.total_supply = self.total_supply - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -85 │ emit Transfer(ctx, from, to: address(0), value) +99 │ emit Transfer(ctx, from, to: address(0), value) │ ^^^ ^^^^ ^ u256: Value │ │ │ │ │ address: Value │ Context: Memory note: - ┌─ uniswap.fe:85:38 + ┌─ uniswap.fe:99:38 │ -85 │ emit Transfer(ctx, from, to: address(0), value) +99 │ emit Transfer(ctx, from, to: address(0), value) │ ^^^^^^^^^^ ^^^^^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:85:9 + ┌─ uniswap.fe:99:9 │ -85 │ emit Transfer(ctx, from, to: address(0), value) +99 │ emit Transfer(ctx, from, to: address(0), value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 │ = Event { @@ -643,351 +650,354 @@ note: } note: - ┌─ uniswap.fe:88:5 - │ -88 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256): -89 │ │ self.allowances[owner][spender] = value -90 │ │ emit Approval(ctx, owner, spender, value) - │ ╰─────────────────────────────────────────────────^ attributes hash: 1630416716014819616 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "owner", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "spender", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } - -note: - ┌─ uniswap.fe:89:9 - │ -89 │ self.allowances[owner][spender] = value - │ ^^^^ UniswapV2Pair: Value + ┌─ uniswap.fe:102:5 + │ +102 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { +103 │ │ self.allowances[owner][spender] = value +104 │ │ emit Approval(ctx, owner, spender, value) +105 │ │ } + │ ╰─────^ attributes hash: 1630416716014819616 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "owner", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "spender", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ uniswap.fe:89:9 - │ -89 │ self.allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^ ^^^^^ address: Value - │ │ - │ Map>: Storage { nonce: Some(1) } + ┌─ uniswap.fe:103:9 + │ +103 │ self.allowances[owner][spender] = value + │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:89:9 - │ -89 │ self.allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value - │ │ - │ Map: Storage { nonce: None } + ┌─ uniswap.fe:103:9 + │ +103 │ self.allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^ ^^^^^ address: Value + │ │ + │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:89:9 - │ -89 │ self.allowances[owner][spender] = value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } -90 │ emit Approval(ctx, owner, spender, value) - │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ │ - │ │ │ address: Value - │ │ address: Value - │ Context: Memory + ┌─ uniswap.fe:103:9 + │ +103 │ self.allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value + │ │ + │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:90:9 - │ -90 │ emit Approval(ctx, owner, spender, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8893313742751514912 - │ - = Event { - name: "Approval", - fields: [ - EventField { - name: "owner", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "spender", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - is_indexed: false, - }, - ], - } + ┌─ uniswap.fe:103:9 + │ +103 │ self.allowances[owner][spender] = value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } +104 │ emit Approval(ctx, owner, spender, value) + │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ │ + │ │ │ address: Value + │ │ address: Value + │ Context: Memory note: - ┌─ uniswap.fe:93:5 - │ -93 │ ╭ fn _transfer(self, ctx: Context, from: address, to: address, value: u256): -94 │ │ self.balances[from] = self.balances[from] - value -95 │ │ self.balances[to] = self.balances[to] + value -96 │ │ emit Transfer(ctx, from, to, value) - │ ╰───────────────────────────────────────────^ attributes hash: 1442617122763943794 - │ - = FunctionSignature { - self_decl: Some( - Mutable, - ), - ctx_decl: Some( - Mutable, - ), - params: [ - FunctionParam { - label: None, - name: "ctx", - typ: Ok( - Struct( - Struct { - name: "Context", - field_count: 0, - }, - ), - ), - }, - FunctionParam { - label: None, - name: "from", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "to", - typ: Ok( - Base( - Address, - ), - ), - }, - FunctionParam { - label: None, - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - }, - ], - return_type: Ok( - Base( - Unit, - ), - ), - } + ┌─ uniswap.fe:104:9 + │ +104 │ emit Approval(ctx, owner, spender, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 8893313742751514912 + │ + = Event { + name: "Approval", + fields: [ + EventField { + name: "owner", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "spender", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + is_indexed: false, + }, + ], + } note: - ┌─ uniswap.fe:94:9 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^ UniswapV2Pair: Value + ┌─ uniswap.fe:107:5 + │ +107 │ ╭ fn _transfer(self, ctx: Context, from: address, to: address, value: u256) { +108 │ │ self.balances[from] = self.balances[from] - value +109 │ │ self.balances[to] = self.balances[to] + value +110 │ │ emit Transfer(ctx, from, to, value) +111 │ │ } + │ ╰─────^ attributes hash: 1442617122763943794 + │ + = FunctionSignature { + self_decl: Some( + Mutable, + ), + ctx_decl: Some( + Mutable, + ), + params: [ + FunctionParam { + label: None, + name: "ctx", + typ: Ok( + Struct( + Struct { + name: "Context", + field_count: 0, + }, + ), + ), + }, + FunctionParam { + label: None, + name: "from", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "to", + typ: Ok( + Base( + Address, + ), + ), + }, + FunctionParam { + label: None, + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + }, + ], + return_type: Ok( + Base( + Unit, + ), + ), + } note: - ┌─ uniswap.fe:94:9 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^ ^^^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ uniswap.fe:108:9 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:94:9 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value - │ │ - │ u256: Storage { nonce: None } + ┌─ uniswap.fe:108:9 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^^^^^^^^^^ ^^^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:94:31 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^ ^^^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ uniswap.fe:108:9 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value + │ │ + │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:94:31 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value + ┌─ uniswap.fe:108:31 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^^^^^^^^^^ ^^^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:94:31 - │ -94 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^ UniswapV2Pair: Value + ┌─ uniswap.fe:108:31 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:95:9 - │ -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^ ^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ uniswap.fe:108:31 + │ +108 │ self.balances[from] = self.balances[from] - value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:95:9 - │ -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value - │ │ - │ u256: Storage { nonce: None } + ┌─ uniswap.fe:109:9 + │ +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^^^^^^^^^^ ^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:95:29 - │ -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^ ^^ address: Value - │ │ - │ Map: Storage { nonce: Some(0) } + ┌─ uniswap.fe:109:9 + │ +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value + │ │ + │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:95:29 - │ -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value - │ │ - │ u256: Storage { nonce: None } => Value + ┌─ uniswap.fe:109:29 + │ +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^^^^^^^^^^ ^^ address: Value + │ │ + │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:95:29 - │ -95 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -96 │ emit Transfer(ctx, from, to, value) - │ ^^^ ^^^^ ^^ ^^^^^ u256: Value - │ │ │ │ - │ │ │ address: Value - │ │ address: Value - │ Context: Memory + ┌─ uniswap.fe:109:29 + │ +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value + │ │ + │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:96:9 - │ -96 │ emit Transfer(ctx, from, to, value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 - │ - = Event { - name: "Transfer", - fields: [ - EventField { - name: "from", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "to", - typ: Ok( - Base( - Address, - ), - ), - is_indexed: true, - }, - EventField { - name: "value", - typ: Ok( - Base( - Numeric( - U256, - ), - ), - ), - is_indexed: false, - }, - ], - } + ┌─ uniswap.fe:109:29 + │ +109 │ self.balances[to] = self.balances[to] + value + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +110 │ emit Transfer(ctx, from, to, value) + │ ^^^ ^^^^ ^^ ^^^^^ u256: Value + │ │ │ │ + │ │ │ address: Value + │ │ address: Value + │ Context: Memory + +note: + ┌─ uniswap.fe:110:9 + │ +110 │ emit Transfer(ctx, from, to, value) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 5533489995250141934 + │ + = Event { + name: "Transfer", + fields: [ + EventField { + name: "from", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "to", + typ: Ok( + Base( + Address, + ), + ), + is_indexed: true, + }, + EventField { + name: "value", + typ: Ok( + Base( + Numeric( + U256, + ), + ), + ), + is_indexed: false, + }, + ], + } note: - ┌─ uniswap.fe:98:5 + ┌─ uniswap.fe:113:5 │ - 98 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool: - 99 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) -100 │ │ return true - │ ╰───────────────────^ attributes hash: 8309406699454253603 +113 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { +114 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +115 │ │ return true +116 │ │ } + │ ╰─────^ attributes hash: 8309406699454253603 │ = FunctionSignature { self_decl: Some( @@ -1038,38 +1048,39 @@ note: } note: - ┌─ uniswap.fe:99:9 - │ -99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) - │ ^^^^ ^^^ ^^^ Context: Memory - │ │ │ - │ │ Context: Memory - │ UniswapV2Pair: Value + ┌─ uniswap.fe:114:9 + │ +114 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^ ^^^ ^^^ Context: Memory + │ │ │ + │ │ Context: Memory + │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:99:35 - │ -99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value - │ │ │ - │ │ address: Value - │ address: Value + ┌─ uniswap.fe:114:35 + │ +114 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^ u256: Value + │ │ │ + │ │ address: Value + │ address: Value note: - ┌─ uniswap.fe:99:9 + ┌─ uniswap.fe:114:9 │ - 99 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) +114 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -100 │ return true +115 │ return true │ ^^^^ bool: Value note: - ┌─ uniswap.fe:102:5 + ┌─ uniswap.fe:118:5 │ -102 │ ╭ pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool: -103 │ │ self._transfer(ctx, from: ctx.msg_sender(), to, value) -104 │ │ return true - │ ╰───────────────────^ attributes hash: 14718526948940966913 +118 │ ╭ pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool { +119 │ │ self._transfer(ctx, from: ctx.msg_sender(), to, value) +120 │ │ return true +121 │ │ } + │ ╰─────^ attributes hash: 14718526948940966913 │ = FunctionSignature { self_decl: Some( @@ -1120,40 +1131,41 @@ note: } note: - ┌─ uniswap.fe:103:9 + ┌─ uniswap.fe:119:9 │ -103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) +119 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:103:35 + ┌─ uniswap.fe:119:35 │ -103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) +119 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) │ ^^^^^^^^^^^^^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ address: Value │ address: Value note: - ┌─ uniswap.fe:103:9 + ┌─ uniswap.fe:119:9 │ -103 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) +119 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -104 │ return true +120 │ return true │ ^^^^ bool: Value note: - ┌─ uniswap.fe:106:5 + ┌─ uniswap.fe:123:5 │ -106 │ ╭ pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool: -107 │ │ assert self.allowances[from][ctx.msg_sender()] >= value -108 │ │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value -109 │ │ self._transfer(ctx, from, to, value) -110 │ │ return true - │ ╰───────────────────^ attributes hash: 3284161617958543499 +123 │ ╭ pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool { +124 │ │ assert self.allowances[from][ctx.msg_sender()] >= value +125 │ │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +126 │ │ self._transfer(ctx, from, to, value) +127 │ │ return true +128 │ │ } + │ ╰─────^ attributes hash: 3284161617958543499 │ = FunctionSignature { self_decl: Some( @@ -1213,115 +1225,115 @@ note: } note: - ┌─ uniswap.fe:107:16 + ┌─ uniswap.fe:124:16 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:107:16 + ┌─ uniswap.fe:124:16 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:107:16 + ┌─ uniswap.fe:124:16 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:107:38 + ┌─ uniswap.fe:124:38 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:107:16 + ┌─ uniswap.fe:124:16 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:107:16 + ┌─ uniswap.fe:124:16 │ -107 │ assert self.allowances[from][ctx.msg_sender()] >= value +124 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:108:9 + ┌─ uniswap.fe:125:9 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:108:9 + ┌─ uniswap.fe:125:9 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:108:31 + ┌─ uniswap.fe:125:31 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:108:9 + ┌─ uniswap.fe:125:9 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: None } note: - ┌─ uniswap.fe:108:51 + ┌─ uniswap.fe:125:51 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:108:51 + ┌─ uniswap.fe:125:51 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:108:73 + ┌─ uniswap.fe:125:73 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:108:51 + ┌─ uniswap.fe:125:51 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256: Value │ │ │ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:108:51 + ┌─ uniswap.fe:125:51 │ -108 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value +125 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -109 │ self._transfer(ctx, from, to, value) +126 │ self._transfer(ctx, from, to, value) │ ^^^^ ^^^ ^^^^ ^^ ^^^^^ u256: Value │ │ │ │ │ │ │ │ │ address: Value @@ -1330,19 +1342,20 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:109:9 + ┌─ uniswap.fe:126:9 │ -109 │ self._transfer(ctx, from, to, value) +126 │ self._transfer(ctx, from, to, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -110 │ return true +127 │ return true │ ^^^^ bool: Value note: - ┌─ uniswap.fe:112:5 + ┌─ uniswap.fe:130:5 │ -112 │ ╭ pub fn balanceOf(self, _ account: address) -> u256: -113 │ │ return self.balances[account] - │ ╰─────────────────────────────────────^ attributes hash: 5993653573135321647 +130 │ ╭ pub fn balanceOf(self, _ account: address) -> u256 { +131 │ │ return self.balances[account] +132 │ │ } + │ ╰─────^ attributes hash: 5993653573135321647 │ = FunctionSignature { self_decl: Some( @@ -1372,31 +1385,32 @@ note: } note: - ┌─ uniswap.fe:113:16 + ┌─ uniswap.fe:131:16 │ -113 │ return self.balances[account] +131 │ return self.balances[account] │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:113:16 + ┌─ uniswap.fe:131:16 │ -113 │ return self.balances[account] +131 │ return self.balances[account] │ ^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:113:16 + ┌─ uniswap.fe:131:16 │ -113 │ return self.balances[account] +131 │ return self.balances[account] │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:115:5 + ┌─ uniswap.fe:134:5 │ -115 │ ╭ pub fn get_reserves(self) -> (u256, u256, u256): -116 │ │ return (self.reserve0, self.reserve1, self.block_timestamp_last) - │ ╰────────────────────────────────────────────────────────────────────────^ attributes hash: 3743538709625240197 +134 │ ╭ pub fn get_reserves(self) -> (u256, u256, u256) { +135 │ │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +136 │ │ } + │ ╰─────^ attributes hash: 3743538709625240197 │ = FunctionSignature { self_decl: Some( @@ -1430,47 +1444,48 @@ note: } note: - ┌─ uniswap.fe:116:17 + ┌─ uniswap.fe:135:17 │ -116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +135 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:116:17 + ┌─ uniswap.fe:135:17 │ -116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +135 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:116:32 + ┌─ uniswap.fe:135:32 │ -116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +135 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:116:47 + ┌─ uniswap.fe:135:47 │ -116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +135 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(9) } => Value note: - ┌─ uniswap.fe:116:16 + ┌─ uniswap.fe:135:16 │ -116 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) +135 │ return (self.reserve0, self.reserve1, self.block_timestamp_last) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (u256, u256, u256): Memory note: - ┌─ uniswap.fe:119:5 + ┌─ uniswap.fe:139:5 │ -119 │ ╭ pub fn initialize(self, ctx: Context, token0: address, token1: address): -120 │ │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" -121 │ │ self.token0 = token0 -122 │ │ self.token1 = token1 - │ ╰────────────────────────────^ attributes hash: 10460756106041683522 +139 │ ╭ pub fn initialize(self, ctx: Context, token0: address, token1: address) { +140 │ │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +141 │ │ self.token0 = token0 +142 │ │ self.token1 = token1 +143 │ │ } + │ ╰─────^ attributes hash: 10460756106041683522 │ = FunctionSignature { self_decl: Some( @@ -1519,64 +1534,64 @@ note: } note: - ┌─ uniswap.fe:120:16 + ┌─ uniswap.fe:140:16 │ -120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +140 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:120:16 + ┌─ uniswap.fe:140:16 │ -120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +140 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Value note: - ┌─ uniswap.fe:120:36 + ┌─ uniswap.fe:140:36 │ -120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +140 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^ address: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:120:16 + ┌─ uniswap.fe:140:16 │ -120 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" +140 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -121 │ self.token0 = token0 +141 │ self.token0 = token0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:121:9 + ┌─ uniswap.fe:141:9 │ -121 │ self.token0 = token0 +141 │ self.token0 = token0 │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(5) } -122 │ self.token1 = token1 +142 │ self.token1 = token1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:122:9 + ┌─ uniswap.fe:142:9 │ -122 │ self.token1 = token1 +142 │ self.token1 = token1 │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(6) } note: - ┌─ uniswap.fe:125:5 + ┌─ uniswap.fe:146:5 │ -125 │ ╭ fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256): -126 │ │ # changed from u32s -127 │ │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 -128 │ │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) +146 │ ╭ fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { +147 │ │ # changed from u32s +148 │ │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) +149 │ │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 · │ -137 │ │ self.block_timestamp_last = block_timestamp -138 │ │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) - │ ╰────────────────────────────────────────────────────────────────────────^ attributes hash: 14441581101409065213 +158 │ │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +159 │ │ } + │ ╰─────^ attributes hash: 14441581101409065213 │ = FunctionSignature { self_decl: Some( @@ -1651,230 +1666,227 @@ note: } note: - ┌─ uniswap.fe:127:30 + ┌─ uniswap.fe:149:30 │ -127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +149 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 │ ^^^^ u256 -128 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) -129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +150 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last │ ^^^^ u256 note: - ┌─ uniswap.fe:127:37 + ┌─ uniswap.fe:149:37 │ -127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 +149 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 │ ^^^ Context: Memory note: - ┌─ uniswap.fe:127:37 + ┌─ uniswap.fe:149:37 │ -127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 - │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^ u256: Value - │ │ │ +149 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 + │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^ u256: Value + │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:127:61 + ┌─ uniswap.fe:149:61 │ -127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 - │ ^^^^^ u256: Value +149 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 + │ ^^^^^^^ u256: Value note: - ┌─ uniswap.fe:127:37 + ┌─ uniswap.fe:149:37 │ -127 │ let block_timestamp: u256 = ctx.block_timestamp() % 2**32 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -128 │ # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) -129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +149 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +150 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last │ ^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:129:52 + ┌─ uniswap.fe:150:52 │ -129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +150 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(9) } => Value note: - ┌─ uniswap.fe:129:34 + ┌─ uniswap.fe:150:34 │ -129 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired +150 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:130:12 + ┌─ uniswap.fe:151:12 │ -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:130:33 + ┌─ uniswap.fe:151:33 │ -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:130:12 + ┌─ uniswap.fe:151:12 │ -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:130:51 + ┌─ uniswap.fe:151:51 │ -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:130:12 + ┌─ uniswap.fe:151:12 │ -130 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: +151 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -131 │ # `*` never overflows, and + overflow is desired -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:132:13 + ┌─ uniswap.fe:152:13 │ -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(10) } note: - ┌─ uniswap.fe:132:43 + ┌─ uniswap.fe:152:43 │ -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value - │ │ │ - │ │ u256: Value +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value + │ │ │ + │ │ u256: Value │ u256: Storage { nonce: Some(10) } => Value note: - ┌─ uniswap.fe:132:73 + ┌─ uniswap.fe:152:73 │ -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value - │ │ +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value + │ │ │ u256: Value note: - ┌─ uniswap.fe:132:73 + ┌─ uniswap.fe:152:73 │ -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:132:43 + ┌─ uniswap.fe:152:43 │ -132 │ self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +152 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:133:13 + ┌─ uniswap.fe:153:13 │ -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(11) } note: - ┌─ uniswap.fe:133:43 + ┌─ uniswap.fe:153:43 │ -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value - │ │ │ - │ │ u256: Value +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value + │ │ │ + │ │ u256: Value │ u256: Storage { nonce: Some(11) } => Value note: - ┌─ uniswap.fe:133:73 + ┌─ uniswap.fe:153:73 │ -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value - │ │ +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value + │ │ │ u256: Value note: - ┌─ uniswap.fe:133:73 + ┌─ uniswap.fe:153:73 │ -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:133:43 + ┌─ uniswap.fe:153:43 │ -133 │ self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -134 │ -135 │ self.reserve0 = balance0 +153 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +154 │ } +155 │ self.reserve0 = balance0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:135:9 + ┌─ uniswap.fe:155:9 │ -135 │ self.reserve0 = balance0 +155 │ self.reserve0 = balance0 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(7) } -136 │ self.reserve1 = balance1 +156 │ self.reserve1 = balance1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:136:9 + ┌─ uniswap.fe:156:9 │ -136 │ self.reserve1 = balance1 +156 │ self.reserve1 = balance1 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(8) } -137 │ self.block_timestamp_last = block_timestamp +157 │ self.block_timestamp_last = block_timestamp │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:137:9 + ┌─ uniswap.fe:157:9 │ -137 │ self.block_timestamp_last = block_timestamp +157 │ self.block_timestamp_last = block_timestamp │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(9) } -138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +158 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:138:34 + ┌─ uniswap.fe:158:34 │ -138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +158 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:138:59 + ┌─ uniswap.fe:158:59 │ -138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +158 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:138:9 + ┌─ uniswap.fe:158:9 │ -138 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) +158 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 11491202868117077488 │ = Event { @@ -1906,16 +1918,16 @@ note: } note: - ┌─ uniswap.fe:141:5 + ┌─ uniswap.fe:161:5 │ -141 │ ╭ fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool: -142 │ │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() -143 │ │ let fee_on: bool = fee_to != address(0) -144 │ │ let k_last: u256 = self.k_last # gas savings +161 │ ╭ fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool { +162 │ │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +163 │ │ let fee_on: bool = fee_to != address(0) +164 │ │ let k_last: u256 = self.k_last · │ -157 │ │ -158 │ │ return fee_on - │ ╰─────────────────────^ attributes hash: 12335666382859496931 +181 │ │ return fee_on +182 │ │ } + │ ╰─────^ attributes hash: 12335666382859496931 │ = FunctionSignature { self_decl: Some( @@ -1968,185 +1980,185 @@ note: } note: - ┌─ uniswap.fe:142:21 + ┌─ uniswap.fe:162:21 │ -142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +162 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^ address -143 │ let fee_on: bool = fee_to != address(0) +163 │ let fee_on: bool = fee_to != address(0) │ ^^^^ bool -144 │ let k_last: u256 = self.k_last # gas savings +164 │ let k_last: u256 = self.k_last │ ^^^^ u256 · -147 │ let root_k: u256 = sqrt(reserve0 * reserve1) +167 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^ u256 -148 │ let root_k_last: u256 = sqrt(k_last) +168 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^ u256 -149 │ if root_k > root_k_last: -150 │ let numerator: u256 = self.total_supply * root_k - root_k_last +169 │ if root_k > root_k_last { +170 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^ u256 -151 │ let denominator: u256 = root_k * 5 + root_k_last +171 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^ u256 -152 │ let liquidity: u256 = numerator / denominator +172 │ let liquidity: u256 = numerator / denominator │ ^^^^ u256 note: - ┌─ uniswap.fe:142:48 + ┌─ uniswap.fe:162:48 │ -142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +162 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:142:53 + ┌─ uniswap.fe:162:53 │ -142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +162 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^ address: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:142:31 + ┌─ uniswap.fe:162:31 │ -142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +162 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:142:31 + ┌─ uniswap.fe:162:31 │ -142 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() +162 │ let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -143 │ let fee_on: bool = fee_to != address(0) +163 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:143:38 + ┌─ uniswap.fe:163:38 │ -143 │ let fee_on: bool = fee_to != address(0) +163 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:143:28 + ┌─ uniswap.fe:163:28 │ -143 │ let fee_on: bool = fee_to != address(0) +163 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -144 │ let k_last: u256 = self.k_last # gas savings +164 │ let k_last: u256 = self.k_last │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:144:28 + ┌─ uniswap.fe:164:28 │ -144 │ let k_last: u256 = self.k_last # gas savings +164 │ let k_last: u256 = self.k_last │ ^^^^^^^^^^^ u256: Storage { nonce: Some(12) } => Value -145 │ if fee_on: +165 │ if fee_on { │ ^^^^^^ bool: Value -146 │ if k_last != 0: +166 │ if k_last != 0 { │ ^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:146:16 + ┌─ uniswap.fe:166:16 │ -146 │ if k_last != 0: +166 │ if k_last != 0 { │ ^^^^^^^^^^^ bool: Value -147 │ let root_k: u256 = sqrt(reserve0 * reserve1) +167 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:147:41 + ┌─ uniswap.fe:167:41 │ -147 │ let root_k: u256 = sqrt(reserve0 * reserve1) +167 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:147:36 + ┌─ uniswap.fe:167:36 │ -147 │ let root_k: u256 = sqrt(reserve0 * reserve1) +167 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -148 │ let root_k_last: u256 = sqrt(k_last) +168 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^ u256: Value note: - ┌─ uniswap.fe:148:41 + ┌─ uniswap.fe:168:41 │ -148 │ let root_k_last: u256 = sqrt(k_last) +168 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^^^^^^^ u256: Value -149 │ if root_k > root_k_last: +169 │ if root_k > root_k_last { │ ^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:149:20 + ┌─ uniswap.fe:169:20 │ -149 │ if root_k > root_k_last: +169 │ if root_k > root_k_last { │ ^^^^^^^^^^^^^^^^^^^^ bool: Value -150 │ let numerator: u256 = self.total_supply * root_k - root_k_last +170 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:150:43 + ┌─ uniswap.fe:170:43 │ -150 │ let numerator: u256 = self.total_supply * root_k - root_k_last +170 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^ ^^^^^^ u256: Value │ │ │ u256: Storage { nonce: Some(2) } => Value note: - ┌─ uniswap.fe:150:43 + ┌─ uniswap.fe:170:43 │ -150 │ let numerator: u256 = self.total_supply * root_k - root_k_last +170 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:150:43 + ┌─ uniswap.fe:170:43 │ -150 │ let numerator: u256 = self.total_supply * root_k - root_k_last +170 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -151 │ let denominator: u256 = root_k * 5 + root_k_last +171 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:151:45 + ┌─ uniswap.fe:171:45 │ -151 │ let denominator: u256 = root_k * 5 + root_k_last +171 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:151:45 + ┌─ uniswap.fe:171:45 │ -151 │ let denominator: u256 = root_k * 5 + root_k_last +171 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -152 │ let liquidity: u256 = numerator / denominator +172 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:152:43 + ┌─ uniswap.fe:172:43 │ -152 │ let liquidity: u256 = numerator / denominator +172 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -153 │ if liquidity > 0: +173 │ if liquidity > 0 { │ ^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:153:24 + ┌─ uniswap.fe:173:24 │ -153 │ if liquidity > 0: +173 │ if liquidity > 0 { │ ^^^^^^^^^^^^^ bool: Value -154 │ self._mint(ctx, to: fee_to, value: liquidity) +174 │ self._mint(ctx, to: fee_to, value: liquidity) │ ^^^^ ^^^ ^^^^^^ ^^^^^^^^^ u256: Value │ │ │ │ │ │ │ address: Value @@ -2154,45 +2166,46 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:154:25 + ┌─ uniswap.fe:174:25 │ -154 │ self._mint(ctx, to: fee_to, value: liquidity) +174 │ self._mint(ctx, to: fee_to, value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -155 │ elif k_last != 0: - │ ^^^^^^ ^ u256: Value - │ │ - │ u256: Value + · +178 │ } else if k_last != 0 { + │ ^^^^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ uniswap.fe:155:14 + ┌─ uniswap.fe:178:19 │ -155 │ elif k_last != 0: - │ ^^^^^^^^^^^ bool: Value -156 │ self.k_last = 0 +178 │ } else if k_last != 0 { + │ ^^^^^^^^^^^ bool: Value +179 │ self.k_last = 0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:156:13 + ┌─ uniswap.fe:179:13 │ -156 │ self.k_last = 0 +179 │ self.k_last = 0 │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(12) } -157 │ -158 │ return fee_on +180 │ } +181 │ return fee_on │ ^^^^^^ bool: Value note: - ┌─ uniswap.fe:161:5 + ┌─ uniswap.fe:185:5 │ -161 │ ╭ pub fn mint(self, ctx: Context, to: address) -> u256: -162 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 -163 │ │ let reserve0: u256 = self.reserve0 -164 │ │ let reserve1: u256 = self.reserve1 +185 │ ╭ pub fn mint(self, ctx: Context, to: address) -> u256 { +186 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 +187 │ │ let reserve0: u256 = self.reserve0 +188 │ │ let reserve1: u256 = self.reserve1 · │ -187 │ │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) -188 │ │ return liquidity - │ ╰────────────────────────^ attributes hash: 11513995717553818344 +209 │ │ return liquidity +210 │ │ } + │ ╰─────^ attributes hash: 11513995717553818344 │ = FunctionSignature { self_decl: Some( @@ -2234,145 +2247,143 @@ note: } note: - ┌─ uniswap.fe:162:32 + ┌─ uniswap.fe:186:32 │ -162 │ let MINIMUM_LIQUIDITY: u256 = 1000 +186 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^ u256 -163 │ let reserve0: u256 = self.reserve0 +187 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -164 │ let reserve1: u256 = self.reserve1 +188 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^ u256 -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^ u256 -167 │ let amount0: u256 = balance0 - self.reserve0 +191 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^ u256 -168 │ let amount1: u256 = balance1 - self.reserve1 +192 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^ u256 -169 │ -170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +193 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ bool -171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +194 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^ u256 -172 │ let liquidity: u256 = 0 +195 │ let liquidity: u256 = 0 │ ^^^^ u256 note: - ┌─ uniswap.fe:162:39 + ┌─ uniswap.fe:186:39 │ -162 │ let MINIMUM_LIQUIDITY: u256 = 1000 +186 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^ u256: Value -163 │ let reserve0: u256 = self.reserve0 +187 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:163:30 + ┌─ uniswap.fe:187:30 │ -163 │ let reserve0: u256 = self.reserve0 +187 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -164 │ let reserve1: u256 = self.reserve1 +188 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:164:30 + ┌─ uniswap.fe:188:30 │ -164 │ let reserve1: u256 = self.reserve1 +188 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:165:41 + ┌─ uniswap.fe:189:41 │ -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:165:30 + ┌─ uniswap.fe:189:30 │ -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:165:64 + ┌─ uniswap.fe:189:64 │ -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:165:30 + ┌─ uniswap.fe:189:30 │ -165 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) +189 │ let balance0: u256 = ERC20(ctx, self.token0).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:166:41 + ┌─ uniswap.fe:190:41 │ -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:166:30 + ┌─ uniswap.fe:190:30 │ -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:166:64 + ┌─ uniswap.fe:190:64 │ -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:166:30 + ┌─ uniswap.fe:190:30 │ -166 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) +190 │ let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -167 │ let amount0: u256 = balance0 - self.reserve0 +191 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:167:40 + ┌─ uniswap.fe:191:40 │ -167 │ let amount0: u256 = balance0 - self.reserve0 +191 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:167:29 + ┌─ uniswap.fe:191:29 │ -167 │ let amount0: u256 = balance0 - self.reserve0 +191 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -168 │ let amount1: u256 = balance1 - self.reserve1 +192 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:168:40 + ┌─ uniswap.fe:192:40 │ -168 │ let amount1: u256 = balance1 - self.reserve1 +192 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:168:29 + ┌─ uniswap.fe:192:29 │ -168 │ let amount1: u256 = balance1 - self.reserve1 +192 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -169 │ -170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +193 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ u256: Value @@ -2380,132 +2391,131 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:170:28 + ┌─ uniswap.fe:193:28 │ -170 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +193 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +194 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:171:34 + ┌─ uniswap.fe:194:34 │ -171 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee +194 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value -172 │ let liquidity: u256 = 0 +195 │ let liquidity: u256 = 0 │ ^ u256: Value -173 │ if total_supply == 0: +196 │ if total_supply == 0 { │ ^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:173:12 + ┌─ uniswap.fe:196:12 │ -173 │ if total_supply == 0: +196 │ if total_supply == 0 { │ ^^^^^^^^^^^^^^^^^ bool: Value -174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +197 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:174:30 + ┌─ uniswap.fe:197:30 │ -174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +197 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:174:25 + ┌─ uniswap.fe:197:25 │ -174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +197 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:174:25 + ┌─ uniswap.fe:197:25 │ -174 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +197 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens +198 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^ ^^^ ^ u256: Value │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:175:33 + ┌─ uniswap.fe:198:33 │ -175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens +198 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:175:13 + ┌─ uniswap.fe:198:13 │ -175 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens +198 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -176 │ else: -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value - │ │ │ - │ │ u256: Value +199 │ } else { +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value + │ │ │ + │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:177:29 + ┌─ uniswap.fe:200:29 │ -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value - │ │ +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value + │ │ │ u256: Value note: - ┌─ uniswap.fe:177:29 + ┌─ uniswap.fe:200:29 │ -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value - │ │ │ - │ │ u256: Value +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256: Value + │ │ │ + │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:177:66 + ┌─ uniswap.fe:200:64 │ -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value - │ │ - │ u256: Value +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256: Value + │ │ + │ u256: Value note: - ┌─ uniswap.fe:177:66 + ┌─ uniswap.fe:200:64 │ -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:177:25 + ┌─ uniswap.fe:200:25 │ -177 │ liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -178 │ -179 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +200 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value +201 │ } +202 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:179:16 + ┌─ uniswap.fe:202:16 │ -179 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +202 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40>: Memory │ │ │ bool: Value -180 │ -181 │ self._mint(ctx, to, value: liquidity) +203 │ self._mint(ctx, to, value: liquidity) │ ^^^^ ^^^ ^^ ^^^^^^^^^ u256: Value │ │ │ │ │ │ │ address: Value @@ -2513,11 +2523,11 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:181:9 + ┌─ uniswap.fe:203:9 │ -181 │ self._mint(ctx, to, value: liquidity) +203 │ self._mint(ctx, to, value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -182 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +204 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -2527,51 +2537,50 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:182:9 + ┌─ uniswap.fe:204:9 │ -182 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +204 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -183 │ -184 │ if fee_on: +205 │ if fee_on { │ ^^^^^^ bool: Value -185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +206 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:185:13 + ┌─ uniswap.fe:206:13 │ -185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +206 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(12) } note: - ┌─ uniswap.fe:185:27 + ┌─ uniswap.fe:206:27 │ -185 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +206 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^^^^^^^^^ u256: Value -186 │ -187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +207 │ } +208 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:187:32 + ┌─ uniswap.fe:208:32 │ -187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +208 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ address: Value -188 │ return liquidity +209 │ return liquidity │ ^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:187:9 + ┌─ uniswap.fe:208:9 │ -187 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +208 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 4243961805717991435 │ = Event { @@ -2612,16 +2621,16 @@ note: } note: - ┌─ uniswap.fe:191:5 + ┌─ uniswap.fe:213:5 │ -191 │ ╭ pub fn burn(self, ctx: Context, to: address) -> (u256, u256): -192 │ │ let reserve0: u256 = self.reserve0 -193 │ │ let reserve1: u256 = self.reserve1 -194 │ │ let token0: ERC20 = ERC20(ctx, self.token0) +213 │ ╭ pub fn burn(self, ctx: Context, to: address) -> (u256, u256) { +214 │ │ let reserve0: u256 = self.reserve0 +215 │ │ let reserve1: u256 = self.reserve1 +216 │ │ let token0: ERC20 = ERC20(ctx, self.token0) · │ -216 │ │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) -217 │ │ return (amount0, amount1) - │ ╰─────────────────────────────────^ attributes hash: 4652297158603848356 +237 │ │ return (amount0, amount1) +238 │ │ } + │ ╰─────^ attributes hash: 4652297158603848356 │ = FunctionSignature { self_decl: Some( @@ -2674,139 +2683,139 @@ note: } note: - ┌─ uniswap.fe:192:23 + ┌─ uniswap.fe:214:23 │ -192 │ let reserve0: u256 = self.reserve0 +214 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -193 │ let reserve1: u256 = self.reserve1 +215 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 -194 │ let token0: ERC20 = ERC20(ctx, self.token0) +216 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -195 │ let token1: ERC20 = ERC20(ctx, self.token1) +217 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 -196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +218 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^ u256 -197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +219 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^ u256 -198 │ let liquidity: u256 = self.balances[ctx.self_address()] +220 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^ u256 -199 │ -200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +221 │ +222 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ bool -201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +223 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^ u256 -202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +224 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^ u256 -203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +225 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^ u256 note: - ┌─ uniswap.fe:192:30 + ┌─ uniswap.fe:214:30 │ -192 │ let reserve0: u256 = self.reserve0 +214 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:192:30 + ┌─ uniswap.fe:214:30 │ -192 │ let reserve0: u256 = self.reserve0 +214 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -193 │ let reserve1: u256 = self.reserve1 +215 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:193:30 + ┌─ uniswap.fe:215:30 │ -193 │ let reserve1: u256 = self.reserve1 +215 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -194 │ let token0: ERC20 = ERC20(ctx, self.token0) +216 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:194:40 + ┌─ uniswap.fe:216:40 │ -194 │ let token0: ERC20 = ERC20(ctx, self.token0) +216 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:194:29 + ┌─ uniswap.fe:216:29 │ -194 │ let token0: ERC20 = ERC20(ctx, self.token0) +216 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -195 │ let token1: ERC20 = ERC20(ctx, self.token1) +217 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:195:40 + ┌─ uniswap.fe:217:40 │ -195 │ let token1: ERC20 = ERC20(ctx, self.token1) +217 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:195:29 + ┌─ uniswap.fe:217:29 │ -195 │ let token1: ERC20 = ERC20(ctx, self.token1) +217 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +218 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:196:47 + ┌─ uniswap.fe:218:47 │ -196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +218 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:196:30 + ┌─ uniswap.fe:218:30 │ -196 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +218 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +219 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:197:47 + ┌─ uniswap.fe:219:47 │ -197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +219 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:197:30 + ┌─ uniswap.fe:219:30 │ -197 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +219 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -198 │ let liquidity: u256 = self.balances[ctx.self_address()] +220 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:198:31 + ┌─ uniswap.fe:220:31 │ -198 │ let liquidity: u256 = self.balances[ctx.self_address()] +220 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^ ^^^ Context: Memory │ │ │ Map: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:198:45 + ┌─ uniswap.fe:220:45 │ -198 │ let liquidity: u256 = self.balances[ctx.self_address()] +220 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:198:31 + ┌─ uniswap.fe:220:31 │ -198 │ let liquidity: u256 = self.balances[ctx.self_address()] +220 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Storage { nonce: None } => Value -199 │ -200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +221 │ +222 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ u256: Value @@ -2814,158 +2823,157 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:200:28 + ┌─ uniswap.fe:222:28 │ -200 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +222 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +223 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:201:34 + ┌─ uniswap.fe:223:34 │ -201 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee +223 │ let total_supply: u256 = self.total_supply # gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(2) } => Value -202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +224 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:202:29 + ┌─ uniswap.fe:224:29 │ -202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +224 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:202:29 + ┌─ uniswap.fe:224:29 │ -202 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution +224 │ let amount0: u256 = (liquidity * balance0) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +225 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:203:29 + ┌─ uniswap.fe:225:29 │ -203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +225 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:203:29 + ┌─ uniswap.fe:225:29 │ -203 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution +225 │ let amount1: u256 = (liquidity * balance1) / total_supply # using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +226 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:204:16 + ┌─ uniswap.fe:226:16 │ -204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +226 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ ^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:204:32 + ┌─ uniswap.fe:226:32 │ -204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +226 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:204:16 + ┌─ uniswap.fe:226:16 │ -204 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +226 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40>: Memory │ │ │ bool: Value -205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) +227 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) │ ^^^^ ^^^ ^^^ Context: Memory │ │ │ │ │ Context: Memory │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:205:31 + ┌─ uniswap.fe:227:31 │ -205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) +227 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:205:9 + ┌─ uniswap.fe:227:9 │ -205 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) +227 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -206 │ token0.transfer(to, amount0) +228 │ token0.transfer(to, amount0) │ ^^^^^^ ^^ ^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:206:9 + ┌─ uniswap.fe:228:9 │ -206 │ token0.transfer(to, amount0) +228 │ token0.transfer(to, amount0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -207 │ token1.transfer(to, amount1) +229 │ token1.transfer(to, amount1) │ ^^^^^^ ^^ ^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:207:9 + ┌─ uniswap.fe:229:9 │ -207 │ token1.transfer(to, amount1) +229 │ token1.transfer(to, amount1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -208 │ balance0 = token0.balanceOf(ctx.self_address()) +230 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ ERC20: Value │ u256: Value note: - ┌─ uniswap.fe:208:37 + ┌─ uniswap.fe:230:37 │ -208 │ balance0 = token0.balanceOf(ctx.self_address()) +230 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:208:20 + ┌─ uniswap.fe:230:20 │ -208 │ balance0 = token0.balanceOf(ctx.self_address()) +230 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -209 │ balance1 = token1.balanceOf(ctx.self_address()) +231 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ ERC20: Value │ u256: Value note: - ┌─ uniswap.fe:209:37 + ┌─ uniswap.fe:231:37 │ -209 │ balance1 = token1.balanceOf(ctx.self_address()) +231 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:209:20 + ┌─ uniswap.fe:231:20 │ -209 │ balance1 = token1.balanceOf(ctx.self_address()) +231 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -210 │ -211 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +232 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -2975,60 +2983,59 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:211:9 + ┌─ uniswap.fe:232:9 │ -211 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +232 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -212 │ -213 │ if fee_on: +233 │ if fee_on { │ ^^^^^^ bool: Value -214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +234 │ self.k_last = reserve0 * reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:214:13 + ┌─ uniswap.fe:234:13 │ -214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +234 │ self.k_last = reserve0 * reserve1 │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Storage { nonce: Some(12) } note: - ┌─ uniswap.fe:214:27 + ┌─ uniswap.fe:234:27 │ -214 │ self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date +234 │ self.k_last = reserve0 * reserve1 │ ^^^^^^^^^^^^^^^^^^^ u256: Value -215 │ -216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +235 │ } +236 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:216:32 + ┌─ uniswap.fe:236:32 │ -216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +236 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ ^^ address: Value │ │ │ │ │ │ │ u256: Value │ │ u256: Value │ address: Value -217 │ return (amount0, amount1) +237 │ return (amount0, amount1) │ ^^^^^^^ ^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:217:16 + ┌─ uniswap.fe:237:16 │ -217 │ return (amount0, amount1) +237 │ return (amount0, amount1) │ ^^^^^^^^^^^^^^^^^^ (u256, u256): Memory note: - ┌─ uniswap.fe:216:9 + ┌─ uniswap.fe:236:9 │ -216 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +236 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 10738919684795162003 │ = Event { @@ -3078,16 +3085,16 @@ note: } note: - ┌─ uniswap.fe:222:5 + ┌─ uniswap.fe:243:5 │ -222 │ ╭ pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address): -223 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" -224 │ │ let reserve0: u256 = self.reserve0 -225 │ │ let reserve1: u256 = self.reserve1 +243 │ ╭ pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address) { +244 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +245 │ │ let reserve0: u256 = self.reserve0 +246 │ │ let reserve1: u256 = self.reserve1 · │ -255 │ │ self._update(ctx, balance0, balance1, reserve0, reserve1) -256 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) - │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────^ attributes hash: 18411078236281700131 +279 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +280 │ │ } + │ ╰─────^ attributes hash: 18411078236281700131 │ = FunctionSignature { self_decl: Some( @@ -3149,467 +3156,468 @@ note: } note: - ┌─ uniswap.fe:224:23 + ┌─ uniswap.fe:245:23 │ -224 │ let reserve0: u256 = self.reserve0 +245 │ let reserve0: u256 = self.reserve0 │ ^^^^ u256 -225 │ let reserve1: u256 = self.reserve1 +246 │ let reserve1: u256 = self.reserve1 │ ^^^^ u256 · -228 │ let token0: ERC20 = ERC20(ctx, self.token0) +249 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -229 │ let token1: ERC20 = ERC20(ctx, self.token1) +250 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 · -242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +265 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^ u256 -243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +266 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^ u256 -244 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^ u256 -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^ u256 · -250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +273 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^ u256 -251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +274 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^ u256 note: - ┌─ uniswap.fe:223:16 + ┌─ uniswap.fe:244:16 │ -223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +244 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:223:16 + ┌─ uniswap.fe:244:16 │ -223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +244 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:223:35 + ┌─ uniswap.fe:244:35 │ -223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +244 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:223:16 + ┌─ uniswap.fe:244:16 │ -223 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +244 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<37>: Memory │ │ │ bool: Value -224 │ let reserve0: u256 = self.reserve0 +245 │ let reserve0: u256 = self.reserve0 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:224:30 + ┌─ uniswap.fe:245:30 │ -224 │ let reserve0: u256 = self.reserve0 +245 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -225 │ let reserve1: u256 = self.reserve1 +246 │ let reserve1: u256 = self.reserve1 │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:225:30 + ┌─ uniswap.fe:246:30 │ -225 │ let reserve1: u256 = self.reserve1 +246 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value -226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +247 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:226:16 + ┌─ uniswap.fe:247:16 │ -226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +247 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:226:43 + ┌─ uniswap.fe:247:43 │ -226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +247 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:226:16 + ┌─ uniswap.fe:247:16 │ -226 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +247 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<33>: Memory │ │ │ bool: Value -227 │ -228 │ let token0: ERC20 = ERC20(ctx, self.token0) +248 │ +249 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:228:40 + ┌─ uniswap.fe:249:40 │ -228 │ let token0: ERC20 = ERC20(ctx, self.token0) +249 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:228:29 + ┌─ uniswap.fe:249:29 │ -228 │ let token0: ERC20 = ERC20(ctx, self.token0) +249 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -229 │ let token1: ERC20 = ERC20(ctx, self.token1) +250 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:229:40 + ┌─ uniswap.fe:250:40 │ -229 │ let token1: ERC20 = ERC20(ctx, self.token1) +250 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:229:29 + ┌─ uniswap.fe:250:29 │ -229 │ let token1: ERC20 = ERC20(ctx, self.token1) +250 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value · -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^ ^^^^^^ ERC20: Value │ │ │ address: Value note: - ┌─ uniswap.fe:232:22 + ┌─ uniswap.fe:253:22 │ -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:232:16 + ┌─ uniswap.fe:253:16 │ -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^ ERC20: Value │ │ │ │ │ address: Value │ bool: Value note: - ┌─ uniswap.fe:232:48 + ┌─ uniswap.fe:253:48 │ -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:232:42 + ┌─ uniswap.fe:253:42 │ -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:232:16 + ┌─ uniswap.fe:253:16 │ -232 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +253 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ String<21>: Memory │ │ │ bool: Value -233 │ -234 │ if amount0_out > 0: +254 │ +255 │ if amount0_out > 0 { │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:234:12 + ┌─ uniswap.fe:255:12 │ -234 │ if amount0_out > 0: +255 │ if amount0_out > 0 { │ ^^^^^^^^^^^^^^^ bool: Value -235 │ token0.transfer(to, amount0_out) # optimistically transfer tokens +256 │ token0.transfer(to, amount0_out) # optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:235:13 + ┌─ uniswap.fe:256:13 │ -235 │ token0.transfer(to, amount0_out) # optimistically transfer tokens +256 │ token0.transfer(to, amount0_out) # optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -236 │ if amount1_out > 0: +257 │ } +258 │ if amount1_out > 0 { │ ^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:236:12 + ┌─ uniswap.fe:258:12 │ -236 │ if amount1_out > 0: +258 │ if amount1_out > 0 { │ ^^^^^^^^^^^^^^^ bool: Value -237 │ token1.transfer(to, amount1_out) # optimistically transfer tokens +259 │ token1.transfer(to, amount1_out) # optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ address: Value │ ERC20: Value note: - ┌─ uniswap.fe:237:13 + ┌─ uniswap.fe:259:13 │ -237 │ token1.transfer(to, amount1_out) # optimistically transfer tokens +259 │ token1.transfer(to, amount1_out) # optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value · -242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +265 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:242:47 + ┌─ uniswap.fe:265:47 │ -242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +265 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:242:30 + ┌─ uniswap.fe:265:30 │ -242 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +265 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +266 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:243:47 + ┌─ uniswap.fe:266:47 │ -243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +266 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:243:30 + ┌─ uniswap.fe:266:30 │ -243 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +266 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -244 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:245:82 + ┌─ uniswap.fe:268:82 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:268:32 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:44 + ┌─ uniswap.fe:268:44 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:43 + ┌─ uniswap.fe:268:43 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:268:32 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:245:32 + ┌─ uniswap.fe:268:32 │ -245 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +268 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:246:82 + ┌─ uniswap.fe:269:82 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:246:32 + ┌─ uniswap.fe:269:32 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:246:44 + ┌─ uniswap.fe:269:44 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:246:43 + ┌─ uniswap.fe:269:43 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:246:32 + ┌─ uniswap.fe:269:32 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:246:32 + ┌─ uniswap.fe:269:32 │ -246 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +269 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -247 │ -248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +270 │ +271 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:248:16 + ┌─ uniswap.fe:271:16 │ -248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +271 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ bool: Value note: - ┌─ uniswap.fe:248:34 + ┌─ uniswap.fe:271:34 │ -248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +271 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:248:16 + ┌─ uniswap.fe:271:16 │ -248 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +271 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<36>: Memory │ │ │ bool: Value -249 │ -250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +272 │ +273 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:250:39 + ┌─ uniswap.fe:273:39 │ -250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +273 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:250:57 + ┌─ uniswap.fe:273:57 │ -250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +273 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:250:39 + ┌─ uniswap.fe:273:39 │ -250 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +273 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +274 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^ ^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:251:39 + ┌─ uniswap.fe:274:39 │ -251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +274 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:251:57 + ┌─ uniswap.fe:274:57 │ -251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +274 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:251:39 + ┌─ uniswap.fe:274:39 │ -251 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +274 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -252 │ -253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +275 │ +276 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:253:16 + ┌─ uniswap.fe:276:16 │ -253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +276 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:253:57 + ┌─ uniswap.fe:276:57 │ -253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +276 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:253:57 + ┌─ uniswap.fe:276:57 │ -253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +276 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:253:16 + ┌─ uniswap.fe:276:16 │ -253 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +276 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ String<12>: Memory │ │ │ bool: Value -254 │ -255 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +277 │ +278 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -3619,19 +3627,19 @@ note: │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:255:9 + ┌─ uniswap.fe:278:9 │ -255 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +278 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +279 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^ ^^^ Context: Memory │ │ │ Context: Memory note: - ┌─ uniswap.fe:256:32 + ┌─ uniswap.fe:279:32 │ -256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +279 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^ address: Value │ │ │ │ │ │ │ │ │ │ │ u256: Value @@ -3641,9 +3649,9 @@ note: │ address: Value note: - ┌─ uniswap.fe:256:9 + ┌─ uniswap.fe:279:9 │ -256 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +279 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 16055667627771619025 │ = Event { @@ -3715,15 +3723,15 @@ note: } note: - ┌─ uniswap.fe:259:5 + ┌─ uniswap.fe:283:5 │ -259 │ ╭ pub fn skim(self, ctx: Context, to: address): -260 │ │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings -261 │ │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings -262 │ │ -263 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) -264 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) - │ ╰─────────────────────────────────────────────────────────────────────────────────^ attributes hash: 9469713119497359790 +283 │ ╭ pub fn skim(self, ctx: Context, to: address) { +284 │ │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +285 │ │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +286 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +287 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +288 │ │ } + │ ╰─────^ attributes hash: 9469713119497359790 │ = FunctionSignature { self_decl: Some( @@ -3763,50 +3771,49 @@ note: } note: - ┌─ uniswap.fe:260:21 + ┌─ uniswap.fe:284:21 │ -260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +284 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^ ERC20 -261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +285 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^ ERC20 note: - ┌─ uniswap.fe:260:35 + ┌─ uniswap.fe:284:35 │ -260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +284 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:260:40 + ┌─ uniswap.fe:284:40 │ -260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +284 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:260:29 + ┌─ uniswap.fe:284:29 │ -260 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings +284 │ let token0: ERC20 = ERC20(ctx, self.token0) # gas savings │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +285 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:261:40 + ┌─ uniswap.fe:285:40 │ -261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +285 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:261:29 + ┌─ uniswap.fe:285:29 │ -261 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings +285 │ let token1: ERC20 = ERC20(ctx, self.token1) # gas savings │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -262 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ │ │ ERC20: Value @@ -3814,37 +3821,37 @@ note: │ ERC20: Value note: - ┌─ uniswap.fe:263:46 + ┌─ uniswap.fe:286:46 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:263:29 + ┌─ uniswap.fe:286:29 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:263:68 + ┌─ uniswap.fe:286:68 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value note: - ┌─ uniswap.fe:263:29 + ┌─ uniswap.fe:286:29 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:263:9 + ┌─ uniswap.fe:286:9 │ -263 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context: Memory │ │ │ │ │ │ │ ERC20: Value @@ -3852,48 +3859,48 @@ note: │ ERC20: Value note: - ┌─ uniswap.fe:264:46 + ┌─ uniswap.fe:287:46 │ -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:264:29 + ┌─ uniswap.fe:287:29 │ -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:264:68 + ┌─ uniswap.fe:287:68 │ -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:264:29 + ┌─ uniswap.fe:287:29 │ -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value note: - ┌─ uniswap.fe:264:9 + ┌─ uniswap.fe:287:9 │ -264 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool: Value note: - ┌─ uniswap.fe:267:5 + ┌─ uniswap.fe:291:5 │ -267 │ ╭ pub fn sync(self, ctx: Context): -268 │ │ let token0: ERC20 = ERC20(ctx, self.token0) -269 │ │ let token1: ERC20 = ERC20(ctx, self.token1) -270 │ │ self._update(ctx, +291 │ ╭ pub fn sync(self, ctx: Context) { +292 │ │ let token0: ERC20 = ERC20(ctx, self.token0) +293 │ │ let token1: ERC20 = ERC20(ctx, self.token1) +294 │ │ self._update(ctx, · │ -273 │ │ reserve0: self.reserve0, -274 │ │ reserve1: self.reserve1) - │ ╰─────────────────────────────────────────────^ attributes hash: 1731341862738941170 +298 │ │ reserve1: self.reserve1) +299 │ │ } + │ ╰─────^ attributes hash: 1731341862738941170 │ = FunctionSignature { self_decl: Some( @@ -3924,145 +3931,146 @@ note: } note: - ┌─ uniswap.fe:268:21 + ┌─ uniswap.fe:292:21 │ -268 │ let token0: ERC20 = ERC20(ctx, self.token0) +292 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^ ERC20 -269 │ let token1: ERC20 = ERC20(ctx, self.token1) +293 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^ ERC20 note: - ┌─ uniswap.fe:268:35 + ┌─ uniswap.fe:292:35 │ -268 │ let token0: ERC20 = ERC20(ctx, self.token0) +292 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:268:40 + ┌─ uniswap.fe:292:40 │ -268 │ let token0: ERC20 = ERC20(ctx, self.token0) +292 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^ address: Storage { nonce: Some(5) } => Value note: - ┌─ uniswap.fe:268:29 + ┌─ uniswap.fe:292:29 │ -268 │ let token0: ERC20 = ERC20(ctx, self.token0) +292 │ let token0: ERC20 = ERC20(ctx, self.token0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -269 │ let token1: ERC20 = ERC20(ctx, self.token1) +293 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^ ^^^^ UniswapV2Pair: Value │ │ │ Context: Memory note: - ┌─ uniswap.fe:269:40 + ┌─ uniswap.fe:293:40 │ -269 │ let token1: ERC20 = ERC20(ctx, self.token1) +293 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^ address: Storage { nonce: Some(6) } => Value note: - ┌─ uniswap.fe:269:29 + ┌─ uniswap.fe:293:29 │ -269 │ let token1: ERC20 = ERC20(ctx, self.token1) +293 │ let token1: ERC20 = ERC20(ctx, self.token1) │ ^^^^^^^^^^^^^^^^^^^^^^^ ERC20: Value -270 │ self._update(ctx, +294 │ self._update(ctx, │ ^^^^ ^^^ Context: Memory │ │ │ UniswapV2Pair: Value -271 │ balance0: token0.balanceOf(ctx.self_address()), +295 │ balance0: token0.balanceOf(ctx.self_address()), │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:271:49 + ┌─ uniswap.fe:295:49 │ -271 │ balance0: token0.balanceOf(ctx.self_address()), +295 │ balance0: token0.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:271:32 + ┌─ uniswap.fe:295:32 │ -271 │ balance0: token0.balanceOf(ctx.self_address()), +295 │ balance0: token0.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -272 │ balance1: token1.balanceOf(ctx.self_address()), +296 │ balance1: token1.balanceOf(ctx.self_address()), │ ^^^^^^ ^^^ Context: Memory │ │ │ ERC20: Value note: - ┌─ uniswap.fe:272:49 + ┌─ uniswap.fe:296:49 │ -272 │ balance1: token1.balanceOf(ctx.self_address()), +296 │ balance1: token1.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:272:32 + ┌─ uniswap.fe:296:32 │ -272 │ balance1: token1.balanceOf(ctx.self_address()), +296 │ balance1: token1.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -273 │ reserve0: self.reserve0, +297 │ reserve0: self.reserve0, │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:273:32 + ┌─ uniswap.fe:297:32 │ -273 │ reserve0: self.reserve0, +297 │ reserve0: self.reserve0, │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(7) } => Value -274 │ reserve1: self.reserve1) +298 │ reserve1: self.reserve1) │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:274:32 + ┌─ uniswap.fe:298:32 │ -274 │ reserve1: self.reserve1) +298 │ reserve1: self.reserve1) │ ^^^^^^^^^^^^^ u256: Storage { nonce: Some(8) } => Value note: - ┌─ uniswap.fe:270:9 + ┌─ uniswap.fe:294:9 │ -270 │ ╭ self._update(ctx, -271 │ │ balance0: token0.balanceOf(ctx.self_address()), -272 │ │ balance1: token1.balanceOf(ctx.self_address()), -273 │ │ reserve0: self.reserve0, -274 │ │ reserve1: self.reserve1) +294 │ ╭ self._update(ctx, +295 │ │ balance0: token0.balanceOf(ctx.self_address()), +296 │ │ balance1: token1.balanceOf(ctx.self_address()), +297 │ │ reserve0: self.reserve0, +298 │ │ reserve1: self.reserve1) │ ╰─────────────────────────────────────────────^ (): Value note: - ┌─ uniswap.fe:277:5 + ┌─ uniswap.fe:303:5 │ -277 │ fee_to: address +303 │ fee_to: address │ ^^^^^^^^^^^^^^^ address -278 │ fee_to_setter: address +304 │ fee_to_setter: address │ ^^^^^^^^^^^^^^^^^^^^^^ address -279 │ -280 │ pairs: Map> +305 │ +306 │ pairs: Map> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> -281 │ -282 │ all_pairs: Array +307 │ +308 │ all_pairs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -283 │ pair_counter: u256 +309 │ pair_counter: u256 │ ^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:286:9 + ┌─ uniswap.fe:312:9 │ -286 │ idx token0: address +312 │ idx token0: address │ ^^^^^^^^^^^^^^^^^^^ address -287 │ idx token1: address +313 │ idx token1: address │ ^^^^^^^^^^^^^^^^^^^ address -288 │ pair: address +314 │ pair: address │ ^^^^^^^^^^^^^ address -289 │ index: u256 +315 │ index: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:294:5 + ┌─ uniswap.fe:322:5 │ -294 │ ╭ pub fn fee_to(self) -> address: -295 │ │ return self.fee_to - │ ╰──────────────────────────^ attributes hash: 227275695522088782 +322 │ ╭ pub fn fee_to(self) -> address { +323 │ │ return self.fee_to +324 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -4078,23 +4086,24 @@ note: } note: - ┌─ uniswap.fe:295:16 + ┌─ uniswap.fe:323:16 │ -295 │ return self.fee_to +323 │ return self.fee_to │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:295:16 + ┌─ uniswap.fe:323:16 │ -295 │ return self.fee_to +323 │ return self.fee_to │ ^^^^^^^^^^^ address: Storage { nonce: Some(0) } => Value note: - ┌─ uniswap.fe:297:5 + ┌─ uniswap.fe:326:5 │ -297 │ ╭ pub fn fee_to_setter(self) -> address: -298 │ │ return self.fee_to_setter - │ ╰─────────────────────────────────^ attributes hash: 227275695522088782 +326 │ ╭ pub fn fee_to_setter(self) -> address { +327 │ │ return self.fee_to_setter +328 │ │ } + │ ╰─────^ attributes hash: 227275695522088782 │ = FunctionSignature { self_decl: Some( @@ -4110,23 +4119,24 @@ note: } note: - ┌─ uniswap.fe:298:16 + ┌─ uniswap.fe:327:16 │ -298 │ return self.fee_to_setter +327 │ return self.fee_to_setter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:298:16 + ┌─ uniswap.fe:327:16 │ -298 │ return self.fee_to_setter +327 │ return self.fee_to_setter │ ^^^^^^^^^^^^^^^^^^ address: Storage { nonce: Some(1) } => Value note: - ┌─ uniswap.fe:300:5 + ┌─ uniswap.fe:330:5 │ -300 │ ╭ pub fn all_pairs_length(self) -> u256: -301 │ │ return self.pair_counter - │ ╰────────────────────────────────^ attributes hash: 11773348765973600208 +330 │ ╭ pub fn all_pairs_length(self) -> u256 { +331 │ │ return self.pair_counter +332 │ │ } + │ ╰─────^ attributes hash: 11773348765973600208 │ = FunctionSignature { self_decl: Some( @@ -4144,28 +4154,28 @@ note: } note: - ┌─ uniswap.fe:301:16 + ┌─ uniswap.fe:331:16 │ -301 │ return self.pair_counter +331 │ return self.pair_counter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:301:16 + ┌─ uniswap.fe:331:16 │ -301 │ return self.pair_counter +331 │ return self.pair_counter │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:303:5 + ┌─ uniswap.fe:334:5 │ -303 │ ╭ pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address: -304 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" -305 │ │ -306 │ │ let token0: address = token_a if token_a < token_b else token_b +334 │ ╭ pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address { +335 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +336 │ │ +337 │ │ let token0: address = token_a if token_a < token_b else token_b · │ -320 │ │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) -321 │ │ return address(pair) - │ ╰────────────────────────────^ attributes hash: 8455575078477255668 +352 │ │ return address(pair) +353 │ │ } + │ ╰─────^ attributes hash: 8455575078477255668 │ = FunctionSignature { self_decl: Some( @@ -4218,296 +4228,296 @@ note: } note: - ┌─ uniswap.fe:306:21 + ┌─ uniswap.fe:337:21 │ -306 │ let token0: address = token_a if token_a < token_b else token_b +337 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ address -307 │ let token1: address = token_a if token_a > token_b else token_b +338 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ address · -311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +342 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^ u256 -312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +343 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^^^^^^^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:304:16 + ┌─ uniswap.fe:335:16 │ -304 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +335 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:304:16 + ┌─ uniswap.fe:335:16 │ -304 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +335 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<30>: Memory │ │ │ bool: Value -305 │ -306 │ let token0: address = token_a if token_a < token_b else token_b +336 │ +337 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:306:31 + ┌─ uniswap.fe:337:31 │ -306 │ let token0: address = token_a if token_a < token_b else token_b +337 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ │ │ bool: Value │ address: Value note: - ┌─ uniswap.fe:306:31 + ┌─ uniswap.fe:337:31 │ -306 │ let token0: address = token_a if token_a < token_b else token_b +337 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -307 │ let token1: address = token_a if token_a > token_b else token_b +338 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:307:31 + ┌─ uniswap.fe:338:31 │ -307 │ let token1: address = token_a if token_a > token_b else token_b +338 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address: Value │ │ │ │ │ bool: Value │ address: Value note: - ┌─ uniswap.fe:307:31 + ┌─ uniswap.fe:338:31 │ -307 │ let token1: address = token_a if token_a > token_b else token_b +338 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address: Value -308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +339 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^ ^ u256: Value │ │ │ address: Value note: - ┌─ uniswap.fe:308:26 + ┌─ uniswap.fe:339:26 │ -308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +339 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:308:16 + ┌─ uniswap.fe:339:16 │ -308 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +339 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ String<23>: Memory │ │ │ bool: Value -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:309:16 + ┌─ uniswap.fe:340:16 │ -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:309:16 + ┌─ uniswap.fe:340:16 │ -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:309:16 + ┌─ uniswap.fe:340:16 │ -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ address: Storage { nonce: None } => Value note: - ┌─ uniswap.fe:309:46 + ┌─ uniswap.fe:340:46 │ -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:309:16 + ┌─ uniswap.fe:340:16 │ -309 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +340 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ String<22>: Memory │ │ │ bool: Value -310 │ -311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +341 │ +342 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^ ^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:311:36 + ┌─ uniswap.fe:342:36 │ -311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +342 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^ (address, address): Memory note: - ┌─ uniswap.fe:311:36 + ┌─ uniswap.fe:342:36 │ -311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +342 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array: Memory note: - ┌─ uniswap.fe:311:26 + ┌─ uniswap.fe:342:26 │ -311 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +342 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256: Value -312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +343 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^ ^ ^^^^ u256: Value │ │ │ │ │ u256: Value │ Context: Memory note: - ┌─ uniswap.fe:312:35 + ┌─ uniswap.fe:343:35 │ -312 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +343 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Pair: Value -313 │ pair.initialize(token0, token1) +344 │ pair.initialize(token0, token1) │ ^^^^ ^^^^^^ ^^^^^^ address: Value │ │ │ │ │ address: Value │ UniswapV2Pair: Value note: - ┌─ uniswap.fe:313:9 + ┌─ uniswap.fe:344:9 │ -313 │ pair.initialize(token0, token1) +344 │ pair.initialize(token0, token1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (): Value -314 │ -315 │ self.pairs[token0][token1] = address(pair) +345 │ +346 │ self.pairs[token0][token1] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:315:9 + ┌─ uniswap.fe:346:9 │ -315 │ self.pairs[token0][token1] = address(pair) +346 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:315:9 + ┌─ uniswap.fe:346:9 │ -315 │ self.pairs[token0][token1] = address(pair) +346 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:315:9 + ┌─ uniswap.fe:346:9 │ -315 │ self.pairs[token0][token1] = address(pair) +346 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:315:38 + ┌─ uniswap.fe:346:38 │ -315 │ self.pairs[token0][token1] = address(pair) +346 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^ address: Value -316 │ self.pairs[token1][token0] = address(pair) +347 │ self.pairs[token1][token0] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:316:9 + ┌─ uniswap.fe:347:9 │ -316 │ self.pairs[token1][token0] = address(pair) +347 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map>: Storage { nonce: Some(2) } note: - ┌─ uniswap.fe:316:9 + ┌─ uniswap.fe:347:9 │ -316 │ self.pairs[token1][token0] = address(pair) +347 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ Map: Storage { nonce: None } note: - ┌─ uniswap.fe:316:9 + ┌─ uniswap.fe:347:9 │ -316 │ self.pairs[token1][token0] = address(pair) +347 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:316:38 + ┌─ uniswap.fe:347:38 │ -316 │ self.pairs[token1][token0] = address(pair) +347 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^ address: Value -317 │ self.all_pairs[self.pair_counter] = address(pair) +348 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:317:9 + ┌─ uniswap.fe:348:9 │ -317 │ self.all_pairs[self.pair_counter] = address(pair) +348 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ Array: Storage { nonce: Some(3) } note: - ┌─ uniswap.fe:317:24 + ┌─ uniswap.fe:348:24 │ -317 │ self.all_pairs[self.pair_counter] = address(pair) +348 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:317:9 + ┌─ uniswap.fe:348:9 │ -317 │ self.all_pairs[self.pair_counter] = address(pair) +348 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ address: Storage { nonce: None } note: - ┌─ uniswap.fe:317:45 + ┌─ uniswap.fe:348:45 │ -317 │ self.all_pairs[self.pair_counter] = address(pair) +348 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^ address: Value -318 │ self.pair_counter = self.pair_counter + 1 +349 │ self.pair_counter = self.pair_counter + 1 │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:318:9 + ┌─ uniswap.fe:349:9 │ -318 │ self.pair_counter = self.pair_counter + 1 +349 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ u256: Storage { nonce: Some(4) } note: - ┌─ uniswap.fe:318:29 + ┌─ uniswap.fe:349:29 │ -318 │ self.pair_counter = self.pair_counter + 1 +349 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Storage { nonce: Some(4) } => Value note: - ┌─ uniswap.fe:318:29 + ┌─ uniswap.fe:349:29 │ -318 │ self.pair_counter = self.pair_counter + 1 +349 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^^^^^ u256: Value -319 │ -320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +350 │ +351 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^ ^^^^^^ ^^^^^^ ^^^^ UniswapV2Pair: Value │ │ │ │ │ │ │ address: Value @@ -4515,31 +4525,31 @@ note: │ Context: Memory note: - ┌─ uniswap.fe:320:53 + ┌─ uniswap.fe:351:53 │ -320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +351 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ address: Value note: - ┌─ uniswap.fe:320:75 + ┌─ uniswap.fe:351:75 │ -320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +351 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^^^^^ u256: Storage { nonce: Some(4) } => Value -321 │ return address(pair) +352 │ return address(pair) │ ^^^^ UniswapV2Pair: Value note: - ┌─ uniswap.fe:321:16 + ┌─ uniswap.fe:352:16 │ -321 │ return address(pair) +352 │ return address(pair) │ ^^^^^^^^^^^^^ address: Value note: - ┌─ uniswap.fe:320:9 + ┌─ uniswap.fe:351:9 │ -320 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +351 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attributes hash: 13094055123344570742 │ = Event { @@ -4587,12 +4597,13 @@ note: } note: - ┌─ uniswap.fe:323:5 + ┌─ uniswap.fe:355:5 │ -323 │ ╭ pub fn set_fee_to(self, ctx: Context, fee_to: address): -324 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" -325 │ │ self.fee_to = fee_to - │ ╰────────────────────────────^ attributes hash: 9061125162615165722 +355 │ ╭ pub fn set_fee_to(self, ctx: Context, fee_to: address) { +356 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +357 │ │ self.fee_to = fee_to +358 │ │ } + │ ╰─────^ attributes hash: 9061125162615165722 │ = FunctionSignature { self_decl: Some( @@ -4632,50 +4643,51 @@ note: } note: - ┌─ uniswap.fe:324:16 + ┌─ uniswap.fe:356:16 │ -324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +356 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:324:16 + ┌─ uniswap.fe:356:16 │ -324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +356 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory: Value │ │ │ address: Value note: - ┌─ uniswap.fe:324:36 + ┌─ uniswap.fe:356:36 │ -324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +356 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^ address: Storage { nonce: Some(1) } => Value note: - ┌─ uniswap.fe:324:16 + ┌─ uniswap.fe:356:16 │ -324 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +356 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -325 │ self.fee_to = fee_to +357 │ self.fee_to = fee_to │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:325:9 + ┌─ uniswap.fe:357:9 │ -325 │ self.fee_to = fee_to +357 │ self.fee_to = fee_to │ ^^^^^^^^^^^ ^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(0) } note: - ┌─ uniswap.fe:327:5 + ┌─ uniswap.fe:360:5 │ -327 │ ╭ pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address): -328 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" -329 │ │ self.fee_to_setter = fee_to_setter - │ ╰──────────────────────────────────────────^ attributes hash: 16865322734649050051 +360 │ ╭ pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address) { +361 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +362 │ │ self.fee_to_setter = fee_to_setter +363 │ │ } + │ ╰─────^ attributes hash: 16865322734649050051 │ = FunctionSignature { self_decl: Some( @@ -4715,48 +4727,48 @@ note: } note: - ┌─ uniswap.fe:328:16 + ┌─ uniswap.fe:361:16 │ -328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +361 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context: Memory note: - ┌─ uniswap.fe:328:16 + ┌─ uniswap.fe:361:16 │ -328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +361 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address: Value │ │ │ address: Value note: - ┌─ uniswap.fe:328:16 + ┌─ uniswap.fe:361:16 │ -328 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +361 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20>: Memory │ │ │ bool: Value -329 │ self.fee_to_setter = fee_to_setter +362 │ self.fee_to_setter = fee_to_setter │ ^^^^ UniswapV2Factory: Value note: - ┌─ uniswap.fe:329:9 + ┌─ uniswap.fe:362:9 │ -329 │ self.fee_to_setter = fee_to_setter +362 │ self.fee_to_setter = fee_to_setter │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address: Value │ │ │ address: Storage { nonce: Some(1) } note: - ┌─ uniswap.fe:332:1 + ┌─ uniswap.fe:366:1 │ -332 │ ╭ fn sqrt(_ val: u256) -> u256: -333 │ │ let z: u256 -334 │ │ if (val > 3): -335 │ │ z = val +366 │ ╭ fn sqrt(_ val: u256) -> u256 { +367 │ │ let z: u256 +368 │ │ if val > 3 { +369 │ │ z = val · │ -341 │ │ z = 1 -342 │ │ return z - │ ╰────────────^ attributes hash: 4892692935064256824 +378 │ │ return z +379 │ │ } + │ ╰─^ attributes hash: 4892692935064256824 │ = FunctionSignature { self_decl: None, @@ -4786,113 +4798,116 @@ note: } note: - ┌─ uniswap.fe:333:12 + ┌─ uniswap.fe:367:12 │ -333 │ let z: u256 +367 │ let z: u256 │ ^^^^ u256 · -336 │ let x: u256 = val / 2 + 1 +370 │ let x: u256 = val / 2 + 1 │ ^^^^ u256 note: - ┌─ uniswap.fe:334:9 + ┌─ uniswap.fe:368:8 │ -334 │ if (val > 3): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value +368 │ if val > 3 { + │ ^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ uniswap.fe:334:8 + ┌─ uniswap.fe:368:8 │ -334 │ if (val > 3): - │ ^^^^^^^^^ bool: Value -335 │ z = val +368 │ if val > 3 { + │ ^^^^^^^ bool: Value +369 │ z = val │ ^ ^^^ u256: Value │ │ │ u256: Value -336 │ let x: u256 = val / 2 + 1 +370 │ let x: u256 = val / 2 + 1 │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:336:23 + ┌─ uniswap.fe:370:23 │ -336 │ let x: u256 = val / 2 + 1 +370 │ let x: u256 = val / 2 + 1 │ ^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:336:23 + ┌─ uniswap.fe:370:23 │ -336 │ let x: u256 = val / 2 + 1 +370 │ let x: u256 = val / 2 + 1 │ ^^^^^^^^^^^ u256: Value -337 │ while (x < z): - │ ^ ^ u256: Value - │ │ - │ u256: Value +371 │ while x < z { + │ ^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ uniswap.fe:337:15 + ┌─ uniswap.fe:371:15 │ -337 │ while (x < z): - │ ^^^^^^^ bool: Value -338 │ z = x +371 │ while x < z { + │ ^^^^^ bool: Value +372 │ z = x │ ^ ^ u256: Value │ │ │ u256: Value -339 │ x = (val / x + x) / 2 +373 │ x = (val / x + x) / 2 │ ^ ^^^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ uniswap.fe:339:18 + ┌─ uniswap.fe:373:18 │ -339 │ x = (val / x + x) / 2 +373 │ x = (val / x + x) / 2 │ ^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:339:17 + ┌─ uniswap.fe:373:17 │ -339 │ x = (val / x + x) / 2 +373 │ x = (val / x + x) / 2 │ ^^^^^^^^^^^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:339:17 + ┌─ uniswap.fe:373:17 │ -339 │ x = (val / x + x) / 2 +373 │ x = (val / x + x) / 2 │ ^^^^^^^^^^^^^^^^^ u256: Value -340 │ elif (val != 0): - │ ^^^ ^ u256: Value - │ │ - │ u256: Value +374 │ } +375 │ } else if val != 0 { + │ ^^^ ^ u256: Value + │ │ + │ u256: Value note: - ┌─ uniswap.fe:340:10 + ┌─ uniswap.fe:375:15 │ -340 │ elif (val != 0): - │ ^^^^^^^^^^ bool: Value -341 │ z = 1 +375 │ } else if val != 0 { + │ ^^^^^^^^ bool: Value +376 │ z = 1 │ ^ ^ u256: Value │ │ │ u256: Value -342 │ return z +377 │ } +378 │ return z │ ^ u256: Value note: - ┌─ uniswap.fe:344:1 + ┌─ uniswap.fe:381:1 │ -344 │ ╭ fn min(_ x: u256, _ y: u256) -> u256: -345 │ │ return x if x < y else y - │ ╰────────────────────────────^ attributes hash: 4448606202021980030 +381 │ ╭ fn min(_ x: u256, _ y: u256) -> u256 { +382 │ │ return x if x < y else y +383 │ │ } + │ ╰─^ attributes hash: 4448606202021980030 │ = FunctionSignature { self_decl: None, @@ -4935,26 +4950,26 @@ note: } note: - ┌─ uniswap.fe:345:17 + ┌─ uniswap.fe:382:17 │ -345 │ return x if x < y else y +382 │ return x if x < y else y │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ uniswap.fe:345:12 + ┌─ uniswap.fe:382:12 │ -345 │ return x if x < y else y +382 │ return x if x < y else y │ ^ ^^^^^ ^ u256: Value │ │ │ │ │ bool: Value │ u256: Value note: - ┌─ uniswap.fe:345:12 + ┌─ uniswap.fe:382:12 │ -345 │ return x if x < y else y +382 │ return x if x < y else y │ ^^^^^^^^^^^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__while_loop.snap b/crates/analyzer/tests/snapshots/analysis__while_loop.snap index d86e016338..8d8879e6ac 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop.snap @@ -4,29 +4,29 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ while_loop.fe:2:5 - │ -2 │ ╭ pub fn bar() -> u256: -3 │ │ let val: u256 = 0 -4 │ │ while val < 2: -5 │ │ val = val + 1 -6 │ │ if val == 2: -7 │ │ val = 3 -8 │ │ return val - │ ╰──────────────────^ attributes hash: 6115314201970082834 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ while_loop.fe:2:5 + │ + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ let val: u256 = 0 + 4 │ │ while val < 2 { + 5 │ │ val = val + 1 + · │ +10 │ │ return val +11 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: ┌─ while_loop.fe:3:18 @@ -39,7 +39,7 @@ note: │ 3 │ let val: u256 = 0 │ ^ u256: Value -4 │ while val < 2: +4 │ while val < 2 { │ ^^^ ^ u256: Value │ │ │ u256: Value @@ -47,7 +47,7 @@ note: note: ┌─ while_loop.fe:4:15 │ -4 │ while val < 2: +4 │ while val < 2 { │ ^^^^^^^ bool: Value 5 │ val = val + 1 │ ^^^ ^^^ ^ u256: Value @@ -60,21 +60,22 @@ note: │ 5 │ val = val + 1 │ ^^^^^^^ u256: Value -6 │ if val == 2: +6 │ if val == 2 { │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ while_loop.fe:6:16 - │ -6 │ if val == 2: - │ ^^^^^^^^ bool: Value -7 │ val = 3 - │ ^^^ ^ u256: Value - │ │ - │ u256: Value -8 │ return val - │ ^^^ u256: Value + ┌─ while_loop.fe:6:16 + │ + 6 │ if val == 2 { + │ ^^^^^^^^ bool: Value + 7 │ val = 3 + │ ^^^ ^ u256: Value + │ │ + │ u256: Value + · +10 │ return val + │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap b/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap index 0d63533196..29ea6a30fd 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap @@ -6,13 +6,14 @@ expression: "build_snapshot(&db, module)" note: ┌─ while_loop_with_break.fe:2:5 │ -2 │ ╭ pub fn bar() -> u256: +2 │ ╭ pub fn bar() -> u256 { 3 │ │ let val: u256 = 0 -4 │ │ while val < 2: +4 │ │ while val < 2 { 5 │ │ val = val + 1 -6 │ │ break -7 │ │ return val - │ ╰──────────────────^ attributes hash: 6115314201970082834 + · │ +8 │ │ return val +9 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -38,7 +39,7 @@ note: │ 3 │ let val: u256 = 0 │ ^ u256: Value -4 │ while val < 2: +4 │ while val < 2 { │ ^^^ ^ u256: Value │ │ │ u256: Value @@ -46,7 +47,7 @@ note: note: ┌─ while_loop_with_break.fe:4:15 │ -4 │ while val < 2: +4 │ while val < 2 { │ ^^^^^^^ bool: Value 5 │ val = val + 1 │ ^^^ ^^^ ^ u256: Value @@ -59,8 +60,8 @@ note: │ 5 │ val = val + 1 │ ^^^^^^^ u256: Value -6 │ break -7 │ return val + · +8 │ return val │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__while_loop_with_break_2.snap b/crates/analyzer/tests/snapshots/analysis__while_loop_with_break_2.snap index fdb03b312d..5cb31858a3 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop_with_break_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop_with_break_2.snap @@ -4,29 +4,29 @@ expression: "build_snapshot(&db, module)" --- note: - ┌─ while_loop_with_break_2.fe:2:5 - │ -2 │ ╭ pub fn bar() -> u256: -3 │ │ let val: u256 = 0 -4 │ │ while val < 2: -5 │ │ val = val + 1 -6 │ │ if val == 1: -7 │ │ break -8 │ │ return val - │ ╰──────────────────^ attributes hash: 6115314201970082834 - │ - = FunctionSignature { - self_decl: None, - ctx_decl: None, - params: [], - return_type: Ok( - Base( - Numeric( - U256, - ), - ), - ), - } + ┌─ while_loop_with_break_2.fe:2:5 + │ + 2 │ ╭ pub fn bar() -> u256 { + 3 │ │ let val: u256 = 0 + 4 │ │ while val < 2 { + 5 │ │ val = val + 1 + · │ +10 │ │ return val +11 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 + │ + = FunctionSignature { + self_decl: None, + ctx_decl: None, + params: [], + return_type: Ok( + Base( + Numeric( + U256, + ), + ), + ), + } note: ┌─ while_loop_with_break_2.fe:3:18 @@ -39,7 +39,7 @@ note: │ 3 │ let val: u256 = 0 │ ^ u256: Value -4 │ while val < 2: +4 │ while val < 2 { │ ^^^ ^ u256: Value │ │ │ u256: Value @@ -47,7 +47,7 @@ note: note: ┌─ while_loop_with_break_2.fe:4:15 │ -4 │ while val < 2: +4 │ while val < 2 { │ ^^^^^^^ bool: Value 5 │ val = val + 1 │ ^^^ ^^^ ^ u256: Value @@ -60,18 +60,18 @@ note: │ 5 │ val = val + 1 │ ^^^^^^^ u256: Value -6 │ if val == 1: +6 │ if val == 1 { │ ^^^ ^ u256: Value │ │ │ u256: Value note: - ┌─ while_loop_with_break_2.fe:6:16 - │ -6 │ if val == 1: - │ ^^^^^^^^ bool: Value -7 │ break -8 │ return val - │ ^^^ u256: Value + ┌─ while_loop_with_break_2.fe:6:16 + │ + 6 │ if val == 1 { + │ ^^^^^^^^ bool: Value + · +10 │ return val + │ ^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap b/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap index 4c8b02724d..3ad21cdf94 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap @@ -6,14 +6,14 @@ expression: "build_snapshot(&db, module)" note: ┌─ while_loop_with_continue.fe:2:5 │ - 2 │ ╭ pub fn bar() -> u256: + 2 │ ╭ pub fn bar() -> u256 { 3 │ │ let i: u256 = 0 4 │ │ let counter: u256 = 0 - 5 │ │ + 5 │ │ while i < 2 { · │ -10 │ │ counter = counter + 1 -11 │ │ return counter - │ ╰──────────────────────^ attributes hash: 6115314201970082834 +12 │ │ return counter +13 │ │ } + │ ╰─────^ attributes hash: 6115314201970082834 │ = FunctionSignature { self_decl: None, @@ -43,39 +43,38 @@ note: │ ^ u256: Value 4 │ let counter: u256 = 0 │ ^ u256: Value -5 │ -6 │ while i < 2: +5 │ while i < 2 { │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ while_loop_with_continue.fe:6:15 + ┌─ while_loop_with_continue.fe:5:15 │ -6 │ while i < 2: +5 │ while i < 2 { │ ^^^^^ bool: Value -7 │ i = i + 1 +6 │ i = i + 1 │ ^ ^ ^ u256: Value │ │ │ │ │ u256: Value │ u256: Value note: - ┌─ while_loop_with_continue.fe:7:17 + ┌─ while_loop_with_continue.fe:6:17 │ -7 │ i = i + 1 +6 │ i = i + 1 │ ^^^^^ u256: Value -8 │ if i == 1: +7 │ if i == 1 { │ ^ ^ u256: Value │ │ │ u256: Value note: - ┌─ while_loop_with_continue.fe:8:16 + ┌─ while_loop_with_continue.fe:7:16 │ - 8 │ if i == 1: + 7 │ if i == 1 { │ ^^^^^^ bool: Value - 9 │ continue + · 10 │ counter = counter + 1 │ ^^^^^^^ ^^^^^^^ ^ u256: Value │ │ │ @@ -87,7 +86,8 @@ note: │ 10 │ counter = counter + 1 │ ^^^^^^^^^^^ u256: Value -11 │ return counter +11 │ } +12 │ return counter │ ^^^^^^^ u256: Value diff --git a/crates/analyzer/tests/snapshots/errors__bad_ingot.snap b/crates/analyzer/tests/snapshots/errors__bad_ingot.snap index 52a29e4426..c57a325fef 100644 --- a/crates/analyzer/tests/snapshots/errors__bad_ingot.snap +++ b/crates/analyzer/tests/snapshots/errors__bad_ingot.snap @@ -57,47 +57,47 @@ error: a type with the same name has already been imported 2 │ use biz::bad::{Bur, Bud as Bar, Boo} │ ^^^ `Bar` first defined here · -6 │ contract Bar: +6 │ contract Bar { │ --- `Bar` redefined here error: function name conflicts with the ingot named "std" - ┌─ compile_errors/bad_ingot/src/main.fe:11:4 + ┌─ compile_errors/bad_ingot/src/main.fe:12:4 │ -11 │ fn std(): +12 │ fn std() {} │ ^^^ `std` is already defined error: the type `Foo` is private - ┌─ compile_errors/bad_ingot/src/main.fe:8:19 + ┌─ compile_errors/bad_ingot/src/main.fe:7:19 │ -8 │ pub fn a() -> foo::Foo: +7 │ pub fn a() -> foo::Foo { │ ^^^^^^^^ this type is not `pub` │ ┌─ compile_errors/bad_ingot/src/foo.fe:5:8 │ -5 │ struct Foo: +5 │ struct Foo { │ --- `Foo` is defined here │ = `Foo` can only be used within `foo` = Hint: use `pub` to make `Foo` visible from outside of `foo` error: the type `Foo` is private - ┌─ compile_errors/bad_ingot/src/main.fe:9:16 + ┌─ compile_errors/bad_ingot/src/main.fe:8:16 │ -9 │ return foo::Foo(my_num: true) +8 │ return foo::Foo(my_num: true) │ ^^^^^^^^ this type is not `pub` │ ┌─ compile_errors/bad_ingot/src/foo.fe:5:8 │ -5 │ struct Foo: +5 │ struct Foo { │ --- `Foo` is defined here │ = `Foo` can only be used within `foo` = Hint: use `pub` to make `Foo` visible from outside of `foo` error: incorrect type for `Foo` argument `my_num` - ┌─ compile_errors/bad_ingot/src/main.fe:9:33 + ┌─ compile_errors/bad_ingot/src/main.fe:8:33 │ -9 │ return foo::Foo(my_num: true) +8 │ return foo::Foo(my_num: true) │ ^^^^ this has type `bool`; expected type `u256` diff --git a/crates/analyzer/tests/snapshots/errors__bad_visibility.snap b/crates/analyzer/tests/snapshots/errors__bad_visibility.snap index c908031945..c3a0da1ab1 100644 --- a/crates/analyzer/tests/snapshots/errors__bad_visibility.snap +++ b/crates/analyzer/tests/snapshots/errors__bad_visibility.snap @@ -6,7 +6,7 @@ expression: error_string_ingot(&path) error: the type `MyInt` is private ┌─ compile_errors/bad_visibility/src/main.fe:5:33 │ -5 │ pub fn priv_type_alias() -> MyInt: +5 │ pub fn priv_type_alias() -> MyInt { │ ^^^^^ this type is not `pub` │ ┌─ compile_errors/bad_visibility/src/foo.fe:1:6 @@ -32,9 +32,9 @@ error: the type `MyInt` is private = Hint: use `pub` to make `MyInt` visible from outside of `foo` error: the constant `MY_CONST` is private - ┌─ compile_errors/bad_visibility/src/main.fe:10:16 + ┌─ compile_errors/bad_visibility/src/main.fe:11:16 │ -10 │ return MY_CONST +11 │ return MY_CONST │ ^^^^^^^^ this constant is not `pub` │ ┌─ compile_errors/bad_visibility/src/foo.fe:3:7 @@ -46,9 +46,9 @@ error: the constant `MY_CONST` is private = Hint: use `pub` to make `MY_CONST` visible from outside of `foo` error: the constant `MY_CONST` is private - ┌─ compile_errors/bad_visibility/src/main.fe:10:16 + ┌─ compile_errors/bad_visibility/src/main.fe:11:16 │ -10 │ return MY_CONST +11 │ return MY_CONST │ ^^^^^^^^ this constant is not `pub` │ ┌─ compile_errors/bad_visibility/src/foo.fe:3:1 @@ -60,127 +60,128 @@ error: the constant `MY_CONST` is private = Hint: use `pub const MY_CONST` to make `MY_CONST` visible from outside of `foo` error: the event `MyEvent` is private - ┌─ compile_errors/bad_visibility/src/main.fe:13:14 + ┌─ compile_errors/bad_visibility/src/main.fe:15:14 │ -13 │ emit MyEvent(ctx, x: 1) +15 │ emit MyEvent(ctx, x: 1) │ ^^^^^^^ this event is not `pub` │ ┌─ compile_errors/bad_visibility/src/foo.fe:5:7 │ - 5 │ event MyEvent: + 5 │ event MyEvent { │ ------- `MyEvent` is defined here │ = `MyEvent` can only be used within `foo` = Hint: use `pub` to make `MyEvent` visible from outside of `foo` error: the event `MyEvent` is private - ┌─ compile_errors/bad_visibility/src/main.fe:13:14 + ┌─ compile_errors/bad_visibility/src/main.fe:15:14 │ -13 │ emit MyEvent(ctx, x: 1) +15 │ emit MyEvent(ctx, x: 1) │ ^^^^^^^ this event is not `pub` │ ┌─ compile_errors/bad_visibility/src/foo.fe:5:1 │ - 5 │ ╭ event MyEvent: + 5 │ ╭ event MyEvent { 6 │ │ x: i32 - │ ╰──────────' `MyEvent` is defined here + 7 │ │ } + │ ╰─' `MyEvent` is defined here │ = `MyEvent` can only be used within `foo` = Hint: use `pub event MyEvent` to make `MyEvent` visible from outside of `foo` error: cannot find value `ctx` in this scope - ┌─ compile_errors/bad_visibility/src/main.fe:13:22 + ┌─ compile_errors/bad_visibility/src/main.fe:15:22 │ -13 │ emit MyEvent(ctx, x: 1) +15 │ emit MyEvent(ctx, x: 1) │ ^^^ undefined error: the type `MyStruct` is private - ┌─ compile_errors/bad_visibility/src/main.fe:16:16 + ┌─ compile_errors/bad_visibility/src/main.fe:19:16 │ -16 │ let s: MyStruct = MyStruct(x: 1) +19 │ let s: MyStruct = MyStruct(x: 1) │ ^^^^^^^^ this type is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:8:8 + ┌─ compile_errors/bad_visibility/src/foo.fe:9:8 │ - 8 │ struct MyStruct: + 9 │ struct MyStruct { │ -------- `MyStruct` is defined here │ = `MyStruct` can only be used within `foo` = Hint: use `pub` to make `MyStruct` visible from outside of `foo` error: the type `MyStruct` is private - ┌─ compile_errors/bad_visibility/src/main.fe:16:27 + ┌─ compile_errors/bad_visibility/src/main.fe:19:27 │ -16 │ let s: MyStruct = MyStruct(x: 1) +19 │ let s: MyStruct = MyStruct(x: 1) │ ^^^^^^^^ this type is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:8:8 + ┌─ compile_errors/bad_visibility/src/foo.fe:9:8 │ - 8 │ struct MyStruct: + 9 │ struct MyStruct { │ -------- `MyStruct` is defined here │ = `MyStruct` can only be used within `foo` = Hint: use `pub` to make `MyStruct` visible from outside of `foo` error: Can not call private constructor of struct `MyStruct` - ┌─ compile_errors/bad_visibility/src/foo.fe:9:5 - │ -9 │ x: i32 - │ ^^^^^^ Field `x` is private - │ - = Suggestion: implement a method `new(...)` on struct `MyStruct` to call the constructor and return the struct + ┌─ compile_errors/bad_visibility/src/foo.fe:10:5 + │ +10 │ x: i32 + │ ^^^^^^ Field `x` is private + │ + = Suggestion: implement a method `new(...)` on struct `MyStruct` to call the constructor and return the struct error: the function `my_func` is private - ┌─ compile_errors/bad_visibility/src/main.fe:19:9 + ┌─ compile_errors/bad_visibility/src/main.fe:23:9 │ -19 │ my_func() +23 │ my_func() │ ^^^^^^^ this function is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:11:4 + ┌─ compile_errors/bad_visibility/src/foo.fe:13:4 │ -11 │ fn my_func(): +13 │ fn my_func() {} │ ------- `my_func` is defined here │ = `my_func` can only be used within `foo` = Hint: use `pub` to make `my_func` visible from outside of `foo` error: the type `MyContract` is private - ┌─ compile_errors/bad_visibility/src/main.fe:22:16 + ┌─ compile_errors/bad_visibility/src/main.fe:27:16 │ -22 │ let _: MyContract = MyContract(ctx, addr) +27 │ let _: MyContract = MyContract(ctx, addr) │ ^^^^^^^^^^ this type is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:14:10 + ┌─ compile_errors/bad_visibility/src/foo.fe:15:10 │ -14 │ contract MyContract: +15 │ contract MyContract { │ ---------- `MyContract` is defined here │ = `MyContract` can only be used within `foo` = Hint: use `pub` to make `MyContract` visible from outside of `foo` error: the type `MyContract` is private - ┌─ compile_errors/bad_visibility/src/main.fe:22:29 + ┌─ compile_errors/bad_visibility/src/main.fe:27:29 │ -22 │ let _: MyContract = MyContract(ctx, addr) +27 │ let _: MyContract = MyContract(ctx, addr) │ ^^^^^^^^^^ this type is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:14:10 + ┌─ compile_errors/bad_visibility/src/foo.fe:15:10 │ -14 │ contract MyContract: +15 │ contract MyContract { │ ---------- `MyContract` is defined here │ = `MyContract` can only be used within `foo` = Hint: use `pub` to make `MyContract` visible from outside of `foo` error: the type `MyContract` is private - ┌─ compile_errors/bad_visibility/src/main.fe:23:9 + ┌─ compile_errors/bad_visibility/src/main.fe:28:9 │ -23 │ MyContract.create(ctx, 1) +28 │ MyContract.create(ctx, 1) │ ^^^^^^^^^^ this type is not `pub` │ - ┌─ compile_errors/bad_visibility/src/foo.fe:14:10 + ┌─ compile_errors/bad_visibility/src/foo.fe:15:10 │ -14 │ contract MyContract: +15 │ contract MyContract { │ ---------- `MyContract` is defined here │ = `MyContract` can only be used within `foo` diff --git a/crates/analyzer/tests/snapshots/errors__break_without_loop_2.snap b/crates/analyzer/tests/snapshots/errors__break_without_loop_2.snap index ac501de3bf..5170bbdaf1 100644 --- a/crates/analyzer/tests/snapshots/errors__break_without_loop_2.snap +++ b/crates/analyzer/tests/snapshots/errors__break_without_loop_2.snap @@ -4,9 +4,9 @@ expression: "error_string(\"[snippet]\", &src)" --- error: `break` outside of a loop - ┌─ [snippet]:4:5 + ┌─ [snippet]:3:13 │ -4 │ break - │ ^^^^^ `break` can only be used inside of a `for` or `while` loop +3 │ if true { break } + │ ^^^^^ `break` can only be used inside of a `for` or `while` loop diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap index 97a17ce6f5..ebd0ec09f2 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_2_args.snap @@ -4,14 +4,14 @@ expression: "error_string(\"[snippet]\", &src)" --- error: `balance_of` expects 1 argument, but 2 were provided - ┌─ src/evm.fe:38:15 + ┌─ src/evm.fe:50:15 │ -38 │ pub unsafe fn balance_of(_ addr: address) -> u256: +50 │ pub unsafe fn balance_of(_ addr: address) -> u256 { │ ^^^^^^^^^^ expects 1 argument │ - ┌─ [snippet]:4:26 + ┌─ [snippet]:3:33 │ - 4 │ std::evm::balance_of(address(0), 2) - │ ---------- - supplied 2 arguments + 3 │ unsafe { std::evm::balance_of(address(0), 2) } + │ ---------- - supplied 2 arguments diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap index ddd8ab137f..b1b6d46710 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_with_wrong_type.snap @@ -4,9 +4,9 @@ expression: "error_string(\"[snippet]\", &src)" --- error: incorrect type for `balance_of` argument at position 0 - ┌─ [snippet]:4:26 + ┌─ [snippet]:3:33 │ -4 │ std::evm::balance_of(true) - │ ^^^^ this has type `bool`; expected type `address` +3 │ unsafe { std::evm::balance_of(true) } + │ ^^^^ this has type `bool`; expected type `address` diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap b/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap index 4568a33546..9602329664 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_of_without_parameter.snap @@ -4,14 +4,14 @@ expression: "error_string(\"[snippet]\", &src)" --- error: `balance_of` expects 1 argument, but 0 were provided - ┌─ src/evm.fe:38:15 + ┌─ src/evm.fe:50:15 │ -38 │ pub unsafe fn balance_of(_ addr: address) -> u256: +50 │ pub unsafe fn balance_of(_ addr: address) -> u256 { │ ^^^^^^^^^^ expects 1 argument │ - ┌─ [snippet]:4:25 + ┌─ [snippet]:3:32 │ - 4 │ std::evm::balance_of() - │ -- supplied 0 arguments + 3 │ unsafe { std::evm::balance_of() } + │ -- supplied 0 arguments diff --git a/crates/analyzer/tests/snapshots/errors__call_balance_with_arg.snap b/crates/analyzer/tests/snapshots/errors__call_balance_with_arg.snap index 4e4224c2bf..6b0564205f 100644 --- a/crates/analyzer/tests/snapshots/errors__call_balance_with_arg.snap +++ b/crates/analyzer/tests/snapshots/errors__call_balance_with_arg.snap @@ -4,14 +4,14 @@ expression: "error_string(\"[snippet]\", &src)" --- error: `balance` expects 0 arguments, but 1 was provided - ┌─ src/evm.fe:41:15 + ┌─ src/evm.fe:54:15 │ -41 │ pub unsafe fn balance() -> u256: +54 │ pub unsafe fn balance() -> u256 { │ ^^^^^^^ expects 0 arguments │ - ┌─ [snippet]:4:23 + ┌─ [snippet]:3:30 │ - 4 │ std::evm::balance(address(0)) - │ ---------- supplied 1 argument + 3 │ unsafe { std::evm::balance(address(0)) } + │ ---------- supplied 1 argument diff --git a/crates/analyzer/tests/snapshots/errors__call_builtin_object.snap b/crates/analyzer/tests/snapshots/errors__call_builtin_object.snap index dfd8942624..ae8b1d4a90 100644 --- a/crates/analyzer/tests/snapshots/errors__call_builtin_object.snap +++ b/crates/analyzer/tests/snapshots/errors__call_builtin_object.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: cannot find value `block` in this scope - ┌─ compile_errors/call_builtin_object.fe:4:5 + ┌─ compile_errors/call_builtin_object.fe:3:9 │ -4 │ block.foo() - │ ^^^^^ undefined +3 │ block.foo() + │ ^^^^^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__call_call_on_external_contract.snap b/crates/analyzer/tests/snapshots/errors__call_call_on_external_contract.snap index 66b7a19efb..e390932ebb 100644 --- a/crates/analyzer/tests/snapshots/errors__call_call_on_external_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__call_call_on_external_contract.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `__call__()` is not directly callable - ┌─ compile_errors/call_call_on_external_contract.fe:13:9 + ┌─ compile_errors/call_call_on_external_contract.fe:12:13 │ -13 │ foo.__call__() - │ ^^^^^^^^ +12 │ foo.__call__() + │ ^^^^^^^^ │ = Note: `__call__` is not part of the contract's interface, and can't be called. diff --git a/crates/analyzer/tests/snapshots/errors__call_call_on_self.snap b/crates/analyzer/tests/snapshots/errors__call_call_on_self.snap index b313abce71..d0e16c98e5 100644 --- a/crates/analyzer/tests/snapshots/errors__call_call_on_self.snap +++ b/crates/analyzer/tests/snapshots/errors__call_call_on_self.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `__call__()` is not directly callable - ┌─ compile_errors/call_call_on_self.fe:6:10 + ┌─ compile_errors/call_call_on_self.fe:5:14 │ -6 │ self.__call__() - │ ^^^^^^^^ +5 │ self.__call__() + │ ^^^^^^^^ │ = Note: `__call__` is not part of the contract's interface, and can't be called. diff --git a/crates/analyzer/tests/snapshots/errors__call_create2_with_wrong_type.snap b/crates/analyzer/tests/snapshots/errors__call_create2_with_wrong_type.snap index e410afaf2d..c2fb8837e6 100644 --- a/crates/analyzer/tests/snapshots/errors__call_create2_with_wrong_type.snap +++ b/crates/analyzer/tests/snapshots/errors__call_create2_with_wrong_type.snap @@ -4,25 +4,25 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: incorrect type for argument to `Bar.create2` - ┌─ compile_errors/call_create2_with_wrong_type.fe:9:26 + ┌─ compile_errors/call_create2_with_wrong_type.fe:7:26 │ -9 │ Bar.create2(ctx, true, 1) +7 │ Bar.create2(ctx, true, 1) │ ^^^^ this has type `bool`; expected a number error: `create2` expects 3 arguments, but 2 were provided - ┌─ compile_errors/call_create2_with_wrong_type.fe:10:13 - │ -10 │ Bar.create2(ctx, 1) # agroce #447 - │ ^^^^^^^ --- - supplied 2 arguments - │ │ - │ expects 3 arguments + ┌─ compile_errors/call_create2_with_wrong_type.fe:8:13 + │ +8 │ Bar.create2(ctx, 1) # agroce #447 + │ ^^^^^^^ --- - supplied 2 arguments + │ │ + │ expects 3 arguments error: `create2` expects 3 arguments, but 1 was provided - ┌─ compile_errors/call_create2_with_wrong_type.fe:11:13 - │ -11 │ Bar.create2(ctx) - │ ^^^^^^^ --- supplied 1 argument - │ │ - │ expects 3 arguments + ┌─ compile_errors/call_create2_with_wrong_type.fe:9:13 + │ +9 │ Bar.create2(ctx) + │ ^^^^^^^ --- supplied 1 argument + │ │ + │ expects 3 arguments diff --git a/crates/analyzer/tests/snapshots/errors__call_create_with_wrong_type.snap b/crates/analyzer/tests/snapshots/errors__call_create_with_wrong_type.snap index 2583a8c8ff..47dabbc1d9 100644 --- a/crates/analyzer/tests/snapshots/errors__call_create_with_wrong_type.snap +++ b/crates/analyzer/tests/snapshots/errors__call_create_with_wrong_type.snap @@ -4,15 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: incorrect type for argument to `Bar.create` - ┌─ compile_errors/call_create_with_wrong_type.fe:8:25 + ┌─ compile_errors/call_create_with_wrong_type.fe:7:25 │ -8 │ Bar.create(ctx, true) +7 │ Bar.create(ctx, true) │ ^^^^ this has type `bool`; expected a number error: `create` expects 2 arguments, but 1 was provided - ┌─ compile_errors/call_create_with_wrong_type.fe:9:13 + ┌─ compile_errors/call_create_with_wrong_type.fe:8:13 │ -9 │ Bar.create(ctx) # agroce #447 +8 │ Bar.create(ctx) # agroce #447 │ ^^^^^^ --- supplied 1 argument │ │ │ expects 2 arguments diff --git a/crates/analyzer/tests/snapshots/errors__call_duplicate_def.snap b/crates/analyzer/tests/snapshots/errors__call_duplicate_def.snap index f26b02e5df..05cb820590 100644 --- a/crates/analyzer/tests/snapshots/errors__call_duplicate_def.snap +++ b/crates/analyzer/tests/snapshots/errors__call_duplicate_def.snap @@ -5,17 +5,18 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `fn __call__()` is defined multiple times in `contract Foo` ┌─ compile_errors/call_duplicate_def.fe:2:5 - │ - 2 │ ╭ pub fn __call__(): - 3 │ │ pass - │ ╰────────────────^ `__call__` first defined here - · │ - 8 │ ╭ pub fn __call__(): - 9 │ │ 1 + 2 - │ ╰───────────────' `__call__` redefined here -10 │ -11 │ ╭ pub fn __call__(): -12 │ │ 3 + 4 - │ ╰─────────────' `__call__` redefined here + │ + 2 │ pub fn __call__() {} + │ ^^^^^^^^^^^^^^^^^^^^ `__call__` first defined here + · + 6 │ ╭ pub fn __call__() { + 7 │ │ 1 + 2 + 8 │ │ } + │ ╰───────' `__call__` redefined here + 9 │ +10 │ ╭ pub fn __call__() { +11 │ │ 3 + 4 +12 │ │ } + │ ╰─────' `__call__` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__call_event_with_wrong_types.snap b/crates/analyzer/tests/snapshots/errors__call_event_with_wrong_types.snap index 0758375f42..561556a3da 100644 --- a/crates/analyzer/tests/snapshots/errors__call_event_with_wrong_types.snap +++ b/crates/analyzer/tests/snapshots/errors__call_event_with_wrong_types.snap @@ -4,15 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: incorrect type for `MyEvent` argument `val_1` - ┌─ compile_errors/call_event_with_wrong_types.fe:9:34 - │ -9 │ emit MyEvent(ctx, val_1: "foo bar", val_2: 1000) - │ ^^^^^^^^^ this has type `String<7>`; expected type `String<5>` + ┌─ compile_errors/call_event_with_wrong_types.fe:10:34 + │ +10 │ emit MyEvent(ctx, val_1: "foo bar", val_2: 1000) + │ ^^^^^^^^^ this has type `String<7>`; expected type `String<5>` error: literal out of range for `u8` - ┌─ compile_errors/call_event_with_wrong_types.fe:9:52 - │ -9 │ emit MyEvent(ctx, val_1: "foo bar", val_2: 1000) - │ ^^^^ does not fit into type `u8` + ┌─ compile_errors/call_event_with_wrong_types.fe:10:52 + │ +10 │ emit MyEvent(ctx, val_1: "foo bar", val_2: 1000) + │ ^^^^ does not fit into type `u8` diff --git a/crates/analyzer/tests/snapshots/errors__call_non_pub_fn_on_external_contract.snap b/crates/analyzer/tests/snapshots/errors__call_non_pub_fn_on_external_contract.snap index 08f85c4dcb..a902afe449 100644 --- a/crates/analyzer/tests/snapshots/errors__call_non_pub_fn_on_external_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__call_non_pub_fn_on_external_contract.snap @@ -4,13 +4,14 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: the function `do_private_thingz` on `contract Foo` is private - ┌─ compile_errors/call_non_pub_fn_on_external_contract.fe:10:26 + ┌─ compile_errors/call_non_pub_fn_on_external_contract.fe:13:30 │ - 5 │ ╭ fn do_private_thingz(self): - 6 │ │ self.val = 100 - │ ╰───────────────────' `do_private_thingz` is defined here + 6 │ ╭ fn do_private_thingz(self) { + 7 │ │ self.val = 100 + 8 │ │ } + │ ╰─────' `do_private_thingz` is defined here · │ -10 │ Foo(ctx, address(0)).do_private_thingz() - │ ^^^^^^^^^^^^^^^^^ this function is not `pub` +13 │ Foo(ctx, address(0)).do_private_thingz() + │ ^^^^^^^^^^^^^^^^^ this function is not `pub` diff --git a/crates/analyzer/tests/snapshots/errors__call_static_function_without_double_colon.snap b/crates/analyzer/tests/snapshots/errors__call_static_function_without_double_colon.snap index 2a1ba20623..78e443efdf 100644 --- a/crates/analyzer/tests/snapshots/errors__call_static_function_without_double_colon.snap +++ b/crates/analyzer/tests/snapshots/errors__call_static_function_without_double_colon.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: Static functions need to be called with `::` not `.` - ┌─ compile_errors/call_static_function_without_double_colon.fe:8:13 + ┌─ compile_errors/call_static_function_without_double_colon.fe:7:13 │ -8 │ Bar.call_me() +7 │ Bar.call_me() │ ^^^^^^^ This is a static function (doesn't take a `self` parameter) │ = Try `Bar::call_me(...)` instead diff --git a/crates/analyzer/tests/snapshots/errors__call_to_mut_fn_without_self.snap b/crates/analyzer/tests/snapshots/errors__call_to_mut_fn_without_self.snap index cb49d062c3..66dbbdf1d6 100644 --- a/crates/analyzer/tests/snapshots/errors__call_to_mut_fn_without_self.snap +++ b/crates/analyzer/tests/snapshots/errors__call_to_mut_fn_without_self.snap @@ -8,8 +8,8 @@ error: `baz` must be called via `self` │ 3 │ baz() │ ^^^ `baz` is called here as a standalone function -4 │ -5 │ fn baz(self): + · +6 │ fn baz(self) {} │ ^^^ `baz` is defined here as a function that takes `self` │ = Suggestion: use `self.baz(...)` instead of `baz(...)` diff --git a/crates/analyzer/tests/snapshots/errors__call_to_pure_fn_on_self.snap b/crates/analyzer/tests/snapshots/errors__call_to_pure_fn_on_self.snap index 27625c0ab9..0fe9a4c629 100644 --- a/crates/analyzer/tests/snapshots/errors__call_to_pure_fn_on_self.snap +++ b/crates/analyzer/tests/snapshots/errors__call_to_pure_fn_on_self.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `pure` must be called without `self` - ┌─ compile_errors/call_to_pure_fn_on_self.fe:6:14 + ┌─ compile_errors/call_to_pure_fn_on_self.fe:5:14 │ -6 │ self.pure() +5 │ self.pure() │ ^^^^ function does not take self │ = Suggestion: try `pure(...)` instead of `self.pure(...)` diff --git a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_external_contract.snap b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_external_contract.snap index 1e1dd874b0..efbbf739ad 100644 --- a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_external_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_external_contract.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No function `doesnt_exist` exists on type `Foo` - ┌─ compile_errors/call_undefined_function_on_external_contract.fe:8:26 + ┌─ compile_errors/call_undefined_function_on_external_contract.fe:9:30 │ -8 │ Foo(ctx, address(0)).doesnt_exist() - │ ^^^^^^^^^^^^ undefined function +9 │ Foo(ctx, address(0)).doesnt_exist() + │ ^^^^^^^^^^^^ undefined function diff --git a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_memory_struct.snap b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_memory_struct.snap index d3b75a66c5..afbd0f442f 100644 --- a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_memory_struct.snap +++ b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_memory_struct.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No function `doesnt_exist` exists on type `Something` - ┌─ compile_errors/call_undefined_function_on_memory_struct.fe:7:12 + ┌─ compile_errors/call_undefined_function_on_memory_struct.fe:8:16 │ -7 │ thingy.doesnt_exist() - │ ^^^^^^^^^^^^ undefined function +8 │ thingy.doesnt_exist() + │ ^^^^^^^^^^^^ undefined function diff --git a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_storage_struct.snap b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_storage_struct.snap index 07d7d0c7d7..c315608b0e 100644 --- a/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_storage_struct.snap +++ b/crates/analyzer/tests/snapshots/errors__call_undefined_function_on_storage_struct.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No function `doesnt_exist` exists on type `Something` - ┌─ compile_errors/call_undefined_function_on_storage_struct.fe:8:17 + ┌─ compile_errors/call_undefined_function_on_storage_struct.fe:9:21 │ -8 │ self.thingy.doesnt_exist() - │ ^^^^^^^^^^^^ undefined function +9 │ self.thingy.doesnt_exist() + │ ^^^^^^^^^^^^ undefined function diff --git a/crates/analyzer/tests/snapshots/errors__call_with_pub_fns.snap b/crates/analyzer/tests/snapshots/errors__call_with_pub_fns.snap index b3f1696a2e..726a854650 100644 --- a/crates/analyzer/tests/snapshots/errors__call_with_pub_fns.snap +++ b/crates/analyzer/tests/snapshots/errors__call_with_pub_fns.snap @@ -4,29 +4,27 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `pub` not allowed if `__call__` is defined - ┌─ compile_errors/call_with_pub_fns.fe:8:12 - │ -2 │ ╭ pub fn __call__(): -3 │ │ pass - │ ╰────────────' `__call__` defined here - · │ -8 │ pub fn baz(): - │ ^^^ `baz` can't be public - │ + ┌─ compile_errors/call_with_pub_fns.fe:6:12 + │ +2 │ pub fn __call__() {} + │ -------------------- `__call__` defined here + · +6 │ pub fn baz() {} + │ ^^^ `baz` can't be public + │ = The `__call__` function replaces the default function dispatcher, which makes `pub` modifiers obsolete. = Hint: Remove the `pub` modifier or `__call__` function. error: `pub` not allowed if `__call__` is defined - ┌─ compile_errors/call_with_pub_fns.fe:11:12 - │ - 2 │ ╭ pub fn __call__(): - 3 │ │ pass - │ ╰────────────' `__call__` defined here - · │ -11 │ pub fn bing(): - │ ^^^^ `bing` can't be public - │ - = The `__call__` function replaces the default function dispatcher, which makes `pub` modifiers obsolete. - = Hint: Remove the `pub` modifier or `__call__` function. + ┌─ compile_errors/call_with_pub_fns.fe:8:12 + │ +2 │ pub fn __call__() {} + │ -------------------- `__call__` defined here + · +8 │ pub fn bing() {} + │ ^^^^ `bing` can't be public + │ + = The `__call__` function replaces the default function dispatcher, which makes `pub` modifiers obsolete. + = Hint: Remove the `pub` modifier or `__call__` function. diff --git a/crates/analyzer/tests/snapshots/errors__call_wrong_return_type.snap b/crates/analyzer/tests/snapshots/errors__call_wrong_return_type.snap index a560426a9f..e27799efb5 100644 --- a/crates/analyzer/tests/snapshots/errors__call_wrong_return_type.snap +++ b/crates/analyzer/tests/snapshots/errors__call_wrong_return_type.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `__call__` function has incorrect return type ┌─ compile_errors/call_wrong_return_type.fe:2:26 │ -2 │ pub fn __call__() -> u64: +2 │ pub fn __call__() -> u64 { │ ^^^ return type should be `()` │ = Hint: Remove the return type specification. diff --git a/crates/analyzer/tests/snapshots/errors__cannot_move2.snap b/crates/analyzer/tests/snapshots/errors__cannot_move2.snap index 05ce089651..d2b7c30b9c 100644 --- a/crates/analyzer/tests/snapshots/errors__cannot_move2.snap +++ b/crates/analyzer/tests/snapshots/errors__cannot_move2.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: can't move value onto stack - ┌─ compile_errors/cannot_move2.fe:6:30 + ┌─ compile_errors/cannot_move2.fe:5:34 │ -6 │ let c: Array = x + y - │ ^ Value to be moved +5 │ let c: Array = x + y + │ ^ Value to be moved │ = Note: Can't move `Array` types on the stack diff --git a/crates/analyzer/tests/snapshots/errors__circular_type_alias.snap b/crates/analyzer/tests/snapshots/errors__circular_type_alias.snap index 114812d2d3..8f7afb71ed 100644 --- a/crates/analyzer/tests/snapshots/errors__circular_type_alias.snap +++ b/crates/analyzer/tests/snapshots/errors__circular_type_alias.snap @@ -10,15 +10,15 @@ error: recursive type definition │ ^^^^^^^^^^^^^^^^^^^^^^^^ error: recursive type definition - ┌─ compile_errors/circular_type_alias.fe:2:1 + ┌─ compile_errors/circular_type_alias.fe:3:1 │ -2 │ type B = Map +3 │ type B = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^ error: recursive type definition - ┌─ compile_errors/circular_type_alias.fe:3:1 + ┌─ compile_errors/circular_type_alias.fe:5:1 │ -3 │ type C = Map +5 │ type C = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/crates/analyzer/tests/snapshots/errors__const_assign.snap b/crates/analyzer/tests/snapshots/errors__const_assign.snap index 8da2057284..bb7d1cf627 100644 --- a/crates/analyzer/tests/snapshots/errors__const_assign.snap +++ b/crates/analyzer/tests/snapshots/errors__const_assign.snap @@ -12,11 +12,11 @@ error: invalid assignment target = The left side of an assignment can be a variable name, attribute, subscript, or tuple. error: cannot assign to constant variable - ┌─ compile_errors/const_assign.fe:9:9 - │ -9 │ LOCAL = 1 - │ ^^^^^ - │ - = The left side of an assignment can be a variable name, attribute, subscript, or tuple. + ┌─ compile_errors/const_assign.fe:10:9 + │ +10 │ LOCAL = 1 + │ ^^^^^ + │ + = The left side of an assignment can be a variable name, attribute, subscript, or tuple. diff --git a/crates/analyzer/tests/snapshots/errors__const_generics_param.snap b/crates/analyzer/tests/snapshots/errors__const_generics_param.snap index dbf04f8584..d20909281e 100644 --- a/crates/analyzer/tests/snapshots/errors__const_generics_param.snap +++ b/crates/analyzer/tests/snapshots/errors__const_generics_param.snap @@ -10,33 +10,33 @@ error: expression is not a constant │ ^^^^^^ expression is required to be constant here error: feature not yet implemented: non numeric type const generics - ┌─ compile_errors/const_generics_param.fe:6:33 + ┌─ compile_errors/const_generics_param.fe:7:33 │ -6 │ let array: Array +7 │ let array: Array │ ^^^^^ not yet implemented error: zero division error - ┌─ compile_errors/const_generics_param.fe:9:38 - │ -9 │ let array: Array - │ ^^^^^ zero division occurred during constant evaluation + ┌─ compile_errors/const_generics_param.fe:11:38 + │ +11 │ let array: Array + │ ^^^^^ zero division occurred during constant evaluation error: zero division error - ┌─ compile_errors/const_generics_param.fe:12:38 + ┌─ compile_errors/const_generics_param.fe:15:38 │ -12 │ let array: Array +15 │ let array: Array │ ^^^^^ zero division occurred during constant evaluation error: overflow error - ┌─ compile_errors/const_generics_param.fe:15:33 + ┌─ compile_errors/const_generics_param.fe:19:33 │ -15 │ let array: Array +19 │ let array: Array │ ^^^^^^^^ overflow occurred during constant evaluation error: overflow error - ┌─ compile_errors/const_generics_param.fe:18:33 + ┌─ compile_errors/const_generics_param.fe:23:33 │ -18 │ let array: Array +23 │ let array: Array │ ^^^^^ overflow occurred during constant evaluation diff --git a/crates/analyzer/tests/snapshots/errors__const_local.snap b/crates/analyzer/tests/snapshots/errors__const_local.snap index 3292d90b9a..da94937890 100644 --- a/crates/analyzer/tests/snapshots/errors__const_local.snap +++ b/crates/analyzer/tests/snapshots/errors__const_local.snap @@ -10,33 +10,33 @@ error: expression is not a constant │ ^^^^^^ expression is required to be constant here error: expression is not a constant - ┌─ compile_errors/const_local.fe:7:25 + ┌─ compile_errors/const_local.fe:8:26 │ -7 │ const FOO:i32 = foo + 1 - │ ^^^ expression is required to be constant here +8 │ const FOO: i32 = foo + 1 + │ ^^^ expression is required to be constant here error: overflow error - ┌─ compile_errors/const_local.fe:12:26 + ┌─ compile_errors/const_local.fe:14:26 │ -12 │ const FOO3: u8 = FOO1 + FOO2 +14 │ const FOO3: u8 = FOO1 + FOO2 │ ^^^^^^^^^^^ overflow occurred during constant evaluation error: cannot find value `BAR` in this scope - ┌─ compile_errors/const_local.fe:15:25 + ┌─ compile_errors/const_local.fe:18:25 │ -15 │ const FOO: u8 = BAR +18 │ const FOO: u8 = BAR │ ^^^ undefined error: expression is not a constant - ┌─ compile_errors/const_local.fe:15:25 + ┌─ compile_errors/const_local.fe:18:25 │ -15 │ const FOO: u8 = BAR +18 │ const FOO: u8 = BAR │ ^^^ expression is required to be constant here error: type mismatch - ┌─ compile_errors/const_local.fe:18:26 + ┌─ compile_errors/const_local.fe:22:26 │ -18 │ const FOO: i32 = "FOO" +22 │ const FOO: i32 = "FOO" │ ^^^^^ this has type `String<3>`; expected type `i32` diff --git a/crates/analyzer/tests/snapshots/errors__continue_without_loop_2.snap b/crates/analyzer/tests/snapshots/errors__continue_without_loop_2.snap index bc1e082a14..f9850a8dd8 100644 --- a/crates/analyzer/tests/snapshots/errors__continue_without_loop_2.snap +++ b/crates/analyzer/tests/snapshots/errors__continue_without_loop_2.snap @@ -4,9 +4,9 @@ expression: "error_string(\"[snippet]\", &src)" --- error: `continue` outside of a loop - ┌─ [snippet]:4:5 + ┌─ [snippet]:3:13 │ -4 │ continue - │ ^^^^^^^^ `continue` can only be used inside of a `for` or `while` loop +3 │ if true { continue } + │ ^^^^^^^^ `continue` can only be used inside of a `for` or `while` loop diff --git a/crates/analyzer/tests/snapshots/errors__ctx_builtins_param_incorrect_type.snap b/crates/analyzer/tests/snapshots/errors__ctx_builtins_param_incorrect_type.snap index 962225fc10..385926345b 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_builtins_param_incorrect_type.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_builtins_param_incorrect_type.snap @@ -4,29 +4,29 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: type mismatch - ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:12:40 + ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:13:40 │ -12 │ let existing_barn: Barn = Barn("hello world", address(0)) +13 │ let existing_barn: Barn = Barn("hello world", address(0)) │ ^^^^^^^^^^^^^ this has type `String<11>`; expected type `Context` error: incorrect type for argument to `Barn.create` - ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:13:46 + ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:14:46 │ -13 │ let created_barn: Barn = Barn.create(address(26), 0) +14 │ let created_barn: Barn = Barn.create(address(26), 0) │ ^^^^^^^^^^^ this has type `address`; expected `Context` error: missing argument label - ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:14:27 + ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:15:27 │ -14 │ emit WorldMessage(42, message: "hello world") +15 │ emit WorldMessage(42, message: "hello world") │ ^ add `ctx:` here │ = Note: this label is optional if the argument is a variable named `ctx`. error: incorrect type for `WorldMessage` argument `ctx` - ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:14:27 + ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:15:27 │ -14 │ emit WorldMessage(42, message: "hello world") +15 │ emit WorldMessage(42, message: "hello world") │ ^^ this has type `u256`; expected type `Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_missing_event.snap b/crates/analyzer/tests/snapshots/errors__ctx_missing_event.snap index 9edab54d21..0004a26eb3 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_missing_event.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_missing_event.snap @@ -4,25 +4,25 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `HelloWorld` expects 2 arguments, but 1 was provided - ┌─ compile_errors/ctx_missing_event.fe:8:14 + ┌─ compile_errors/ctx_missing_event.fe:9:14 │ -8 │ emit HelloWorld(message: "hello world") +9 │ emit HelloWorld(message: "hello world") │ ^^^^^^^^^^ ---------------------- supplied 1 argument │ │ │ expects 2 arguments error: argument label mismatch - ┌─ compile_errors/ctx_missing_event.fe:8:25 + ┌─ compile_errors/ctx_missing_event.fe:9:25 │ -8 │ emit HelloWorld(message: "hello world") +9 │ emit HelloWorld(message: "hello world") │ ^^^^^^^ expected `ctx` │ = Note: arguments must be provided in order. error: incorrect type for `HelloWorld` argument `ctx` - ┌─ compile_errors/ctx_missing_event.fe:8:34 + ┌─ compile_errors/ctx_missing_event.fe:9:34 │ -8 │ emit HelloWorld(message: "hello world") +9 │ emit HelloWorld(message: "hello world") │ ^^^^^^^^^^^^^ this has type `String<11>`; expected type `Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_missing_internal_call.snap b/crates/analyzer/tests/snapshots/errors__ctx_missing_internal_call.snap index 9b291de008..c8b1be4a84 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_missing_internal_call.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_missing_internal_call.snap @@ -6,10 +6,10 @@ expression: "error_string(&path, test_files::fixture(path))" error: `bar` expects 1 argument, but 0 were provided ┌─ compile_errors/ctx_missing_internal_call.fe:6:12 │ - 6 │ pub fn bar(ctx: Context) -> u256: + 6 │ pub fn bar(ctx: Context) -> u256 { │ ^^^ expects 1 argument · -10 │ self.favorite_number = bar() +11 │ self.favorite_number = bar() │ -- supplied 0 arguments diff --git a/crates/analyzer/tests/snapshots/errors__ctx_not_after_self.snap b/crates/analyzer/tests/snapshots/errors__ctx_not_after_self.snap index fb78cee931..14d003954c 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_not_after_self.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_not_after_self.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: invalid parameter order ┌─ compile_errors/ctx_not_after_self.fe:4:33 │ -4 │ pub fn bar(self, baz: u256, ctx: Context): +4 │ pub fn bar(self, baz: u256, ctx: Context) {} │ ^^^^^^^^^^^^ `ctx: Context` must be placed after the `self` parameter diff --git a/crates/analyzer/tests/snapshots/errors__ctx_not_first.snap b/crates/analyzer/tests/snapshots/errors__ctx_not_first.snap index fcd6bbf4a3..3405fa141d 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_not_first.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_not_first.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: invalid parameter order ┌─ compile_errors/ctx_not_first.fe:4:27 │ -4 │ pub fn bar(baz: u256, ctx: Context): +4 │ pub fn bar(baz: u256, ctx: Context) {} │ ^^^^^^^^^^^^ `ctx: Context` must be the first parameter diff --git a/crates/analyzer/tests/snapshots/errors__ctx_passed_external_call.snap b/crates/analyzer/tests/snapshots/errors__ctx_passed_external_call.snap index ae0746c083..8db02d3720 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_passed_external_call.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_passed_external_call.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `bar` expects 0 arguments, but 1 was provided - ┌─ compile_errors/ctx_passed_external_call.fe:13:36 + ┌─ compile_errors/ctx_passed_external_call.fe:14:36 │ -13 │ self.favorite_number = foo.bar(ctx) +14 │ self.favorite_number = foo.bar(ctx) │ ^^^ --- supplied 1 argument │ │ │ expects 0 arguments diff --git a/crates/analyzer/tests/snapshots/errors__ctx_pure.snap b/crates/analyzer/tests/snapshots/errors__ctx_pure.snap index 2d52ec142b..7c371844c2 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_pure.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_pure.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `ctx` cannot be passed into pure functions ┌─ compile_errors/ctx_pure.fe:3:12 │ -3 │ pub fn foo(ctx: Context): +3 │ pub fn foo(ctx: Context) {} │ ^^^^^^^^^^^^ `ctx` can only be passed into contract functions diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_contract_init.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_contract_init.snap index bb869f1b53..ffefd35073 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_contract_init.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_contract_init.snap @@ -4,22 +4,22 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `Bar` expects 2 arguments, but 1 was provided - ┌─ compile_errors/ctx_undefined_contract_init.fe:6:9 + ┌─ compile_errors/ctx_undefined_contract_init.fe:5:9 │ -6 │ Bar(address(0)) +5 │ Bar(address(0)) │ ^^^ ---------- supplied 1 argument │ │ │ expects 2 arguments error: `Context` is not defined - ┌─ compile_errors/ctx_undefined_contract_init.fe:6:12 + ┌─ compile_errors/ctx_undefined_contract_init.fe:5:12 │ -5 │ pub fn baz(): +4 │ pub fn baz() { │ --- │ │ │ Note: declare `ctx` in this function signature │ Example: `pub fn foo(ctx: Context, ...)` -6 │ Bar(address(0)) +5 │ Bar(address(0)) │ ^^^^^^^^^^^^ `ctx` must be defined and passed into the contract constructor │ = Note: import context with `use std::context::Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap index 70aeb08ff8..3086aec51b 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap @@ -4,22 +4,22 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `create` expects 2 arguments, but 1 was provided - ┌─ compile_errors/ctx_undefined_create.fe:6:13 + ┌─ compile_errors/ctx_undefined_create.fe:5:13 │ -6 │ Bar.create(0) +5 │ Bar.create(0) │ ^^^^^^ - supplied 1 argument │ │ │ expects 2 arguments error: `Context` is not defined - ┌─ compile_errors/ctx_undefined_create.fe:6:19 + ┌─ compile_errors/ctx_undefined_create.fe:5:19 │ -5 │ pub fn baz(): +4 │ pub fn baz() { │ --- │ │ │ Note: declare `ctx` in this function signature │ Example: `pub fn foo(ctx: Context, ...)` -6 │ Bar.create(0) +5 │ Bar.create(0) │ ^^^ `ctx` must be defined and passed into the function │ = Note: import context with `use std::context::Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap index 30e40fce29..af6fca9109 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap @@ -4,22 +4,22 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `create2` expects 3 arguments, but 2 were provided - ┌─ compile_errors/ctx_undefined_create2.fe:6:13 + ┌─ compile_errors/ctx_undefined_create2.fe:5:13 │ -6 │ Bar.create2(0, 0) +5 │ Bar.create2(0, 0) │ ^^^^^^^ - - supplied 2 arguments │ │ │ expects 3 arguments error: `Context` is not defined - ┌─ compile_errors/ctx_undefined_create2.fe:6:20 + ┌─ compile_errors/ctx_undefined_create2.fe:5:20 │ -5 │ pub fn baz(): +4 │ pub fn baz() { │ --- │ │ │ Note: declare `ctx` in this function signature │ Example: `pub fn foo(ctx: Context, ...)` -6 │ Bar.create2(0, 0) +5 │ Bar.create2(0, 0) │ ^^^^^^ `ctx` must be defined and passed into the function │ = Note: import context with `use std::context::Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_event.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_event.snap index ea7825bef0..056d03b5fe 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_event.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_event.snap @@ -4,14 +4,14 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `Context` is not defined - ┌─ compile_errors/ctx_undefined_event.fe:6:9 + ┌─ compile_errors/ctx_undefined_event.fe:7:9 │ -5 │ pub fn bar(): +6 │ pub fn bar() { │ --- │ │ │ Note: declare `ctx` in this function signature │ Example: `pub fn foo(ctx: Context, ...)` -6 │ emit YouWin(amount: 42) +7 │ emit YouWin(amount: 42) │ ^^^^^^^^^^^^^^^^^^^^^^^ `ctx` must be defined and passed into the event │ = Note: import context with `use std::context::Context` diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_arg_in_contract_method.snap b/crates/analyzer/tests/snapshots/errors__duplicate_arg_in_contract_method.snap index 92b81b2b42..7edf0596ad 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_arg_in_contract_method.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_arg_in_contract_method.snap @@ -6,8 +6,8 @@ expression: "error_string(&path, test_files::fixture(path))" error: duplicate parameter names in function `bar` ┌─ compile_errors/duplicate_arg_in_contract_method.fe:2:16 │ -2 │ pub fn bar(foo: u8, foo:u8): - │ ^^^^^^^ ------ `foo` redefined here +2 │ pub fn bar(foo: u8, foo: u8) {} + │ ^^^^^^^ ------- `foo` redefined here │ │ │ `foo` first defined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_contract_in_module.snap b/crates/analyzer/tests/snapshots/errors__duplicate_contract_in_module.snap index 1f9fa2f33e..33eb5301ed 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_contract_in_module.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_contract_in_module.snap @@ -6,10 +6,10 @@ expression: "error_string(&path, test_files::fixture(path))" error: a type named "Foo" has already been defined ┌─ compile_errors/duplicate_contract_in_module.fe:1:10 │ -1 │ contract Foo: +1 │ contract Foo { │ ^^^ `Foo` first defined here · -6 │ contract Foo: +5 │ contract Foo { │ --- `Foo` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_event_in_contract.snap b/crates/analyzer/tests/snapshots/errors__duplicate_event_in_contract.snap index 0c3d0fabb1..c9b1eb5daf 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_event_in_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_event_in_contract.snap @@ -6,12 +6,14 @@ expression: "error_string(&path, test_files::fixture(path))" error: duplicate event names in `contract Foo` ┌─ compile_errors/duplicate_event_in_contract.fe:2:5 │ -2 │ ╭ event MyEvent: +2 │ ╭ event MyEvent { 3 │ │ idx addr1: address - │ ╰────────────────────────────^ `MyEvent` first defined here -4 │ -5 │ ╭ event MyEvent: -6 │ │ idx addr1: address - │ ╰──────────────────────────' `MyEvent` redefined here +4 │ │ } + │ ╰───────^ `MyEvent` first defined here +5 │ +6 │ ╭ event MyEvent { +7 │ │ idx addr1: address +8 │ │ } + │ ╰─────' `MyEvent` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_method_in_contract.snap b/crates/analyzer/tests/snapshots/errors__duplicate_method_in_contract.snap index 137d542ed3..27a058a630 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_method_in_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_method_in_contract.snap @@ -4,14 +4,12 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: duplicate function names in `contract Foo` - ┌─ compile_errors/duplicate_method_in_contract.fe:3:5 - │ -3 │ ╭ pub fn bar(): -4 │ │ pass - │ ╰──────────────^ `bar` first defined here -5 │ -6 │ ╭ pub fn bar(): -7 │ │ pass - │ ╰────────────' `bar` redefined here + ┌─ compile_errors/duplicate_method_in_contract.fe:2:5 + │ +2 │ pub fn bar() {} + │ ^^^^^^^^^^^^^^^ `bar` first defined here +3 │ +4 │ pub fn bar() {} + │ --------------- `bar` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_struct_in_module.snap b/crates/analyzer/tests/snapshots/errors__duplicate_struct_in_module.snap index c31e482094..e22ae027da 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_struct_in_module.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_struct_in_module.snap @@ -6,10 +6,10 @@ expression: "error_string(&path, test_files::fixture(path))" error: a type named "MyStruct" has already been defined ┌─ compile_errors/duplicate_struct_in_module.fe:1:8 │ -1 │ struct MyStruct: +1 │ struct MyStruct { │ ^^^^^^^^ `MyStruct` first defined here · -4 │ struct MyStruct: +5 │ struct MyStruct { │ -------- `MyStruct` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_typedef_in_module.snap b/crates/analyzer/tests/snapshots/errors__duplicate_typedef_in_module.snap index 7cdaccc803..712590d674 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_typedef_in_module.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_typedef_in_module.snap @@ -4,21 +4,21 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: a type named "bar" has already been defined - ┌─ compile_errors/duplicate_typedef_in_module.fe:2:6 + ┌─ compile_errors/duplicate_typedef_in_module.fe:1:6 │ -2 │ type bar = u8 +1 │ type bar = u8 │ ^^^ `bar` first defined here -3 │ -4 │ type bar = u8 +2 │ +3 │ type bar = u8 │ --- `bar` redefined here error: function name `bar` conflicts with previously defined type - ┌─ compile_errors/duplicate_typedef_in_module.fe:2:6 + ┌─ compile_errors/duplicate_typedef_in_module.fe:1:6 │ -2 │ type bar = u8 +1 │ type bar = u8 │ ^^^ `bar` first defined here · -8 │ pub fn bar(): +6 │ pub fn bar() {} │ --- `bar` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_var_in_child_scope.snap b/crates/analyzer/tests/snapshots/errors__duplicate_var_in_child_scope.snap index 25ff2a735c..ec25eb8e9b 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_var_in_child_scope.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_var_in_child_scope.snap @@ -8,7 +8,7 @@ error: duplicate definition of variable `sum` │ 4 │ let sum: u256 = 0 │ ^^^ `sum` first defined here -5 │ for i in my_array: +5 │ for i in my_array { 6 │ let sum: u64 = 0 │ --- `sum` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__duplicate_var_in_for_loop.snap b/crates/analyzer/tests/snapshots/errors__duplicate_var_in_for_loop.snap index facf7efcd3..39482d2c89 100644 --- a/crates/analyzer/tests/snapshots/errors__duplicate_var_in_for_loop.snap +++ b/crates/analyzer/tests/snapshots/errors__duplicate_var_in_for_loop.snap @@ -4,20 +4,20 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: duplicate definition of variable `x` - ┌─ compile_errors/duplicate_var_in_for_loop.fe:3:9 + ┌─ compile_errors/duplicate_var_in_for_loop.fe:3:13 │ -3 │ let x: u256 = 10 - │ ^ `x` first defined here +3 │ let x: u256 = 10 + │ ^ `x` first defined here · -7 │ for x in xs: - │ - `x` redefined here +6 │ for x in xs { + │ - `x` redefined here error: `+` operand types must be equal - ┌─ compile_errors/duplicate_var_in_for_loop.fe:8:7 + ┌─ compile_errors/duplicate_var_in_for_loop.fe:7:13 │ -8 │ sum += x - │ ^^^ ^ this has type `u256` - │ │ - │ this has type `u8` +7 │ sum += x + │ ^^^ ^ this has type `u256` + │ │ + │ this has type `u8` diff --git a/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap b/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap index 7098b810ed..da64b2371c 100644 --- a/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap +++ b/crates/analyzer/tests/snapshots/errors__emit_bad_args.snap @@ -4,40 +4,40 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `Foo` expects 4 arguments, but 5 were provided - ┌─ compile_errors/emit_bad_args.fe:10:10 + ┌─ compile_errors/emit_bad_args.fe:11:14 │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^^^ --- ------ ----- ------- ---- supplied 5 arguments - │ │ - │ expects 4 arguments +11 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^^^ --- ------ ----- ------- ---- supplied 5 arguments + │ │ + │ expects 4 arguments error: missing argument label - ┌─ compile_errors/emit_bad_args.fe:10:19 + ┌─ compile_errors/emit_bad_args.fe:11:23 │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^ add `x:` here +11 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^ add `x:` here │ = Note: this label is optional if the argument is a variable named `x`. error: incorrect type for `Foo` argument `x` - ┌─ compile_errors/emit_bad_args.fe:10:19 + ┌─ compile_errors/emit_bad_args.fe:11:23 │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^^^^^^ this has type `(u256, u256)`; expected type `address` +11 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^^^^^^ this has type `(u256, u256)`; expected type `address` error: argument label mismatch - ┌─ compile_errors/emit_bad_args.fe:10:27 + ┌─ compile_errors/emit_bad_args.fe:11:31 │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^ expected `y` +11 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^ expected `y` │ = Note: arguments must be provided in order. error: argument label mismatch - ┌─ compile_errors/emit_bad_args.fe:10:34 + ┌─ compile_errors/emit_bad_args.fe:11:38 │ -10 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) - │ ^ expected `z` +11 │ emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + │ ^ expected `z` │ = Note: arguments must be provided in order. diff --git a/crates/analyzer/tests/snapshots/errors__for_loop_sto_iter_no_copy.snap b/crates/analyzer/tests/snapshots/errors__for_loop_sto_iter_no_copy.snap index 627a1ac05f..ae42c96f52 100644 --- a/crates/analyzer/tests/snapshots/errors__for_loop_sto_iter_no_copy.snap +++ b/crates/analyzer/tests/snapshots/errors__for_loop_sto_iter_no_copy.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: value must be copied to memory ┌─ compile_errors/for_loop_sto_iter_no_copy.fe:5:18 │ -5 │ for i in self.my_array: +5 │ for i in self.my_array { │ ^^^^^^^^^^^^^ this value is in storage │ = Hint: values located in storage can be copied to memory using the `to_mem` function. diff --git a/crates/analyzer/tests/snapshots/errors__init_call_on_external_contract.snap b/crates/analyzer/tests/snapshots/errors__init_call_on_external_contract.snap index 5abbb094a8..5f3d4a2d82 100644 --- a/crates/analyzer/tests/snapshots/errors__init_call_on_external_contract.snap +++ b/crates/analyzer/tests/snapshots/errors__init_call_on_external_contract.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `__init__()` is not directly callable - ┌─ compile_errors/init_call_on_external_contract.fe:14:9 + ┌─ compile_errors/init_call_on_external_contract.fe:13:13 │ -14 │ foo.__init__() - │ ^^^^^^^^ +13 │ foo.__init__() + │ ^^^^^^^^ │ = Note: `__init__` is the constructor function, and can't be called at runtime. diff --git a/crates/analyzer/tests/snapshots/errors__init_call_on_self.snap b/crates/analyzer/tests/snapshots/errors__init_call_on_self.snap index f16850871f..ec3b41debc 100644 --- a/crates/analyzer/tests/snapshots/errors__init_call_on_self.snap +++ b/crates/analyzer/tests/snapshots/errors__init_call_on_self.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `__init__()` is not directly callable - ┌─ compile_errors/init_call_on_self.fe:6:10 + ┌─ compile_errors/init_call_on_self.fe:5:14 │ -6 │ self.__init__() - │ ^^^^^^^^ +5 │ self.__init__() + │ ^^^^^^^^ │ = Note: `__init__` is the constructor function, and can't be called at runtime. diff --git a/crates/analyzer/tests/snapshots/errors__init_duplicate_def.snap b/crates/analyzer/tests/snapshots/errors__init_duplicate_def.snap index 9730de43f7..7cf87c27e1 100644 --- a/crates/analyzer/tests/snapshots/errors__init_duplicate_def.snap +++ b/crates/analyzer/tests/snapshots/errors__init_duplicate_def.snap @@ -5,17 +5,18 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `fn __init__()` is defined multiple times in `contract Foo` ┌─ compile_errors/init_duplicate_def.fe:2:5 - │ - 2 │ ╭ pub fn __init__(): - 3 │ │ pass - │ ╰────────────────^ `__init__` first defined here - · │ - 8 │ ╭ pub fn __init__(): - 9 │ │ 1 + 2 - │ ╰───────────────' `init` redefined here -10 │ -11 │ ╭ pub fn __init__(): -12 │ │ 3 + 4 - │ ╰─────────────' `__init__` redefined here + │ + 2 │ pub fn __init__() {} + │ ^^^^^^^^^^^^^^^^^^^^ `__init__` first defined here + · + 6 │ ╭ pub fn __init__() { + 7 │ │ 1 + 2 + 8 │ │ } + │ ╰───────' `init` redefined here + 9 │ +10 │ ╭ pub fn __init__() { +11 │ │ 3 + 4 +12 │ │ } + │ ╰─────' `__init__` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__init_wrong_return_type.snap b/crates/analyzer/tests/snapshots/errors__init_wrong_return_type.snap index bc13f483c2..c08bc7e059 100644 --- a/crates/analyzer/tests/snapshots/errors__init_wrong_return_type.snap +++ b/crates/analyzer/tests/snapshots/errors__init_wrong_return_type.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `__init__` function has incorrect return type ┌─ compile_errors/init_wrong_return_type.fe:2:26 │ -2 │ pub fn __init__() -> u64: +2 │ pub fn __init__() -> u64 { │ ^^^ return type should be `()` │ = Hint: Remove the return type specification. diff --git a/crates/analyzer/tests/snapshots/errors__invalid_block_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_block_field.snap index 94d3554a7d..be764cc3b3 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_block_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_block_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: cannot find value `block` in this scope - ┌─ compile_errors/invalid_block_field.fe:4:5 + ┌─ compile_errors/invalid_block_field.fe:3:9 │ -4 │ block.foo - │ ^^^^^ undefined +3 │ block.foo + │ ^^^^^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__invalid_chain_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_chain_field.snap index 6b687f24b4..5b5b4bac5c 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_chain_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_chain_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: cannot find value `chain` in this scope - ┌─ compile_errors/invalid_chain_field.fe:4:5 + ┌─ compile_errors/invalid_chain_field.fe:3:9 │ -4 │ chain.foo - │ ^^^^^ undefined +3 │ chain.foo + │ ^^^^^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__invalid_contract_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_contract_field.snap index d933b6efc7..efc9a03615 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_contract_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_contract_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No field `bar` exists on this contract - ┌─ compile_errors/invalid_contract_field.fe:5:10 + ┌─ compile_errors/invalid_contract_field.fe:5:14 │ -5 │ self.bar - │ ^^^ undefined field +5 │ self.bar + │ ^^^ undefined field diff --git a/crates/analyzer/tests/snapshots/errors__invalid_msg_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_msg_field.snap index 08b5f31cba..625fc10866 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_msg_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_msg_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: cannot find value `msg` in this scope - ┌─ compile_errors/invalid_msg_field.fe:4:5 + ┌─ compile_errors/invalid_msg_field.fe:3:9 │ -4 │ msg.foo - │ ^^^ undefined +3 │ msg.foo + │ ^^^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__invalid_string_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_string_field.snap index cbad5a79cc..908d2f5fd9 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_string_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_string_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No field `does_not_exist` exists on type String<0> - ┌─ compile_errors/invalid_string_field.fe:4:8 + ┌─ compile_errors/invalid_string_field.fe:3:12 │ -4 │ "".does_not_exist - │ ^^^^^^^^^^^^^^ unknown field +3 │ "".does_not_exist + │ ^^^^^^^^^^^^^^ unknown field diff --git a/crates/analyzer/tests/snapshots/errors__invalid_struct_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_struct_field.snap index f28c7608fc..60577d03d3 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_struct_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_struct_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No field `foo` exists on struct `Bar` - ┌─ compile_errors/invalid_struct_field.fe:8:14 + ┌─ compile_errors/invalid_struct_field.fe:9:18 │ -8 │ self.val.foo - │ ^^^ undefined field +9 │ self.val.foo + │ ^^^ undefined field diff --git a/crates/analyzer/tests/snapshots/errors__invalid_tuple_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_tuple_field.snap index 1d4f1f19bd..1ec5cd376b 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_tuple_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_tuple_field.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: No field `item5` exists on this tuple - ┌─ compile_errors/invalid_tuple_field.fe:5:14 + ┌─ compile_errors/invalid_tuple_field.fe:5:18 │ -5 │ self.val.item5 - │ ^^^^^ unknown field +5 │ self.val.item5 + │ ^^^^^ unknown field │ = Note: The highest possible field for this tuple is `item1` diff --git a/crates/analyzer/tests/snapshots/errors__invalid_tx_field.snap b/crates/analyzer/tests/snapshots/errors__invalid_tx_field.snap index 98ab8ccb96..1ca1268c22 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_tx_field.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_tx_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: cannot find value `tx` in this scope - ┌─ compile_errors/invalid_tx_field.fe:4:5 + ┌─ compile_errors/invalid_tx_field.fe:3:9 │ -4 │ tx.foo - │ ^^ undefined +3 │ tx.foo + │ ^^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_1.snap b/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_1.snap index 1f072b2f21..799ff91fa2 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_1.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_1.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: invalid declaration - ┌─ compile_errors/invalid_var_declaration_1.fe:3:9 + ┌─ compile_errors/invalid_var_declaration_1.fe:3:13 │ -3 │ let (x,): Array = [1,2,3,4,5,6,7,8,9,0,2,1,3,4,5,6,7,8,9,0] - │ ^^^^ +3 │ let (x,): Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 0] + │ ^^^^ │ = Tuple declaration targets need to be declared with the tuple type but here the type is Array diff --git a/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_2.snap b/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_2.snap index d5a3b9bfff..1591e69763 100644 --- a/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_2.snap +++ b/crates/analyzer/tests/snapshots/errors__invalid_var_declaration_2.snap @@ -4,10 +4,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: invalid declaration - ┌─ compile_errors/invalid_var_declaration_2.fe:3:9 + ┌─ compile_errors/invalid_var_declaration_2.fe:3:13 │ -3 │ let (x, y):(u256,)=(1,) - │ ^^^^^^ +3 │ let (x, y): (u256,) = (1,) + │ ^^^^^^ │ = Tuple declaration has 2 items but the specified tuple type has 1 item diff --git a/crates/analyzer/tests/snapshots/errors__issue_451.snap b/crates/analyzer/tests/snapshots/errors__issue_451.snap index 42091fe8b7..1ff6800d2c 100644 --- a/crates/analyzer/tests/snapshots/errors__issue_451.snap +++ b/crates/analyzer/tests/snapshots/errors__issue_451.snap @@ -6,23 +6,26 @@ expression: "error_string(&path, test_files::fixture(path))" error: duplicate function names in `contract o` ┌─ compile_errors/issue_451.fe:2:5 │ -2 │ ╭ pub fn bar(x:u256,y:u256)->bool: -3 │ │ return - │ ╰─────────────^ `bar` first defined here -4 │ ╭ pub fn bar(): -5 │ │ s - │ ╰──────' `bar` redefined here +2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { +3 │ │ return +4 │ │ } + │ ╰───────^ `bar` first defined here +5 │ +6 │ ╭ pub fn bar() { +7 │ │ s +8 │ │ } + │ ╰─────' `bar` redefined here error: expected function to return `bool` but was `()` - ┌─ compile_errors/issue_451.fe:3:6 + ┌─ compile_errors/issue_451.fe:3:9 │ -3 │ return - │ ^^^^^^ +3 │ return + │ ^^^^^^ error: cannot find value `s` in this scope - ┌─ compile_errors/issue_451.fe:5:6 + ┌─ compile_errors/issue_451.fe:7:9 │ -5 │ s - │ ^ undefined +7 │ s + │ ^ undefined diff --git a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args.snap b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args.snap index 15617085aa..16b7d24e6f 100644 --- a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args.snap +++ b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args.snap @@ -4,15 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args.fe:4:13 + ┌─ compile_errors/mislabeled_call_args.fe:3:13 │ -4 │ bar(doesnt_exist: 1, me_neither: 2) +3 │ bar(doesnt_exist: 1, me_neither: 2) │ ^^^^^^^^^^^^ expected `val1` error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args.fe:4:30 + ┌─ compile_errors/mislabeled_call_args.fe:3:30 │ -4 │ bar(doesnt_exist: 1, me_neither: 2) +3 │ bar(doesnt_exist: 1, me_neither: 2) │ ^^^^^^^^^^ expected `val2` diff --git a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_external_contract_call.snap b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_external_contract_call.snap index 9b3deb4859..0102c190d4 100644 --- a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_external_contract_call.snap +++ b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_external_contract_call.snap @@ -4,15 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args_external_contract_call.fe:11:30 + ┌─ compile_errors/mislabeled_call_args_external_contract_call.fe:11:34 │ -11 │ Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) - │ ^^^^^^^^^^^^ expected `val1` +11 │ Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) + │ ^^^^^^^^^^^^ expected `val1` error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args_external_contract_call.fe:11:47 + ┌─ compile_errors/mislabeled_call_args_external_contract_call.fe:11:51 │ -11 │ Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) - │ ^^^^^^^^^^ expected `val2` +11 │ Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) + │ ^^^^^^^^^^ expected `val2` diff --git a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_self.snap b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_self.snap index 85395d0850..8b664f05d7 100644 --- a/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_self.snap +++ b/crates/analyzer/tests/snapshots/errors__mislabeled_call_args_self.snap @@ -4,15 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args_self.fe:4:18 + ┌─ compile_errors/mislabeled_call_args_self.fe:3:18 │ -4 │ self.bar(doesnt_exist: 1, me_neither: 2) +3 │ self.bar(doesnt_exist: 1, me_neither: 2) │ ^^^^^^^^^^^^ expected `val1` error: argument label mismatch - ┌─ compile_errors/mislabeled_call_args_self.fe:4:35 + ┌─ compile_errors/mislabeled_call_args_self.fe:3:35 │ -4 │ self.bar(doesnt_exist: 1, me_neither: 2) +3 │ self.bar(doesnt_exist: 1, me_neither: 2) │ ^^^^^^^^^^ expected `val2` diff --git a/crates/analyzer/tests/snapshots/errors__mismatch_return_type.snap b/crates/analyzer/tests/snapshots/errors__mismatch_return_type.snap index 3ae965ed45..18e4973cec 100644 --- a/crates/analyzer/tests/snapshots/errors__mismatch_return_type.snap +++ b/crates/analyzer/tests/snapshots/errors__mismatch_return_type.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: expected function to return `address` but was `u256` - ┌─ compile_errors/mismatch_return_type.fe:4:9 + ┌─ compile_errors/mismatch_return_type.fe:3:9 │ -4 │ return 1 +3 │ return 1 │ ^^^^^^^^ diff --git a/crates/analyzer/tests/snapshots/errors__missing_return.snap b/crates/analyzer/tests/snapshots/errors__missing_return.snap index 4f4085dce9..2870b741e5 100644 --- a/crates/analyzer/tests/snapshots/errors__missing_return.snap +++ b/crates/analyzer/tests/snapshots/errors__missing_return.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: function body is missing a return or revert statement ┌─ compile_errors/missing_return.fe:4:12 │ -4 │ pub fn bar(self) -> u256: +4 │ pub fn bar(self) -> u256 { │ ^^^ ---- expected function to return `u256` │ │ │ all paths of this function must `return` or `revert` diff --git a/crates/analyzer/tests/snapshots/errors__missing_return_after_if.snap b/crates/analyzer/tests/snapshots/errors__missing_return_after_if.snap index a82fa06464..5259f972fb 100644 --- a/crates/analyzer/tests/snapshots/errors__missing_return_after_if.snap +++ b/crates/analyzer/tests/snapshots/errors__missing_return_after_if.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: function body is missing a return or revert statement ┌─ compile_errors/missing_return_after_if.fe:2:12 │ -2 │ pub fn bar(val: u256) -> u256: +2 │ pub fn bar(val: u256) -> u256 { │ ^^^ ---- expected function to return `u256` │ │ │ all paths of this function must `return` or `revert` diff --git a/crates/analyzer/tests/snapshots/errors__missing_return_in_else.snap b/crates/analyzer/tests/snapshots/errors__missing_return_in_else.snap index 16e86e3295..6232cd4943 100644 --- a/crates/analyzer/tests/snapshots/errors__missing_return_in_else.snap +++ b/crates/analyzer/tests/snapshots/errors__missing_return_in_else.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: function body is missing a return or revert statement ┌─ compile_errors/missing_return_in_else.fe:2:12 │ -2 │ pub fn bar(val: u256) -> u256: +2 │ pub fn bar(val: u256) -> u256 { │ ^^^ ---- expected function to return `u256` │ │ │ all paths of this function must `return` or `revert` diff --git a/crates/analyzer/tests/snapshots/errors__missing_self.snap b/crates/analyzer/tests/snapshots/errors__missing_self.snap index 604181338c..1814b1c549 100644 --- a/crates/analyzer/tests/snapshots/errors__missing_self.snap +++ b/crates/analyzer/tests/snapshots/errors__missing_self.snap @@ -13,9 +13,9 @@ error: `self` is not defined = Example: `fn pure_fn(self, foo: bool)` error: `self` is not defined - ┌─ compile_errors/missing_self.fe:12:16 + ┌─ compile_errors/missing_self.fe:13:16 │ -12 │ return self.x +13 │ return self.x │ ^^^^ undefined value │ = add `self` to the scope by including it in the function signature diff --git a/crates/analyzer/tests/snapshots/errors__module_const_call.snap b/crates/analyzer/tests/snapshots/errors__module_const_call.snap index 52cac4b98d..2f727a20f3 100644 --- a/crates/analyzer/tests/snapshots/errors__module_const_call.snap +++ b/crates/analyzer/tests/snapshots/errors__module_const_call.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `FOO` is not callable - ┌─ compile_errors/module_const_call.fe:5:5 + ┌─ compile_errors/module_const_call.fe:5:9 │ -5 │ FOO() - │ ^^^ `FOO` is a constant of type `u8`, and can't be used as a function +5 │ FOO() + │ ^^^ `FOO` is a constant of type `u8`, and can't be used as a function diff --git a/crates/analyzer/tests/snapshots/errors__needs_mem_copy.snap b/crates/analyzer/tests/snapshots/errors__needs_mem_copy.snap index 06e888d2a7..642ed3982b 100644 --- a/crates/analyzer/tests/snapshots/errors__needs_mem_copy.snap +++ b/crates/analyzer/tests/snapshots/errors__needs_mem_copy.snap @@ -15,9 +15,9 @@ error: location mismatch = Example: `self.my_array.to_mem()` error: value must be copied to memory - ┌─ compile_errors/needs_mem_copy.fe:8:16 + ┌─ compile_errors/needs_mem_copy.fe:9:16 │ -8 │ return self.my_sto_array +9 │ return self.my_sto_array │ ^^^^^^^^^^^^^^^^^ this value is in storage │ = Hint: values located in storage can be copied to memory using the `to_mem` function. diff --git a/crates/analyzer/tests/snapshots/errors__non_pub_init.snap b/crates/analyzer/tests/snapshots/errors__non_pub_init.snap index 180b00b426..0744a3d70e 100644 --- a/crates/analyzer/tests/snapshots/errors__non_pub_init.snap +++ b/crates/analyzer/tests/snapshots/errors__non_pub_init.snap @@ -5,11 +5,10 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `__init__` function is not public ┌─ compile_errors/non_pub_init.fe:2:5 - │ -2 │ ╭ fn __init__(): -3 │ │ pass - │ ╰────────────^ `__init__` function must be public - │ + │ +2 │ fn __init__() {} + │ ^^^^^^^^^^^^^^^^ `__init__` function must be public + │ = Hint: Add the `pub` modifier. = Example: `pub fn __init__():` diff --git a/crates/analyzer/tests/snapshots/errors__not_callable.snap b/crates/analyzer/tests/snapshots/errors__not_callable.snap index a5a1100146..4d01f65c4f 100644 --- a/crates/analyzer/tests/snapshots/errors__not_callable.snap +++ b/crates/analyzer/tests/snapshots/errors__not_callable.snap @@ -4,23 +4,23 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `u256` type is not callable - ┌─ compile_errors/not_callable.fe:7:5 + ┌─ compile_errors/not_callable.fe:7:9 │ -7 │ 5() - │ ^ this has type `u256` +7 │ 5() + │ ^ this has type `u256` error: `MyEvent` is not callable - ┌─ compile_errors/not_callable.fe:10:5 + ┌─ compile_errors/not_callable.fe:11:9 │ -10 │ MyEvent(x: 10) - │ ^^^^^^^ `MyEvent` is an event, and can't be constructed in this context +11 │ MyEvent(x: 10) + │ ^^^^^^^ `MyEvent` is an event, and can't be constructed in this context │ = Hint: to emit an event, use `emit MyEvent(..)` error: `self` is not callable - ┌─ compile_errors/not_callable.fe:13:5 + ┌─ compile_errors/not_callable.fe:15:9 │ -13 │ self() - │ ^^^^ can't be used as a function +15 │ self() + │ ^^^^ can't be used as a function diff --git a/crates/analyzer/tests/snapshots/errors__private_struct_field.snap b/crates/analyzer/tests/snapshots/errors__private_struct_field.snap index bb326d05b4..3073fcf05c 100644 --- a/crates/analyzer/tests/snapshots/errors__private_struct_field.snap +++ b/crates/analyzer/tests/snapshots/errors__private_struct_field.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: Can not access private field `id` on struct `Bar` - ┌─ compile_errors/private_struct_field.fe:8:14 + ┌─ compile_errors/private_struct_field.fe:9:18 │ -8 │ self.val.id - │ ^^ private field +9 │ self.val.id + │ ^^ private field diff --git a/crates/analyzer/tests/snapshots/errors__return_complex_struct.snap b/crates/analyzer/tests/snapshots/errors__return_complex_struct.snap index ff3fc4d470..c0479c54e8 100644 --- a/crates/analyzer/tests/snapshots/errors__return_complex_struct.snap +++ b/crates/analyzer/tests/snapshots/errors__return_complex_struct.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: feature not yet implemented: structs with complex fields can't be returned from public functions yet - ┌─ compile_errors/return_complex_struct.fe:5:17 + ┌─ compile_errors/return_complex_struct.fe:6:19 │ -5 │ pub fn f() -> Foo: - │ ^^^ not yet implemented +6 │ pub fn f() -> Foo { + │ ^^^ not yet implemented diff --git a/crates/analyzer/tests/snapshots/errors__return_from_init.snap b/crates/analyzer/tests/snapshots/errors__return_from_init.snap index bf23a42bb2..6208fabf96 100644 --- a/crates/analyzer/tests/snapshots/errors__return_from_init.snap +++ b/crates/analyzer/tests/snapshots/errors__return_from_init.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `__init__` function has incorrect return type ┌─ compile_errors/return_from_init.fe:2:26 │ -2 │ pub fn __init__() -> i32: +2 │ pub fn __init__() -> i32 { │ ^^^ return type should be `()` │ = Hint: Remove the return type specification. diff --git a/crates/analyzer/tests/snapshots/errors__return_type_not_fixedsize.snap b/crates/analyzer/tests/snapshots/errors__return_type_not_fixedsize.snap index 5aa6bf5c10..1c4a7ae170 100644 --- a/crates/analyzer/tests/snapshots/errors__return_type_not_fixedsize.snap +++ b/crates/analyzer/tests/snapshots/errors__return_type_not_fixedsize.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: function return type must have a fixed size - ┌─ compile_errors/return_type_not_fixedsize.fe:2:17 + ┌─ compile_errors/return_type_not_fixedsize.fe:2:19 │ -2 │ pub fn f() -> Map: - │ ^^^^^^^^^^^^^^^^^^ this can't be returned from a function +2 │ pub fn f() -> Map {} + │ ^^^^^^^^^^^^^^^^^^ this can't be returned from a function diff --git a/crates/analyzer/tests/snapshots/errors__return_type_undefined.snap b/crates/analyzer/tests/snapshots/errors__return_type_undefined.snap index 55bebd206c..8184e0f0c7 100644 --- a/crates/analyzer/tests/snapshots/errors__return_type_undefined.snap +++ b/crates/analyzer/tests/snapshots/errors__return_type_undefined.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: undefined type - ┌─ compile_errors/return_type_undefined.fe:2:17 + ┌─ compile_errors/return_type_undefined.fe:2:19 │ -2 │ pub fn f() -> Foo: - │ ^^^ `Foo` has not been defined +2 │ pub fn f() -> Foo {} + │ ^^^ `Foo` has not been defined diff --git a/crates/analyzer/tests/snapshots/errors__revert_sto_error_no_copy.snap b/crates/analyzer/tests/snapshots/errors__revert_sto_error_no_copy.snap index 20894e2bbb..3f2430b92f 100644 --- a/crates/analyzer/tests/snapshots/errors__revert_sto_error_no_copy.snap +++ b/crates/analyzer/tests/snapshots/errors__revert_sto_error_no_copy.snap @@ -4,9 +4,9 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: value must be copied to memory - ┌─ compile_errors/revert_sto_error_no_copy.fe:8:16 + ┌─ compile_errors/revert_sto_error_no_copy.fe:7:16 │ -8 │ revert self.my_error +7 │ revert self.my_error │ ^^^^^^^^^^^^^ this value is in storage │ = Hint: values located in storage can be copied to memory using the `to_mem` function. diff --git a/crates/analyzer/tests/snapshots/errors__self_in_standalone_fn.snap b/crates/analyzer/tests/snapshots/errors__self_in_standalone_fn.snap index b578dd6678..631dbca777 100644 --- a/crates/analyzer/tests/snapshots/errors__self_in_standalone_fn.snap +++ b/crates/analyzer/tests/snapshots/errors__self_in_standalone_fn.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `self` can only be used in contract or struct functions ┌─ compile_errors/self_in_standalone_fn.fe:1:12 │ -1 │ fn pure_fn(self): +1 │ fn pure_fn(self) { │ ^^^^ not allowed in functions defined outside of a contract or struct error: `self` can only be used in contract or struct functions @@ -18,7 +18,7 @@ error: `self` can only be used in contract or struct functions error: `pure_fn` expects 0 arguments, but 1 was provided ┌─ compile_errors/self_in_standalone_fn.fe:1:4 │ -1 │ fn pure_fn(self): +1 │ fn pure_fn(self) { │ ^^^^^^^ expects 0 arguments · 7 │ pure_fn(self) diff --git a/crates/analyzer/tests/snapshots/errors__self_misuse.snap b/crates/analyzer/tests/snapshots/errors__self_misuse.snap index accc6743f4..fc5da27038 100644 --- a/crates/analyzer/tests/snapshots/errors__self_misuse.snap +++ b/crates/analyzer/tests/snapshots/errors__self_misuse.snap @@ -4,38 +4,38 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: `self` can't be used as a variable name - ┌─ compile_errors/self_misuse.fe:2:7 + ┌─ compile_errors/self_misuse.fe:2:9 │ -2 │ let self: u8 = 10 - │ ^^^^ expected a name, found keyword `self` +2 │ let self: u8 = 10 + │ ^^^^ expected a name, found keyword `self` error: `self` can only be used in contract or struct functions - ┌─ compile_errors/self_misuse.fe:3:3 + ┌─ compile_errors/self_misuse.fe:3:5 │ -3 │ self = 5 - │ ^^^^ not allowed in functions defined outside of a contract or struct +3 │ self = 5 + │ ^^^^ not allowed in functions defined outside of a contract or struct error: `self` is not callable - ┌─ compile_errors/self_misuse.fe:15:5 + ┌─ compile_errors/self_misuse.fe:16:9 │ -15 │ self() - │ ^^^^ can't be used as a function +16 │ self() + │ ^^^^ can't be used as a function error: `g` must be called via `self` - ┌─ compile_errors/self_misuse.fe:26:6 + ┌─ compile_errors/self_misuse.fe:31:8 │ -26 │ fn g(self): - │ ^ `g` is defined here as a function that takes `self` +31 │ fn g(self) {} + │ ^ `g` is defined here as a function that takes `self` · -30 │ g(self) - │ ^ `g` is called here as a standalone function +34 │ g(self) + │ ^ `g` is called here as a standalone function │ = Suggestion: use `self.g(...)` instead of `g(...)` error: invalid use of contract `self` - ┌─ compile_errors/self_misuse.fe:33:9 + ┌─ compile_errors/self_misuse.fe:38:13 │ -33 │ bar(self) - │ ^^^^ `self` can't be used here +38 │ bar(self) + │ ^^^^ `self` can't be used here diff --git a/crates/analyzer/tests/snapshots/errors__self_not_first.snap b/crates/analyzer/tests/snapshots/errors__self_not_first.snap index fda2a0ac40..afd6235403 100644 --- a/crates/analyzer/tests/snapshots/errors__self_not_first.snap +++ b/crates/analyzer/tests/snapshots/errors__self_not_first.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `self` is not the first parameter ┌─ compile_errors/self_not_first.fe:2:28 │ -2 │ pub fn bar(my_num: u8, self): +2 │ pub fn bar(my_num: u8, self) {} │ ^^^^ `self` may only be used as the first parameter diff --git a/crates/analyzer/tests/snapshots/errors__shadow_builtin_function.snap b/crates/analyzer/tests/snapshots/errors__shadow_builtin_function.snap index e65301aa98..8c640b4358 100644 --- a/crates/analyzer/tests/snapshots/errors__shadow_builtin_function.snap +++ b/crates/analyzer/tests/snapshots/errors__shadow_builtin_function.snap @@ -4,21 +4,21 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: function name `keccak256` conflicts with built-in function - ┌─ compile_errors/shadow_builtin_function.fe:2:10 + ┌─ compile_errors/shadow_builtin_function.fe:2:12 │ -2 │ pub fn keccak256(bytes: Array) -> Array: - │ ^^^^^^^^^ `keccak256` is a built-in function +2 │ pub fn keccak256(bytes: Array) -> Array { + │ ^^^^^^^^^ `keccak256` is a built-in function error: function name `u256` conflicts with built-in type - ┌─ compile_errors/shadow_builtin_function.fe:5:10 + ┌─ compile_errors/shadow_builtin_function.fe:6:12 │ -5 │ pub fn u256(x: u8) -> u256: - │ ^^^^ `u256` is a built-in type +6 │ pub fn u256(x: u8) -> u256 { + │ ^^^^ `u256` is a built-in type error: function name `bool` conflicts with built-in type - ┌─ compile_errors/shadow_builtin_function.fe:8:10 - │ -8 │ pub fn bool(x: u8) -> bool: - │ ^^^^ `bool` is a built-in type + ┌─ compile_errors/shadow_builtin_function.fe:10:12 + │ +10 │ pub fn bool(x: u8) -> bool { + │ ^^^^ `bool` is a built-in type diff --git a/crates/analyzer/tests/snapshots/errors__shadow_builtin_type.snap b/crates/analyzer/tests/snapshots/errors__shadow_builtin_type.snap index 60836e139e..62ab45e08f 100644 --- a/crates/analyzer/tests/snapshots/errors__shadow_builtin_type.snap +++ b/crates/analyzer/tests/snapshots/errors__shadow_builtin_type.snap @@ -10,39 +10,39 @@ error: type name conflicts with the type named "u256" │ ^^^^ `u256` is already defined error: type name conflicts with the type named "String" - ┌─ compile_errors/shadow_builtin_type.fe:2:6 + ┌─ compile_errors/shadow_builtin_type.fe:3:6 │ -2 │ type String = u256 +3 │ type String = u256 │ ^^^^^^ `String` is already defined error: type name conflicts with the type named "Map" - ┌─ compile_errors/shadow_builtin_type.fe:3:6 + ┌─ compile_errors/shadow_builtin_type.fe:5:6 │ -3 │ type Map = u256 +5 │ type Map = u256 │ ^^^ `Map` is already defined error: type name conflicts with the type named "bool" - ┌─ compile_errors/shadow_builtin_type.fe:4:6 + ┌─ compile_errors/shadow_builtin_type.fe:7:6 │ -4 │ type bool = u256 +7 │ type bool = u256 │ ^^^^ `bool` is already defined error: type name conflicts with the function named "keccak256" - ┌─ compile_errors/shadow_builtin_type.fe:6:6 + ┌─ compile_errors/shadow_builtin_type.fe:9:6 │ -6 │ type keccak256 = u8 +9 │ type keccak256 = u8 │ ^^^^^^^^^ `keccak256` is already defined error: function parameter name `u8` conflicts with built-in type - ┌─ compile_errors/shadow_builtin_type.fe:12:8 + ┌─ compile_errors/shadow_builtin_type.fe:18:10 │ -12 │ fn f(u8: u256): - │ ^^ `u8` is a built-in type +18 │ fn f(u8: u256) {} + │ ^^ `u8` is a built-in type error: function parameter name `keccak256` conflicts with built-in function - ┌─ compile_errors/shadow_builtin_type.fe:15:8 + ┌─ compile_errors/shadow_builtin_type.fe:20:10 │ -15 │ fn g(keccak256: u8): - │ ^^^^^^^^^ `keccak256` is a built-in function +20 │ fn g(keccak256: u8) {} + │ ^^^^^^^^^ `keccak256` is a built-in function diff --git a/crates/analyzer/tests/snapshots/errors__strict_boolean_if_else.snap b/crates/analyzer/tests/snapshots/errors__strict_boolean_if_else.snap index d2f8525c06..cff196c587 100644 --- a/crates/analyzer/tests/snapshots/errors__strict_boolean_if_else.snap +++ b/crates/analyzer/tests/snapshots/errors__strict_boolean_if_else.snap @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: `if` statement condition is not bool ┌─ compile_errors/strict_boolean_if_else.fe:3:12 │ -3 │ if val: +3 │ if val { │ ^^^ this has type `u256`; expected type `bool` diff --git a/crates/analyzer/tests/snapshots/errors__struct_recursive_cycles.snap b/crates/analyzer/tests/snapshots/errors__struct_recursive_cycles.snap index cad9b7eefa..89660ab38b 100644 --- a/crates/analyzer/tests/snapshots/errors__struct_recursive_cycles.snap +++ b/crates/analyzer/tests/snapshots/errors__struct_recursive_cycles.snap @@ -1,23 +1,24 @@ --- source: crates/analyzer/tests/errors.rs expression: "error_string(&path, test_files::fixture(path))" + --- error: recursive struct `Foo` - ┌─ compile_errors/struct_recursive_cycles.fe:4:8 + ┌─ compile_errors/struct_recursive_cycles.fe:3:8 │ -4 │ struct Foo: +3 │ struct Foo { │ ^^^ struct `Foo` has infinite size due to recursive definition error: recursive struct `Bar` ┌─ compile_errors/struct_recursive_cycles.fe:8:8 │ -8 │ struct Bar: +8 │ struct Bar { │ ^^^ struct `Bar` has infinite size due to recursive definition error: recursive struct `Foo2` - ┌─ compile_errors/struct_recursive_cycles.fe:12:8 + ┌─ compile_errors/struct_recursive_cycles.fe:13:8 │ -12 │ struct Foo2: +13 │ struct Foo2 { │ ^^^^ struct `Foo2` has infinite size due to recursive definition diff --git a/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap b/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap index 02da0a7cf6..b27627d5d4 100644 --- a/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap +++ b/crates/analyzer/tests/snapshots/errors__undefined_type_param.snap @@ -12,7 +12,7 @@ error: undefined type error: undefined type ┌─ compile_errors/undefined_type_param.fe:8:21 │ -8 │ pub fn a(_ val: DoesntExist): +8 │ pub fn a(_ val: DoesntExist) { │ ^^^^^^^^^^^ `DoesntExist` has not been defined diff --git a/crates/analyzer/tests/snapshots/errors__unsafe_misuse.snap b/crates/analyzer/tests/snapshots/errors__unsafe_misuse.snap index 130b1462f9..50f0b85525 100644 --- a/crates/analyzer/tests/snapshots/errors__unsafe_misuse.snap +++ b/crates/analyzer/tests/snapshots/errors__unsafe_misuse.snap @@ -1,37 +1,38 @@ --- source: crates/analyzer/tests/errors.rs expression: "error_string(&path, test_files::fixture(path))" + --- error: unsafe function `mod_priv` can only be called in an unsafe function or block - ┌─ compile_errors/unsafe_misuse.fe:10:3 - │ - 3 │ unsafe fn mod_priv(): # OK - │ ------------------ `mod_priv` is defined here as unsafe - · -10 │ mod_priv() # BAD - │ ^^^^^^^^ call to unsafe function - │ - = Hint: put this call in an `unsafe` block if you're confident that it's safe to use here + ┌─ compile_errors/unsafe_misuse.fe:8:5 + │ +1 │ unsafe fn mod_priv() {} + │ ------------------ `mod_priv` is defined here as unsafe + · +8 │ mod_priv() + │ ^^^^^^^^ call to unsafe function + │ + = Hint: put this call in an `unsafe` block if you're confident that it's safe to use here error: unsafe function `priv_self` can only be called in an unsafe function or block - ┌─ compile_errors/unsafe_misuse.fe:38:5 + ┌─ compile_errors/unsafe_misuse.fe:35:9 │ -31 │ unsafe fn priv_self(self): # OK - │ ------------------- `priv_self` is defined here as unsafe +28 │ unsafe fn priv_self(self) { + │ ------------------- `priv_self` is defined here as unsafe · -38 │ self.priv_self() # BAD - │ ^^^^^^^^^^^^^^ call to unsafe function +35 │ self.priv_self() + │ ^^^^^^^^^^^^^^ call to unsafe function │ = Hint: put this call in an `unsafe` block if you're confident that it's safe to use here error: unsafe function `priv_nonself` can only be called in an unsafe function or block - ┌─ compile_errors/unsafe_misuse.fe:39:5 + ┌─ compile_errors/unsafe_misuse.fe:36:9 │ -24 │ unsafe fn priv_nonself(): # OK - │ ---------------------- `priv_nonself` is defined here as unsafe +22 │ unsafe fn priv_nonself() { + │ ---------------------- `priv_nonself` is defined here as unsafe · -39 │ priv_nonself() # BAD - │ ^^^^^^^^^^^^ call to unsafe function +36 │ priv_nonself() + │ ^^^^^^^^^^^^ call to unsafe function │ = Hint: put this call in an `unsafe` block if you're confident that it's safe to use here diff --git a/crates/analyzer/tests/snapshots/errors__unsafe_nesting.snap b/crates/analyzer/tests/snapshots/errors__unsafe_nesting.snap index fc7ee3e0ac..456e235280 100644 --- a/crates/analyzer/tests/snapshots/errors__unsafe_nesting.snap +++ b/crates/analyzer/tests/snapshots/errors__unsafe_nesting.snap @@ -4,17 +4,15 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: unnecessary `unsafe` block - ┌─ compile_errors/unsafe_nesting.fe:2:3 - │ -2 │ ╭ unsafe: -3 │ │ g() - │ ╰───────^ this `unsafe` block is nested inside another `unsafe` context + ┌─ compile_errors/unsafe_nesting.fe:2:5 + │ +2 │ unsafe { g() } + │ ^^^^^^^^^^^^^^ this `unsafe` block is nested inside another `unsafe` context error: unnecessary `unsafe` block - ┌─ compile_errors/unsafe_nesting.fe:8:5 - │ -8 │ ╭ unsafe: -9 │ │ h() - │ ╰─────────^ this `unsafe` block is nested inside another `unsafe` context + ┌─ compile_errors/unsafe_nesting.fe:8:9 + │ +8 │ unsafe { h() } + │ ^^^^^^^^^^^^^^ this `unsafe` block is nested inside another `unsafe` context diff --git a/crates/library/std/src/evm.fe b/crates/library/std/src/evm.fe index 23a1728029..eff5c0dae9 100644 --- a/crates/library/std/src/evm.fe +++ b/crates/library/std/src/evm.fe @@ -203,7 +203,7 @@ pub unsafe fn pc() -> u256 { # TODO: dunno if we should enable this # pub unsafe fn pop(_ x: u256) { # return __pop(x) -} +# } pub unsafe fn mload(offset p: u256) -> u256 { return __mload(p) diff --git a/crates/lowering/src/ast_utils.rs b/crates/lowering/src/ast_utils.rs index aae54a1ce0..1d7ff36304 100644 --- a/crates/lowering/src/ast_utils.rs +++ b/crates/lowering/src/ast_utils.rs @@ -821,21 +821,23 @@ mod tests { let original_body = vec![if_else]; assert_eq!( to_code(&original_body), - "if true: + "if true { -else: - 1 if true else 1 if true else 2" +} else { + 1 if true else 1 if true else 2 +}" ); let body = inject_before_expression(&original_body, ternary.original_id, &replacement); assert_eq!( to_code(&body), - "if true: + "if true { -else: +} else { return - 1 if true else 1 if true else 2" + 1 if true else 1 if true else 2 +}" ); } @@ -893,10 +895,11 @@ else: assert_eq!( to_code(&transformed_outer), "let outer: u256 -if true: +if true { outer = 1 -else: - outer = 1 if true else 2" +} else { + outer = 1 if true else 2 +}" ); let new_body = inject_before_expression( @@ -908,11 +911,11 @@ else: assert_eq!( to_code(&new_body), "let outer: u256 -if true: +if true { outer = 1 -else: +} else { outer = 1 if true else 2 - +} foo(1 if true else 1 if true else 2)" ); @@ -922,11 +925,11 @@ foo(1 if true else 1 if true else 2)" assert_eq!( to_code(&new_body), "let outer: u256 -if true: +if true { outer = 1 -else: +} else { outer = 1 if true else 2 - +} foo(outer)" ); @@ -943,17 +946,17 @@ foo(outer)" assert_eq!( to_code(&new_body), r#"let outer: u256 -if true: +if true { outer = 1 -else: +} else { let inner: u256 - if true: + if true { inner = 1 - else: + } else { inner = 2 - + } outer = inner - +} foo(outer)"# ) } diff --git a/crates/lowering/tests/snapshots/lowering__and_or.snap b/crates/lowering/tests/snapshots/lowering__and_or.snap index 2e4e78082b..ff26bee9ff 100644 --- a/crates/lowering/tests/snapshots/lowering__and_or.snap +++ b/crates/lowering/tests/snapshots/lowering__and_or.snap @@ -3,180 +3,194 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_bool_bool_: +struct $tuple_bool_bool_ { pub item0: bool pub item1: bool +} -contract Foo: - pub fn bar() -> bool: +contract Foo { + pub fn bar() -> bool { let $boolean_expr_result_0: bool = true - if not false: + if not false { $boolean_expr_result_0 = true - + } return baz($boolean_expr_result_0) + } - pub fn nested() -> (): - if true: + pub fn nested() -> () { + if true { let a: bool = true let b: bool = false let x: bool = true let y: bool = false let $boolean_expr_result_0: bool = true - if not x: + if not x { $boolean_expr_result_0 = y - + } let $boolean_expr_result_1: bool = false - if a: + if a { $boolean_expr_result_1 = b - + } return double_baz($boolean_expr_result_1, $boolean_expr_result_0) - + } return () + } - pub fn nested_ternary() -> bool: + pub fn nested_ternary() -> bool { let a: bool = true let b: bool = false let x: bool = true let y: bool = false let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false - if a: + if a { $boolean_expr_result_1 = b - - if baz($boolean_expr_result_1): + } + if baz($boolean_expr_result_1) { let $boolean_expr_result_2: bool = false - if x: + if x { $boolean_expr_result_2 = y - + } $boolean_expr_result_0 = $boolean_expr_result_2 - + } return $boolean_expr_result_0 + } - pub fn in_dec() -> (): + pub fn in_dec() -> () { let a: bool = true let b: bool = false let x: bool = true let y: bool = false let $boolean_expr_result_0: bool = true - if not x: + if not x { $boolean_expr_result_0 = y - + } let $boolean_expr_result_1: bool = false - if a: + if a { $boolean_expr_result_1 = b - + } let z: $tuple_bool_bool_ = $tuple_bool_bool_(item0: $boolean_expr_result_1, item1: $boolean_expr_result_0) return () + } - pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true let $boolean_expr_result_2: bool = true - if not first: + if not first { $boolean_expr_result_2 = second - - if not $boolean_expr_result_2: + } + if not $boolean_expr_result_2 { $boolean_expr_result_1 = third - - if not $boolean_expr_result_1: + } + if not $boolean_expr_result_1 { $boolean_expr_result_0 = fourth - + } return $boolean_expr_result_0 + } - pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true - if not first: + if not first { $boolean_expr_result_1 = second - - if not $boolean_expr_result_1: + } + if not $boolean_expr_result_1 { let $boolean_expr_result_2: bool = true - if not third: + if not third { $boolean_expr_result_2 = fourth - + } $boolean_expr_result_0 = $boolean_expr_result_2 - + } return $boolean_expr_result_0 + } - pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = true let $boolean_expr_result_2: bool = true - if not first: + if not first { $boolean_expr_result_2 = second - - if not $boolean_expr_result_2: + } + if not $boolean_expr_result_2 { $boolean_expr_result_1 = third - - if not $boolean_expr_result_1: + } + if not $boolean_expr_result_1 { $boolean_expr_result_0 = fourth - + } return $boolean_expr_result_0 + } - pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = false - if first: + if first { $boolean_expr_result_2 = second - - if $boolean_expr_result_2: + } + if $boolean_expr_result_2 { $boolean_expr_result_1 = third - - if $boolean_expr_result_1: + } + if $boolean_expr_result_1 { $boolean_expr_result_0 = fourth - + } return $boolean_expr_result_0 + } - pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false - if first: + if first { $boolean_expr_result_1 = second - - if $boolean_expr_result_1: + } + if $boolean_expr_result_1 { let $boolean_expr_result_2: bool = false - if third: + if third { $boolean_expr_result_2 = fourth - + } $boolean_expr_result_0 = $boolean_expr_result_2 - + } return $boolean_expr_result_0 + } - pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = false let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = false - if first: + if first { $boolean_expr_result_2 = second - - if $boolean_expr_result_2: + } + if $boolean_expr_result_2 { $boolean_expr_result_1 = third - - if $boolean_expr_result_1: + } + if $boolean_expr_result_1 { $boolean_expr_result_0 = fourth - + } return $boolean_expr_result_0 + } - pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { let $boolean_expr_result_0: bool = true let $boolean_expr_result_1: bool = false let $boolean_expr_result_2: bool = true - if not first: + if not first { $boolean_expr_result_2 = second - - if $boolean_expr_result_2: + } + if $boolean_expr_result_2 { $boolean_expr_result_1 = third - - if not $boolean_expr_result_1: + } + if not $boolean_expr_result_1 { $boolean_expr_result_0 = fourth - + } return $boolean_expr_result_0 + } - pub fn baz(_ val: bool) -> bool: + pub fn baz(_ val: bool) -> bool { return val + } - pub fn double_baz(_ val: bool, _ val2: bool) -> (): - pass + pub fn double_baz(_ val: bool, _ val2: bool) -> () { return () + } +} diff --git a/crates/lowering/tests/snapshots/lowering__aug_assign.snap b/crates/lowering/tests/snapshots/lowering__aug_assign.snap index fe1bb08526..93cea4bbc2 100644 --- a/crates/lowering/tests/snapshots/lowering__aug_assign.snap +++ b/crates/lowering/tests/snapshots/lowering__aug_assign.snap @@ -1,62 +1,77 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -contract Foo: +contract Foo { my_num: u256 - pub fn add(a: u256, b: u256) -> u256: + pub fn add(a: u256, b: u256) -> u256 { a = a + b return a + } - pub fn sub(a: u256, b: u256) -> u256: + pub fn sub(a: u256, b: u256) -> u256 { a = a - b return a + } - pub fn mul(a: u256, b: u256) -> u256: + pub fn mul(a: u256, b: u256) -> u256 { a = a * b return a + } - pub fn div(a: u256, b: u256) -> u256: + pub fn div(a: u256, b: u256) -> u256 { a = a / b return a + } - pub fn mod(a: u256, b: u256) -> u256: + pub fn mod(a: u256, b: u256) -> u256 { a = a % b return a + } - pub fn pow(a: u256, b: u256) -> u256: + pub fn pow(a: u256, b: u256) -> u256 { a = a ** b return a + } - pub fn lshift(a: u8, b: u8) -> u8: + pub fn lshift(a: u8, b: u8) -> u8 { a = a << b return a + } - pub fn rshift(a: u8, b: u8) -> u8: + pub fn rshift(a: u8, b: u8) -> u8 { a = a >> b return a + } - pub fn bit_or(a: u8, b: u8) -> u8: + pub fn bit_or(a: u8, b: u8) -> u8 { a = a | b return a + } - pub fn bit_xor(a: u8, b: u8) -> u8: + pub fn bit_xor(a: u8, b: u8) -> u8 { a = a ^ b return a + } - pub fn bit_and(a: u8, b: u8) -> u8: + pub fn bit_and(a: u8, b: u8) -> u8 { a = a & b return a + } - pub fn add_from_sto(self, a: u256, b: u256) -> u256: + pub fn add_from_sto(self, a: u256, b: u256) -> u256 { self.my_num = a self.my_num = self.my_num + b return self.my_num + } - pub fn add_from_mem(a: u256, b: u256) -> u256: + pub fn add_from_mem(a: u256, b: u256) -> u256 { let my_array: Array my_array[7] = a my_array[7] = my_array[7] + b return my_array[7] + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__base_tuple.snap b/crates/lowering/tests/snapshots/lowering__base_tuple.snap index 0ff6b72e4e..10bb79bf63 100644 --- a/crates/lowering/tests/snapshots/lowering__base_tuple.snap +++ b/crates/lowering/tests/snapshots/lowering__base_tuple.snap @@ -3,58 +3,71 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_bool_address_: +use std::context::Context + +struct $tuple_bool_address_ { pub item0: bool pub item1: address +} -struct $tuple_bool_bool_: +struct $tuple_bool_bool_ { pub item0: bool pub item1: bool +} -struct $tuple_address_address_: +struct $tuple_address_address_ { pub item0: address pub item1: address +} -struct $tuple_u256_bool_: +struct $tuple_u256_bool_ { pub item0: u256 pub item1: bool +} -struct $tuple_u256_bool_u8_address_: +struct $tuple_u256_bool_u8_address_ { pub item0: u256 pub item1: bool pub item2: u8 pub item3: address +} -struct $tuple_address_address_u16_i32_bool_: +struct $tuple_address_address_u16_i32_bool_ { pub item0: address pub item1: address pub item2: u16 pub item3: i32 pub item4: bool +} -use std::context::Context - -contract Foo: +contract Foo { my_tuple_field: $tuple_bool_address_ - event MyEvent: + event MyEvent { my_tuple: $tuple_bool_bool_ my_other_tuple: $tuple_address_address_ + } - pub fn bar(my_num: u256, my_bool: bool) -> $tuple_u256_bool_: + pub fn bar(my_num: u256, my_bool: bool) -> $tuple_u256_bool_ { return $tuple_u256_bool_(item0: my_num, item1: my_bool) + } - pub fn baz() -> $tuple_u256_bool_u8_address_: + pub fn baz() -> $tuple_u256_bool_u8_address_ { return $tuple_u256_bool_u8_address_(item0: 999999, item1: false, item2: u8(42), item3: address(26)) + } - pub fn bing() -> (): + pub fn bing() -> () { let foo: $tuple_address_address_u16_i32_bool_ = $tuple_address_address_u16_i32_bool_(item0: address(0), item1: address(0), item2: u16(0), item3: i32(0), item4: false) return () + } - pub fn bop(my_tuple1: $tuple_u256_bool_, my_tuple2: $tuple_u256_bool_u8_address_, my_tuple3: $tuple_address_address_u16_i32_bool_) -> (): - pass + pub fn bop(my_tuple1: $tuple_u256_bool_, my_tuple2: $tuple_u256_bool_u8_address_, my_tuple3: $tuple_address_address_u16_i32_bool_) -> () { return () + } - pub fn food(ctx: Context) -> (): + pub fn food(ctx: Context) -> () { emit MyEvent(ctx, my_tuple: $tuple_bool_bool_(item0: false, item1: true), my_other_tuple: $tuple_address_address_(item0: address(0), item1: address(1))) return () + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__custom_empty_type.snap b/crates/lowering/tests/snapshots/lowering__custom_empty_type.snap index 46fe25fa6a..10cc33e526 100644 --- a/crates/lowering/tests/snapshots/lowering__custom_empty_type.snap +++ b/crates/lowering/tests/snapshots/lowering__custom_empty_type.snap @@ -1,11 +1,13 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -struct MyEmptyType: - pass +struct MyEmptyType {} -contract Foo: - pub fn bar() -> MyEmptyType: +contract Foo { + pub fn bar() -> MyEmptyType { return MyEmptyType() + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__init.snap b/crates/lowering/tests/snapshots/lowering__init.snap index 2de41ae976..a16f04e093 100644 --- a/crates/lowering/tests/snapshots/lowering__init.snap +++ b/crates/lowering/tests/snapshots/lowering__init.snap @@ -1,9 +1,11 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -contract Foo: - pub fn __init__() -> (): - pass +contract Foo { + pub fn __init__() -> () { return () + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__list_expressions.snap b/crates/lowering/tests/snapshots/lowering__list_expressions.snap index 833f9db6ee..df4ee54f95 100644 --- a/crates/lowering/tests/snapshots/lowering__list_expressions.snap +++ b/crates/lowering/tests/snapshots/lowering__list_expressions.snap @@ -3,20 +3,24 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -fn list_expr_array_u256_3(_ val0: u256, _ val1: u256, _ val2: u256) -> Array: +fn list_expr_array_u256_3(_ val0: u256, _ val1: u256, _ val2: u256) -> Array { let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 generated_array[2] = val2 return generated_array +} -fn list_expr_array_unit_0() -> Array<(), 0>: +fn list_expr_array_unit_0() -> Array<(), 0> { let generated_array: Array<(), 0> return generated_array +} -contract Foo: - pub fn foo() -> (): +contract Foo { + pub fn foo() -> () { let x: Array = list_expr_array_u256_3(10, 20, 30) list_expr_array_unit_0() return () + } +} diff --git a/crates/lowering/tests/snapshots/lowering__map_tuple.snap b/crates/lowering/tests/snapshots/lowering__map_tuple.snap index 478c2e67d3..792e4b0d5f 100644 --- a/crates/lowering/tests/snapshots/lowering__map_tuple.snap +++ b/crates/lowering/tests/snapshots/lowering__map_tuple.snap @@ -3,17 +3,22 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_u256_u8_: +struct $tuple_u256_u8_ { pub item0: u256 pub item1: u8 +} -struct $tuple_address_tuple_u256_u8__: +struct $tuple_address_tuple_u256_u8__ { pub item0: address pub item1: $tuple_u256_u8_ +} -contract Foo: +contract Foo { tuples: Map - pub fn bar(self, x: u256) -> u256: + pub fn bar(self, x: u256) -> u256 { self.tuples[0] = $tuple_address_tuple_u256_u8__(item0: address(100), item1: $tuple_u256_u8_(item0: x, item1: 5)) return self.tuples[0].item1.item0 + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__module_const.snap b/crates/lowering/tests/snapshots/lowering__module_const.snap index 73c1d94bfa..fe4d118120 100644 --- a/crates/lowering/tests/snapshots/lowering__module_const.snap +++ b/crates/lowering/tests/snapshots/lowering__module_const.snap @@ -3,15 +3,17 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_u256_u256_: +struct $tuple_u256_u256_ { pub item0: u256 pub item1: u256 +} -fn list_expr_array_u256_2(_ val0: u256, _ val1: u256) -> Array: +fn list_expr_array_u256_2(_ val0: u256, _ val1: u256) -> Array { let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 return generated_array +} const THREE: u256 = 3 @@ -21,42 +23,43 @@ const IS_ADMIN: bool = true const UNIT: () = () -struct Bar: +struct Bar { pub val: u256 +} -contract Foo: +contract Foo { table: Map - pub fn revert_with_bar() -> (): + pub fn revert_with_bar() -> () { revert Bar(val: 10) return () + } - pub fn return_unit() -> (): + pub fn return_unit() -> () { return () + } - pub fn usage(self) -> u256: + pub fn usage(self) -> u256 { let my_calc: u256 = 3 * 10 let my_other_calc: u256 = 3 * 3 let my_array: Array = list_expr_array_u256_2(3, 10) let my_tuple: $tuple_u256_u256_ = $tuple_u256_u256_(item0: 3, item1: 10) let my_bar: Bar = Bar(val: 3) - while 3 > 4: - pass + while 3 > 4 { - for x in list_expr_array_u256_2(3, 10): - pass + } + for x in list_expr_array_u256_2(3, 10) { + } self.table[10] = 3 - if 3 == 10: - pass - else: - if 10 == 10: - return 3 * 10 - else: - if true: - revert Bar(val: 3) - - + if 3 == 10 { + } else if 10 == 10 { + return 3 * 10 + } else if true { + revert Bar(val: 3) + } return self.table[3] + } +} diff --git a/crates/lowering/tests/snapshots/lowering__module_fn.snap b/crates/lowering/tests/snapshots/lowering__module_fn.snap index 1ac7d0bb87..b1014514ee 100644 --- a/crates/lowering/tests/snapshots/lowering__module_fn.snap +++ b/crates/lowering/tests/snapshots/lowering__module_fn.snap @@ -3,33 +3,41 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_u256_u8_: +struct $tuple_u256_u8_ { pub item0: u256 pub item1: u8 +} -struct $tuple_address_tuple_u256_u8__: +struct $tuple_address_tuple_u256_u8__ { pub item0: address pub item1: $tuple_u256_u8_ +} -fn list_expr_array_u8_3(_ val0: u8, _ val1: u8, _ val2: u8) -> Array: +fn list_expr_array_u8_3(_ val0: u8, _ val1: u8, _ val2: u8) -> Array { let generated_array: Array generated_array[0] = val0 generated_array[1] = val1 generated_array[2] = val2 return generated_array +} -fn return_tuple() -> $tuple_address_tuple_u256_u8__: +fn return_tuple() -> $tuple_address_tuple_u256_u8__ { return $tuple_address_tuple_u256_u8__(item0: address(0), item1: $tuple_u256_u8_(item0: 10, item1: 20)) +} -fn return_array() -> Array: +fn return_array() -> Array { return list_expr_array_u8_3(1, 2, 3) +} -contract Foo: - pub fn bar(self) -> u256: +contract Foo { + pub fn bar(self) -> u256 { let tuple: $tuple_address_tuple_u256_u8__ = return_tuple() return tuple.item1.item0 + } - pub fn sum_things() -> u8: + pub fn sum_things() -> u8 { let x: Array = return_array() return x[0] + x[1] + x[2] + } +} diff --git a/crates/lowering/tests/snapshots/lowering__module_level_events.snap b/crates/lowering/tests/snapshots/lowering__module_level_events.snap index 94c383f24b..5e53173d0b 100644 --- a/crates/lowering/tests/snapshots/lowering__module_level_events.snap +++ b/crates/lowering/tests/snapshots/lowering__module_level_events.snap @@ -5,12 +5,16 @@ expression: lowered --- use std::context::Context -event Transfer: +event Transfer { idx sender: address idx receiver: address value: u256 +} -contract Foo: - fn transfer(ctx: Context, to: address, value: u256) -> (): +contract Foo { + fn transfer(ctx: Context, to: address, value: u256) -> () { emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) return () + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__nested_tuple.snap b/crates/lowering/tests/snapshots/lowering__nested_tuple.snap index c682345ef2..2f796220be 100644 --- a/crates/lowering/tests/snapshots/lowering__nested_tuple.snap +++ b/crates/lowering/tests/snapshots/lowering__nested_tuple.snap @@ -3,26 +3,33 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_u8_bool_: +struct $tuple_u8_bool_ { pub item0: u8 pub item1: bool +} -struct $tuple_u8_u8_: +struct $tuple_u8_u8_ { pub item0: u8 pub item1: u8 +} -struct $tuple_address_tuple_u8_u8__: +struct $tuple_address_tuple_u8_u8__ { pub item0: address pub item1: $tuple_u8_u8_ +} -struct $tuple_u256_tuple_u8_bool__tuple_address_tuple_u8_u8___: +struct $tuple_u256_tuple_u8_bool__tuple_address_tuple_u8_u8___ { pub item0: u256 pub item1: $tuple_u8_bool_ pub item2: $tuple_address_tuple_u8_u8__ +} -contract Foo: +contract Foo { tup: $tuple_u256_tuple_u8_bool__tuple_address_tuple_u8_u8___ - pub fn bar(self, x: u256) -> u8: + pub fn bar(self, x: u256) -> u8 { self.tup = $tuple_u256_tuple_u8_bool__tuple_address_tuple_u8_u8___(item0: 1, item1: $tuple_u8_bool_(item0: 0, item1: true), item2: $tuple_address_tuple_u8_u8__(item0: address(0), item1: $tuple_u8_u8_(item0: 10, item1: 100))) return self.tup.item2.item1.item0 + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__return_unit.snap b/crates/lowering/tests/snapshots/lowering__return_unit.snap index ce84293711..d482f6bb20 100644 --- a/crates/lowering/tests/snapshots/lowering__return_unit.snap +++ b/crates/lowering/tests/snapshots/lowering__return_unit.snap @@ -1,41 +1,45 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -contract Foo: - pub fn explicit_return_a1() -> (): +contract Foo { + pub fn explicit_return_a1() -> () { return () + } - pub fn explicit_return_a2() -> (): + pub fn explicit_return_a2() -> () { return () + } - pub fn explicit_return_b1() -> (): + pub fn explicit_return_b1() -> () { return () + } - pub fn explicit_return_b2() -> (): + pub fn explicit_return_b2() -> () { return () + } - pub fn implicit_a1() -> (): - pass + pub fn implicit_a1() -> () { return () + } - pub fn implicit_a2() -> (): - pass + pub fn implicit_a2() -> () { return () + } - pub fn if_elif_else() -> (): - if true: + pub fn if_elif_else() -> () { + if true { return () - else: - if false: - return () - else: - pass - - + } else if false { + return () + } return () + } - pub fn tuple_stmt() -> (): + pub fn tuple_stmt() -> () { () return () + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__struct_fn.snap b/crates/lowering/tests/snapshots/lowering__struct_fn.snap index a9258179d1..69db3a5e87 100644 --- a/crates/lowering/tests/snapshots/lowering__struct_fn.snap +++ b/crates/lowering/tests/snapshots/lowering__struct_fn.snap @@ -3,20 +3,24 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct Foo: +struct Foo { pub x: u256 - pub fn set_x(self, _ new: u256) -> u256: + pub fn set_x(self, _ new: u256) -> u256 { let old: u256 = self.get_x() self.x = new return old + } - pub fn get_x(self) -> u256: + pub fn get_x(self) -> u256 { return self.x + } +} -fn main() -> (): +fn main() -> () { let foo: Foo = Foo(x: 10) foo.set_x(100) assert foo.get_x() == 100 return () +} diff --git a/crates/lowering/tests/snapshots/lowering__ternary.snap b/crates/lowering/tests/snapshots/lowering__ternary.snap index 35f973296a..e835ce6ecb 100644 --- a/crates/lowering/tests/snapshots/lowering__ternary.snap +++ b/crates/lowering/tests/snapshots/lowering__ternary.snap @@ -3,86 +3,92 @@ source: crates/lowering/tests/lowering.rs expression: lowered --- -struct $tuple_u256_u256_: +struct $tuple_u256_u256_ { pub item0: u256 pub item1: u256 +} -contract Foo: - pub fn bar() -> (): +contract Foo { + pub fn bar() -> () { let $ternary_result_0: u256 - if true: + if true { $ternary_result_0 = 1 - else: + } else { $ternary_result_0 = 0 - + } return baz($ternary_result_0) + } - pub fn nested() -> (): - if true: + pub fn nested() -> () { + if true { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 let $ternary_result_0: u256 - if true: + if true { $ternary_result_0 = x - else: + } else { $ternary_result_0 = y - + } let $ternary_result_1: u256 - if true: + if true { $ternary_result_1 = a - else: + } else { $ternary_result_1 = b - + } return double_baz($ternary_result_1, $ternary_result_0) - + } return () + } - pub fn nested_ternary() -> (): + pub fn nested_ternary() -> () { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 let $ternary_result_0: u256 - if true: + if true { $ternary_result_0 = a - else: + } else { let $ternary_result_1: u256 - if true: + if true { $ternary_result_1 = x - else: + } else { $ternary_result_1 = y - + } $ternary_result_0 = $ternary_result_1 - + } return baz($ternary_result_0) + } - pub fn in_dec() -> (): + pub fn in_dec() -> () { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 let $ternary_result_0: u256 - if true: + if true { $ternary_result_0 = x - else: + } else { $ternary_result_0 = y - + } let $ternary_result_1: u256 - if true: + if true { $ternary_result_1 = a - else: + } else { $ternary_result_1 = b - + } let z: $tuple_u256_u256_ = $tuple_u256_u256_(item0: $ternary_result_1, item1: $ternary_result_0) return () + } - pub fn baz(_ val: u256) -> (): - pass + pub fn baz(_ val: u256) -> () { return () + } - pub fn double_baz(_ val1: u256, _ val2: u256) -> (): - pass + pub fn double_baz(_ val1: u256, _ val2: u256) -> () { return () + } +} diff --git a/crates/lowering/tests/snapshots/lowering__tuple_destruct.snap b/crates/lowering/tests/snapshots/lowering__tuple_destruct.snap index a1de172a75..ebc7b51c8f 100644 --- a/crates/lowering/tests/snapshots/lowering__tuple_destruct.snap +++ b/crates/lowering/tests/snapshots/lowering__tuple_destruct.snap @@ -1,22 +1,24 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -struct $tuple_bool_bool_address_u8_: +struct $tuple_bool_bool_address_u8_ { pub item0: bool pub item1: bool pub item2: address pub item3: u8 +} -struct $tuple_u256_bool_: +struct $tuple_u256_bool_ { pub item0: u256 pub item1: bool +} -contract Foo: +contract Foo { my_sto_tuple: $tuple_bool_bool_address_u8_ - pub fn bar(self, my_tuple: $tuple_u256_bool_) -> (): + pub fn bar(self, my_tuple: $tuple_u256_bool_) -> () { let $tmp_tuple_0: $tuple_u256_bool_ = my_tuple let my_u256: u256 = $tmp_tuple_0.item0 let my_bool: bool = $tmp_tuple_0.item1 @@ -26,3 +28,6 @@ contract Foo: let c: address = $tmp_tuple_1.item2 let d: u8 = $tmp_tuple_1.item3 return () + } +} + diff --git a/crates/lowering/tests/snapshots/lowering__type_alias_tuple.snap b/crates/lowering/tests/snapshots/lowering__type_alias_tuple.snap index c09fdda914..cec07631b6 100644 --- a/crates/lowering/tests/snapshots/lowering__type_alias_tuple.snap +++ b/crates/lowering/tests/snapshots/lowering__type_alias_tuple.snap @@ -1,15 +1,16 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -struct $tuple_u8_address_: +struct $tuple_u8_address_ { pub item0: u8 pub item1: address +} type Tup = $tuple_u8_address_ -contract Foo: +contract Foo { tup: Tup - +} diff --git a/crates/lowering/tests/snapshots/lowering__unit_implicit.snap b/crates/lowering/tests/snapshots/lowering__unit_implicit.snap index ba9a85d4ac..89044b9438 100644 --- a/crates/lowering/tests/snapshots/lowering__unit_implicit.snap +++ b/crates/lowering/tests/snapshots/lowering__unit_implicit.snap @@ -1,9 +1,11 @@ --- source: crates/lowering/tests/lowering.rs -expression: lowered_code +expression: lowered --- -contract Foo: - fn bar() -> (): - pass +contract Foo { + fn bar() -> () { return () + } +} + diff --git a/crates/parser/src/ast.rs b/crates/parser/src/ast.rs index 15fdb898d8..3289aad82c 100644 --- a/crates/parser/src/ast.rs +++ b/crates/parser/src/ast.rs @@ -492,6 +492,7 @@ impl fmt::Display for Pragma { impl fmt::Display for Use { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + // XXX pub write!(f, "use {}", self.tree.kind) } } @@ -530,6 +531,7 @@ impl fmt::Display for Path { impl fmt::Display for ConstantDecl { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + // XXX pub write!( f, "const {}: {} = {}", @@ -540,18 +542,25 @@ impl fmt::Display for ConstantDecl { impl fmt::Display for TypeAlias { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + // XXX pub write!(f, "type {} = {}", self.name.kind, self.typ.kind) } } impl fmt::Display for Contract { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - writeln!(f, "contract {} {{", self.name.kind)?; + // XXX pub + write!(f, "contract {} {{", self.name.kind)?; if !self.fields.is_empty() { - write!(indented(f), "{}\n\n", node_line_joined(&self.fields))?; + for field in &self.fields { + writeln!(f)?; + write!(indented(f), "{}", field.kind)?; + } + writeln!(f)?; } if !self.body.is_empty() { + writeln!(f)?; write!(indented(f), "{}", double_line_joined(&self.body))?; writeln!(f)?; } @@ -561,6 +570,7 @@ impl fmt::Display for Contract { impl fmt::Display for Struct { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + // XXX pub write!(f, "struct {} ", self.name.kind)?; if self.fields.is_empty() && self.functions.is_empty() { write!(f, "{{}}") @@ -582,7 +592,7 @@ impl fmt::Display for TypeDesc { TypeDesc::Unit => write!(f, "()"), TypeDesc::Base { base } => write!(f, "{}", base), TypeDesc::Path(path) => write!(f, "{}", path), - TypeDesc::Tuple { items } => write!(f, "({})", node_comma_joined(items)), + TypeDesc::Tuple { items } => write!(f, "({})", node_comma_joined(items)), // XXX if 1 item, insert trailing comma TypeDesc::Generic { base, args } => { write!(f, "{}<{}>", base.kind, comma_joined(&args.kind)) } @@ -595,7 +605,7 @@ impl fmt::Display for GenericArg { match self { GenericArg::TypeDesc(node) => write!(f, "{}", node.kind), GenericArg::Int(node) => write!(f, "{}", node.kind), - GenericArg::ConstExpr(node) => write!(f, "{}", node.kind), + GenericArg::ConstExpr(node) => write!(f, "{}", node.kind), // XXX wrap in {} } } } @@ -645,6 +655,10 @@ impl fmt::Display for Function { if self.is_pub() { write!(f, "pub ")?; } + if self.is_unsafe() { + write!(f, "unsafe ")?; + } + // XXX print generic params write!( f, "fn {}({})", @@ -654,7 +668,15 @@ impl fmt::Display for Function { if let Some(return_type) = self.return_type.as_ref() { write!(f, " -> {}", return_type.kind)?; } - if self.body.is_empty() { + if self.body.is_empty() + || matches!( + &self.body[..], + &[Node { + kind: FuncStmt::Pass, + .. + }] + ) + { write!(f, " {{}}") } else { writeln!(f, " {{")?; @@ -733,7 +755,16 @@ impl fmt::Display for FuncStmt { writeln!(f, "if {} {{", test.kind)?; writeln!(indented(f), "{}", node_line_joined(body))?; if or_else.is_empty() { - Ok(()) + write!(f, "}}") + } else if matches!( + &or_else[..], + &[Node { + kind: FuncStmt::If { .. }, + .. + }] + ) { + write!(f, "}} else ")?; + write!(f, "{}", or_else[0].kind) } else { writeln!(f, "}} else {{")?; writeln!(indented(f), "{}", node_line_joined(or_else))?; @@ -751,7 +782,7 @@ impl fmt::Display for FuncStmt { write!(f, "emit {}({})", name.kind, node_comma_joined(&args.kind)) } FuncStmt::Expr { value } => write!(f, "{}", value.kind), - FuncStmt::Pass => write!(f, "pass"), + FuncStmt::Pass => Ok(()), FuncStmt::Break => write!(f, "break"), FuncStmt::Continue => write!(f, "continue"), FuncStmt::Revert { error } => { @@ -774,7 +805,7 @@ impl fmt::Display for VarDeclTarget { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { match self { VarDeclTarget::Name(name) => write!(f, "{}", name), - VarDeclTarget::Tuple(elts) => write!(f, "{}", node_comma_joined(elts)), + VarDeclTarget::Tuple(elts) => write!(f, "{}", node_comma_joined(elts)), // XXX wrap in parens; trailing comma for one elem } } } @@ -828,7 +859,7 @@ impl fmt::Display for Expr { write!(f, "({})", node_comma_joined(&args.kind)) } Expr::List { elts } => write!(f, "[{}]", node_comma_joined(elts)), - Expr::Tuple { elts } => write!(f, "({})", node_comma_joined(elts)), + Expr::Tuple { elts } => write!(f, "({})", node_comma_joined(elts)), // XXX trailing comma for 1 elem Expr::Bool(bool) => write!(f, "{}", bool), Expr::Name(name) => write!(f, "{}", name), Expr::Path(path) => write!(f, "{}", path), diff --git a/crates/parser/src/lexer/token.rs b/crates/parser/src/lexer/token.rs index 50e5569034..b39aa76886 100644 --- a/crates/parser/src/lexer/token.rs +++ b/crates/parser/src/lexer/token.rs @@ -292,7 +292,7 @@ impl TokenKind { GtGtEq => "symbol `>>=`", Arrow => "symbol `->`", - Error => unreachable!(), + Error => unreachable!(), // XXX this is reachable } } } diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__defs.snap b/crates/parser/tests/cases/snapshots/cases__print_ast__defs.snap new file mode 100644 index 0000000000..f68eeaaed5 --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__defs.snap @@ -0,0 +1,46 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"printing/defs.fe\", src)" + +--- +use foo::bar as baz +use foo::food +use bing::bong::* +use test1::{test1_1, test1_2::{test_1_2_1::*}} + +type MyType = String<42> + +struct MyStruct { + field1: foo::Bar + field2: u256 + field3: address + + pub fn field2_squared(self) -> u256 { + return self.field2 * self.field2 + } +} + +struct EmptyType {} + +contract Foo { + field1: Map + field2: bool + + event EmptyEvent {} + + event MyEvent { + idx field1: bool + field2: String<42> + } + + pub fn my_func() { + std::solidity::bytes2::from_array([1, 2]) + } + + fn my_other_func() {} +} + +contract Bar { + pub fn __init__() {} +} + diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap b/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap new file mode 100644 index 0000000000..c74fd97eac --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap @@ -0,0 +1,124 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"demos/erc20_token.fe\", src)" + +--- +use std::context::Context + +contract ERC20 { + _balances: Map + _allowances: Map> + _total_supply: u256 + _name: String<100> + _symbol: String<100> + _decimals: u8 + + event Approval { + idx owner: address + idx spender: address + value: u256 + } + + event Transfer { + idx from: address + idx to: address + value: u256 + } + + pub fn __init__(self, ctx: Context, name: String<100>, symbol: String<100>) { + self._name = name + self._symbol = symbol + self._decimals = u8(18) + self._mint(ctx, account: ctx.msg_sender(), value: 1000_000_000_000_000_000_000_000) + } + + pub fn name(self) -> String<100> { + return self._name.to_mem() + } + + pub fn symbol(self) -> String<100> { + return self._symbol.to_mem() + } + + pub fn decimals(self) -> u8 { + return self._decimals + } + + pub fn totalSupply(self) -> u256 { + return self._total_supply + } + + pub fn balanceOf(self, _ account: address) -> u256 { + return self._balances[account] + } + + pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool { + self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) + return true + } + + pub fn allowance(self, owner: address, spender: address) -> u256 { + return self._allowances[owner][spender] + } + + pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { + self._approve(ctx, owner: ctx.msg_sender(), spender, value) + return true + } + + pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool { + assert self._allowances[sender][ctx.msg_sender()] >= value + self._transfer(ctx, sender, recipient, value) + self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) + return true + } + + pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool { + self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) + return true + } + + pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool { + self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) + return true + } + + fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256) { + assert sender != address(0) + assert recipient != address(0) + _before_token_transfer(from: sender, to: recipient, value) + self._balances[sender] = self._balances[sender] - value + self._balances[recipient] = self._balances[recipient] + value + emit Transfer(ctx, from: sender, to: recipient, value) + } + + fn _mint(self, ctx: Context, account: address, value: u256) { + assert account != address(0) + _before_token_transfer(from: address(0), to: account, value) + self._total_supply = self._total_supply + value + self._balances[account] = self._balances[account] + value + emit Transfer(ctx, from: address(0), to: account, value) + } + + fn _burn(self, ctx: Context, account: address, value: u256) { + assert account != address(0) + _before_token_transfer(from: account, to: address(0), value) + self._balances[account] = self._balances[account] - value + self._total_supply = self._total_supply - value + emit Transfer(ctx, from: account, to: address(0), value) + } + + fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { + assert owner != address(0) + assert spender != address(0) + self._allowances[owner][spender] = value + emit Approval(ctx, owner, spender, value) + } + + fn _setup_decimals(self, _ decimals_: u8) { + self._decimals = decimals_ + } + + fn _before_token_transfer(from: address, to: address, _ value: u256) {} +} + diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__expr_parens.snap b/crates/parser/tests/cases/snapshots/cases__print_ast__expr_parens.snap new file mode 100644 index 0000000000..101def37f8 --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__expr_parens.snap @@ -0,0 +1,28 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"printing/expr_parens.fe\", src)" + +--- +contract Foo { + fn bar() -> i256 { + let baz1: i256 = -(4 * (26 + 52)) + let baz2: bool = not ((true or false) and true) + let baz3: bool = not (true or false) and true + let baz4: bool = not true or false and true + let baz5: bool = not true or not (false and (true or not (32 + 26) / 5 == 0)) and false + let baz6: i256 = -(4 * (26 + 52)) + let bing: i256 + bing = (4 << 26) + 52 + self.does_not_exist + bing = (4 << 26) * (52 / does_not_exist + 32) + bing = -42 ** 52 + bing = (-42) ** 52 + let bong: bool = -call_my_func("hello") == -3 ** 41 + let bang: bool = 1 == 2 == (3 == 4) + let biz: u256 = 3 * (4 / 5) + let big: u256 = 3 * 4 / 5 + let test: u256 = 3 ** 4 ** 5 + let test2: u256 = (3 ** 4) ** 5 + return -4 * (26 + 52) + } +} + diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap b/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap new file mode 100644 index 0000000000..d4a34739bc --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap @@ -0,0 +1,24 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"demos/guest_book.fe\", src)" + +--- +use std::context::Context + +contract GuestBook { + messages: Map> + + event Signed { + book_msg: String<100> + } + + pub fn sign(self, ctx: Context, book_msg: String<100>) { + self.messages[ctx.msg_sender()] = book_msg + emit Signed(ctx, book_msg) + } + + pub fn get_msg(self, addr: address) -> String<100> { + return self.messages[addr].to_mem() + } +} + diff --git a/crates/test-files/fixtures/compile_errors/abi_encode_from_storage.fe b/crates/test-files/fixtures/compile_errors/abi_encode_from_storage.fe index 7afade8abd..d790d287fa 100644 --- a/crates/test-files/fixtures/compile_errors/abi_encode_from_storage.fe +++ b/crates/test-files/fixtures/compile_errors/abi_encode_from_storage.fe @@ -4,4 +4,4 @@ contract Foo { pub fn bar(self) { self.my_field.abi_encode() } -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/compile_errors/abi_encode_u256.fe b/crates/test-files/fixtures/compile_errors/abi_encode_u256.fe index 64e05e3e95..ca87c46734 100644 --- a/crates/test-files/fixtures/compile_errors/abi_encode_u256.fe +++ b/crates/test-files/fixtures/compile_errors/abi_encode_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn foo(): - 42.abi_encode() \ No newline at end of file +contract Foo { + pub fn foo() { + 42.abi_encode() + } +} diff --git a/crates/test-files/fixtures/compile_errors/assert_sto_msg_no_copy.fe b/crates/test-files/fixtures/compile_errors/assert_sto_msg_no_copy.fe index b589818952..5acb966e9c 100644 --- a/crates/test-files/fixtures/compile_errors/assert_sto_msg_no_copy.fe +++ b/crates/test-files/fixtures/compile_errors/assert_sto_msg_no_copy.fe @@ -1,5 +1,7 @@ -contract Foo: +contract Foo { my_string: String<42> - pub fn bar(self): - assert false, self.my_string \ No newline at end of file + pub fn bar(self) { + assert false, self.my_string + } +} diff --git a/crates/test-files/fixtures/compile_errors/bad_ingot/src/bing.fe b/crates/test-files/fixtures/compile_errors/bad_ingot/src/bing.fe index d3d4c58dfc..c98d5c8b3c 100644 --- a/crates/test-files/fixtures/compile_errors/bad_ingot/src/bing.fe +++ b/crates/test-files/fixtures/compile_errors/bad_ingot/src/bing.fe @@ -1,4 +1,3 @@ use std -struct Bong: - pass \ No newline at end of file +struct Bong {} diff --git a/crates/test-files/fixtures/compile_errors/bad_ingot/src/biz/bad.fe b/crates/test-files/fixtures/compile_errors/bad_ingot/src/biz/bad.fe index 44b94fcc5c..0eb4b24e59 100644 --- a/crates/test-files/fixtures/compile_errors/bad_ingot/src/biz/bad.fe +++ b/crates/test-files/fixtures/compile_errors/bad_ingot/src/biz/bad.fe @@ -1,5 +1,3 @@ -struct Bur: - pass +struct Bur {} -struct Bud: - pass \ No newline at end of file +struct Bud {} diff --git a/crates/test-files/fixtures/compile_errors/bad_ingot/src/foo.fe b/crates/test-files/fixtures/compile_errors/bad_ingot/src/foo.fe index e4782ed2ce..5b6dc4972a 100644 --- a/crates/test-files/fixtures/compile_errors/bad_ingot/src/foo.fe +++ b/crates/test-files/fixtures/compile_errors/bad_ingot/src/foo.fe @@ -2,8 +2,8 @@ use ingot::bing::Bong::* use ingot::bing::Tong use ingot::bing as std -struct Foo: +struct Foo { pub my_num: u256 +} -struct Bar: - pass \ No newline at end of file +struct Bar {} diff --git a/crates/test-files/fixtures/compile_errors/bad_ingot/src/main.fe b/crates/test-files/fixtures/compile_errors/bad_ingot/src/main.fe index 551f022150..54c403ef2a 100644 --- a/crates/test-files/fixtures/compile_errors/bad_ingot/src/main.fe +++ b/crates/test-files/fixtures/compile_errors/bad_ingot/src/main.fe @@ -3,10 +3,10 @@ use biz::bad::{Bur, Bud as Bar, Boo} use biz::Bark use none::* -contract Bar: - - pub fn a() -> foo::Foo: +contract Bar { + pub fn a() -> foo::Foo { return foo::Foo(my_num: true) + } +} -fn std(): - pass \ No newline at end of file +fn std() {} diff --git a/crates/test-files/fixtures/compile_errors/bad_string.fe b/crates/test-files/fixtures/compile_errors/bad_string.fe index 8c7d5ab82f..90e8d7d4c5 100644 --- a/crates/test-files/fixtures/compile_errors/bad_string.fe +++ b/crates/test-files/fixtures/compile_errors/bad_string.fe @@ -1,3 +1,5 @@ -contract foo: - pub fn bar(self): +contract foo { + pub fn bar(self) { let s: String<1> = "Fe" + } +} diff --git a/crates/test-files/fixtures/compile_errors/bad_tuple_attr1.fe b/crates/test-files/fixtures/compile_errors/bad_tuple_attr1.fe index 66cc49fc79..88f9f25602 100644 --- a/crates/test-files/fixtures/compile_errors/bad_tuple_attr1.fe +++ b/crates/test-files/fixtures/compile_errors/bad_tuple_attr1.fe @@ -1,6 +1,8 @@ # See ethereum/fe issue #396 -contract foo: +contract foo { my_sto_tuple: (u256, i32) - pub fn bar(self): + pub fn bar(self) { self.my_sto_tuple.iteo0 + } +} diff --git a/crates/test-files/fixtures/compile_errors/bad_tuple_attr2.fe b/crates/test-files/fixtures/compile_errors/bad_tuple_attr2.fe index fdbb95eed7..d05bbbb54c 100644 --- a/crates/test-files/fixtures/compile_errors/bad_tuple_attr2.fe +++ b/crates/test-files/fixtures/compile_errors/bad_tuple_attr2.fe @@ -1,6 +1,8 @@ # See ethereum/fe issue #399 -contract foo: +contract foo { my_sto_tuple: (u256, i32) - pub fn bar(self): - self.my_sto_tuple.m \ No newline at end of file + pub fn bar(self) { + self.my_sto_tuple.m + } +} diff --git a/crates/test-files/fixtures/compile_errors/bad_tuple_attr3.fe b/crates/test-files/fixtures/compile_errors/bad_tuple_attr3.fe index 87e15f2802..f7a5d9ed53 100644 --- a/crates/test-files/fixtures/compile_errors/bad_tuple_attr3.fe +++ b/crates/test-files/fixtures/compile_errors/bad_tuple_attr3.fe @@ -1,6 +1,8 @@ # See ethereum/fe issue #470 -contract foo: +contract foo { my_sto_tuple: (u256, i32) - pub fn bar(self): - self.my_sto_tuple.item00 \ No newline at end of file + pub fn bar(self) { + self.my_sto_tuple.item00 + } +} diff --git a/crates/test-files/fixtures/compile_errors/bad_visibility/src/foo.fe b/crates/test-files/fixtures/compile_errors/bad_visibility/src/foo.fe index 40e95bbe16..08fc81c6e4 100644 --- a/crates/test-files/fixtures/compile_errors/bad_visibility/src/foo.fe +++ b/crates/test-files/fixtures/compile_errors/bad_visibility/src/foo.fe @@ -2,14 +2,16 @@ type MyInt = i32 const MY_CONST: MyInt = 1 -event MyEvent: +event MyEvent { x: i32 - -struct MyStruct: +} + +struct MyStruct { + x: i32 +} + +fn my_func() {} + +contract MyContract { x: i32 - -fn my_func(): - pass - -contract MyContract: - x: i32 \ No newline at end of file +} diff --git a/crates/test-files/fixtures/compile_errors/bad_visibility/src/main.fe b/crates/test-files/fixtures/compile_errors/bad_visibility/src/main.fe index fe3700989c..e66ba402fb 100644 --- a/crates/test-files/fixtures/compile_errors/bad_visibility/src/main.fe +++ b/crates/test-files/fixtures/compile_errors/bad_visibility/src/main.fe @@ -1,23 +1,30 @@ use foo::{MyInt, MY_CONST, MyEvent, MyStruct, my_func, MyContract} use std::context::Context -contract Main: - pub fn priv_type_alias() -> MyInt: +contract Main { + pub fn priv_type_alias() -> MyInt { let x: MyInt = 1 return x - - pub fn priv_const() -> i32: + } + + pub fn priv_const() -> i32 { return MY_CONST - - pub fn priv_event(): + } + + pub fn priv_event() { emit MyEvent(ctx, x: 1) - - pub fn priv_struct(): + } + + pub fn priv_struct() { let s: MyStruct = MyStruct(x: 1) - - pub fn priv_func(): + } + + pub fn priv_func() { my_func() - - pub fn priv_contract(ctx: Context, addr: address): + } + + pub fn priv_contract(ctx: Context, addr: address) { let _: MyContract = MyContract(ctx, addr) MyContract.create(ctx, 1) + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_builtin_object.fe b/crates/test-files/fixtures/compile_errors/call_builtin_object.fe index ffa016137a..1205522966 100644 --- a/crates/test-files/fixtures/compile_errors/call_builtin_object.fe +++ b/crates/test-files/fixtures/compile_errors/call_builtin_object.fe @@ -1,4 +1,5 @@ - -contract Bar: - pub fn test(): - block.foo() \ No newline at end of file +contract Bar { + pub fn test() { + block.foo() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_call_on_external_contract.fe b/crates/test-files/fixtures/compile_errors/call_call_on_external_contract.fe index fa77408611..1f5a704ec5 100644 --- a/crates/test-files/fixtures/compile_errors/call_call_on_external_contract.fe +++ b/crates/test-files/fixtures/compile_errors/call_call_on_external_contract.fe @@ -1,13 +1,14 @@ use std::context::Context -contract Foo: - pub fn __call__(): - pass - fn f(): - pass +contract Foo { + pub fn __call__() {} + fn f() {} +} -contract Bar: - fn b(ctx: Context): - let foo: Foo = Foo(ctx, address(0)) - foo.__call__() +contract Bar { + fn b(ctx: Context) { + let foo: Foo = Foo(ctx, address(0)) + foo.__call__() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_call_on_self.fe b/crates/test-files/fixtures/compile_errors/call_call_on_self.fe index df9445f322..33dab51277 100644 --- a/crates/test-files/fixtures/compile_errors/call_call_on_self.fe +++ b/crates/test-files/fixtures/compile_errors/call_call_on_self.fe @@ -1,6 +1,7 @@ -contract Foo: - pub fn __call__(): - pass +contract Foo { + pub fn __call__() {} - fn bar(self): - self.__call__() \ No newline at end of file + fn bar(self) { + self.__call__() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_create2_with_wrong_type.fe b/crates/test-files/fixtures/compile_errors/call_create2_with_wrong_type.fe index d0838a28e0..998f638195 100644 --- a/crates/test-files/fixtures/compile_errors/call_create2_with_wrong_type.fe +++ b/crates/test-files/fixtures/compile_errors/call_create2_with_wrong_type.fe @@ -1,11 +1,11 @@ use std::context::Context -contract Bar: - pass +contract Bar {} -contract Foo: - - pub fn foo(ctx: Context): +contract Foo { + pub fn foo(ctx: Context) { Bar.create2(ctx, true, 1) Bar.create2(ctx, 1) # agroce #447 Bar.create2(ctx) + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_create_with_wrong_type.fe b/crates/test-files/fixtures/compile_errors/call_create_with_wrong_type.fe index 1d96d69a09..1f32b10311 100644 --- a/crates/test-files/fixtures/compile_errors/call_create_with_wrong_type.fe +++ b/crates/test-files/fixtures/compile_errors/call_create_with_wrong_type.fe @@ -1,9 +1,10 @@ use std::context::Context -contract Bar: - pass +contract Bar {} -contract Foo: - pub fn foo(ctx: Context): +contract Foo { + pub fn foo(ctx: Context) { Bar.create(ctx, true) Bar.create(ctx) # agroce #447 + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_duplicate_def.fe b/crates/test-files/fixtures/compile_errors/call_duplicate_def.fe index 0631c11131..ed2fcb3b47 100644 --- a/crates/test-files/fixtures/compile_errors/call_duplicate_def.fe +++ b/crates/test-files/fixtures/compile_errors/call_duplicate_def.fe @@ -1,12 +1,13 @@ -contract Foo: - pub fn __call__(): - pass +contract Foo { + pub fn __call__() {} - fn bar(): - pass + fn bar() {} - pub fn __call__(): + pub fn __call__() { 1 + 2 + } - pub fn __call__(): + pub fn __call__() { 3 + 4 + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_event_with_wrong_types.fe b/crates/test-files/fixtures/compile_errors/call_event_with_wrong_types.fe index acd1c26f3c..95a7137dec 100644 --- a/crates/test-files/fixtures/compile_errors/call_event_with_wrong_types.fe +++ b/crates/test-files/fixtures/compile_errors/call_event_with_wrong_types.fe @@ -1,9 +1,12 @@ use std::context::Context -contract Foo: - event MyEvent: +contract Foo { + event MyEvent { val_1: String<5> idx val_2: u8 + } - pub fn foo(ctx: Context): + pub fn foo(ctx: Context) { emit MyEvent(ctx, val_1: "foo bar", val_2: 1000) + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_non_pub_fn_on_external_contract.fe b/crates/test-files/fixtures/compile_errors/call_non_pub_fn_on_external_contract.fe index e08c02f3d3..93869ae5df 100644 --- a/crates/test-files/fixtures/compile_errors/call_non_pub_fn_on_external_contract.fe +++ b/crates/test-files/fixtures/compile_errors/call_non_pub_fn_on_external_contract.fe @@ -1,10 +1,15 @@ use std::context::Context -contract Foo: - val: u8 - fn do_private_thingz(self): - self.val = 100 +contract Foo { + val: u8 -contract Bar: - fn test(ctx: Context): - Foo(ctx, address(0)).do_private_thingz() + fn do_private_thingz(self) { + self.val = 100 + } +} + +contract Bar { + fn test(ctx: Context) { + Foo(ctx, address(0)).do_private_thingz() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_static_function_without_double_colon.fe b/crates/test-files/fixtures/compile_errors/call_static_function_without_double_colon.fe index 8c01065106..5b4659ccef 100644 --- a/crates/test-files/fixtures/compile_errors/call_static_function_without_double_colon.fe +++ b/crates/test-files/fixtures/compile_errors/call_static_function_without_double_colon.fe @@ -1,8 +1,9 @@ -struct Bar: - pub fn call_me(): - pass +struct Bar { + pub fn call_me() {} +} -contract Foo: - - fn bar(self): - Bar.call_me() \ No newline at end of file +contract Foo { + fn bar(self) { + Bar.call_me() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_to_mut_fn_without_self.fe b/crates/test-files/fixtures/compile_errors/call_to_mut_fn_without_self.fe index 04f50a83a2..3b456486ec 100644 --- a/crates/test-files/fixtures/compile_errors/call_to_mut_fn_without_self.fe +++ b/crates/test-files/fixtures/compile_errors/call_to_mut_fn_without_self.fe @@ -1,6 +1,7 @@ -contract Foo: - fn bar(self): +contract Foo { + fn bar(self) { baz() + } - fn baz(self): - pass \ No newline at end of file + fn baz(self) {} +} diff --git a/crates/test-files/fixtures/compile_errors/call_to_pure_fn_on_self.fe b/crates/test-files/fixtures/compile_errors/call_to_pure_fn_on_self.fe index de2fa0f781..916acaae56 100644 --- a/crates/test-files/fixtures/compile_errors/call_to_pure_fn_on_self.fe +++ b/crates/test-files/fixtures/compile_errors/call_to_pure_fn_on_self.fe @@ -1,6 +1,7 @@ -contract Foo: - fn pure(): - pass +contract Foo { + fn pure() {} - fn bar(self): - self.pure() \ No newline at end of file + fn bar(self) { + self.pure() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_external_contract.fe b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_external_contract.fe index 422a042cfe..cc108a5d7a 100644 --- a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_external_contract.fe +++ b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_external_contract.fe @@ -1,8 +1,11 @@ use std::context::Context -contract Foo: - val: u8 +contract Foo { + val: u8 +} -contract Bar: - pub fn test(ctx: Context): - Foo(ctx, address(0)).doesnt_exist() \ No newline at end of file +contract Bar { + pub fn test(ctx: Context) { + Foo(ctx, address(0)).doesnt_exist() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_memory_struct.fe b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_memory_struct.fe index adbdd360ef..c4163afb43 100644 --- a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_memory_struct.fe +++ b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_memory_struct.fe @@ -1,7 +1,10 @@ -struct Something: - pub val: u8 +struct Something { + pub val: u8 +} -contract Bar: - pub fn test(): - let thingy: Something = Something(val: u8(1)) - thingy.doesnt_exist() \ No newline at end of file +contract Bar { + pub fn test() { + let thingy: Something = Something(val: u8(1)) + thingy.doesnt_exist() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_storage_struct.fe b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_storage_struct.fe index 052af5ab3f..97aa91ca3c 100644 --- a/crates/test-files/fixtures/compile_errors/call_undefined_function_on_storage_struct.fe +++ b/crates/test-files/fixtures/compile_errors/call_undefined_function_on_storage_struct.fe @@ -1,8 +1,11 @@ -struct Something: - val: u8 +struct Something { + val: u8 +} -contract Bar: - thingy: Something +contract Bar { + thingy: Something - pub fn test(self): - self.thingy.doesnt_exist() \ No newline at end of file + pub fn test(self) { + self.thingy.doesnt_exist() + } +} diff --git a/crates/test-files/fixtures/compile_errors/call_with_pub_fns.fe b/crates/test-files/fixtures/compile_errors/call_with_pub_fns.fe index 3d00797fec..8a1c4cb201 100644 --- a/crates/test-files/fixtures/compile_errors/call_with_pub_fns.fe +++ b/crates/test-files/fixtures/compile_errors/call_with_pub_fns.fe @@ -1,12 +1,9 @@ -contract Foo: - pub fn __call__(): - pass +contract Foo { + pub fn __call__() {} - fn bar(): - pass + fn bar() {} - pub fn baz(): - pass + pub fn baz() {} - pub fn bing(): - pass + pub fn bing() {} +} diff --git a/crates/test-files/fixtures/compile_errors/call_wrong_return_type.fe b/crates/test-files/fixtures/compile_errors/call_wrong_return_type.fe index cbd52b6f11..687e1d02d0 100644 --- a/crates/test-files/fixtures/compile_errors/call_wrong_return_type.fe +++ b/crates/test-files/fixtures/compile_errors/call_wrong_return_type.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn __call__() -> u64: - return 10 \ No newline at end of file +contract Foo { + pub fn __call__() -> u64 { + return 10 + } +} diff --git a/crates/test-files/fixtures/compile_errors/cannot_move.fe b/crates/test-files/fixtures/compile_errors/cannot_move.fe index 441d924ce5..4ecc955b3d 100644 --- a/crates/test-files/fixtures/compile_errors/cannot_move.fe +++ b/crates/test-files/fixtures/compile_errors/cannot_move.fe @@ -1,5 +1,7 @@ -contract Foo: +contract Foo { data: Array - pub fn foo(self) -> Array: + pub fn foo(self) -> Array { return self.data + } +} diff --git a/crates/test-files/fixtures/compile_errors/cannot_move2.fe b/crates/test-files/fixtures/compile_errors/cannot_move2.fe index 0e7d483cf2..e13377770f 100644 --- a/crates/test-files/fixtures/compile_errors/cannot_move2.fe +++ b/crates/test-files/fixtures/compile_errors/cannot_move2.fe @@ -1,6 +1,7 @@ -contract Foo: - - pub fn foo(): - let x: Array - let y: Array - let c: Array = x + y +contract Foo { + pub fn foo() { + let x: Array + let y: Array + let c: Array = x + y + } +} diff --git a/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe b/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe index 9326c687f2..c3c9165d16 100644 --- a/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe +++ b/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe @@ -1,7 +1,8 @@ use std::context::Context -contract Foo: - pub fn bar(ctx: Context) -> address: +contract Foo { + pub fn bar(ctx: Context) -> address { let foo: Foo = Foo.create(ctx, 0) - - return address(foo) \ No newline at end of file + return address(foo) + } +} diff --git a/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe b/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe index d213206741..439d1878b4 100644 --- a/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe +++ b/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe @@ -1,7 +1,8 @@ use std::context::Context -contract Foo: - pub fn bar(ctx: Context) -> address: +contract Foo { + pub fn bar(ctx: Context) -> address { let foo: Foo = Foo.create2(ctx, 2, 0) - - return address(foo) \ No newline at end of file + return address(foo) + } +} diff --git a/crates/test-files/fixtures/compile_errors/circular_type_alias.fe b/crates/test-files/fixtures/compile_errors/circular_type_alias.fe index 7bb514dc76..20dbc3a23f 100644 --- a/crates/test-files/fixtures/compile_errors/circular_type_alias.fe +++ b/crates/test-files/fixtures/compile_errors/circular_type_alias.fe @@ -1,3 +1,5 @@ type A = Map + type B = Map + type C = Map diff --git a/crates/test-files/fixtures/compile_errors/const_assign.fe b/crates/test-files/fixtures/compile_errors/const_assign.fe index 72c975afaf..d2e88cd240 100644 --- a/crates/test-files/fixtures/compile_errors/const_assign.fe +++ b/crates/test-files/fixtures/compile_errors/const_assign.fe @@ -1,9 +1,12 @@ const MODULE: i32 = 10 -contract FOO: - fn assign_to_global_const(): +contract FOO { + fn assign_to_global_const() { MODULE = 1 - - fn assign_to_local_const(): + } + + fn assign_to_local_const() { const LOCAL: i32 = 10 - LOCAL = 1 \ No newline at end of file + LOCAL = 1 + } +} diff --git a/crates/test-files/fixtures/compile_errors/const_generics_param.fe b/crates/test-files/fixtures/compile_errors/const_generics_param.fe index 04b01aec93..7ae80cab97 100644 --- a/crates/test-files/fixtures/compile_errors/const_generics_param.fe +++ b/crates/test-files/fixtures/compile_errors/const_generics_param.fe @@ -1,18 +1,25 @@ -contract Foo: - fn not_a_constant(): +contract Foo { + fn not_a_constant() { let array: Array + } - fn not_a_numeric_const_generics(): + fn not_a_numeric_const_generics() { let array: Array - - fn zero_division_div(): + } + + fn zero_division_div() { let array: Array + } - fn zero_division_mod(): + fn zero_division_mod() { let array: Array - - fn shift_overflow(): + } + + fn shift_overflow() { let array: Array - - fn subtraction_overflow(): - let array: Array \ No newline at end of file + } + + fn subtraction_overflow() { + let array: Array + } +} diff --git a/crates/test-files/fixtures/compile_errors/const_local.fe b/crates/test-files/fixtures/compile_errors/const_local.fe index 992f6492bb..bf7567a6f2 100644 --- a/crates/test-files/fixtures/compile_errors/const_local.fe +++ b/crates/test-files/fixtures/compile_errors/const_local.fe @@ -1,18 +1,24 @@ -contract Foo: - fn not_a_constant(): +contract Foo { + fn not_a_constant() { const FOO: (i32, i32) = (1, 2) - - fn not_a_constant2(): + } + + fn not_a_constant2() { let foo: i32 = 1 - const FOO:i32 = foo + 1 - - fn overflow(): + const FOO: i32 = foo + 1 + } + + fn overflow() { const FOO1: u8 = 255 const FOO2: u8 = 1 const FOO3: u8 = FOO1 + FOO2 - - fn undefined(): + } + + fn undefined() { const FOO: u8 = BAR - - fn type_error(): - const FOO: i32 = "FOO" \ No newline at end of file + } + + fn type_error() { + const FOO: i32 = "FOO" + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_builtins_param_incorrect_type.fe b/crates/test-files/fixtures/compile_errors/ctx_builtins_param_incorrect_type.fe index 68e74c4b42..9f3ef60453 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_builtins_param_incorrect_type.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_builtins_param_incorrect_type.fe @@ -1,14 +1,17 @@ use std::context::Context -event WorldMessage: +event WorldMessage { message: String<42> +} -contract Barn: - pub fn cow(): - pass +contract Barn { + pub fn cow() {} +} -contract Foo: - pub fn bar(ctx: Context): +contract Foo { + pub fn bar(ctx: Context) { let existing_barn: Barn = Barn("hello world", address(0)) let created_barn: Barn = Barn.create(address(26), 0) emit WorldMessage(42, message: "hello world") + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_init.fe b/crates/test-files/fixtures/compile_errors/ctx_init.fe index e29893503f..6cac5ce32e 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_init.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_init.fe @@ -4,4 +4,4 @@ contract Foo { pub fn bar() { let fake_ctx: Context = Context() } -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe b/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe index 737da5ba02..bc9471a328 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe @@ -1,9 +1,11 @@ use std::context::Context -contract Foo: - pub fn bar(): - pass +contract Foo { + pub fn bar() {} +} -contract Bar: - pub fn create_foo(ctx: Context): +contract Bar { + pub fn create_foo(ctx: Context) { Foo.create(0) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_missing_event.fe b/crates/test-files/fixtures/compile_errors/ctx_missing_event.fe index 5d4b92e48e..ed3621bd31 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_event.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_missing_event.fe @@ -1,8 +1,11 @@ use std::context::Context -event HelloWorld: +event HelloWorld { message: String<26> +} -contract Bar: - pub fn say_hello(ctx: Context): +contract Bar { + pub fn say_hello(ctx: Context) { emit HelloWorld(message: "hello world") + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_missing_internal_call.fe b/crates/test-files/fixtures/compile_errors/ctx_missing_internal_call.fe index 17fcaa8fe9..b209554942 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_internal_call.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_missing_internal_call.fe @@ -1,10 +1,13 @@ use std::context::Context -contract Foo: +contract Foo { favorite_number: u256 - pub fn bar(ctx: Context) -> u256: + pub fn bar(ctx: Context) -> u256 { return ctx.block_number() + } - pub fn baz(self, ctx: Context): - self.favorite_number = bar() \ No newline at end of file + pub fn baz(self, ctx: Context) { + self.favorite_number = bar() + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_missing_load.fe b/crates/test-files/fixtures/compile_errors/ctx_missing_load.fe index 56ce0bf838..78354ea44b 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_load.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_missing_load.fe @@ -1,9 +1,11 @@ use std::context::Context -contract Foo: - pub fn bar(): - pass +contract Foo { + pub fn bar() {} +} -contract Bar: - pub fn create_foo(ctx: Context): +contract Bar { + pub fn create_foo(ctx: Context) { Foo(0) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_not_after_self.fe b/crates/test-files/fixtures/compile_errors/ctx_not_after_self.fe index bcd3eb8227..78a5c29f0b 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_not_after_self.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_not_after_self.fe @@ -1,5 +1,5 @@ use std::context::Context -contract Foo: - pub fn bar(self, baz: u256, ctx: Context): - pass \ No newline at end of file +contract Foo { + pub fn bar(self, baz: u256, ctx: Context) {} +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_not_first.fe b/crates/test-files/fixtures/compile_errors/ctx_not_first.fe index ceef91dfda..7fc14087f0 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_not_first.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_not_first.fe @@ -1,5 +1,5 @@ use std::context::Context -contract Foo: - pub fn bar(baz: u256, ctx: Context): - pass \ No newline at end of file +contract Foo { + pub fn bar(baz: u256, ctx: Context) {} +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_passed_external_call.fe b/crates/test-files/fixtures/compile_errors/ctx_passed_external_call.fe index 3f4db78ca8..22a1397cf8 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_passed_external_call.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_passed_external_call.fe @@ -1,13 +1,16 @@ use std::context::Context -contract Foo: - - pub fn bar(ctx: Context) -> u256: +contract Foo { + pub fn bar(ctx: Context) -> u256 { return ctx.block_number() + } +} -contract Bing: +contract Bing { favorite_number: u256 - pub fn baz(self, ctx: Context): + pub fn baz(self, ctx: Context) { let foo: Foo = Foo.create(ctx, 0) - self.favorite_number = foo.bar(ctx) \ No newline at end of file + self.favorite_number = foo.bar(ctx) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_pure.fe b/crates/test-files/fixtures/compile_errors/ctx_pure.fe index 1adf683fd2..47b098f3b5 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_pure.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_pure.fe @@ -1,4 +1,3 @@ use std::context::Context -pub fn foo(ctx: Context): - pass \ No newline at end of file +pub fn foo(ctx: Context) {} diff --git a/crates/test-files/fixtures/compile_errors/ctx_undeclared.fe b/crates/test-files/fixtures/compile_errors/ctx_undeclared.fe index cfabd9a812..b519e50862 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_undeclared.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_undeclared.fe @@ -1,5 +1,7 @@ use std::context::Context -contract Foo: - pub fn bar() -> u256: - return ctx.block_number() \ No newline at end of file +contract Foo { + pub fn bar() -> u256 { + return ctx.block_number() + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_undefined_contract_init.fe b/crates/test-files/fixtures/compile_errors/ctx_undefined_contract_init.fe index 399fc360f0..916fb95cd6 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_undefined_contract_init.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_undefined_contract_init.fe @@ -1,6 +1,7 @@ -contract Bar: - pass +contract Bar {} -contract Foo: - pub fn baz(): - Bar(address(0)) \ No newline at end of file +contract Foo { + pub fn baz() { + Bar(address(0)) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_undefined_create.fe b/crates/test-files/fixtures/compile_errors/ctx_undefined_create.fe index bfceaf88bc..77a4bd4d1b 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_undefined_create.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_undefined_create.fe @@ -1,6 +1,7 @@ -contract Bar: - pass +contract Bar {} -contract Foo: - pub fn baz(): - Bar.create(0) \ No newline at end of file +contract Foo { + pub fn baz() { + Bar.create(0) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_undefined_create2.fe b/crates/test-files/fixtures/compile_errors/ctx_undefined_create2.fe index 1cbb2b34d8..ecb000893d 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_undefined_create2.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_undefined_create2.fe @@ -1,6 +1,7 @@ -contract Bar: - pass +contract Bar {} -contract Foo: - pub fn baz(): - Bar.create2(0, 0) \ No newline at end of file +contract Foo { + pub fn baz() { + Bar.create2(0, 0) + } +} diff --git a/crates/test-files/fixtures/compile_errors/ctx_undefined_event.fe b/crates/test-files/fixtures/compile_errors/ctx_undefined_event.fe index fe1e67ff26..bce08b154d 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_undefined_event.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_undefined_event.fe @@ -1,6 +1,9 @@ -event YouWin: +event YouWin { amount: u256 +} -contract Foo: - pub fn bar(): - emit YouWin(amount: 42) \ No newline at end of file +contract Foo { + pub fn bar() { + emit YouWin(amount: 42) + } +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_arg_in_contract_method.fe b/crates/test-files/fixtures/compile_errors/duplicate_arg_in_contract_method.fe index 13f12a47ce..d98855b49a 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_arg_in_contract_method.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_arg_in_contract_method.fe @@ -1,3 +1,3 @@ -contract Foo: - pub fn bar(foo: u8, foo:u8): - pass +contract Foo { + pub fn bar(foo: u8, foo: u8) {} +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_contract_in_module.fe b/crates/test-files/fixtures/compile_errors/duplicate_contract_in_module.fe index 2cf82749dc..b5a8975ddb 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_contract_in_module.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_contract_in_module.fe @@ -1,9 +1,7 @@ -contract Foo: +contract Foo { + pub fn bar() {} +} - pub fn bar(): - pass - -contract Foo: - - pub fn bar(): - pass +contract Foo { + pub fn bar() {} +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_event_in_contract.fe b/crates/test-files/fixtures/compile_errors/duplicate_event_in_contract.fe index 1618ee1bfe..49f545190c 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_event_in_contract.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_event_in_contract.fe @@ -1,6 +1,9 @@ -contract Foo: - event MyEvent: +contract Foo { + event MyEvent { idx addr1: address + } - event MyEvent: + event MyEvent { idx addr1: address + } +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_field_in_contract.fe b/crates/test-files/fixtures/compile_errors/duplicate_field_in_contract.fe index 5da1eb18a2..a7e122c9ac 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_field_in_contract.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_field_in_contract.fe @@ -1,3 +1,4 @@ -contract Foo: +contract Foo { bar: u8 bar: u8 +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_field_in_struct.fe b/crates/test-files/fixtures/compile_errors/duplicate_field_in_struct.fe index dd724b3989..382e08f530 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_field_in_struct.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_field_in_struct.fe @@ -1,6 +1,8 @@ -struct MyStruct: +struct MyStruct { foo: u8 foo: u8 +} -contract Foo: +contract Foo { bar: u8 +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_method_in_contract.fe b/crates/test-files/fixtures/compile_errors/duplicate_method_in_contract.fe index 48887c6231..5d14b377f8 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_method_in_contract.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_method_in_contract.fe @@ -1,7 +1,5 @@ -contract Foo: +contract Foo { + pub fn bar() {} - pub fn bar(): - pass - - pub fn bar(): - pass + pub fn bar() {} +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_struct_in_module.fe b/crates/test-files/fixtures/compile_errors/duplicate_struct_in_module.fe index e0d9eb8ca7..e31b291546 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_struct_in_module.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_struct_in_module.fe @@ -1,10 +1,11 @@ -struct MyStruct: +struct MyStruct { foo: u8 +} -struct MyStruct: +struct MyStruct { foo: u8 +} -contract Foo: - - pub fn bar(): - pass +contract Foo { + pub fn bar() {} +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_typedef_in_module.fe b/crates/test-files/fixtures/compile_errors/duplicate_typedef_in_module.fe index 7183f41382..4c1bb7a9c6 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_typedef_in_module.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_typedef_in_module.fe @@ -1,9 +1,7 @@ - type bar = u8 type bar = u8 -contract Foo: - - pub fn bar(): - pass +contract Foo { + pub fn bar() {} +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_var_in_child_scope.fe b/crates/test-files/fixtures/compile_errors/duplicate_var_in_child_scope.fe index bebcd50c24..58856c3e55 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_var_in_child_scope.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_var_in_child_scope.fe @@ -1,7 +1,10 @@ -contract Foo: - pub fn bar(): +contract Foo { + pub fn bar() { let my_array: Array let sum: u256 = 0 - for i in my_array: + for i in my_array { let sum: u64 = 0 sum += i + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_var_in_contract_method.fe b/crates/test-files/fixtures/compile_errors/duplicate_var_in_contract_method.fe index 2686816290..e459b777ab 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_var_in_contract_method.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_var_in_contract_method.fe @@ -1,4 +1,6 @@ -contract Foo: - pub fn bar(): +contract Foo { + pub fn bar() { let foo: u8 let foo: u8 + } +} diff --git a/crates/test-files/fixtures/compile_errors/duplicate_var_in_for_loop.fe b/crates/test-files/fixtures/compile_errors/duplicate_var_in_for_loop.fe index 3d7495ed53..773f2b8c09 100644 --- a/crates/test-files/fixtures/compile_errors/duplicate_var_in_for_loop.fe +++ b/crates/test-files/fixtures/compile_errors/duplicate_var_in_for_loop.fe @@ -1,8 +1,10 @@ -contract C: - fn f(): - let x: u256 = 10 - - let xs: Array = [1, 2, 3, 4] - let sum: u8 = 0 - for x in xs: - sum += x +contract C { + fn f() { + let x: u256 = 10 + let xs: Array = [1, 2, 3, 4] + let sum: u8 = 0 + for x in xs { + sum += x + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/emit_bad_args.fe b/crates/test-files/fixtures/compile_errors/emit_bad_args.fe index 20a57fe12e..889469b1b5 100644 --- a/crates/test-files/fixtures/compile_errors/emit_bad_args.fe +++ b/crates/test-files/fixtures/compile_errors/emit_bad_args.fe @@ -1,10 +1,13 @@ use std::context::Context -contract Bar: - event Foo: - idx x: address - y: u256 - z: bool +contract Bar { + event Foo { + idx x: address + y: u256 + z: bool + } - pub fn test(ctx: Context): - emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) \ No newline at end of file + pub fn test(ctx: Context) { + emit Foo(ctx, (1, 2), z: 10, y: true, x: 5) + } +} diff --git a/crates/test-files/fixtures/compile_errors/external_call_type_error.fe b/crates/test-files/fixtures/compile_errors/external_call_type_error.fe index 4c71c4a6be..33398e30b6 100644 --- a/crates/test-files/fixtures/compile_errors/external_call_type_error.fe +++ b/crates/test-files/fixtures/compile_errors/external_call_type_error.fe @@ -1,9 +1,11 @@ use std::context::Context -contract Foo: - pub fn bar(_ a: u256): - pass +contract Foo { + pub fn bar(_ a: u256) {} +} -contract FooProxy: - pub fn baz(ctx: Context): - Foo(ctx, address(0)).bar("hello world") \ No newline at end of file +contract FooProxy { + pub fn baz(ctx: Context) { + Foo(ctx, address(0)).bar("hello world") + } +} diff --git a/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe b/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe index a7958c29d9..29dd9b068f 100644 --- a/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe +++ b/crates/test-files/fixtures/compile_errors/external_call_wrong_number_of_params.fe @@ -1,9 +1,11 @@ use std::context::Context -contract Foo: - pub fn bar(a: u256, b: u256): - pass +contract Foo { + pub fn bar(a: u256, b: u256) {} +} -contract FooProxy: - pub fn baz(ctx: Context): +contract FooProxy { + pub fn baz(ctx: Context) { Foo(ctx, address(0)).bar(42) + } +} diff --git a/crates/test-files/fixtures/compile_errors/for_loop_sto_iter_no_copy.fe b/crates/test-files/fixtures/compile_errors/for_loop_sto_iter_no_copy.fe index 71187942ff..67b64bd8a5 100644 --- a/crates/test-files/fixtures/compile_errors/for_loop_sto_iter_no_copy.fe +++ b/crates/test-files/fixtures/compile_errors/for_loop_sto_iter_no_copy.fe @@ -1,6 +1,9 @@ -contract Foo: +contract Foo { my_array: Array - pub fn bar(self): - for i in self.my_array: - pass \ No newline at end of file + pub fn bar(self) { + for i in self.my_array { + + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/indexed_event.fe b/crates/test-files/fixtures/compile_errors/indexed_event.fe index 88d5213829..9083c4df30 100644 --- a/crates/test-files/fixtures/compile_errors/indexed_event.fe +++ b/crates/test-files/fixtures/compile_errors/indexed_event.fe @@ -1,6 +1,8 @@ -contract Foo: - event MyEvent: +contract Foo { + event MyEvent { idx addr1: address idx addr2: address idx addr3: address idx addr4: address + } +} diff --git a/crates/test-files/fixtures/compile_errors/init_call_on_external_contract.fe b/crates/test-files/fixtures/compile_errors/init_call_on_external_contract.fe index 9c71f10a32..75fa1f96c0 100644 --- a/crates/test-files/fixtures/compile_errors/init_call_on_external_contract.fe +++ b/crates/test-files/fixtures/compile_errors/init_call_on_external_contract.fe @@ -1,14 +1,15 @@ use std::context::Context -contract Foo: - pub fn __init__(): - pass - pub fn f(): - pass +contract Foo { + pub fn __init__() {} + pub fn f() {} +} -contract Bar: - fn b(ctx: Context): - let foo: Foo = Foo(ctx, address(0)) - foo.f() - foo.__init__() +contract Bar { + fn b(ctx: Context) { + let foo: Foo = Foo(ctx, address(0)) + foo.f() + foo.__init__() + } +} diff --git a/crates/test-files/fixtures/compile_errors/init_call_on_self.fe b/crates/test-files/fixtures/compile_errors/init_call_on_self.fe index 9056109b28..9b158e466e 100644 --- a/crates/test-files/fixtures/compile_errors/init_call_on_self.fe +++ b/crates/test-files/fixtures/compile_errors/init_call_on_self.fe @@ -1,6 +1,7 @@ -contract Foo: - pub fn __init__(): - pass +contract Foo { + pub fn __init__() {} - fn bar(self): - self.__init__() \ No newline at end of file + fn bar(self) { + self.__init__() + } +} diff --git a/crates/test-files/fixtures/compile_errors/init_duplicate_def.fe b/crates/test-files/fixtures/compile_errors/init_duplicate_def.fe index f50a160553..d104e06f0f 100644 --- a/crates/test-files/fixtures/compile_errors/init_duplicate_def.fe +++ b/crates/test-files/fixtures/compile_errors/init_duplicate_def.fe @@ -1,12 +1,13 @@ -contract Foo: - pub fn __init__(): - pass +contract Foo { + pub fn __init__() {} - pub fn bar(): - pass + pub fn bar() {} - pub fn __init__(): + pub fn __init__() { 1 + 2 + } - pub fn __init__(): + pub fn __init__() { 3 + 4 + } +} diff --git a/crates/test-files/fixtures/compile_errors/init_wrong_return_type.fe b/crates/test-files/fixtures/compile_errors/init_wrong_return_type.fe index 56e02ab555..628942d79b 100644 --- a/crates/test-files/fixtures/compile_errors/init_wrong_return_type.fe +++ b/crates/test-files/fixtures/compile_errors/init_wrong_return_type.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn __init__() -> u64: - return 10 \ No newline at end of file +contract Foo { + pub fn __init__() -> u64 { + return 10 + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_block_field.fe b/crates/test-files/fixtures/compile_errors/invalid_block_field.fe index 0b8164de50..a6b6651ad8 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_block_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_block_field.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn foo(): - block.foo \ No newline at end of file +contract Foo { + pub fn foo() { + block.foo + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_chain_field.fe b/crates/test-files/fixtures/compile_errors/invalid_chain_field.fe index 3065544f2a..8d5aa5b637 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_chain_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_chain_field.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn foo(): - chain.foo \ No newline at end of file +contract Foo { + pub fn foo() { + chain.foo + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_compiler_version.fe b/crates/test-files/fixtures/compile_errors/invalid_compiler_version.fe index 4c20078790..e20da6eb98 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_compiler_version.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_compiler_version.fe @@ -1,4 +1,3 @@ pragma <=0.1.0 -contract foo: - pass \ No newline at end of file +contract foo {} diff --git a/crates/test-files/fixtures/compile_errors/invalid_contract_field.fe b/crates/test-files/fixtures/compile_errors/invalid_contract_field.fe index 59296728f8..a4159641bd 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_contract_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_contract_field.fe @@ -1,5 +1,7 @@ -contract Foo: - val: u256 +contract Foo { + val: u256 - pub fn foo(self): - self.bar \ No newline at end of file + pub fn foo(self) { + self.bar + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_msg_field.fe b/crates/test-files/fixtures/compile_errors/invalid_msg_field.fe index ba371ccb4d..bc0fcaa49d 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_msg_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_msg_field.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn foo(): - msg.foo \ No newline at end of file +contract Foo { + pub fn foo() { + msg.foo + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_string_field.fe b/crates/test-files/fixtures/compile_errors/invalid_string_field.fe index e8f1ae29dd..8c30dbaabd 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_string_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_string_field.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn foo(): - "".does_not_exist \ No newline at end of file +contract Foo { + pub fn foo() { + "".does_not_exist + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_struct_field.fe b/crates/test-files/fixtures/compile_errors/invalid_struct_field.fe index 3abec6909d..015be9507b 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_struct_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_struct_field.fe @@ -1,8 +1,11 @@ -struct Bar: - id: u256 +struct Bar { + id: u256 +} -contract Foo: - val: Bar +contract Foo { + val: Bar - pub fn foo(self): - self.val.foo \ No newline at end of file + pub fn foo(self) { + self.val.foo + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_tuple_field.fe b/crates/test-files/fixtures/compile_errors/invalid_tuple_field.fe index 3cd30bb411..69382b0e1a 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_tuple_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_tuple_field.fe @@ -1,5 +1,7 @@ -contract Foo: - val: (u256, u8) +contract Foo { + val: (u256, u8) - pub fn foo(self): - self.val.item5 \ No newline at end of file + pub fn foo(self) { + self.val.item5 + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_tx_field.fe b/crates/test-files/fixtures/compile_errors/invalid_tx_field.fe index f4fa525536..40d4b5f357 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_tx_field.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_tx_field.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn foo(): - tx.foo \ No newline at end of file +contract Foo { + pub fn foo() { + tx.foo + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_var_declaration_1.fe b/crates/test-files/fixtures/compile_errors/invalid_var_declaration_1.fe index 19ca17a281..7b3246425e 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_var_declaration_1.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_var_declaration_1.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(): - let (x,): Array = [1,2,3,4,5,6,7,8,9,0,2,1,3,4,5,6,7,8,9,0] \ No newline at end of file +contract Foo { + pub fn bar() { + let (x,): Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 0] + } +} diff --git a/crates/test-files/fixtures/compile_errors/invalid_var_declaration_2.fe b/crates/test-files/fixtures/compile_errors/invalid_var_declaration_2.fe index bc4058cb80..e4f57b1659 100644 --- a/crates/test-files/fixtures/compile_errors/invalid_var_declaration_2.fe +++ b/crates/test-files/fixtures/compile_errors/invalid_var_declaration_2.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(): - let (x, y):(u256,)=(1,) +contract Foo { + pub fn bar() { + let (x, y): (u256,) = (1,) + } +} diff --git a/crates/test-files/fixtures/compile_errors/issue_451.fe b/crates/test-files/fixtures/compile_errors/issue_451.fe index 318812a94f..ef6ecb104b 100644 --- a/crates/test-files/fixtures/compile_errors/issue_451.fe +++ b/crates/test-files/fixtures/compile_errors/issue_451.fe @@ -1,5 +1,9 @@ -contract o: - pub fn bar(x:u256,y:u256)->bool: - return - pub fn bar(): - s \ No newline at end of file +contract o { + pub fn bar(x: u256, y: u256) -> bool { + return + } + + pub fn bar() { + s + } +} diff --git a/crates/test-files/fixtures/compile_errors/mislabeled_call_args.fe b/crates/test-files/fixtures/compile_errors/mislabeled_call_args.fe index 130d8e69c5..1454e40a35 100644 --- a/crates/test-files/fixtures/compile_errors/mislabeled_call_args.fe +++ b/crates/test-files/fixtures/compile_errors/mislabeled_call_args.fe @@ -1,7 +1,7 @@ -contract Foo: - - pub fn baz(): +contract Foo { + pub fn baz() { bar(doesnt_exist: 1, me_neither: 2) - - pub fn bar(val1: u256, val2: u256): - pass \ No newline at end of file + } + + pub fn bar(val1: u256, val2: u256) {} +} diff --git a/crates/test-files/fixtures/compile_errors/mislabeled_call_args_external_contract_call.fe b/crates/test-files/fixtures/compile_errors/mislabeled_call_args_external_contract_call.fe index 5609b68d5f..13e568e7e7 100644 --- a/crates/test-files/fixtures/compile_errors/mislabeled_call_args_external_contract_call.fe +++ b/crates/test-files/fixtures/compile_errors/mislabeled_call_args_external_contract_call.fe @@ -1,11 +1,13 @@ use std::context::Context -contract Foo: - val: u8 +contract Foo { + val: u8 - pub fn baz(val1: u256, val2: u256): - pass + pub fn baz(val1: u256, val2: u256) {} +} -contract Bar: - pub fn test(ctx: Context): - Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) \ No newline at end of file +contract Bar { + pub fn test(ctx: Context) { + Foo(ctx, address(0)).baz(doesnt_exist: 1, me_neither: 4) + } +} diff --git a/crates/test-files/fixtures/compile_errors/mislabeled_call_args_self.fe b/crates/test-files/fixtures/compile_errors/mislabeled_call_args_self.fe index d974f83152..586fbda943 100644 --- a/crates/test-files/fixtures/compile_errors/mislabeled_call_args_self.fe +++ b/crates/test-files/fixtures/compile_errors/mislabeled_call_args_self.fe @@ -1,7 +1,7 @@ -contract Foo: - - pub fn baz(self): +contract Foo { + pub fn baz(self) { self.bar(doesnt_exist: 1, me_neither: 2) + } - pub fn bar(self, val1: u256, val2: u256): - pass \ No newline at end of file + pub fn bar(self, val1: u256, val2: u256) {} +} diff --git a/crates/test-files/fixtures/compile_errors/mismatch_return_type.fe b/crates/test-files/fixtures/compile_errors/mismatch_return_type.fe index f3070a52dd..9850dd9b5f 100644 --- a/crates/test-files/fixtures/compile_errors/mismatch_return_type.fe +++ b/crates/test-files/fixtures/compile_errors/mismatch_return_type.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn bar() -> address: +contract Foo { + pub fn bar() -> address { return 1 + } +} diff --git a/crates/test-files/fixtures/compile_errors/missing_return.fe b/crates/test-files/fixtures/compile_errors/missing_return.fe index ae596ecc9f..6d802629f3 100644 --- a/crates/test-files/fixtures/compile_errors/missing_return.fe +++ b/crates/test-files/fixtures/compile_errors/missing_return.fe @@ -1,5 +1,7 @@ -contract Foo: +contract Foo { baz: Map - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.baz[0] = 1 + } +} diff --git a/crates/test-files/fixtures/compile_errors/missing_return_after_if.fe b/crates/test-files/fixtures/compile_errors/missing_return_after_if.fe index d632e4bf87..e282a9a652 100644 --- a/crates/test-files/fixtures/compile_errors/missing_return_after_if.fe +++ b/crates/test-files/fixtures/compile_errors/missing_return_after_if.fe @@ -1,4 +1,7 @@ -contract Foo: - pub fn bar(val: u256) -> u256: - if val > 1: +contract Foo { + pub fn bar(val: u256) -> u256 { + if val > 1 { return 5 + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/missing_return_in_else.fe b/crates/test-files/fixtures/compile_errors/missing_return_in_else.fe index fc3f011ed6..d3ff9b6f58 100644 --- a/crates/test-files/fixtures/compile_errors/missing_return_in_else.fe +++ b/crates/test-files/fixtures/compile_errors/missing_return_in_else.fe @@ -1,6 +1,9 @@ -contract Foo: - pub fn bar(val: u256) -> u256: - if val > 1: +contract Foo { + pub fn bar(val: u256) -> u256 { + if val > 1 { return 5 - else: - let x:u256 = 1 + } else { + let x: u256 = 1 + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/missing_self.fe b/crates/test-files/fixtures/compile_errors/missing_self.fe index a68870e2f9..c0be638b19 100644 --- a/crates/test-files/fixtures/compile_errors/missing_self.fe +++ b/crates/test-files/fixtures/compile_errors/missing_self.fe @@ -1,12 +1,15 @@ -contract Foo: - fn pure_fn(): +contract Foo { + fn pure_fn() { self.mut_fn() + } - fn mut_fn(self): - pass + fn mut_fn(self) {} +} -struct Bar: +struct Bar { x: u8 - fn f() -> u8: - return self.x \ No newline at end of file + fn f() -> u8 { + return self.x + } +} diff --git a/crates/test-files/fixtures/compile_errors/module_const_call.fe b/crates/test-files/fixtures/compile_errors/module_const_call.fe index 01ba54f90e..1ca7215ebe 100644 --- a/crates/test-files/fixtures/compile_errors/module_const_call.fe +++ b/crates/test-files/fixtures/compile_errors/module_const_call.fe @@ -1,5 +1,7 @@ const FOO: u8 = 1 -contract C: - fn f(): - FOO() +contract C { + fn f() { + FOO() + } +} diff --git a/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe b/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe index cad0c8d514..264f390b25 100644 --- a/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe +++ b/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { my_sto_array: Array - pub fn bar(self, my_array: Array): + pub fn bar(self, my_array: Array) { my_array = self.my_sto_array + } - pub fn foo(self) -> Array: + pub fn foo(self) -> Array { return self.my_sto_array + } +} diff --git a/crates/test-files/fixtures/compile_errors/non_pub_init.fe b/crates/test-files/fixtures/compile_errors/non_pub_init.fe index 88292ea504..768a7dd1d8 100644 --- a/crates/test-files/fixtures/compile_errors/non_pub_init.fe +++ b/crates/test-files/fixtures/compile_errors/non_pub_init.fe @@ -1,3 +1,3 @@ -contract Foo: - fn __init__(): - pass \ No newline at end of file +contract Foo { + fn __init__() {} +} diff --git a/crates/test-files/fixtures/compile_errors/not_callable.fe b/crates/test-files/fixtures/compile_errors/not_callable.fe index 8070130049..48c2cb1638 100644 --- a/crates/test-files/fixtures/compile_errors/not_callable.fe +++ b/crates/test-files/fixtures/compile_errors/not_callable.fe @@ -1,13 +1,17 @@ +contract Foo { + event MyEvent { + x: u8 + } -contract Foo: - event MyEvent: - x: u8 + fn call_int() { + 5() + } - fn call_int(): - 5() + fn call_event() { + MyEvent(x: 10) + } - fn call_event(): - MyEvent(x: 10) - - fn call_self(self): - self() + fn call_self(self) { + self() + } +} diff --git a/crates/test-files/fixtures/compile_errors/not_in_scope.fe b/crates/test-files/fixtures/compile_errors/not_in_scope.fe index 3320939063..3cfbe58a07 100644 --- a/crates/test-files/fixtures/compile_errors/not_in_scope.fe +++ b/crates/test-files/fixtures/compile_errors/not_in_scope.fe @@ -1,8 +1,10 @@ -contract Foo: - - pub fn bar() -> u256: - if true: +contract Foo { + pub fn bar() -> u256 { + if true { let y: u256 = 1 - else: + } else { let y: u256 = 1 - return y \ No newline at end of file + } + return y + } +} diff --git a/crates/test-files/fixtures/compile_errors/not_in_scope_2.fe b/crates/test-files/fixtures/compile_errors/not_in_scope_2.fe index 35925f0df5..db4d77afa4 100644 --- a/crates/test-files/fixtures/compile_errors/not_in_scope_2.fe +++ b/crates/test-files/fixtures/compile_errors/not_in_scope_2.fe @@ -1,8 +1,10 @@ -contract Foo: - - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let i: u256 = 0 - while i < 1: + while i < 1 { i = 1 let y: u256 = 1 - return y \ No newline at end of file + } + return y + } +} diff --git a/crates/test-files/fixtures/compile_errors/private_struct_field.fe b/crates/test-files/fixtures/compile_errors/private_struct_field.fe index b32198e308..fb21bee9d4 100644 --- a/crates/test-files/fixtures/compile_errors/private_struct_field.fe +++ b/crates/test-files/fixtures/compile_errors/private_struct_field.fe @@ -1,8 +1,11 @@ -struct Bar: - id: u256 +struct Bar { + id: u256 +} -contract Foo: - val: Bar +contract Foo { + val: Bar - pub fn foo(self): - self.val.id \ No newline at end of file + pub fn foo(self) { + self.val.id + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_addition_with_mixed_types.fe b/crates/test-files/fixtures/compile_errors/return_addition_with_mixed_types.fe index 9a015c7e50..71e8b6efa3 100644 --- a/crates/test-files/fixtures/compile_errors/return_addition_with_mixed_types.fe +++ b/crates/test-files/fixtures/compile_errors/return_addition_with_mixed_types.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u128) -> u128: +contract Foo { + pub fn bar(x: u256, y: u128) -> u128 { return x + y + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe b/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe index e1899ce412..34132a222c 100644 --- a/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe +++ b/crates/test-files/fixtures/compile_errors/return_call_to_fn_with_param_type_mismatch.fe @@ -1,7 +1,9 @@ -contract Foo: - - pub fn foo(_ val: address) -> u256: +contract Foo { + pub fn foo(_ val: address) -> u256 { return 42 + } - pub fn bar() -> u256: + pub fn bar() -> u256 { return foo(100) + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_call_to_fn_without_return.fe b/crates/test-files/fixtures/compile_errors/return_call_to_fn_without_return.fe index d8ba4d2c04..940b667804 100644 --- a/crates/test-files/fixtures/compile_errors/return_call_to_fn_without_return.fe +++ b/crates/test-files/fixtures/compile_errors/return_call_to_fn_without_return.fe @@ -1,7 +1,9 @@ -contract Foo: - - pub fn foo(): +contract Foo { + pub fn foo() { revert + } - pub fn bar() -> u256: + pub fn bar() -> u256 { return foo() + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_complex_struct.fe b/crates/test-files/fixtures/compile_errors/return_complex_struct.fe index 2d36e01e06..cb2d0d6887 100644 --- a/crates/test-files/fixtures/compile_errors/return_complex_struct.fe +++ b/crates/test-files/fixtures/compile_errors/return_complex_struct.fe @@ -1,6 +1,9 @@ -struct Foo: - pub bar: Array +struct Foo { + pub bar: Array +} -contract C: - pub fn f() -> Foo: - return Foo(bar: [1, 2]) +contract C { + pub fn f() -> Foo { + return Foo(bar: [1, 2]) + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_from_init.fe b/crates/test-files/fixtures/compile_errors/return_from_init.fe index 74deb758fc..2293fbf6a1 100644 --- a/crates/test-files/fixtures/compile_errors/return_from_init.fe +++ b/crates/test-files/fixtures/compile_errors/return_from_init.fe @@ -1,3 +1,5 @@ -contract C: - pub fn __init__() -> i32: +contract C { + pub fn __init__() -> i32 { return 0 + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_lt_mixed_types.fe b/crates/test-files/fixtures/compile_errors/return_lt_mixed_types.fe index 35116296af..954003b23b 100644 --- a/crates/test-files/fixtures/compile_errors/return_lt_mixed_types.fe +++ b/crates/test-files/fixtures/compile_errors/return_lt_mixed_types.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128, y: u256) -> bool: +contract Foo { + pub fn bar(x: u128, y: u256) -> bool { return x < y + } +} diff --git a/crates/test-files/fixtures/compile_errors/return_type_not_fixedsize.fe b/crates/test-files/fixtures/compile_errors/return_type_not_fixedsize.fe index 2bbd05ec7e..aa1ba7f7ae 100644 --- a/crates/test-files/fixtures/compile_errors/return_type_not_fixedsize.fe +++ b/crates/test-files/fixtures/compile_errors/return_type_not_fixedsize.fe @@ -1,3 +1,3 @@ -contract C: - pub fn f() -> Map: - pass +contract C { + pub fn f() -> Map {} +} diff --git a/crates/test-files/fixtures/compile_errors/return_type_undefined.fe b/crates/test-files/fixtures/compile_errors/return_type_undefined.fe index 5a45e87658..d0ceb7fdee 100644 --- a/crates/test-files/fixtures/compile_errors/return_type_undefined.fe +++ b/crates/test-files/fixtures/compile_errors/return_type_undefined.fe @@ -1,3 +1,3 @@ -contract C: - pub fn f() -> Foo: - pass +contract C { + pub fn f() -> Foo {} +} diff --git a/crates/test-files/fixtures/compile_errors/revert_sto_error_no_copy.fe b/crates/test-files/fixtures/compile_errors/revert_sto_error_no_copy.fe index ab0416bb76..76bd0ba657 100644 --- a/crates/test-files/fixtures/compile_errors/revert_sto_error_no_copy.fe +++ b/crates/test-files/fixtures/compile_errors/revert_sto_error_no_copy.fe @@ -1,8 +1,9 @@ -struct MyError: - pass +struct MyError {} -contract Foo: +contract Foo { my_error: MyError - pub fn bar(self): - revert self.my_error \ No newline at end of file + pub fn bar(self) { + revert self.my_error + } +} diff --git a/crates/test-files/fixtures/compile_errors/self_in_standalone_fn.fe b/crates/test-files/fixtures/compile_errors/self_in_standalone_fn.fe index e3e66dce6e..2fb51b36f6 100644 --- a/crates/test-files/fixtures/compile_errors/self_in_standalone_fn.fe +++ b/crates/test-files/fixtures/compile_errors/self_in_standalone_fn.fe @@ -1,7 +1,9 @@ -fn pure_fn(self): +fn pure_fn(self) { self.mut_fn() +} -contract Foo: - - fn foo(self): - pure_fn(self) \ No newline at end of file +contract Foo { + fn foo(self) { + pure_fn(self) + } +} diff --git a/crates/test-files/fixtures/compile_errors/self_misuse.fe b/crates/test-files/fixtures/compile_errors/self_misuse.fe index d48b9b1281..b01490b7c8 100644 --- a/crates/test-files/fixtures/compile_errors/self_misuse.fe +++ b/crates/test-files/fixtures/compile_errors/self_misuse.fe @@ -1,33 +1,40 @@ -fn foo(): - let self: u8 = 10 - self = 5 +fn foo() { + let self: u8 = 10 + self = 5 +} -fn change_x(_ s: S): - s.x = 100 +fn change_x(_ s: S) { + s.x = 100 +} -fn bar(_ c: C): - pass +fn bar(_ c: C) {} -struct S: - pub x: u8 +struct S { + pub x: u8 - fn f(self): - self() + fn f(self) { + self() + } - fn g(self): - self = S(x: 10) + fn g(self) { + self = S(x: 10) + } - fn h(self): - change_x(self) # allowed + fn h(self) { + change_x(self) + } +} -contract C: - x: u8 +contract C { + x: u8 - fn g(self): - pass + fn g(self) {} - fn h(self): - g(self) + fn h(self) { + g(self) + } - fn i(self): - bar(self) + fn i(self) { + bar(self) + } +} diff --git a/crates/test-files/fixtures/compile_errors/self_not_first.fe b/crates/test-files/fixtures/compile_errors/self_not_first.fe index 7cf39ebc5a..f45fbe7afd 100644 --- a/crates/test-files/fixtures/compile_errors/self_not_first.fe +++ b/crates/test-files/fixtures/compile_errors/self_not_first.fe @@ -1,3 +1,3 @@ -contract Foo: - pub fn bar(my_num: u8, self): - pass \ No newline at end of file +contract Foo { + pub fn bar(my_num: u8, self) {} +} diff --git a/crates/test-files/fixtures/compile_errors/shadow_builtin_function.fe b/crates/test-files/fixtures/compile_errors/shadow_builtin_function.fe index d7fe7ce528..41f53e24ed 100644 --- a/crates/test-files/fixtures/compile_errors/shadow_builtin_function.fe +++ b/crates/test-files/fixtures/compile_errors/shadow_builtin_function.fe @@ -1,9 +1,13 @@ -contract C: - pub fn keccak256(bytes: Array) -> Array: - return [1, 2, 3, 4] +contract C { + pub fn keccak256(bytes: Array) -> Array { + return [1, 2, 3, 4] + } - pub fn u256(x: u8) -> u256: - return 10 + pub fn u256(x: u8) -> u256 { + return 10 + } - pub fn bool(x: u8) -> bool: - return x != 0 + pub fn bool(x: u8) -> bool { + return x != 0 + } +} diff --git a/crates/test-files/fixtures/compile_errors/shadow_builtin_type.fe b/crates/test-files/fixtures/compile_errors/shadow_builtin_type.fe index 237907d8a6..7598e78b2e 100644 --- a/crates/test-files/fixtures/compile_errors/shadow_builtin_type.fe +++ b/crates/test-files/fixtures/compile_errors/shadow_builtin_type.fe @@ -1,16 +1,21 @@ type u256 = u8 + type String = u256 + type Map = u256 + type bool = u256 type keccak256 = u8 + type block = u8 + type msg = u8 + type chain = u8 -contract C: - fn f(u8: u256): - pass +contract C { + fn f(u8: u256) {} - fn g(keccak256: u8): - pass + fn g(keccak256: u8) {} +} diff --git a/crates/test-files/fixtures/compile_errors/strict_boolean_if_else.fe b/crates/test-files/fixtures/compile_errors/strict_boolean_if_else.fe index 6468521a8b..e68f3d21d5 100644 --- a/crates/test-files/fixtures/compile_errors/strict_boolean_if_else.fe +++ b/crates/test-files/fixtures/compile_errors/strict_boolean_if_else.fe @@ -1,6 +1,9 @@ -contract Foo: - pub fn bar(val: u256) -> u256: - if val: +contract Foo { + pub fn bar(val: u256) -> u256 { + if val { return 5 - else: + } else { return 1 + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/struct_call_bad_args.fe b/crates/test-files/fixtures/compile_errors/struct_call_bad_args.fe index 85761e9170..941c89f306 100644 --- a/crates/test-files/fixtures/compile_errors/struct_call_bad_args.fe +++ b/crates/test-files/fixtures/compile_errors/struct_call_bad_args.fe @@ -1,8 +1,10 @@ -struct House: +struct House { pub vacant: bool pub price: u256 +} -contract Foo: - - pub fn bar(): +contract Foo { + pub fn bar() { let my_house: House = House(price: false, vacant: 100, bar: address(0)) + } +} diff --git a/crates/test-files/fixtures/compile_errors/struct_call_without_kw_args.fe b/crates/test-files/fixtures/compile_errors/struct_call_without_kw_args.fe index 726059de2f..00a2ca097e 100644 --- a/crates/test-files/fixtures/compile_errors/struct_call_without_kw_args.fe +++ b/crates/test-files/fixtures/compile_errors/struct_call_without_kw_args.fe @@ -1,8 +1,10 @@ -struct House: +struct House { pub vacant: bool pub price: u256 +} -contract Foo: - - pub fn bar(): +contract Foo { + pub fn bar() { let my_house: House = House(true, price: 1000000) + } +} diff --git a/crates/test-files/fixtures/compile_errors/struct_private_constructor.fe b/crates/test-files/fixtures/compile_errors/struct_private_constructor.fe index 4efaff9369..0ac2cb12de 100644 --- a/crates/test-files/fixtures/compile_errors/struct_private_constructor.fe +++ b/crates/test-files/fixtures/compile_errors/struct_private_constructor.fe @@ -1,8 +1,10 @@ -struct House: +struct House { vacant: bool pub price: u256 +} -contract Foo: - - pub fn bar(): +contract Foo { + pub fn bar() { let my_house: House = House(vacant: true, price: 1000000) + } +} diff --git a/crates/test-files/fixtures/compile_errors/struct_recursive_cycles.fe b/crates/test-files/fixtures/compile_errors/struct_recursive_cycles.fe index a5d67c93c0..8325a04068 100644 --- a/crates/test-files/fixtures/compile_errors/struct_recursive_cycles.fe +++ b/crates/test-files/fixtures/compile_errors/struct_recursive_cycles.fe @@ -1,22 +1,25 @@ - # structs `Foo` and `Bar` contains indirect recursion # struct Foo depends on `Bar` -struct Foo: +struct Foo { x: Bar +} # struct Bar depends on `Foo` -struct Bar: +struct Bar { x: Foo +} # struct `Foo2` depends on itself - contains direct recursion -struct Foo2: +struct Foo2 { x: Foo2 +} # struct `Bar2` has no recursion -struct Bar2: +struct Bar2 { x: Foo y: Bar +} -contract MyContract: - pub fn func(foo: Foo, foo2: Foo2, bar2: Bar2): - pass +contract MyContract { + pub fn func(foo: Foo, foo2: Foo2, bar2: Bar2) {} +} diff --git a/crates/test-files/fixtures/compile_errors/undefined_type_param.fe b/crates/test-files/fixtures/compile_errors/undefined_type_param.fe index 0916484b66..69bcf0c5be 100644 --- a/crates/test-files/fixtures/compile_errors/undefined_type_param.fe +++ b/crates/test-files/fixtures/compile_errors/undefined_type_param.fe @@ -1,18 +1,20 @@ # https://github.com/ethereum/fe/issues/530 -struct BadField: +struct BadField { pub x: MysteryType +} -contract Foo: - # case 1: using arg with undefined type within the fn body - pub fn a(_ val: DoesntExist): +contract Foo { + pub fn a(_ val: DoesntExist) { val + 10 + } - # case 2: calling a fn that has undefined-type arg - pub fn b(): + pub fn b() { a(10) + } - # case 3: using a struct field that has an undefined type - pub fn c(): + pub fn c() { let x: BadField x.x = 10 + } +} diff --git a/crates/test-files/fixtures/compile_errors/unsafe_misuse.fe b/crates/test-files/fixtures/compile_errors/unsafe_misuse.fe index 84b98cd8da..a3dab0f05e 100644 --- a/crates/test-files/fixtures/compile_errors/unsafe_misuse.fe +++ b/crates/test-files/fixtures/compile_errors/unsafe_misuse.fe @@ -1,42 +1,42 @@ +unsafe fn mod_priv() {} -# unsafe module functions can be pub or not -unsafe fn mod_priv(): # OK - pass -pub unsafe fn mod_pub(): - mod_priv() # OK - -pub fn f(): - # unsafe fn called outside unsafe - mod_priv() # BAD - -pub fn g(): - unsafe: - mod_priv() # OK - -contract Foo: - # pub unsafe contract functions are allowed - pub unsafe fn pub_self(self): # Ok - pass - pub unsafe fn pub_noself(): # Ok - pass - - # non-pub contract fns can be unsafe - unsafe fn priv_nonself(): # OK - # can call any unsafe fn - mod_priv() # OK - mod_pub() # OK - priv_nonself() # OK - - # unsafe fns can take self - unsafe fn priv_self(self): # OK - self.priv_self2() # OK - unsafe fn priv_self2(self): # OK - pass - - fn bar(self): - # BAD: unsafe fn called outside unsafe - self.priv_self() # BAD - priv_nonself() # BAD - unsafe: - self.priv_self() # OK - priv_nonself() # OK +pub unsafe fn mod_pub() { + mod_priv() +} + +pub fn f() { + mod_priv() +} + +pub fn g() { + unsafe { + mod_priv() + } +} + +contract Foo { + pub unsafe fn pub_self(self) {} + + pub unsafe fn pub_noself() {} + + unsafe fn priv_nonself() { + mod_priv() + mod_pub() + priv_nonself() + } + + unsafe fn priv_self(self) { + self.priv_self2() + } + + unsafe fn priv_self2(self) {} + + fn bar(self) { + self.priv_self() + priv_nonself() + unsafe { + self.priv_self() + priv_nonself() + } + } +} diff --git a/crates/test-files/fixtures/compile_errors/unsafe_nesting.fe b/crates/test-files/fixtures/compile_errors/unsafe_nesting.fe index 914e737ac7..968785e87d 100644 --- a/crates/test-files/fixtures/compile_errors/unsafe_nesting.fe +++ b/crates/test-files/fixtures/compile_errors/unsafe_nesting.fe @@ -1,12 +1,12 @@ -unsafe fn f(): - unsafe: - g() +unsafe fn f() { + unsafe { g() } +} -fn g(): - unsafe: - h() - unsafe: - h() +fn g() { + unsafe { + h() + unsafe { h() } + } +} -fn h(): - pass \ No newline at end of file +fn h() {} diff --git a/crates/test-files/fixtures/crashes/agroce531.fe b/crates/test-files/fixtures/crashes/agroce531.fe index 47201c0047..ff3d2c6bfd 100644 --- a/crates/test-files/fixtures/crashes/agroce531.fe +++ b/crates/test-files/fixtures/crashes/agroce531.fe @@ -1,5 +1,7 @@ -struct tuple_bool_address_: - m:bool +struct tuple_bool_address_ { + m: bool +} -contract o: - e:(bool,address) +contract o { + e: (bool, address) +} diff --git a/crates/test-files/fixtures/crashes/agroce550.fe b/crates/test-files/fixtures/crashes/agroce550.fe index 030464bb09..71b67d2ef5 100644 --- a/crates/test-files/fixtures/crashes/agroce550.fe +++ b/crates/test-files/fixtures/crashes/agroce550.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn o(): - [-1>>0] \ No newline at end of file +contract Foo { + pub fn o() { + [-1 >> 0] + } +} diff --git a/crates/test-files/fixtures/crashes/agroce551.fe b/crates/test-files/fixtures/crashes/agroce551.fe index e98b2bc161..5b329e29f8 100644 --- a/crates/test-files/fixtures/crashes/agroce551.fe +++ b/crates/test-files/fixtures/crashes/agroce551.fe @@ -1,3 +1,5 @@ -contract o: - pub fn l(b:bool): - "" \ No newline at end of file +contract o { + pub fn l(b: bool) { + "" + } +} diff --git a/crates/test-files/fixtures/crashes/agroce623.fe b/crates/test-files/fixtures/crashes/agroce623.fe index a7fd6bfddf..7c9c83e3ae 100644 --- a/crates/test-files/fixtures/crashes/agroce623.fe +++ b/crates/test-files/fixtures/crashes/agroce623.fe @@ -1,3 +1,5 @@ -contract r: - pub fn t(): - [] \ No newline at end of file +contract r { + pub fn t() { + [] + } +} diff --git a/crates/test-files/fixtures/crashes/revert_const.fe b/crates/test-files/fixtures/crashes/revert_const.fe index b2ec81b4ea..55a3f885fe 100644 --- a/crates/test-files/fixtures/crashes/revert_const.fe +++ b/crates/test-files/fixtures/crashes/revert_const.fe @@ -1,7 +1,9 @@ const FOO: u256 = 0x101 -struct Error: - code: u256 +struct Error { + code: u256 +} -fn exit(): - revert Error(code = FOO) +fn exit() { + revert Error(code: FOO) +} diff --git a/crates/test-files/fixtures/demos/erc20_token.fe b/crates/test-files/fixtures/demos/erc20_token.fe index bded603876..e2f6364b95 100644 --- a/crates/test-files/fixtures/demos/erc20_token.fe +++ b/crates/test-files/fixtures/demos/erc20_token.fe @@ -115,4 +115,4 @@ contract ERC20 { } fn _before_token_transfer(from: address, to: address, _ value: u256) {} -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/demos/simple_open_auction.fe b/crates/test-files/fixtures/demos/simple_open_auction.fe index 30042671ab..6c2a13c358 100644 --- a/crates/test-files/fixtures/demos/simple_open_auction.fe +++ b/crates/test-files/fixtures/demos/simple_open_auction.fe @@ -1,19 +1,15 @@ use std::context::Context -# errors -struct AuctionAlreadyEnded: - pass +# errors +struct AuctionAlreadyEnded {} +struct AuctionNotYetEnded {} +struct AuctionEndAlreadyCalled {} -struct BidNotHighEnough: +struct BidNotHighEnough { pub highest_bid: u256 +} -struct AuctionNotYetEnded: - pass - -struct AuctionEndAlreadyCalled: - pass - -contract SimpleOpenAuction: +contract SimpleOpenAuction { # states auction_end_time: u256 beneficiary: address @@ -23,56 +19,62 @@ contract SimpleOpenAuction: pending_returns: Map - ended: bool + ended: bool # events - event HighestBidIncreased: + event HighestBidIncreased { idx bidder: address amount: u256 - - event AuctionEnded: + } + + event AuctionEnded { idx winner: address amount: u256 + } - # constructor - pub fn __init__(self, ctx: Context, bidding_time: u256, beneficiary_addr: address): + # constructor + pub fn __init__(self, ctx: Context, bidding_time: u256, beneficiary_addr: address) { self.beneficiary = beneficiary_addr self.auction_end_time = ctx.block_timestamp() + bidding_time - + } + #method - pub fn bid(self, ctx: Context): - if ctx.block_timestamp() > self.auction_end_time: + pub fn bid(self, ctx: Context) { + if ctx.block_timestamp() > self.auction_end_time { revert AuctionAlreadyEnded() - - if ctx.msg_value() <= self.highest_bid: + } + if ctx.msg_value() <= self.highest_bid { revert BidNotHighEnough(highest_bid: self.highest_bid) - - if self.highest_bid != 0: + } + if self.highest_bid != 0 { self.pending_returns[self.highest_bidder] += self.highest_bid - + } self.highest_bidder = ctx.msg_sender() self.highest_bid = ctx.msg_value() emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) + } - pub fn withdraw(self, ctx: Context) -> bool: + pub fn withdraw(self, ctx: Context) -> bool { let amount: u256 = self.pending_returns[ctx.msg_sender()] - if amount > 0: + if amount > 0 { self.pending_returns[ctx.msg_sender()] = 0 ctx.send_value(to: ctx.msg_sender(), wei: amount) - + } return true + } - pub fn action_end(self, ctx: Context): - if ctx.block_timestamp() <= self.auction_end_time: + pub fn action_end(self, ctx: Context) { + if ctx.block_timestamp() <= self.auction_end_time { revert AuctionNotYetEnded() - - if self.ended: + } + if self.ended { revert AuctionEndAlreadyCalled() - + } self.ended = true emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) ctx.send_value(to: self.beneficiary, wei: self.highest_bid) - \ No newline at end of file + } +} \ No newline at end of file diff --git a/crates/test-files/fixtures/demos/uniswap.fe b/crates/test-files/fixtures/demos/uniswap.fe index 71ee0f0c46..7fbc0eda1e 100644 --- a/crates/test-files/fixtures/demos/uniswap.fe +++ b/crates/test-files/fixtures/demos/uniswap.fe @@ -4,6 +4,7 @@ contract ERC20 { pub fn balanceOf(_ account: address) -> u256 { return 0 } + pub fn transfer(to: address, _ amount: u256) -> bool { return false } @@ -36,22 +37,26 @@ contract UniswapV2Pair { idx spender: address value: u256 } + event Transfer { idx from: address idx to: address value: u256 } + event Mint { idx sender: address amount0: u256 amount1: u256 } + event Burn { idx sender: address amount0: u256 amount1: u256 idx to: address } + event Swap { idx sender: address amount0_in: u256 @@ -60,6 +65,7 @@ contract UniswapV2Pair { amount1_out: u256 idx to: address } + event Sync { reserve0: u256 reserve1: u256 @@ -93,13 +99,11 @@ contract UniswapV2Pair { emit Transfer(ctx, from, to: address(0), value) } - fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { self.allowances[owner][spender] = value emit Approval(ctx, owner, spender, value) } - fn _transfer(self, ctx: Context, from: address, to: address, value: u256) { self.balances[from] = self.balances[from] - value self.balances[to] = self.balances[to] + value @@ -141,38 +145,39 @@ contract UniswapV2Pair { # update reserves and, on the first call per block, price accumulators fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { # changed from u32s - let block_timestamp: u256 = ctx.block_timestamp() % 2**32 # TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) - let time_elapsed: u256 = block_timestamp - self.block_timestamp_last # overflow is desired - if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0: - # `*` never overflows, and + overflow is desired - self.price0_cumulative_last = self.price0_cumulative_last + (reserve1 / reserve0) * time_elapsed - self.price1_cumulative_last = self.price1_cumulative_last + (reserve0 / reserve1) * time_elapsed - + let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 + let time_elapsed: u256 = block_timestamp - self.block_timestamp_last + if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { + self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed + self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed + } self.reserve0 = balance0 self.reserve1 = balance1 self.block_timestamp_last = block_timestamp emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) } - # if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool { let fee_to: address = UniswapV2Factory(ctx, self.factory).fee_to() let fee_on: bool = fee_to != address(0) - let k_last: u256 = self.k_last # gas savings - if fee_on: - if k_last != 0: + let k_last: u256 = self.k_last + if fee_on { + if k_last != 0 { let root_k: u256 = sqrt(reserve0 * reserve1) let root_k_last: u256 = sqrt(k_last) - if root_k > root_k_last: + if root_k > root_k_last { let numerator: u256 = self.total_supply * root_k - root_k_last let denominator: u256 = root_k * 5 + root_k_last let liquidity: u256 = numerator / denominator - if liquidity > 0: + if liquidity > 0 { self._mint(ctx, to: fee_to, value: liquidity) - elif k_last != 0: + } + } + } + } else if k_last != 0 { self.k_last = 0 - + } return fee_on } @@ -185,24 +190,21 @@ contract UniswapV2Pair { let balance1: u256 = ERC20(ctx, self.token1).balanceOf(ctx.self_address()) let amount0: u256 = balance0 - self.reserve0 let amount1: u256 = balance1 - self.reserve1 - let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) let total_supply: u256 = self.total_supply # gas savings, must be defined here since totalSupply can update in _mintFee let liquidity: u256 = 0 - if total_supply == 0: + if total_supply == 0 { liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) # permanently lock the first MINIMUM_LIQUIDITY tokens - else: - liquidity = min((amount0 * total_supply) / reserve0, (amount1 * total_supply) / reserve1) - + } else { + liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) + } assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" - self._mint(ctx, to, value: liquidity) self._update(ctx, balance0, balance1, reserve0, reserve1) - - if fee_on: + if fee_on { self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date - + } emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) return liquidity } @@ -227,12 +229,10 @@ contract UniswapV2Pair { token1.transfer(to, amount1) balance0 = token0.balanceOf(ctx.self_address()) balance1 = token1.balanceOf(ctx.self_address()) - self._update(ctx, balance0, balance1, reserve0, reserve1) - - if fee_on: - self.k_last = reserve0 * reserve1 # reserve0 and reserve1 are up-to-date - + if fee_on { + self.k_last = reserve0 * reserve1 + } emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) return (amount0, amount1) } @@ -259,8 +259,8 @@ contract UniswapV2Pair { token1.transfer(to, amount1_out) # optimistically transfer tokens } # TODO: bytes support -# if data.length > 0: -# IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0_out, amount1_out, data) + # if data.length > 0: + # IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0_out, amount1_out, data) let balance0: u256 = token0.balanceOf(ctx.self_address()) let balance1: u256 = token1.balanceOf(ctx.self_address()) @@ -316,7 +316,7 @@ contract UniswapV2Factory { } pub fn __init__(self, _ fee_to_setter: address) { - self.fee_to_setter = fee_to_setter + self.fee_to_setter = fee_to_setter } pub fn fee_to(self) -> address { @@ -365,14 +365,14 @@ contract UniswapV2Factory { fn sqrt(_ val: u256) -> u256 { let z: u256 - if (val > 3) { + if val > 3 { z = val let x: u256 = val / 2 + 1 - while (x < z) { + while x < z { z = x x = (val / x + x) / 2 } - } else if (val != 0) { + } else if val != 0 { z = 1 } return z diff --git a/crates/test-files/fixtures/differential/math_i8.fe b/crates/test-files/fixtures/differential/math_i8.fe index 11cc7f5216..de819932c9 100644 --- a/crates/test-files/fixtures/differential/math_i8.fe +++ b/crates/test-files/fixtures/differential/math_i8.fe @@ -1,43 +1,57 @@ -contract Foo: - - pub fn add(val1: i8, val2: i8) -> i8: - return val1 + val2 - - pub fn subtract(val1: i8, val2: i8) -> i8: - return val1 - val2 - - pub fn multiply(val1: i8, val2: i8) -> i8: - return val1 * val2 - - pub fn divide(val1: i8, val2: i8) -> i8: - return val1 / val2 - - pub fn pow(val1: i8, val2: u8) -> i8: - return val1 ** val2 - - pub fn modulo(val1: i8, val2: i8) -> i8: - return val1 % val2 - - pub fn rightshift(val1: i8, val2: u8) -> i8: - return val1 >> val2 - - pub fn leftshift(val1: i8, val2: u8) -> i8: - return val1 << val2 - - pub fn invert(val1: i8) -> i8: - return ~val1 - - pub fn cast1(val1: i8) -> u8: - return u8(val1) - - pub fn cast2(val1: i8) -> u16: - return u16(u8(val1)) - - pub fn cast3(val1: i8) -> u16: - return u16(i16(val1)) - - pub fn order_of_operation(val1: i8, val2: i8, val3: u8) -> i8: - return val1 - val2 * (val1 + val2 / 4 * val1 - val2**val3) + val1 - - pub fn negate(val1: i8) -> i8: - return -val1 \ No newline at end of file +contract Foo { + pub fn add(val1: i8, val2: i8) -> i8 { + return val1 + val2 + } + + pub fn subtract(val1: i8, val2: i8) -> i8 { + return val1 - val2 + } + + pub fn multiply(val1: i8, val2: i8) -> i8 { + return val1 * val2 + } + + pub fn divide(val1: i8, val2: i8) -> i8 { + return val1 / val2 + } + + pub fn pow(val1: i8, val2: u8) -> i8 { + return val1 ** val2 + } + + pub fn modulo(val1: i8, val2: i8) -> i8 { + return val1 % val2 + } + + pub fn rightshift(val1: i8, val2: u8) -> i8 { + return val1 >> val2 + } + + pub fn leftshift(val1: i8, val2: u8) -> i8 { + return val1 << val2 + } + + pub fn invert(val1: i8) -> i8 { + return ~val1 + } + + pub fn cast1(val1: i8) -> u8 { + return u8(val1) + } + + pub fn cast2(val1: i8) -> u16 { + return u16(u8(val1)) + } + + pub fn cast3(val1: i8) -> u16 { + return u16(i16(val1)) + } + + pub fn order_of_operation(val1: i8, val2: i8, val3: u8) -> i8 { + return val1 - val2 * (val1 + val2 / 4 * val1 - val2 ** val3) + val1 + } + + pub fn negate(val1: i8) -> i8 { + return -val1 + } +} diff --git a/crates/test-files/fixtures/differential/math_u8.fe b/crates/test-files/fixtures/differential/math_u8.fe index 9d266de3dc..a0d2805eb3 100644 --- a/crates/test-files/fixtures/differential/math_u8.fe +++ b/crates/test-files/fixtures/differential/math_u8.fe @@ -1,61 +1,80 @@ -contract Foo: - - pub fn add(val1: u8, val2: u8) -> u8: - return val1 + val2 - - pub fn subtract(val1: u8, val2: u8) -> u8: - return val1 - val2 - - pub fn multiply(val1: u8, val2: u8) -> u8: - return val1 * val2 - - pub fn divide(val1: u8, val2: u8) -> u8: - return val1 / val2 - - pub fn pow(val1: u8, val2: u8) -> u8: - return val1 ** val2 - - pub fn modulo(val1: u8, val2: u8) -> u8: - return val1 % val2 - - pub fn rightshift(val1: u8, val2: u8) -> u8: - return val1 >> val2 - - pub fn leftshift(val1: u8, val2: u8) -> u8: - return val1 << val2 - - pub fn invert(val1: u8) -> u8: - return ~val1 - - pub fn bit_and(val1: u8, val2: u8) -> u8: - return val1 & val2 - - pub fn bit_or(val1: u8, val2: u8) -> u8: - return val1 | val2 - - pub fn bit_xor(val1: u8, val2: u8) -> u8: - return val1 ^ val2 - - pub fn cast1(val1: u8) -> i8: - return i8(val1) - - pub fn cast2(val1: u8) -> i16: - return i16(i8(val1)) - - pub fn cast3(val1: u8) -> i16: - return i16(u16(val1)) - - pub fn order_of_operation(val1: u8, val2: u8) -> u8: - return val1 - val2 * (val1 + val2 / 4 * val1 - val2**val1) + val1 - - pub fn sqrt(val: u256) -> u256: - let z: u256 - if (val > 3): - z = val - let x: u256 = val / 2 + 1 - while (x < z): - z = x - x = (val / x + x) / 2 - elif (val != 0): - z = 1 - return z \ No newline at end of file +contract Foo { + pub fn add(val1: u8, val2: u8) -> u8 { + return val1 + val2 + } + + pub fn subtract(val1: u8, val2: u8) -> u8 { + return val1 - val2 + } + + pub fn multiply(val1: u8, val2: u8) -> u8 { + return val1 * val2 + } + + pub fn divide(val1: u8, val2: u8) -> u8 { + return val1 / val2 + } + + pub fn pow(val1: u8, val2: u8) -> u8 { + return val1 ** val2 + } + + pub fn modulo(val1: u8, val2: u8) -> u8 { + return val1 % val2 + } + + pub fn rightshift(val1: u8, val2: u8) -> u8 { + return val1 >> val2 + } + + pub fn leftshift(val1: u8, val2: u8) -> u8 { + return val1 << val2 + } + + pub fn invert(val1: u8) -> u8 { + return ~val1 + } + + pub fn bit_and(val1: u8, val2: u8) -> u8 { + return val1 & val2 + } + + pub fn bit_or(val1: u8, val2: u8) -> u8 { + return val1 | val2 + } + + pub fn bit_xor(val1: u8, val2: u8) -> u8 { + return val1 ^ val2 + } + + pub fn cast1(val1: u8) -> i8 { + return i8(val1) + } + + pub fn cast2(val1: u8) -> i16 { + return i16(i8(val1)) + } + + pub fn cast3(val1: u8) -> i16 { + return i16(u16(val1)) + } + + pub fn order_of_operation(val1: u8, val2: u8) -> u8 { + return val1 - val2 * (val1 + val2 / 4 * val1 - val2 ** val1) + val1 + } + + pub fn sqrt(val: u256) -> u256 { + let z: u256 + if val > 3 { + z = val + let x: u256 = val / 2 + 1 + while x < z { + z = x + x = (val / x + x) / 2 + } + } else if val != 0 { + z = 1 + } + return z + } +} diff --git a/crates/test-files/fixtures/differential/storage_and_memory.fe b/crates/test-files/fixtures/differential/storage_and_memory.fe index e32efa0edb..e74d90524f 100644 --- a/crates/test-files/fixtures/differential/storage_and_memory.fe +++ b/crates/test-files/fixtures/differential/storage_and_memory.fe @@ -1,47 +1,57 @@ use std::context::Context -struct MyStruct: +struct MyStruct { my_num: u256 my_num2: u8 my_bool: bool my_addr: address my_num3: i8 - -contract Foo: - - data: MyStruct - items: Array - more_items: Array - some_string: String<100> - - pub fn set_data(self, val: MyStruct): - self.data = val - - pub fn get_data(self) -> MyStruct: - return self.data.to_mem() - - pub fn set_string(self, val: String<100>): - self.some_string = val - - pub fn get_string(self) -> String<100>: - return self.some_string.to_mem() - - pub fn set_item(self, index: u256, item: i8): - self.items[index] = item - - pub fn get_items(self) -> Array: - return self.items.to_mem() - - pub fn set_range(self, ctx: Context, from: u256, to: u256): - let index: u256 = from - let counter: u256 = 0 - while index < to: - self.more_items[index] = self.more_items[index] + ctx.block_number() - index += 1 - counter += 1 - - if counter > 20: - break - - pub fn get_range(self) -> Array: - return self.more_items.to_mem() +} + +contract Foo { + data: MyStruct + items: Array + more_items: Array + some_string: String<100> + + pub fn set_data(self, val: MyStruct) { + self.data = val + } + + pub fn get_data(self) -> MyStruct { + return self.data.to_mem() + } + + pub fn set_string(self, val: String<100>) { + self.some_string = val + } + + pub fn get_string(self) -> String<100> { + return self.some_string.to_mem() + } + + pub fn set_item(self, index: u256, item: i8) { + self.items[index] = item + } + + pub fn get_items(self) -> Array { + return self.items.to_mem() + } + + pub fn set_range(self, ctx: Context, from: u256, to: u256) { + let index: u256 = from + let counter: u256 = 0 + while index < to { + self.more_items[index] = self.more_items[index] + ctx.block_number() + index += 1 + counter += 1 + if counter > 20 { + break + } + } + } + + pub fn get_range(self) -> Array { + return self.more_items.to_mem() + } +} diff --git a/crates/test-files/fixtures/features/abi_decode_checks.fe b/crates/test-files/fixtures/features/abi_decode_checks.fe index f0f684b24b..93cb84d718 100644 --- a/crates/test-files/fixtures/features/abi_decode_checks.fe +++ b/crates/test-files/fixtures/features/abi_decode_checks.fe @@ -1,22 +1,9 @@ -contract Foo: - pub fn decode_u256(a: u256): - pass +contract Foo { + pub fn decode_u256(a: u256) {} - pub fn decode_u128_bool(a: u128, b: bool): - pass + pub fn decode_u128_bool(a: u128, b: bool) {} - pub fn decode_u256_bytes_tuple_array( - a: u256, - b: Array, - c: (address, u8), - d: Array - ): - pass + pub fn decode_u256_bytes_tuple_array(a: u256, b: Array, c: (address, u8), d: Array) {} - pub fn decode_string_address_bytes_bool( - a: String<80>, - b: address, - c: Array, - d: bool - ): - pass + pub fn decode_string_address_bytes_bool(a: String<80>, b: address, c: Array, d: bool) {} +} diff --git a/crates/test-files/fixtures/features/address_bytes10_map.fe b/crates/test-files/fixtures/features/address_bytes10_map.fe index a78188b72c..6f85dd3f1a 100644 --- a/crates/test-files/fixtures/features/address_bytes10_map.fe +++ b/crates/test-files/fixtures/features/address_bytes10_map.fe @@ -8,4 +8,4 @@ contract Foo { pub fn write_bar(self, key: address, value: Array) { self.bar[key] = value } -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/features/arrays.fe b/crates/test-files/fixtures/features/arrays.fe index b7b1214db6..cbd81d2c1d 100644 --- a/crates/test-files/fixtures/features/arrays.fe +++ b/crates/test-files/fixtures/features/arrays.fe @@ -1,9 +1,12 @@ -contract Foo: +contract Foo { my_array: Array - pub fn get_from_storage(self, index: u256) -> u256: + pub fn get_from_storage(self, index: u256) -> u256 { return self.my_array[index] + } - pub fn get_from_memory(index: u256) -> u256: + pub fn get_from_memory(index: u256) -> u256 { let my_array: Array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] return my_array[index] + } +} diff --git a/crates/test-files/fixtures/features/assert.fe b/crates/test-files/fixtures/features/assert.fe index e33d9f3132..96d2413f44 100644 --- a/crates/test-files/fixtures/features/assert.fe +++ b/crates/test-files/fixtures/features/assert.fe @@ -1,20 +1,26 @@ -contract Foo: +contract Foo { my_bool: bool my_string: String<5> - pub fn bar(baz: u256): + pub fn bar(baz: u256) { assert baz > 5 + } - pub fn revert_with_static_string(baz: u256): + pub fn revert_with_static_string(baz: u256) { assert baz > 5, "Must be greater than five" + } - pub fn revert_with(baz: u256, reason: String<1000>): + pub fn revert_with(baz: u256, reason: String<1000>) { assert baz > 5, reason + } - pub fn assert_sto_bool(self): + pub fn assert_sto_bool(self) { self.my_bool = false assert self.my_bool + } - pub fn assert_sto_string_msg(self): + pub fn assert_sto_string_msg(self) { self.my_string = "hello" assert false, self.my_string.to_mem() + } +} diff --git a/crates/test-files/fixtures/features/associated_fns.fe b/crates/test-files/fixtures/features/associated_fns.fe index a460e9fc74..d708b684ff 100644 --- a/crates/test-files/fixtures/features/associated_fns.fe +++ b/crates/test-files/fixtures/features/associated_fns.fe @@ -1,16 +1,22 @@ +struct Lib { + pub fn square(x: u256) -> u256 { + return x * x + } +} -struct Lib: # This can't be a contract, yet - pub fn square(x: u256) -> u256: - return x * x +struct MyStruct { + pub x: u256 -struct MyStruct: - pub x: u256 - pub fn new(x: u256) -> MyStruct: - return MyStruct(x) + pub fn new(x: u256) -> MyStruct { + return MyStruct(x) + } +} -contract Foo: - my_struct: MyStruct +contract Foo { + my_struct: MyStruct - pub fn bar(self, val: u256) -> u256: - self.my_struct = MyStruct::new(x: val) - return Lib::square(x: self.my_struct.x) + pub fn bar(self, val: u256) -> u256 { + self.my_struct = MyStruct::new(x: val) + return Lib::square(x: self.my_struct.x) + } +} diff --git a/crates/test-files/fixtures/features/aug_assign.fe b/crates/test-files/fixtures/features/aug_assign.fe index 180e92fa8f..da6bbd2e38 100644 --- a/crates/test-files/fixtures/features/aug_assign.fe +++ b/crates/test-files/fixtures/features/aug_assign.fe @@ -1,57 +1,71 @@ -contract Foo: +contract Foo { my_num: u256 - pub fn add(a: u256, b: u256) -> u256: + pub fn add(a: u256, b: u256) -> u256 { a += b return a + } - pub fn sub(a: u256, b: u256) -> u256: + pub fn sub(a: u256, b: u256) -> u256 { a -= b return a + } - pub fn mul(a: u256, b: u256) -> u256: + pub fn mul(a: u256, b: u256) -> u256 { a *= b return a + } - pub fn div(a: u256, b: u256) -> u256: + pub fn div(a: u256, b: u256) -> u256 { a /= b return a + } - pub fn mod(a: u256, b: u256) -> u256: + pub fn mod(a: u256, b: u256) -> u256 { a %= b return a + } - pub fn pow(a: u256, b: u256) -> u256: + pub fn pow(a: u256, b: u256) -> u256 { a **= b return a + } - pub fn lshift(a: u8, b: u8) -> u8: + pub fn lshift(a: u8, b: u8) -> u8 { a <<= b return a + } - pub fn rshift(a: u8, b: u8) -> u8: + pub fn rshift(a: u8, b: u8) -> u8 { a >>= b return a + } - pub fn bit_or(a: u8, b: u8) -> u8: + pub fn bit_or(a: u8, b: u8) -> u8 { a |= b return a + } - pub fn bit_xor(a: u8, b: u8) -> u8: + pub fn bit_xor(a: u8, b: u8) -> u8 { a ^= b return a + } - pub fn bit_and(a: u8, b: u8) -> u8: + pub fn bit_and(a: u8, b: u8) -> u8 { a &= b return a + } - pub fn add_from_sto(self, a: u256, b: u256) -> u256: + pub fn add_from_sto(self, a: u256, b: u256) -> u256 { self.my_num = a self.my_num += b return self.my_num + } - pub fn add_from_mem(a: u256, b: u256) -> u256: + pub fn add_from_mem(a: u256, b: u256) -> u256 { let my_array: Array my_array[7] = a my_array[7] += b return my_array[7] + } +} diff --git a/crates/test-files/fixtures/features/balances.fe b/crates/test-files/fixtures/features/balances.fe index 978489eca6..8b8d86ecb6 100644 --- a/crates/test-files/fixtures/features/balances.fe +++ b/crates/test-files/fixtures/features/balances.fe @@ -1,9 +1,12 @@ use std::evm::{balance, balance_of} use std::context::Context -contract Foo: - pub fn my_balance(self, ctx: Context) -> u256: +contract Foo { + pub fn my_balance(self, ctx: Context) -> u256 { return ctx.self_balance() + } - pub fn other_balance(self, ctx: Context, someone: address) -> u256: + pub fn other_balance(self, ctx: Context, someone: address) -> u256 { return ctx.balance_of(someone) + } +} diff --git a/crates/test-files/fixtures/features/base_tuple.fe b/crates/test-files/fixtures/features/base_tuple.fe index feb8272c8b..d4b6920cab 100644 --- a/crates/test-files/fixtures/features/base_tuple.fe +++ b/crates/test-files/fixtures/features/base_tuple.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool): +contract Foo { + pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool) { return (my_num, my_bool) + } +} diff --git a/crates/test-files/fixtures/features/call_fn.fe b/crates/test-files/fixtures/features/call_fn.fe index caf4606ecd..5b44dce524 100644 --- a/crates/test-files/fixtures/features/call_fn.fe +++ b/crates/test-files/fixtures/features/call_fn.fe @@ -1,7 +1,11 @@ -contract Foo: - pub fn __call__(self): - unsafe: - if __calldataload(0) == 1: +contract Foo { + pub fn __call__(self) { + unsafe { + if __calldataload(0) == 1 { __revert(0, 0) - else: - __return(0, 0) \ No newline at end of file + } else { + __return(0, 0) + } + } + } +} diff --git a/crates/test-files/fixtures/features/call_statement_with_args.fe b/crates/test-files/fixtures/features/call_statement_with_args.fe index ff312cca2f..5312046273 100644 --- a/crates/test-files/fixtures/features/call_statement_with_args.fe +++ b/crates/test-files/fixtures/features/call_statement_with_args.fe @@ -1,9 +1,12 @@ -contract Foo: +contract Foo { baz: Map - fn assign(self, _ val: u256): + fn assign(self, _ val: u256) { self.baz[0] = val + } - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.assign(100) return self.baz[0] + } +} diff --git a/crates/test-files/fixtures/features/call_statement_with_args_2.fe b/crates/test-files/fixtures/features/call_statement_with_args_2.fe index 44025abb30..fb7facc533 100644 --- a/crates/test-files/fixtures/features/call_statement_with_args_2.fe +++ b/crates/test-files/fixtures/features/call_statement_with_args_2.fe @@ -1,10 +1,13 @@ -contract Foo: +contract Foo { baz: Map - fn assign(self, _ val: u256) -> u256: + fn assign(self, _ val: u256) -> u256 { self.baz[0] = val return val + } - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.assign(100) return self.baz[0] + } +} diff --git a/crates/test-files/fixtures/features/call_statement_without_args.fe b/crates/test-files/fixtures/features/call_statement_without_args.fe index 6647fb1e98..eade30b6e8 100644 --- a/crates/test-files/fixtures/features/call_statement_without_args.fe +++ b/crates/test-files/fixtures/features/call_statement_without_args.fe @@ -1,9 +1,12 @@ -contract Foo: +contract Foo { baz: Map - fn assign(self): + fn assign(self) { self.baz[0] = 100 + } - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.assign() return self.baz[0] + } +} diff --git a/crates/test-files/fixtures/features/cast_address_to_u256.fe b/crates/test-files/fixtures/features/cast_address_to_u256.fe index 69f59704ef..5ab657613b 100644 --- a/crates/test-files/fixtures/features/cast_address_to_u256.fe +++ b/crates/test-files/fixtures/features/cast_address_to_u256.fe @@ -1,4 +1,6 @@ -contract Foo: - pub fn bar(a: address) -> address: - let x: u256 = u256(a) - return address(x) +contract Foo { + pub fn bar(a: address) -> address { + let x: u256 = u256(a) + return address(x) + } +} diff --git a/crates/test-files/fixtures/features/checked_arithmetic.fe b/crates/test-files/fixtures/features/checked_arithmetic.fe index 25b3975d6d..fd762e3326 100644 --- a/crates/test-files/fixtures/features/checked_arithmetic.fe +++ b/crates/test-files/fixtures/features/checked_arithmetic.fe @@ -1,217 +1,289 @@ -contract CheckedArithmetic: - - pub fn add_u256(left: u256, right: u256) -> u256: +contract CheckedArithmetic { + pub fn add_u256(left: u256, right: u256) -> u256 { return left + right + } - pub fn add_u128(left: u128, right: u128) -> u128: + pub fn add_u128(left: u128, right: u128) -> u128 { return left + right + } - pub fn add_u64(left: u64, right: u64) -> u64: + pub fn add_u64(left: u64, right: u64) -> u64 { return left + right + } - pub fn add_u32(left: u32, right: u32) -> u32: + pub fn add_u32(left: u32, right: u32) -> u32 { return left + right + } - pub fn add_u16(left: u16, right: u16) -> u16: + pub fn add_u16(left: u16, right: u16) -> u16 { return left + right + } - pub fn add_u8(left: u8, right: u8) -> u8: + pub fn add_u8(left: u8, right: u8) -> u8 { return left + right + } - pub fn add_i256(left: i256, right: i256) -> i256: + pub fn add_i256(left: i256, right: i256) -> i256 { return left + right + } - pub fn add_i128(left: i128, right: i128) -> i128: + pub fn add_i128(left: i128, right: i128) -> i128 { return left + right + } - pub fn add_i64(left: i64, right: i64) -> i64: + pub fn add_i64(left: i64, right: i64) -> i64 { return left + right + } - pub fn add_i32(left: i32, right: i32) -> i32: + pub fn add_i32(left: i32, right: i32) -> i32 { return left + right + } - pub fn add_i16(left: i16, right: i16) -> i16: + pub fn add_i16(left: i16, right: i16) -> i16 { return left + right + } - pub fn add_i8(left: i8, right: i8) -> i8: + pub fn add_i8(left: i8, right: i8) -> i8 { return left + right + } - pub fn sub_u256(left: u256, right: u256) -> u256: + pub fn sub_u256(left: u256, right: u256) -> u256 { return left - right + } - pub fn sub_u128(left: u128, right: u128) -> u128: + pub fn sub_u128(left: u128, right: u128) -> u128 { return left - right + } - pub fn sub_u64(left: u64, right: u64) -> u64: + pub fn sub_u64(left: u64, right: u64) -> u64 { return left - right + } - pub fn sub_u32(left: u32, right: u32) -> u32: + pub fn sub_u32(left: u32, right: u32) -> u32 { return left - right + } - pub fn sub_u16(left: u16, right: u16) -> u16: + pub fn sub_u16(left: u16, right: u16) -> u16 { return left - right + } - pub fn sub_u8(left: u8, right: u8) -> u8: + pub fn sub_u8(left: u8, right: u8) -> u8 { return left - right + } - pub fn sub_i256(left: i256, right: i256) -> i256: + pub fn sub_i256(left: i256, right: i256) -> i256 { return left - right + } - pub fn sub_i128(left: i128, right: i128) -> i128: + pub fn sub_i128(left: i128, right: i128) -> i128 { return left - right + } - pub fn sub_i64(left: i64, right: i64) -> i64: + pub fn sub_i64(left: i64, right: i64) -> i64 { return left - right + } - pub fn sub_i32(left: i32, right: i32) -> i32: + pub fn sub_i32(left: i32, right: i32) -> i32 { return left - right + } - pub fn sub_i16(left: i16, right: i16) -> i16: + pub fn sub_i16(left: i16, right: i16) -> i16 { return left - right + } - pub fn sub_i8(left: i8, right: i8) -> i8: + pub fn sub_i8(left: i8, right: i8) -> i8 { return left - right + } - pub fn div_u256(left: u256, right: u256) -> u256: + pub fn div_u256(left: u256, right: u256) -> u256 { return left / right + } - pub fn div_u128(left: u128, right: u128) -> u128: + pub fn div_u128(left: u128, right: u128) -> u128 { return left / right + } - pub fn div_u64(left: u64, right: u64) -> u64: + pub fn div_u64(left: u64, right: u64) -> u64 { return left / right + } - pub fn div_u32(left: u32, right: u32) -> u32: + pub fn div_u32(left: u32, right: u32) -> u32 { return left / right + } - pub fn div_u16(left: u16, right: u16) -> u16: + pub fn div_u16(left: u16, right: u16) -> u16 { return left / right + } - pub fn div_u8(left: u8, right: u8) -> u8: + pub fn div_u8(left: u8, right: u8) -> u8 { return left / right + } - pub fn div_i256(left: i256, right: i256) -> i256: + pub fn div_i256(left: i256, right: i256) -> i256 { return left / right + } - pub fn div_i128(left: i128, right: i128) -> i128: + pub fn div_i128(left: i128, right: i128) -> i128 { return left / right + } - pub fn div_i64(left: i64, right: i64) -> i64: + pub fn div_i64(left: i64, right: i64) -> i64 { return left / right + } - pub fn div_i32(left: i32, right: i32) -> i32: + pub fn div_i32(left: i32, right: i32) -> i32 { return left / right + } - pub fn div_i16(left: i16, right: i16) -> i16: + pub fn div_i16(left: i16, right: i16) -> i16 { return left / right + } - pub fn div_i8(left: i8, right: i8) -> i8: + pub fn div_i8(left: i8, right: i8) -> i8 { return left / right + } - pub fn mul_u256(left: u256, right: u256) -> u256: + pub fn mul_u256(left: u256, right: u256) -> u256 { return left * right + } - pub fn mul_u128(left: u128, right: u128) -> u128: + pub fn mul_u128(left: u128, right: u128) -> u128 { return left * right + } - pub fn mul_u64(left: u64, right: u64) -> u64: + pub fn mul_u64(left: u64, right: u64) -> u64 { return left * right + } - pub fn mul_u32(left: u32, right: u32) -> u32: + pub fn mul_u32(left: u32, right: u32) -> u32 { return left * right + } - pub fn mul_u16(left: u16, right: u16) -> u16: + pub fn mul_u16(left: u16, right: u16) -> u16 { return left * right + } - pub fn mul_u8(left: u8, right: u8) -> u8: + pub fn mul_u8(left: u8, right: u8) -> u8 { return left * right + } - pub fn mul_i256(left: i256, right: i256) -> i256: + pub fn mul_i256(left: i256, right: i256) -> i256 { return left * right + } - pub fn mul_i128(left: i128, right: i128) -> i128: + pub fn mul_i128(left: i128, right: i128) -> i128 { return left * right + } - pub fn mul_i64(left: i64, right: i64) -> i64: + pub fn mul_i64(left: i64, right: i64) -> i64 { return left * right + } - pub fn mul_i32(left: i32, right: i32) -> i32: + pub fn mul_i32(left: i32, right: i32) -> i32 { return left * right + } - pub fn mul_i16(left: i16, right: i16) -> i16: + pub fn mul_i16(left: i16, right: i16) -> i16 { return left * right + } - pub fn mul_i8(left: i8, right: i8) -> i8: + pub fn mul_i8(left: i8, right: i8) -> i8 { return left * right + } - pub fn mod_u256(left: u256, right: u256) -> u256: + pub fn mod_u256(left: u256, right: u256) -> u256 { return left % right + } - pub fn mod_u128(left: u128, right: u128) -> u128: + pub fn mod_u128(left: u128, right: u128) -> u128 { return left % right + } - pub fn mod_u64(left: u64, right: u64) -> u64: + pub fn mod_u64(left: u64, right: u64) -> u64 { return left % right + } - pub fn mod_u32(left: u32, right: u32) -> u32: + pub fn mod_u32(left: u32, right: u32) -> u32 { return left % right + } - pub fn mod_u16(left: u16, right: u16) -> u16: + pub fn mod_u16(left: u16, right: u16) -> u16 { return left % right + } - pub fn mod_u8(left: u8, right: u8) -> u8: + pub fn mod_u8(left: u8, right: u8) -> u8 { return left % right + } - pub fn mod_i256(left: i256, right: i256) -> i256: + pub fn mod_i256(left: i256, right: i256) -> i256 { return left % right + } - pub fn mod_i128(left: i128, right: i128) -> i128: + pub fn mod_i128(left: i128, right: i128) -> i128 { return left % right + } - pub fn mod_i64(left: i64, right: i64) -> i64: + pub fn mod_i64(left: i64, right: i64) -> i64 { return left % right + } - pub fn mod_i32(left: i32, right: i32) -> i32: + pub fn mod_i32(left: i32, right: i32) -> i32 { return left % right + } - pub fn mod_i16(left: i16, right: i16) -> i16: + pub fn mod_i16(left: i16, right: i16) -> i16 { return left % right + } - pub fn mod_i8(left: i8, right: i8) -> i8: + pub fn mod_i8(left: i8, right: i8) -> i8 { return left % right + } - pub fn pow_u256(left: u256, right: u256) -> u256: + pub fn pow_u256(left: u256, right: u256) -> u256 { return left ** right + } - pub fn pow_u128(left: u128, right: u128) -> u128: + pub fn pow_u128(left: u128, right: u128) -> u128 { return left ** right + } - pub fn pow_u64(left: u64, right: u64) -> u64: + pub fn pow_u64(left: u64, right: u64) -> u64 { return left ** right + } - pub fn pow_u32(left: u32, right: u32) -> u32: + pub fn pow_u32(left: u32, right: u32) -> u32 { return left ** right + } - pub fn pow_u16(left: u16, right: u16) -> u16: + pub fn pow_u16(left: u16, right: u16) -> u16 { return left ** right + } - pub fn pow_u8(left: u8, right: u8) -> u8: + pub fn pow_u8(left: u8, right: u8) -> u8 { return left ** right + } - pub fn pow_i256(left: i256, right: u256) -> i256: + pub fn pow_i256(left: i256, right: u256) -> i256 { return left ** right + } - pub fn pow_i128(left: i128, right: u128) -> i128: + pub fn pow_i128(left: i128, right: u128) -> i128 { return left ** right + } - pub fn pow_i64(left: i64, right: u64) -> i64: + pub fn pow_i64(left: i64, right: u64) -> i64 { return left ** right + } - pub fn pow_i32(left: i32, right: u32) -> i32: + pub fn pow_i32(left: i32, right: u32) -> i32 { return left ** right + } - pub fn pow_i16(left: i16, right: u16) -> i16: + pub fn pow_i16(left: i16, right: u16) -> i16 { return left ** right + } - pub fn pow_i8(left: i8, right: u8) -> i8: - return left ** right \ No newline at end of file + pub fn pow_i8(left: i8, right: u8) -> i8 { + return left ** right + } +} diff --git a/crates/test-files/fixtures/features/const_generics.fe b/crates/test-files/fixtures/features/const_generics.fe index 46508a062b..b3773c51e1 100644 --- a/crates/test-files/fixtures/features/const_generics.fe +++ b/crates/test-files/fixtures/features/const_generics.fe @@ -1,15 +1,15 @@ -contract Foo: - pub fn bar(): +contract Foo { + pub fn bar() { # const generics with literal. let array_lit: Array let array_lit2: Array # const generics with ternary expression. let array_ternary: Array - + # const generics with logical expression. - let array_logical_or: Array - let array_logical_and: Array + let array_logical_or: Array + let array_logical_and: Array # const generics with binary expression. let array_add: Array @@ -35,12 +35,14 @@ contract Foo: let array_gt2: Array 10 else 8 }> let array_gte: Array= 10 else 8 }> let array_gte2: Array= 10 else 0 }> - + # const generics with unary expression. let array_not: Array - + # const generics with const variable. const DOUBLE_ARRAY_LENGTH: u64 = 16 const TWO: u64 = 2 - let array_with_const: Array \ No newline at end of file + let array_with_const: Array + } +} \ No newline at end of file diff --git a/crates/test-files/fixtures/features/const_local.fe b/crates/test-files/fixtures/features/const_local.fe index 2967c5af4e..1800710820 100644 --- a/crates/test-files/fixtures/features/const_local.fe +++ b/crates/test-files/fixtures/features/const_local.fe @@ -1,5 +1,5 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { const C1: i64 = 1 const C2: i64 = 2 const C3: i64 = 10 @@ -12,4 +12,6 @@ contract Foo: const C9: bool = C8 < C7 # true const C10: u256 = 42 if C9 else 0 # 42 let _arr: Array - return C10 \ No newline at end of file + return C10 + } +} diff --git a/crates/test-files/fixtures/features/constructor.fe b/crates/test-files/fixtures/features/constructor.fe index aa3914154e..03a7af61d5 100644 --- a/crates/test-files/fixtures/features/constructor.fe +++ b/crates/test-files/fixtures/features/constructor.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn __init__(self, baz: u256, bing: u256): + pub fn __init__(self, baz: u256, bing: u256) { self.bar[42] = baz + bing + } - pub fn read_bar(self) -> u256: - return self.bar[42] \ No newline at end of file + pub fn read_bar(self) -> u256 { + return self.bar[42] + } +} diff --git a/crates/test-files/fixtures/features/create2_contract.fe b/crates/test-files/fixtures/features/create2_contract.fe index 78de6b168d..a66c301703 100644 --- a/crates/test-files/fixtures/features/create2_contract.fe +++ b/crates/test-files/fixtures/features/create2_contract.fe @@ -1,11 +1,14 @@ use std::context::Context -contract Foo: - pub fn get_my_num() -> u256: +contract Foo { + pub fn get_my_num() -> u256 { return 42 + } +} -contract FooFactory: - pub fn create2_foo(ctx: Context) -> address: - # value and salt +contract FooFactory { + pub fn create2_foo(ctx: Context) -> address { let foo: Foo = Foo.create2(ctx, 0, 52) return address(foo) + } +} diff --git a/crates/test-files/fixtures/features/create_contract.fe b/crates/test-files/fixtures/features/create_contract.fe index d41550a990..84474819aa 100644 --- a/crates/test-files/fixtures/features/create_contract.fe +++ b/crates/test-files/fixtures/features/create_contract.fe @@ -1,10 +1,14 @@ use std::context::Context -contract Foo: - pub fn get_my_num() -> u256: +contract Foo { + pub fn get_my_num() -> u256 { return 42 + } +} -contract FooFactory: - pub fn create_foo(ctx: Context) -> address: +contract FooFactory { + pub fn create_foo(ctx: Context) -> address { let foo: Foo = Foo.create(ctx, 0) return address(foo) + } +} diff --git a/crates/test-files/fixtures/features/create_contract_from_init.fe b/crates/test-files/fixtures/features/create_contract_from_init.fe index 2caf4e7c1e..72d1a7daad 100644 --- a/crates/test-files/fixtures/features/create_contract_from_init.fe +++ b/crates/test-files/fixtures/features/create_contract_from_init.fe @@ -1,14 +1,19 @@ use std::context::Context -contract Foo: - pub fn get_my_num() -> u256: +contract Foo { + pub fn get_my_num() -> u256 { return 42 + } +} -contract FooFactory: +contract FooFactory { foo_addr: address - pub fn __init__(self, ctx: Context): + pub fn __init__(self, ctx: Context) { self.foo_addr = address(Foo.create(ctx, 0)) + } - pub fn get_foo_addr(self) -> address: - return self.foo_addr \ No newline at end of file + pub fn get_foo_addr(self) -> address { + return self.foo_addr + } +} diff --git a/crates/test-files/fixtures/features/ctx_init_in_call.fe b/crates/test-files/fixtures/features/ctx_init_in_call.fe index 69c5c52644..5005fc4181 100644 --- a/crates/test-files/fixtures/features/ctx_init_in_call.fe +++ b/crates/test-files/fixtures/features/ctx_init_in_call.fe @@ -1,16 +1,17 @@ use std::context::Context use std::evm -contract Foo: - - pub fn __call__(): - unsafe: +contract Foo { + pub fn __call__() { + unsafe { let ctx: Context = Context() let value: u256 = u256(bar(ctx)) - - # return `value` evm::mstore(offset: 0, value) evm::return_mem(offset: 0, len: 32) + } + } - fn bar(ctx: Context) -> address: + fn bar(ctx: Context) -> address { return ctx.self_address() + } +} diff --git a/crates/test-files/fixtures/features/ctx_param_external_func_call.fe b/crates/test-files/fixtures/features/ctx_param_external_func_call.fe index 482cca6d32..c4e6e7c43b 100644 --- a/crates/test-files/fixtures/features/ctx_param_external_func_call.fe +++ b/crates/test-files/fixtures/features/ctx_param_external_func_call.fe @@ -1,24 +1,26 @@ use std::context::Context -contract Foo: +contract Foo { my_num: u256 - pub fn baz(ctx: Context) -> u256: + pub fn baz(ctx: Context) -> u256 { return ctx.block_number() + } - pub fn bing(self, _ new_num: u256) -> u256: + pub fn bing(self, _ new_num: u256) -> u256 { self.my_num = new_num return self.my_num + } +} - -contract Bar: - - pub fn call_baz(ctx: Context, foo_addr: address) -> u256: - # let foo = ctx.load(foo_addr) +contract Bar { + pub fn call_baz(ctx: Context, foo_addr: address) -> u256 { let foo: Foo = Foo(ctx, foo_addr) return foo.baz() + } - pub fn call_bing(ctx: Context) -> u256: - # let foo = ctx.create(0) + pub fn call_bing(ctx: Context) -> u256 { let foo: Foo = Foo.create(ctx, 0) return foo.bing(42) + } +} diff --git a/crates/test-files/fixtures/features/ctx_param_internal_func_call.fe b/crates/test-files/fixtures/features/ctx_param_internal_func_call.fe index fe130749a5..f2f7712088 100644 --- a/crates/test-files/fixtures/features/ctx_param_internal_func_call.fe +++ b/crates/test-files/fixtures/features/ctx_param_internal_func_call.fe @@ -1,13 +1,14 @@ use std::context::Context -contract Foo: +contract Foo { is_true: bool - pub fn bar(self, ctx: Context) -> u256: - # do something with self + pub fn bar(self, ctx: Context) -> u256 { self.is_true = false - return baz(ctx) + } - fn baz(ctx: Context) -> u256: - return ctx.block_number() \ No newline at end of file + fn baz(ctx: Context) -> u256 { + return ctx.block_number() + } +} diff --git a/crates/test-files/fixtures/features/ctx_param_simple.fe b/crates/test-files/fixtures/features/ctx_param_simple.fe index 305c3cac32..b46f70f081 100644 --- a/crates/test-files/fixtures/features/ctx_param_simple.fe +++ b/crates/test-files/fixtures/features/ctx_param_simple.fe @@ -1,6 +1,7 @@ use std::context::Context -contract Foo: - pub fn bar(self, ctx: Context) -> u256: - # TODO: add missing self access check - return ctx.block_number() \ No newline at end of file +contract Foo { + pub fn bar(self, ctx: Context) -> u256 { + return ctx.block_number() + } +} diff --git a/crates/test-files/fixtures/features/empty.fe b/crates/test-files/fixtures/features/empty.fe index 2dd735eac7..08732e586b 100644 --- a/crates/test-files/fixtures/features/empty.fe +++ b/crates/test-files/fixtures/features/empty.fe @@ -1,2 +1,3 @@ -contract Empty: - lonely: u256 \ No newline at end of file +contract Empty { + lonely: u256 +} diff --git a/crates/test-files/fixtures/features/events.fe b/crates/test-files/fixtures/features/events.fe index 01ea0f38f4..453ac576a6 100644 --- a/crates/test-files/fixtures/features/events.fe +++ b/crates/test-files/fixtures/features/events.fe @@ -1,34 +1,43 @@ use std::context::Context -contract Foo: - event Nums: +contract Foo { + event Nums { idx num1: u256 num2: u256 + } - event Bases: + event Bases { num: u256 addr: address + } - event Mix: + event Mix { num1: u256 idx addr: address num2: u256 my_bytes: Array + } - event Addresses: + event Addresses { addrs: Array + } - pub fn emit_nums(ctx: Context): + pub fn emit_nums(ctx: Context) { emit Nums(ctx, num1: 26, num2: 42) + } - pub fn emit_bases(ctx: Context, addr: address): + pub fn emit_bases(ctx: Context, addr: address) { emit Bases(ctx, num: 26, addr) + } - pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array): + pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array) { emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) + } - pub fn emit_addresses(ctx: Context, addr1: address, addr2: address): + pub fn emit_addresses(ctx: Context, addr1: address, addr2: address) { let addrs: Array addrs[0] = addr1 addrs[1] = addr2 - emit Addresses(ctx, addrs) \ No newline at end of file + emit Addresses(ctx, addrs) + } +} diff --git a/crates/test-files/fixtures/features/external_contract.fe b/crates/test-files/fixtures/features/external_contract.fe index a46468dbdb..9a04e61aa9 100644 --- a/crates/test-files/fixtures/features/external_contract.fe +++ b/crates/test-files/fixtures/features/external_contract.fe @@ -1,37 +1,33 @@ use std::context::Context -contract Foo: - event MyEvent: +contract Foo { + event MyEvent { my_num: u256 my_addrs: Array my_string: String<11> + } - pub fn emit_event(ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>): + pub fn emit_event(ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>) { emit MyEvent(ctx, my_num, my_addrs, my_string) + } - pub fn build_array(a: u256, b: u256) -> Array: + pub fn build_array(a: u256, b: u256) -> Array { let my_array: Array my_array[0] = a my_array[1] = a * b my_array[2] = b return my_array + } +} -contract FooProxy: - pub fn call_emit_event( - ctx: Context, - foo_address: address, - my_num: u256, - my_addrs: Array, - my_string: String<11> - ): +contract FooProxy { + pub fn call_emit_event(ctx: Context, foo_address: address, my_num: u256, my_addrs: Array, my_string: String<11>) { let foo: Foo = Foo(ctx, foo_address) foo.emit_event(my_num, my_addrs, my_string) + } - pub fn call_build_array( - ctx: Context, - foo_address: address, - a: u256, - b: u256, - ) -> Array: + pub fn call_build_array(ctx: Context, foo_address: address, a: u256, b: u256) -> Array { let foo: Foo = Foo(ctx, foo_address) return foo.build_array(a, b) + } +} diff --git a/crates/test-files/fixtures/features/for_loop_with_break.fe b/crates/test-files/fixtures/features/for_loop_with_break.fe index d68f11902e..25d20b5fb3 100644 --- a/crates/test-files/fixtures/features/for_loop_with_break.fe +++ b/crates/test-files/fixtures/features/for_loop_with_break.fe @@ -1,13 +1,16 @@ -contract Foo: - - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let my_array: Array my_array[0] = 5 my_array[1] = 10 my_array[2] = 15 let sum: u256 = 0 - for i in my_array: + for i in my_array { sum = sum + i - if sum == 15: + if sum == 15 { break - return sum \ No newline at end of file + } + } + return sum + } +} diff --git a/crates/test-files/fixtures/features/for_loop_with_continue.fe b/crates/test-files/fixtures/features/for_loop_with_continue.fe index aef9e407ae..b946482371 100644 --- a/crates/test-files/fixtures/features/for_loop_with_continue.fe +++ b/crates/test-files/fixtures/features/for_loop_with_continue.fe @@ -1,6 +1,5 @@ -contract Foo: - - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let my_array: Array my_array[0] = 2 my_array[1] = 3 @@ -8,8 +7,12 @@ contract Foo: my_array[3] = 6 my_array[4] = 9 let sum: u256 = 0 - for i in my_array: - if i % 2 == 0: + for i in my_array { + if i % 2 == 0 { continue + } sum = sum + i - return sum \ No newline at end of file + } + return sum + } +} diff --git a/crates/test-files/fixtures/features/for_loop_with_static_array.fe b/crates/test-files/fixtures/features/for_loop_with_static_array.fe index 07fce27bdf..632df0dfa5 100644 --- a/crates/test-files/fixtures/features/for_loop_with_static_array.fe +++ b/crates/test-files/fixtures/features/for_loop_with_static_array.fe @@ -1,11 +1,13 @@ -contract Foo: - - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let my_array: Array my_array[0] = 5 my_array[1] = 10 my_array[2] = 15 let sum: u256 = 0 - for i in my_array: + for i in my_array { sum = sum + i - return sum \ No newline at end of file + } + return sum + } +} diff --git a/crates/test-files/fixtures/features/for_loop_with_static_array_from_sto.fe b/crates/test-files/fixtures/features/for_loop_with_static_array_from_sto.fe index e7bf2d496c..901a5fd0bc 100644 --- a/crates/test-files/fixtures/features/for_loop_with_static_array_from_sto.fe +++ b/crates/test-files/fixtures/features/for_loop_with_static_array_from_sto.fe @@ -1,10 +1,12 @@ -contract Foo: +contract Foo { my_array: Array - pub fn bar(self) -> u256: - self.my_array = [1,2,3] + pub fn bar(self) -> u256 { + self.my_array = [1, 2, 3] let sum: u256 = 0 - for i in self.my_array.to_mem(): + for i in self.my_array.to_mem() { sum = sum + i - - return sum \ No newline at end of file + } + return sum + } +} diff --git a/crates/test-files/fixtures/features/if_statement.fe b/crates/test-files/fixtures/features/if_statement.fe index b853b2f6fc..72d037c5c6 100644 --- a/crates/test-files/fixtures/features/if_statement.fe +++ b/crates/test-files/fixtures/features/if_statement.fe @@ -1,7 +1,9 @@ -contract Foo: - - pub fn bar(input: u256) -> u256: - if input > 5: +contract Foo { + pub fn bar(input: u256) -> u256 { + if input > 5 { return 1 - else: + } else { return 0 + } + } +} diff --git a/crates/test-files/fixtures/features/if_statement_2.fe b/crates/test-files/fixtures/features/if_statement_2.fe index f38ad4f10a..1c1cd513a5 100644 --- a/crates/test-files/fixtures/features/if_statement_2.fe +++ b/crates/test-files/fixtures/features/if_statement_2.fe @@ -1,9 +1,10 @@ -contract Foo: - - pub fn bar(val: u256) -> u256: - if val > 5: +contract Foo { + pub fn bar(val: u256) -> u256 { + if val > 5 { return 1 - else: + } else { assert true - + } return 0 + } +} diff --git a/crates/test-files/fixtures/features/if_statement_test_from_sto.fe b/crates/test-files/fixtures/features/if_statement_test_from_sto.fe index e94633369f..6bda2ec697 100644 --- a/crates/test-files/fixtures/features/if_statement_test_from_sto.fe +++ b/crates/test-files/fixtures/features/if_statement_test_from_sto.fe @@ -1,20 +1,21 @@ -contract Foo: +contract Foo { my_bool1: bool my_bool2: bool my_bool3: bool - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.my_bool1 = false self.my_bool2 = false self.my_bool3 = true - - if self.my_bool1: + if self.my_bool1 { return 26 - - if self.my_bool2: + } + if self.my_bool2 { return 26 - - if self.my_bool3: + } + if self.my_bool3 { return 42 - - return 26 \ No newline at end of file + } + return 26 + } +} diff --git a/crates/test-files/fixtures/features/if_statement_with_block_declaration.fe b/crates/test-files/fixtures/features/if_statement_with_block_declaration.fe index 97761bf299..fbd519ad9d 100644 --- a/crates/test-files/fixtures/features/if_statement_with_block_declaration.fe +++ b/crates/test-files/fixtures/features/if_statement_with_block_declaration.fe @@ -1,9 +1,11 @@ -contract Foo: - - pub fn bar() -> u256: - if true: +contract Foo { + pub fn bar() -> u256 { + if true { let y: u256 = 1 return y - else: + } else { let y: u256 = 1 - return y \ No newline at end of file + return y + } + } +} diff --git a/crates/test-files/fixtures/features/int_literal_coercion.fe b/crates/test-files/fixtures/features/int_literal_coercion.fe index 31fa4ce2e6..c837a08ae0 100644 --- a/crates/test-files/fixtures/features/int_literal_coercion.fe +++ b/crates/test-files/fixtures/features/int_literal_coercion.fe @@ -1,6 +1,8 @@ -contract Foo: - pub fn bar() -> u32: +contract Foo { + pub fn bar() -> u32 { let c: u32 = 30 c = 300 let d: (u128, u64, u32) = (100, 200, c) return d.item2 + } +} diff --git a/crates/test-files/fixtures/features/intrinsics.fe b/crates/test-files/fixtures/features/intrinsics.fe index f560b426fe..ddbf835af8 100644 --- a/crates/test-files/fixtures/features/intrinsics.fe +++ b/crates/test-files/fixtures/features/intrinsics.fe @@ -1,95 +1,140 @@ - -contract Intrinsics: - - pub fn add(x: u256, y: u256) -> u256: - unsafe: - return __add(x, y) - - pub fn gas() -> u256: - unsafe: - return __gas() - - pub fn addr() -> address: - unsafe: - return address(__address()) - - pub fn self_balance() -> u256: - unsafe: - return __selfbalance() - - pub fn other_balance(a: u256) -> u256: - unsafe: - return __balance(a) - - pub fn caller() -> address: - unsafe: - return address(__caller()) - - pub fn callvalue() -> u256: - unsafe: - return __callvalue() - - pub fn calldataload(offset: u256) -> u256: - unsafe: - return __calldataload(offset) - - pub fn calldatasize() -> u256: - unsafe: - return __calldatasize() - - pub fn calldatacopy(offset: u256, len: u256) -> u256: - unsafe: - __calldatacopy(0, offset, len) - return __mload(0) - - pub fn codesize() -> u256: - unsafe: - return __codesize() - - pub fn extcodesize(addr: u256) -> u256: - unsafe: - return __extcodesize(addr) - - pub fn extcodehash(addr: u256) -> u256: - unsafe: - return __extcodehash(addr) - - pub fn chainid() -> u256: - unsafe: - return __chainid() - - pub fn basefee() -> u256: - unsafe: - return __basefee() - - pub fn origin() -> u256: - unsafe: - return __origin() - - pub fn gasprice() -> u256: - unsafe: - return __gasprice() - - pub fn blockhash(n: u256) -> u256: - unsafe: - return __blockhash(n) - - pub fn coinbase() -> u256: - unsafe: - return __coinbase() - - pub fn timestamp() -> u256: - unsafe: - return __timestamp() - - pub fn number() -> u256: - unsafe: - return __number() - - pub fn difficulty() -> u256: - unsafe: - return __difficulty() - - pub fn gaslimit() -> u256: - unsafe: - return __gaslimit() +contract Intrinsics { + pub fn add(x: u256, y: u256) -> u256 { + unsafe { + return __add(x, y) + } + } + + pub fn gas() -> u256 { + unsafe { + return __gas() + } + } + + pub fn addr() -> address { + unsafe { + return address(__address()) + } + } + + pub fn self_balance() -> u256 { + unsafe { + return __selfbalance() + } + } + + pub fn other_balance(a: u256) -> u256 { + unsafe { + return __balance(a) + } + } + + pub fn caller() -> address { + unsafe { + return address(__caller()) + } + } + + pub fn callvalue() -> u256 { + unsafe { + return __callvalue() + } + } + + pub fn calldataload(offset: u256) -> u256 { + unsafe { + return __calldataload(offset) + } + } + + pub fn calldatasize() -> u256 { + unsafe { + return __calldatasize() + } + } + + pub fn calldatacopy(offset: u256, len: u256) -> u256 { + unsafe { + __calldatacopy(0, offset, len) + return __mload(0) + } + } + + pub fn codesize() -> u256 { + unsafe { + return __codesize() + } + } + + pub fn extcodesize(addr: u256) -> u256 { + unsafe { + return __extcodesize(addr) + } + } + + pub fn extcodehash(addr: u256) -> u256 { + unsafe { + return __extcodehash(addr) + } + } + + pub fn chainid() -> u256 { + unsafe { + return __chainid() + } + } + + pub fn basefee() -> u256 { + unsafe { + return __basefee() + } + } + + pub fn origin() -> u256 { + unsafe { + return __origin() + } + } + + pub fn gasprice() -> u256 { + unsafe { + return __gasprice() + } + } + + pub fn blockhash(n: u256) -> u256 { + unsafe { + return __blockhash(n) + } + } + + pub fn coinbase() -> u256 { + unsafe { + return __coinbase() + } + } + + pub fn timestamp() -> u256 { + unsafe { + return __timestamp() + } + } + + pub fn number() -> u256 { + unsafe { + return __number() + } + } + + pub fn difficulty() -> u256 { + unsafe { + return __difficulty() + } + } + + pub fn gaslimit() -> u256 { + unsafe { + return __gaslimit() + } + } +} diff --git a/crates/test-files/fixtures/features/keccak.fe b/crates/test-files/fixtures/features/keccak.fe index a80b8b7b32..16d8dedce2 100644 --- a/crates/test-files/fixtures/features/keccak.fe +++ b/crates/test-files/fixtures/features/keccak.fe @@ -1,10 +1,13 @@ -contract Keccak: - - pub fn return_hash_from_u8(val: Array) -> u256: +contract Keccak { + pub fn return_hash_from_u8(val: Array) -> u256 { return keccak256(val) + } - pub fn return_hash_from_foo(val: Array) -> u256: + pub fn return_hash_from_foo(val: Array) -> u256 { return keccak256(val) + } - pub fn return_hash_from_u256(val: Array) -> u256: + pub fn return_hash_from_u256(val: Array) -> u256 { return keccak256(val) + } +} diff --git a/crates/test-files/fixtures/features/map_tuple.fe b/crates/test-files/fixtures/features/map_tuple.fe index 7697786c86..62341dd14c 100644 --- a/crates/test-files/fixtures/features/map_tuple.fe +++ b/crates/test-files/fixtures/features/map_tuple.fe @@ -1,6 +1,8 @@ -contract Foo: +contract Foo { tuples: Map - pub fn bar(self, x: u256) -> u256: + pub fn bar(self, x: u256) -> u256 { self.tuples[0] = (address(100), x) return self.tuples[0].item1 + } +} diff --git a/crates/test-files/fixtures/features/math.fe b/crates/test-files/fixtures/features/math.fe index 427926cfae..a6499b5238 100644 --- a/crates/test-files/fixtures/features/math.fe +++ b/crates/test-files/fixtures/features/math.fe @@ -1,17 +1,20 @@ -contract Math: - - # https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/contracts/libraries/Math.sol#L11-L22 - pub fn sqrt(val: u256) -> u256: +contract Math { + pub fn sqrt(val: u256) -> u256 { let z: u256 - if (val > 3): + if val > 3 { z = val let x: u256 = val / 2 + 1 - while (x < z): + while x < z { z = x x = (val / x + x) / 2 - elif (val != 0): + } + } else if val != 0 { z = 1 + } return z + } - pub fn min(x: u256, y: u256) -> u256: + pub fn min(x: u256, y: u256) -> u256 { return x if x < y else y + } +} diff --git a/crates/test-files/fixtures/features/module_const.fe b/crates/test-files/fixtures/features/module_const.fe index add9aa69d3..027f74caef 100644 --- a/crates/test-files/fixtures/features/module_const.fe +++ b/crates/test-files/fixtures/features/module_const.fe @@ -1,15 +1,16 @@ type MY_ARRAY = Array + const C1: i32 = 1 const C2: i32 = C1 * 3 const C3: i32 = C4 + 2 const C4: i32 = 42 -contract Foo: - fn bar() -> i32: +contract Foo { + fn bar() -> i32 { const LOCAL_CONST: i32 = C3 * 2 let _arr1: Array let _arr2: Array let _my_array: MY_ARRAY return C4 - - + } +} diff --git a/crates/test-files/fixtures/features/module_level_events.fe b/crates/test-files/fixtures/features/module_level_events.fe index a718d00070..96b59c943e 100644 --- a/crates/test-files/fixtures/features/module_level_events.fe +++ b/crates/test-files/fixtures/features/module_level_events.fe @@ -1,10 +1,13 @@ use std::context::Context -event Transfer: +event Transfer { idx sender: address idx receiver: address value: u256 +} -contract Foo: - fn transfer(ctx: Context, to : address, value : u256): - emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) \ No newline at end of file +contract Foo { + fn transfer(ctx: Context, to: address, value: u256) { + emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) + } +} diff --git a/crates/test-files/fixtures/features/multi_param.fe b/crates/test-files/fixtures/features/multi_param.fe index 48f064afe5..df5cd903b5 100644 --- a/crates/test-files/fixtures/features/multi_param.fe +++ b/crates/test-files/fixtures/features/multi_param.fe @@ -1,7 +1,9 @@ -contract Foo: - pub fn bar(x: u256, y: u256, z: u256) -> Array: +contract Foo { + pub fn bar(x: u256, y: u256, z: u256) -> Array { let my_array: Array my_array[0] = x my_array[1] = y my_array[2] = z return my_array + } +} diff --git a/crates/test-files/fixtures/features/nested_map.fe b/crates/test-files/fixtures/features/nested_map.fe index 1b6e0145a2..1271b748a2 100644 --- a/crates/test-files/fixtures/features/nested_map.fe +++ b/crates/test-files/fixtures/features/nested_map.fe @@ -1,15 +1,20 @@ -contract Foo: +contract Foo { bar: Map> baz: Map> - pub fn read_bar(self, a: address, b: address) -> u256: + pub fn read_bar(self, a: address, b: address) -> u256 { return self.bar[a][b] + } - pub fn write_bar(self, a: address, b: address, value: u256): + pub fn write_bar(self, a: address, b: address, value: u256) { self.bar[a][b] = value + } - pub fn read_baz(self, a: address, b: u256) -> bool: + pub fn read_baz(self, a: address, b: u256) -> bool { return self.baz[a][b] + } - pub fn write_baz(self, a: address, b: u256, value: bool): + pub fn write_baz(self, a: address, b: u256, value: bool) { self.baz[a][b] = value + } +} diff --git a/crates/test-files/fixtures/features/numeric_casts.fe b/crates/test-files/fixtures/features/numeric_casts.fe index 50e5f72639..34f5a84c7b 100644 --- a/crates/test-files/fixtures/features/numeric_casts.fe +++ b/crates/test-files/fixtures/features/numeric_casts.fe @@ -1,24 +1,12 @@ -contract Foo: - - pub fn bar(): - - # Fe doesn't allow casting from i8 to u16 directly because depending on the order - # in which sign and size are changed one does arrive at a different value as the - # following code demonstrates. - # This is in line with Solidity: https://docs.soliditylang.org/en/latest/080-breaking-changes.html#new-restrictions - # - # Notice that Rust does allow the transition in one - # step and apparently size is changed before the sign: - # https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=cfc82437a365ca1f534a40f5182bd1e2 - +contract Foo { + pub fn bar() { let a: i8 = i8(-1) let a1: i16 = i16(a) let a2: u16 = u16(a1) - assert a2 == u16(65535) - let b: i8 = i8(-1) let b1: u8 = u8(b) let b2: u16 = u16(b1) - - assert b2 == u16(255) \ No newline at end of file + assert b2 == u16(255) + } +} diff --git a/crates/test-files/fixtures/features/numeric_sizes.fe b/crates/test-files/fixtures/features/numeric_sizes.fe index 55aaa332d1..dedd08c6da 100644 --- a/crates/test-files/fixtures/features/numeric_sizes.fe +++ b/crates/test-files/fixtures/features/numeric_sizes.fe @@ -1,73 +1,97 @@ -contract Foo: - - pub fn get_u8_min() -> u8: +contract Foo { + pub fn get_u8_min() -> u8 { return u8(0) + } - pub fn get_u16_min() -> u16: + pub fn get_u16_min() -> u16 { return u16(0) + } - pub fn get_u32_min() -> u32: + pub fn get_u32_min() -> u32 { return u32(0) + } - pub fn get_u64_min() -> u64: + pub fn get_u64_min() -> u64 { return u64(0) + } - pub fn get_u128_min() -> u128: + pub fn get_u128_min() -> u128 { return u128(0) + } - pub fn get_u256_min() -> u256: + pub fn get_u256_min() -> u256 { return u256(0) + } - pub fn get_i8_min() -> i8: + pub fn get_i8_min() -> i8 { return i8(-128) + } - pub fn get_i16_min() -> i16: + pub fn get_i16_min() -> i16 { return i16(-32768) + } - pub fn get_i32_min() -> i32: + pub fn get_i32_min() -> i32 { return i32(-2147483648) + } - pub fn get_i64_min() -> i64: + pub fn get_i64_min() -> i64 { return i64(-9223372036854775808) + } - pub fn get_i128_min() -> i128: + pub fn get_i128_min() -> i128 { return i128(-170141183460469231731687303715884105728) + } - pub fn get_i256_min() -> i256: + pub fn get_i256_min() -> i256 { return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) + } - pub fn get_u8_max() -> u8: + pub fn get_u8_max() -> u8 { return u8(255) + } - pub fn get_u16_max() -> u16: + pub fn get_u16_max() -> u16 { return u16(65535) + } - pub fn get_u32_max() -> u32: + pub fn get_u32_max() -> u32 { return u32(4294967295) + } - pub fn get_u64_max() -> u64: + pub fn get_u64_max() -> u64 { return u64(18446744073709551615) + } - pub fn get_u128_max() -> u128: + pub fn get_u128_max() -> u128 { return u128(340282366920938463463374607431768211455) + } - pub fn get_u256_max() -> u256: + pub fn get_u256_max() -> u256 { return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) + } - pub fn get_i8_max() -> i8: + pub fn get_i8_max() -> i8 { return i8(127) + } - pub fn get_i16_max() -> i16: + pub fn get_i16_max() -> i16 { return i16(32767) + } - pub fn get_i32_max() -> i32: + pub fn get_i32_max() -> i32 { return i32(2147483647) + } - pub fn get_i64_max() -> i64: + pub fn get_i64_max() -> i64 { return i64(9223372036854775807) + } - pub fn get_i128_max() -> i128: + pub fn get_i128_max() -> i128 { return i128(170141183460469231731687303715884105727) + } - pub fn get_i256_max() -> i256: - return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) \ No newline at end of file + pub fn get_i256_max() -> i256 { + return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) + } +} diff --git a/crates/test-files/fixtures/features/ownable.fe b/crates/test-files/fixtures/features/ownable.fe index 22c7394221..fdc059c340 100644 --- a/crates/test-files/fixtures/features/ownable.fe +++ b/crates/test-files/fixtures/features/ownable.fe @@ -1,25 +1,31 @@ use std::context::Context -contract Ownable: - _owner: address +contract Ownable { + _owner: address - event OwnershipTransferred: - idx previousOwner: address - idx newOwner: address + event OwnershipTransferred { + idx previousOwner: address + idx newOwner: address + } - pub fn __init__(self, ctx: Context): - self._owner = ctx.msg_sender() + pub fn __init__(self, ctx: Context) { + self._owner = ctx.msg_sender() + } - pub fn owner(self) -> address: - return self._owner + pub fn owner(self) -> address { + return self._owner + } - pub fn renounceOwnership(self, ctx: Context): - assert ctx.msg_sender() == self._owner - self._owner = address(0) - emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + pub fn renounceOwnership(self, ctx: Context) { + assert ctx.msg_sender() == self._owner + self._owner = address(0) + emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) + } - pub fn transferOwnership(self, ctx: Context, newOwner: address): - assert ctx.msg_sender() == self._owner - assert newOwner != address(0) - self._owner = newOwner - emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) + pub fn transferOwnership(self, ctx: Context, newOwner: address) { + assert ctx.msg_sender() == self._owner + assert newOwner != address(0) + self._owner = newOwner + emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) + } +} diff --git a/crates/test-files/fixtures/features/pure_fn.fe b/crates/test-files/fixtures/features/pure_fn.fe index d675392017..40213ccb09 100644 --- a/crates/test-files/fixtures/features/pure_fn.fe +++ b/crates/test-files/fixtures/features/pure_fn.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: - return x + y \ No newline at end of file +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { + return x + y + } +} diff --git a/crates/test-files/fixtures/features/pure_fn_internal_call.fe b/crates/test-files/fixtures/features/pure_fn_internal_call.fe index f71155453f..ea72347dea 100644 --- a/crates/test-files/fixtures/features/pure_fn_internal_call.fe +++ b/crates/test-files/fixtures/features/pure_fn_internal_call.fe @@ -1,6 +1,9 @@ -contract Foo: - pub fn bar(self, x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(self, x: u256, y: u256) -> u256 { return pure_bar(x, y) + } - pub fn pure_bar(x: u256, y: u256) -> u256: - return x + y \ No newline at end of file + pub fn pure_bar(x: u256, y: u256) -> u256 { + return x + y + } +} diff --git a/crates/test-files/fixtures/features/pure_fn_standalone.fe b/crates/test-files/fixtures/features/pure_fn_standalone.fe index 373f736e31..2b4f939a3f 100644 --- a/crates/test-files/fixtures/features/pure_fn_standalone.fe +++ b/crates/test-files/fixtures/features/pure_fn_standalone.fe @@ -1,20 +1,24 @@ - -fn add_bonus(_ x: u256) -> u256: +fn add_bonus(_ x: u256) -> u256 { return x + 10 +} -contract Foo: +contract Foo { cool_users: Map points: Map - fn add_points(self, _ user: address, _ val: u256): - if self.cool_users[user]: + fn add_points(self, _ user: address, _ val: u256) { + if self.cool_users[user] { self.points[user] += add_bonus(val) - else: + } else { self.points[user] += val + } + } - pub fn bar(self, _ x: u256) -> u256: + pub fn bar(self, _ x: u256) -> u256 { let a: address = address(x) self.add_points(a, 100) self.cool_users[a] = true self.add_points(a, 100) return self.points[a] + } +} diff --git a/crates/test-files/fixtures/features/radix_binary.fe b/crates/test-files/fixtures/features/radix_binary.fe index 661cdd2f9d..9585efe5df 100644 --- a/crates/test-files/fixtures/features/radix_binary.fe +++ b/crates/test-files/fixtures/features/radix_binary.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> u8: +contract Foo { + pub fn bar() -> u8 { return u8(0b10) + } +} diff --git a/crates/test-files/fixtures/features/radix_hex.fe b/crates/test-files/fixtures/features/radix_hex.fe index 5036f04b42..0155f21dfb 100644 --- a/crates/test-files/fixtures/features/radix_hex.fe +++ b/crates/test-files/fixtures/features/radix_hex.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> u8: +contract Foo { + pub fn bar() -> u8 { return u8(0xfe) + } +} diff --git a/crates/test-files/fixtures/features/radix_octal.fe b/crates/test-files/fixtures/features/radix_octal.fe index e97bd0b57b..1a54548984 100644 --- a/crates/test-files/fixtures/features/radix_octal.fe +++ b/crates/test-files/fixtures/features/radix_octal.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> u8: +contract Foo { + pub fn bar() -> u8 { return u8(0o70) + } +} diff --git a/crates/test-files/fixtures/features/return_addition_i256.fe b/crates/test-files/fixtures/features/return_addition_i256.fe index 5ac7ec29c7..1c971a326f 100644 --- a/crates/test-files/fixtures/features/return_addition_i256.fe +++ b/crates/test-files/fixtures/features/return_addition_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> i256: +contract Foo { + pub fn bar(x: i256, y: i256) -> i256 { return x + y + } +} diff --git a/crates/test-files/fixtures/features/return_addition_u128.fe b/crates/test-files/fixtures/features/return_addition_u128.fe index b3577edd33..b12870302f 100644 --- a/crates/test-files/fixtures/features/return_addition_u128.fe +++ b/crates/test-files/fixtures/features/return_addition_u128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128, y: u128) -> u128: +contract Foo { + pub fn bar(x: u128, y: u128) -> u128 { return x + y + } +} diff --git a/crates/test-files/fixtures/features/return_addition_u256.fe b/crates/test-files/fixtures/features/return_addition_u256.fe index 5e266a8a49..40213ccb09 100644 --- a/crates/test-files/fixtures/features/return_addition_u256.fe +++ b/crates/test-files/fixtures/features/return_addition_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x + y + } +} diff --git a/crates/test-files/fixtures/features/return_array.fe b/crates/test-files/fixtures/features/return_array.fe index 719f6eb272..03bbd33b54 100644 --- a/crates/test-files/fixtures/features/return_array.fe +++ b/crates/test-files/fixtures/features/return_array.fe @@ -1,5 +1,7 @@ -contract Foo: - pub fn bar(x: u256) -> Array: - let my_array: Array +contract Foo { + pub fn bar(x: u256) -> Array { + let my_array: Array my_array[3] = x return my_array + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseand_u128.fe b/crates/test-files/fixtures/features/return_bitwiseand_u128.fe index 8a46043396..83dee12415 100644 --- a/crates/test-files/fixtures/features/return_bitwiseand_u128.fe +++ b/crates/test-files/fixtures/features/return_bitwiseand_u128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128, y: u128) -> u128: +contract Foo { + pub fn bar(x: u128, y: u128) -> u128 { return x & y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseand_u256.fe b/crates/test-files/fixtures/features/return_bitwiseand_u256.fe index ea62bf4291..a1e7f42a75 100644 --- a/crates/test-files/fixtures/features/return_bitwiseand_u256.fe +++ b/crates/test-files/fixtures/features/return_bitwiseand_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x & y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseor_u256.fe b/crates/test-files/fixtures/features/return_bitwiseor_u256.fe index c2b9127841..2c764efd3a 100644 --- a/crates/test-files/fixtures/features/return_bitwiseor_u256.fe +++ b/crates/test-files/fixtures/features/return_bitwiseor_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x | y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshl_i64_coerced.fe b/crates/test-files/fixtures/features/return_bitwiseshl_i64_coerced.fe index 88758a0ffa..334535057d 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshl_i64_coerced.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshl_i64_coerced.fe @@ -1,4 +1,6 @@ -contract Foo: - pub fn bar() -> i64: +contract Foo { + pub fn bar() -> i64 { let x: i64 = -1 << 0 return x + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshl_i8.fe b/crates/test-files/fixtures/features/return_bitwiseshl_i8.fe index f6f46b159a..a5dd82c392 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshl_i8.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshl_i8.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i8, y: u8) -> i8: +contract Foo { + pub fn bar(x: i8, y: u8) -> i8 { return x << y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshl_u256.fe b/crates/test-files/fixtures/features/return_bitwiseshl_u256.fe index 9c8f74c5e6..870c693694 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshl_u256.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshl_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x << y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshl_u8.fe b/crates/test-files/fixtures/features/return_bitwiseshl_u8.fe index 5ea9cb3b52..3b07469734 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshl_u8.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshl_u8.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u8, y: u8) -> u8: +contract Foo { + pub fn bar(x: u8, y: u8) -> u8 { return x << y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshr_i256.fe b/crates/test-files/fixtures/features/return_bitwiseshr_i256.fe index 65132ceb0e..ab36ac3538 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshr_i256.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshr_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: u256) -> i256: +contract Foo { + pub fn bar(x: i256, y: u256) -> i256 { return x >> y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwiseshr_u256.fe b/crates/test-files/fixtures/features/return_bitwiseshr_u256.fe index 1a7e7f9ad7..42047198ba 100644 --- a/crates/test-files/fixtures/features/return_bitwiseshr_u256.fe +++ b/crates/test-files/fixtures/features/return_bitwiseshr_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x >> y + } +} diff --git a/crates/test-files/fixtures/features/return_bitwisexor_u256.fe b/crates/test-files/fixtures/features/return_bitwisexor_u256.fe index e5ab7643a0..7b052ef56d 100644 --- a/crates/test-files/fixtures/features/return_bitwisexor_u256.fe +++ b/crates/test-files/fixtures/features/return_bitwisexor_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x ^ y + } +} diff --git a/crates/test-files/fixtures/features/return_bool_false.fe b/crates/test-files/fixtures/features/return_bool_false.fe index 21c52d3e56..1e412d86d1 100644 --- a/crates/test-files/fixtures/features/return_bool_false.fe +++ b/crates/test-files/fixtures/features/return_bool_false.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> bool: +contract Foo { + pub fn bar() -> bool { return false + } +} diff --git a/crates/test-files/fixtures/features/return_bool_inverted.fe b/crates/test-files/fixtures/features/return_bool_inverted.fe index 301863773c..c893a49c90 100644 --- a/crates/test-files/fixtures/features/return_bool_inverted.fe +++ b/crates/test-files/fixtures/features/return_bool_inverted.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(some_condition: bool) -> bool: +contract Foo { + pub fn bar(some_condition: bool) -> bool { return not some_condition + } +} diff --git a/crates/test-files/fixtures/features/return_bool_op_and.fe b/crates/test-files/fixtures/features/return_bool_op_and.fe index 19c1e9d81d..031ddde636 100644 --- a/crates/test-files/fixtures/features/return_bool_op_and.fe +++ b/crates/test-files/fixtures/features/return_bool_op_and.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: bool, y: bool) -> bool: - return x and y \ No newline at end of file +contract Foo { + pub fn bar(x: bool, y: bool) -> bool { + return x and y + } +} diff --git a/crates/test-files/fixtures/features/return_bool_op_or.fe b/crates/test-files/fixtures/features/return_bool_op_or.fe index 04790a0ee5..74f440c7d1 100644 --- a/crates/test-files/fixtures/features/return_bool_op_or.fe +++ b/crates/test-files/fixtures/features/return_bool_op_or.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: bool, y: bool) -> bool: - return x or y \ No newline at end of file +contract Foo { + pub fn bar(x: bool, y: bool) -> bool { + return x or y + } +} diff --git a/crates/test-files/fixtures/features/return_bool_true.fe b/crates/test-files/fixtures/features/return_bool_true.fe index 4f520cd69d..823dbdc4a7 100644 --- a/crates/test-files/fixtures/features/return_bool_true.fe +++ b/crates/test-files/fixtures/features/return_bool_true.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> bool: +contract Foo { + pub fn bar() -> bool { return true + } +} diff --git a/crates/test-files/fixtures/features/return_builtin_attributes.fe b/crates/test-files/fixtures/features/return_builtin_attributes.fe index f615519ffc..9c01d81f52 100644 --- a/crates/test-files/fixtures/features/return_builtin_attributes.fe +++ b/crates/test-files/fixtures/features/return_builtin_attributes.fe @@ -1,33 +1,43 @@ use std::context::Context -contract Foo: - - pub fn base_fee(ctx: Context) -> u256: +contract Foo { + pub fn base_fee(ctx: Context) -> u256 { return ctx.base_fee() + } - pub fn coinbase(ctx: Context) -> address: + pub fn coinbase(ctx: Context) -> address { return ctx.block_coinbase() + } - pub fn difficulty(ctx: Context) -> u256: + pub fn difficulty(ctx: Context) -> u256 { return ctx.block_difficulty() + } - pub fn number(ctx: Context) -> u256: + pub fn number(ctx: Context) -> u256 { return ctx.block_number() + } - pub fn timestamp(ctx: Context) -> u256: + pub fn timestamp(ctx: Context) -> u256 { return ctx.block_timestamp() + } - pub fn chainid(ctx: Context) -> u256: + pub fn chainid(ctx: Context) -> u256 { return ctx.chain_id() + } - pub fn sender(ctx: Context) -> address: + pub fn sender(ctx: Context) -> address { return ctx.msg_sender() + } - pub fn value(ctx: Context) -> u256: + pub fn value(ctx: Context) -> u256 { return ctx.msg_value() + } - pub fn origin(ctx: Context) -> address: + pub fn origin(ctx: Context) -> address { return ctx.tx_origin() + } - pub fn gas_price(ctx: Context) -> u256: + pub fn gas_price(ctx: Context) -> u256 { return ctx.tx_gas_price() + } +} diff --git a/crates/test-files/fixtures/features/return_cast_i8_to_unsigned.fe b/crates/test-files/fixtures/features/return_cast_i8_to_unsigned.fe index d6c48a5399..97dfb7bbc4 100644 --- a/crates/test-files/fixtures/features/return_cast_i8_to_unsigned.fe +++ b/crates/test-files/fixtures/features/return_cast_i8_to_unsigned.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(val: i8) -> u8: +contract Foo { + pub fn bar(val: i8) -> u8 { return u8(val) + } +} diff --git a/crates/test-files/fixtures/features/return_cast_u8_to_signed.fe b/crates/test-files/fixtures/features/return_cast_u8_to_signed.fe index ce78fe5311..199de9444e 100644 --- a/crates/test-files/fixtures/features/return_cast_u8_to_signed.fe +++ b/crates/test-files/fixtures/features/return_cast_u8_to_signed.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(val: u8) -> i8: +contract Foo { + pub fn bar(val: u8) -> i8 { return i8(val) + } +} diff --git a/crates/test-files/fixtures/features/return_division_i256.fe b/crates/test-files/fixtures/features/return_division_i256.fe index 4f1ac48538..15860fc531 100644 --- a/crates/test-files/fixtures/features/return_division_i256.fe +++ b/crates/test-files/fixtures/features/return_division_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> i256: +contract Foo { + pub fn bar(x: i256, y: i256) -> i256 { return x / y + } +} diff --git a/crates/test-files/fixtures/features/return_division_u256.fe b/crates/test-files/fixtures/features/return_division_u256.fe index abbded9e64..093d335881 100644 --- a/crates/test-files/fixtures/features/return_division_u256.fe +++ b/crates/test-files/fixtures/features/return_division_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x / y + } +} diff --git a/crates/test-files/fixtures/features/return_eq_u256.fe b/crates/test-files/fixtures/features/return_eq_u256.fe index ff09b01a55..9037426bb2 100644 --- a/crates/test-files/fixtures/features/return_eq_u256.fe +++ b/crates/test-files/fixtures/features/return_eq_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x == y + } +} diff --git a/crates/test-files/fixtures/features/return_from_memory_i8.fe b/crates/test-files/fixtures/features/return_from_memory_i8.fe index d80c9e4d8f..b2d3478402 100644 --- a/crates/test-files/fixtures/features/return_from_memory_i8.fe +++ b/crates/test-files/fixtures/features/return_from_memory_i8.fe @@ -1,13 +1,7 @@ - - -contract Foo: - - pub fn bar(self, val: i8) -> i8: +contract Foo { + pub fn bar(self, val: i8) -> i8 { let in_memory: Array = [val, val] - # We do this to prove that we have to adjust the numerics at the point where they - # are loaded on the stack and not e.g. at the point where they are returned. Adjusting - # them at the point of the return would work for a single value that is loaded from - # storage but will fail in cases like this where we sum two values together and then - # return the result. let result: i8 = in_memory[0] + in_memory[1] - return result \ No newline at end of file + return result + } +} diff --git a/crates/test-files/fixtures/features/return_from_storage_array_i8.fe b/crates/test-files/fixtures/features/return_from_storage_array_i8.fe index 90bb599b9f..e78d92c114 100644 --- a/crates/test-files/fixtures/features/return_from_storage_array_i8.fe +++ b/crates/test-files/fixtures/features/return_from_storage_array_i8.fe @@ -1,9 +1,8 @@ - - -contract Foo: - +contract Foo { some_thing: Array - pub fn bar(self, val: i8) -> Array: + pub fn bar(self, val: i8) -> Array { self.some_thing[0] = val - return self.some_thing.to_mem() \ No newline at end of file + return self.some_thing.to_mem() + } +} diff --git a/crates/test-files/fixtures/features/return_from_storage_i8.fe b/crates/test-files/fixtures/features/return_from_storage_i8.fe index 1d2304a4e1..cda7de9670 100644 --- a/crates/test-files/fixtures/features/return_from_storage_i8.fe +++ b/crates/test-files/fixtures/features/return_from_storage_i8.fe @@ -1,17 +1,11 @@ - - -contract Foo: - +contract Foo { some_thing: i8 some_other: i8 - pub fn bar(self, val: i8) -> i8: + pub fn bar(self, val: i8) -> i8 { self.some_thing = val self.some_other = val - # We do this to prove that we have to adjust the numerics at the point where they - # are loaded on the stack and not e.g. at the point where they are returned. Adjusting - # them at the point of the return would work for a single value that is loaded from - # storage but will fail in cases like this where we sum two values together and then - # return the result. - let x:i8 = self.some_thing + self.some_other - return x \ No newline at end of file + let x: i8 = self.some_thing + self.some_other + return x + } +} diff --git a/crates/test-files/fixtures/features/return_gt_i256.fe b/crates/test-files/fixtures/features/return_gt_i256.fe index 90dd79c944..e458d9d885 100644 --- a/crates/test-files/fixtures/features/return_gt_i256.fe +++ b/crates/test-files/fixtures/features/return_gt_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> bool: +contract Foo { + pub fn bar(x: i256, y: i256) -> bool { return x > y + } +} diff --git a/crates/test-files/fixtures/features/return_gt_u256.fe b/crates/test-files/fixtures/features/return_gt_u256.fe index 003c42a33f..1a3cb2233f 100644 --- a/crates/test-files/fixtures/features/return_gt_u256.fe +++ b/crates/test-files/fixtures/features/return_gt_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x > y + } +} diff --git a/crates/test-files/fixtures/features/return_gte_i256.fe b/crates/test-files/fixtures/features/return_gte_i256.fe index d942749c72..97c025eced 100644 --- a/crates/test-files/fixtures/features/return_gte_i256.fe +++ b/crates/test-files/fixtures/features/return_gte_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> bool: +contract Foo { + pub fn bar(x: i256, y: i256) -> bool { return x >= y + } +} diff --git a/crates/test-files/fixtures/features/return_gte_u256.fe b/crates/test-files/fixtures/features/return_gte_u256.fe index 21f81b9367..8443406d84 100644 --- a/crates/test-files/fixtures/features/return_gte_u256.fe +++ b/crates/test-files/fixtures/features/return_gte_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x >= y + } +} diff --git a/crates/test-files/fixtures/features/return_i128_cast.fe b/crates/test-files/fixtures/features/return_i128_cast.fe index ff01543eb8..d508722e48 100644 --- a/crates/test-files/fixtures/features/return_i128_cast.fe +++ b/crates/test-files/fixtures/features/return_i128_cast.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> i128: +contract Foo { + pub fn bar() -> i128 { return i128(-3) + } +} diff --git a/crates/test-files/fixtures/features/return_i256.fe b/crates/test-files/fixtures/features/return_i256.fe index 54d9a4de1b..6de24ec38d 100644 --- a/crates/test-files/fixtures/features/return_i256.fe +++ b/crates/test-files/fixtures/features/return_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> i256: +contract Foo { + pub fn bar() -> i256 { return -3 + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u128.fe b/crates/test-files/fixtures/features/return_identity_u128.fe index c5d19aca32..01b36df425 100644 --- a/crates/test-files/fixtures/features/return_identity_u128.fe +++ b/crates/test-files/fixtures/features/return_identity_u128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128) -> u128: +contract Foo { + pub fn bar(x: u128) -> u128 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u16.fe b/crates/test-files/fixtures/features/return_identity_u16.fe index a42fb38a18..2a17a8f965 100644 --- a/crates/test-files/fixtures/features/return_identity_u16.fe +++ b/crates/test-files/fixtures/features/return_identity_u16.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u16) -> u16: +contract Foo { + pub fn bar(x: u16) -> u16 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u256.fe b/crates/test-files/fixtures/features/return_identity_u256.fe index 44fe532ee6..62f57e717a 100644 --- a/crates/test-files/fixtures/features/return_identity_u256.fe +++ b/crates/test-files/fixtures/features/return_identity_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256) -> u256: +contract Foo { + pub fn bar(x: u256) -> u256 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u32.fe b/crates/test-files/fixtures/features/return_identity_u32.fe index 5531100c12..0c8388d682 100644 --- a/crates/test-files/fixtures/features/return_identity_u32.fe +++ b/crates/test-files/fixtures/features/return_identity_u32.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u32) -> u32: +contract Foo { + pub fn bar(x: u32) -> u32 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u64.fe b/crates/test-files/fixtures/features/return_identity_u64.fe index 50d1ca9cb1..07833752bd 100644 --- a/crates/test-files/fixtures/features/return_identity_u64.fe +++ b/crates/test-files/fixtures/features/return_identity_u64.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u64) -> u64: +contract Foo { + pub fn bar(x: u64) -> u64 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_identity_u8.fe b/crates/test-files/fixtures/features/return_identity_u8.fe index d92fc342cc..06e234ff23 100644 --- a/crates/test-files/fixtures/features/return_identity_u8.fe +++ b/crates/test-files/fixtures/features/return_identity_u8.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u8) -> u8: +contract Foo { + pub fn bar(x: u8) -> u8 { return x + } +} diff --git a/crates/test-files/fixtures/features/return_int_array.fe b/crates/test-files/fixtures/features/return_int_array.fe index afbb390c13..02328c4ff7 100644 --- a/crates/test-files/fixtures/features/return_int_array.fe +++ b/crates/test-files/fixtures/features/return_int_array.fe @@ -1,6 +1,9 @@ -contract Foo: - pub fn i8_array(bar: Array) -> Array: +contract Foo { + pub fn i8_array(bar: Array) -> Array { return bar + } - pub fn i32_array(bar: Array) -> Array: + pub fn i32_array(bar: Array) -> Array { return bar + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i128.fe b/crates/test-files/fixtures/features/return_invert_i128.fe index 0c7eeb69f3..ad2c55de1f 100644 --- a/crates/test-files/fixtures/features/return_invert_i128.fe +++ b/crates/test-files/fixtures/features/return_invert_i128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i128) -> i128: +contract Foo { + pub fn bar(x: i128) -> i128 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i16.fe b/crates/test-files/fixtures/features/return_invert_i16.fe index 2e1e5badd9..50466d78b0 100644 --- a/crates/test-files/fixtures/features/return_invert_i16.fe +++ b/crates/test-files/fixtures/features/return_invert_i16.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i16) -> i16: +contract Foo { + pub fn bar(x: i16) -> i16 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i256.fe b/crates/test-files/fixtures/features/return_invert_i256.fe index 9ab522d7c8..015e9b709a 100644 --- a/crates/test-files/fixtures/features/return_invert_i256.fe +++ b/crates/test-files/fixtures/features/return_invert_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256) -> i256: +contract Foo { + pub fn bar(x: i256) -> i256 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i32.fe b/crates/test-files/fixtures/features/return_invert_i32.fe index 060386bb92..2b3a3916e5 100644 --- a/crates/test-files/fixtures/features/return_invert_i32.fe +++ b/crates/test-files/fixtures/features/return_invert_i32.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i32) -> i32: +contract Foo { + pub fn bar(x: i32) -> i32 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i64.fe b/crates/test-files/fixtures/features/return_invert_i64.fe index 35b0e5d59f..4200350fc7 100644 --- a/crates/test-files/fixtures/features/return_invert_i64.fe +++ b/crates/test-files/fixtures/features/return_invert_i64.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i64) -> i64: +contract Foo { + pub fn bar(x: i64) -> i64 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_i8.fe b/crates/test-files/fixtures/features/return_invert_i8.fe index ffa3666309..c22af14bbd 100644 --- a/crates/test-files/fixtures/features/return_invert_i8.fe +++ b/crates/test-files/fixtures/features/return_invert_i8.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i8) -> i8: +contract Foo { + pub fn bar(x: i8) -> i8 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u128.fe b/crates/test-files/fixtures/features/return_invert_u128.fe index 39830cd7a5..e448bab79a 100644 --- a/crates/test-files/fixtures/features/return_invert_u128.fe +++ b/crates/test-files/fixtures/features/return_invert_u128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128) -> u128: +contract Foo { + pub fn bar(x: u128) -> u128 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u16.fe b/crates/test-files/fixtures/features/return_invert_u16.fe index a910bb74de..794906285c 100644 --- a/crates/test-files/fixtures/features/return_invert_u16.fe +++ b/crates/test-files/fixtures/features/return_invert_u16.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u16) -> u16: +contract Foo { + pub fn bar(x: u16) -> u16 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u256.fe b/crates/test-files/fixtures/features/return_invert_u256.fe index 99e1cdda33..0ead4b67ba 100644 --- a/crates/test-files/fixtures/features/return_invert_u256.fe +++ b/crates/test-files/fixtures/features/return_invert_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256) -> u256: +contract Foo { + pub fn bar(x: u256) -> u256 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u32.fe b/crates/test-files/fixtures/features/return_invert_u32.fe index 68f8f166b8..53dc778579 100644 --- a/crates/test-files/fixtures/features/return_invert_u32.fe +++ b/crates/test-files/fixtures/features/return_invert_u32.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u32) -> u32: +contract Foo { + pub fn bar(x: u32) -> u32 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u64.fe b/crates/test-files/fixtures/features/return_invert_u64.fe index 7f10eedb92..ca26875f0b 100644 --- a/crates/test-files/fixtures/features/return_invert_u64.fe +++ b/crates/test-files/fixtures/features/return_invert_u64.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u64) -> u64: +contract Foo { + pub fn bar(x: u64) -> u64 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_invert_u8.fe b/crates/test-files/fixtures/features/return_invert_u8.fe index a9acec5112..a18cabeea1 100644 --- a/crates/test-files/fixtures/features/return_invert_u8.fe +++ b/crates/test-files/fixtures/features/return_invert_u8.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u8) -> u8: +contract Foo { + pub fn bar(x: u8) -> u8 { return ~x + } +} diff --git a/crates/test-files/fixtures/features/return_lt_i256.fe b/crates/test-files/fixtures/features/return_lt_i256.fe index bbfebbcf05..9ad64af39d 100644 --- a/crates/test-files/fixtures/features/return_lt_i256.fe +++ b/crates/test-files/fixtures/features/return_lt_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> bool: +contract Foo { + pub fn bar(x: i256, y: i256) -> bool { return x < y + } +} diff --git a/crates/test-files/fixtures/features/return_lt_u128.fe b/crates/test-files/fixtures/features/return_lt_u128.fe index 2feb2e7e36..83677391ea 100644 --- a/crates/test-files/fixtures/features/return_lt_u128.fe +++ b/crates/test-files/fixtures/features/return_lt_u128.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u128, y: u128) -> bool: +contract Foo { + pub fn bar(x: u128, y: u128) -> bool { return x < y + } +} diff --git a/crates/test-files/fixtures/features/return_lt_u256.fe b/crates/test-files/fixtures/features/return_lt_u256.fe index 6e11bd4295..d88f14e5d3 100644 --- a/crates/test-files/fixtures/features/return_lt_u256.fe +++ b/crates/test-files/fixtures/features/return_lt_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x < y + } +} diff --git a/crates/test-files/fixtures/features/return_lte_i256.fe b/crates/test-files/fixtures/features/return_lte_i256.fe index f1c1285d16..e8900f4b1b 100644 --- a/crates/test-files/fixtures/features/return_lte_i256.fe +++ b/crates/test-files/fixtures/features/return_lte_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> bool: +contract Foo { + pub fn bar(x: i256, y: i256) -> bool { return x <= y + } +} diff --git a/crates/test-files/fixtures/features/return_lte_u256.fe b/crates/test-files/fixtures/features/return_lte_u256.fe index ed0cfc30a9..7a5f538914 100644 --- a/crates/test-files/fixtures/features/return_lte_u256.fe +++ b/crates/test-files/fixtures/features/return_lte_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x <= y + } +} diff --git a/crates/test-files/fixtures/features/return_mod_i256.fe b/crates/test-files/fixtures/features/return_mod_i256.fe index 2f4585f7fc..16b1818ec1 100644 --- a/crates/test-files/fixtures/features/return_mod_i256.fe +++ b/crates/test-files/fixtures/features/return_mod_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> i256: +contract Foo { + pub fn bar(x: i256, y: i256) -> i256 { return x % y + } +} diff --git a/crates/test-files/fixtures/features/return_mod_u256.fe b/crates/test-files/fixtures/features/return_mod_u256.fe index 2996c3a93c..8b4888b97a 100644 --- a/crates/test-files/fixtures/features/return_mod_u256.fe +++ b/crates/test-files/fixtures/features/return_mod_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x % y + } +} diff --git a/crates/test-files/fixtures/features/return_msg_sig.fe b/crates/test-files/fixtures/features/return_msg_sig.fe index c3fd6d259f..8c0c3ddabc 100644 --- a/crates/test-files/fixtures/features/return_msg_sig.fe +++ b/crates/test-files/fixtures/features/return_msg_sig.fe @@ -1,5 +1,7 @@ use std::context::Context -contract Foo: - pub fn bar(ctx: Context) -> u256: +contract Foo { + pub fn bar(ctx: Context) -> u256 { return ctx.msg_sig() + } +} diff --git a/crates/test-files/fixtures/features/return_multiplication_i256.fe b/crates/test-files/fixtures/features/return_multiplication_i256.fe index 93cb31f058..49eb9faac4 100644 --- a/crates/test-files/fixtures/features/return_multiplication_i256.fe +++ b/crates/test-files/fixtures/features/return_multiplication_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> i256: +contract Foo { + pub fn bar(x: i256, y: i256) -> i256 { return x * y + } +} diff --git a/crates/test-files/fixtures/features/return_multiplication_u256.fe b/crates/test-files/fixtures/features/return_multiplication_u256.fe index 108c82a16e..1041a66f55 100644 --- a/crates/test-files/fixtures/features/return_multiplication_u256.fe +++ b/crates/test-files/fixtures/features/return_multiplication_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x * y + } +} diff --git a/crates/test-files/fixtures/features/return_noteq_u256.fe b/crates/test-files/fixtures/features/return_noteq_u256.fe index 9d400c268b..4221ee1913 100644 --- a/crates/test-files/fixtures/features/return_noteq_u256.fe +++ b/crates/test-files/fixtures/features/return_noteq_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> bool: +contract Foo { + pub fn bar(x: u256, y: u256) -> bool { return x != y + } +} diff --git a/crates/test-files/fixtures/features/return_pow_i256.fe b/crates/test-files/fixtures/features/return_pow_i256.fe index 1c15e8a8fa..78e57a1c34 100644 --- a/crates/test-files/fixtures/features/return_pow_i256.fe +++ b/crates/test-files/fixtures/features/return_pow_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i8, y: u8) -> i8: +contract Foo { + pub fn bar(x: i8, y: u8) -> i8 { return x ** y + } +} diff --git a/crates/test-files/fixtures/features/return_pow_u256.fe b/crates/test-files/fixtures/features/return_pow_u256.fe index 83963e7ebf..6e6d6043ed 100644 --- a/crates/test-files/fixtures/features/return_pow_u256.fe +++ b/crates/test-files/fixtures/features/return_pow_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x ** y + } +} diff --git a/crates/test-files/fixtures/features/return_subtraction_i256.fe b/crates/test-files/fixtures/features/return_subtraction_i256.fe index 276e962762..a79d87574b 100644 --- a/crates/test-files/fixtures/features/return_subtraction_i256.fe +++ b/crates/test-files/fixtures/features/return_subtraction_i256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: i256, y: i256) -> i256: +contract Foo { + pub fn bar(x: i256, y: i256) -> i256 { return x - y + } +} diff --git a/crates/test-files/fixtures/features/return_subtraction_u256.fe b/crates/test-files/fixtures/features/return_subtraction_u256.fe index 5acb6e0aa0..27a052fece 100644 --- a/crates/test-files/fixtures/features/return_subtraction_u256.fe +++ b/crates/test-files/fixtures/features/return_subtraction_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar(x: u256, y: u256) -> u256: +contract Foo { + pub fn bar(x: u256, y: u256) -> u256 { return x - y + } +} diff --git a/crates/test-files/fixtures/features/return_sum_list_expression_1.fe b/crates/test-files/fixtures/features/return_sum_list_expression_1.fe index 1b1671196a..f13a272c50 100644 --- a/crates/test-files/fixtures/features/return_sum_list_expression_1.fe +++ b/crates/test-files/fixtures/features/return_sum_list_expression_1.fe @@ -1,10 +1,13 @@ -contract Foo: +contract Foo { num_two: u256 - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.num_two = 2 let my_array: Array = [1, self.num_two, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] let sum: u256 = 0 - for i in my_array: + for i in my_array { sum = sum + i + } return sum + } +} diff --git a/crates/test-files/fixtures/features/return_sum_list_expression_2.fe b/crates/test-files/fixtures/features/return_sum_list_expression_2.fe index bac099d8b5..edddc6a955 100644 --- a/crates/test-files/fixtures/features/return_sum_list_expression_2.fe +++ b/crates/test-files/fixtures/features/return_sum_list_expression_2.fe @@ -1,10 +1,13 @@ -contract Foo: - - pub fn bar(self) -> u256: +contract Foo { + pub fn bar(self) -> u256 { return count([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]) + } - fn count(_ values: Array) -> u256: + fn count(_ values: Array) -> u256 { let sum: u256 = 0 - for i in values: + for i in values { sum = sum + i + } return sum + } +} diff --git a/crates/test-files/fixtures/features/return_u128_cast.fe b/crates/test-files/fixtures/features/return_u128_cast.fe index 7289233ddf..2956254ba4 100644 --- a/crates/test-files/fixtures/features/return_u128_cast.fe +++ b/crates/test-files/fixtures/features/return_u128_cast.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> u128: +contract Foo { + pub fn bar() -> u128 { return u128(42) + } +} diff --git a/crates/test-files/fixtures/features/return_u256.fe b/crates/test-files/fixtures/features/return_u256.fe index 1cd90cdd48..fb0fcd47f0 100644 --- a/crates/test-files/fixtures/features/return_u256.fe +++ b/crates/test-files/fixtures/features/return_u256.fe @@ -1,3 +1,5 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { return 42 + } +} diff --git a/crates/test-files/fixtures/features/return_u256_from_called_fn.fe b/crates/test-files/fixtures/features/return_u256_from_called_fn.fe index cbfc4b7b47..37e37432ac 100644 --- a/crates/test-files/fixtures/features/return_u256_from_called_fn.fe +++ b/crates/test-files/fixtures/features/return_u256_from_called_fn.fe @@ -1,8 +1,9 @@ -contract Foo: - - # We intentionally define `bar` before `foo` to test that order isn't important - pub fn bar(self) -> u256: +contract Foo { + pub fn bar(self) -> u256 { return foo() + } - pub fn foo() -> u256: + pub fn foo() -> u256 { return 42 + } +} diff --git a/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe b/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe index 330fd6a652..fb945e4d12 100644 --- a/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe +++ b/crates/test-files/fixtures/features/return_u256_from_called_fn_with_args.fe @@ -1,11 +1,16 @@ -contract Foo: +contract Foo { baz: Map - pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256: + + pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256 { return v1 + v2 + v3 + v4 + v5 + } - pub fn cem() -> u256: + pub fn cem() -> u256 { return 100 + } - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.baz[0] = 43 return foo(5, 2, cem(), 25 + 25, self.baz[0]) + } +} diff --git a/crates/test-files/fixtures/features/return_unit.fe b/crates/test-files/fixtures/features/return_unit.fe index 58013a855a..079890199c 100644 --- a/crates/test-files/fixtures/features/return_unit.fe +++ b/crates/test-files/fixtures/features/return_unit.fe @@ -1,19 +1,21 @@ -contract Foo: +contract Foo { + pub fn explicit_return_a1() { + return + } - pub fn explicit_return_a1(): - return + pub fn explicit_return_a2() { + return () + } - pub fn explicit_return_a2(): - return () + pub fn explicit_return_b1() -> () { + return + } - pub fn explicit_return_b1() -> (): - return + pub fn explicit_return_b2() -> () { + return () + } - pub fn explicit_return_b2() -> (): - return () + pub fn implicit_a1() {} - pub fn implicit_a1(): - pass - - pub fn implicit_a2() -> (): - pass \ No newline at end of file + pub fn implicit_a2() -> () {} +} diff --git a/crates/test-files/fixtures/features/revert.fe b/crates/test-files/fixtures/features/revert.fe index e68e17eb27..3b7a69031e 100644 --- a/crates/test-files/fixtures/features/revert.fe +++ b/crates/test-files/fixtures/features/revert.fe @@ -1,21 +1,27 @@ use std::context::Context -struct OtherError: +struct OtherError { pub msg: u256 pub val: bool +} -contract Foo: +contract Foo { my_other_error: OtherError - pub fn bar() -> u256: + pub fn bar() -> u256 { revert + } - pub fn revert_custom_error(ctx: Context): + pub fn revert_custom_error(ctx: Context) { ctx.send_value(to: address(0), wei: 100) + } - pub fn revert_other_error(): + pub fn revert_other_error() { revert OtherError(msg: 1, val: true) + } - pub fn revert_other_error_from_sto(self): + pub fn revert_other_error_from_sto(self) { self.my_other_error = OtherError(msg: 1, val: true) revert self.my_other_error.to_mem() + } +} diff --git a/crates/test-files/fixtures/features/self_address.fe b/crates/test-files/fixtures/features/self_address.fe index c2ed173a78..2b9d7bfe9e 100644 --- a/crates/test-files/fixtures/features/self_address.fe +++ b/crates/test-files/fixtures/features/self_address.fe @@ -1,5 +1,7 @@ use std::context::Context -contract Foo: - pub fn my_address(ctx: Context) -> address: - return ctx.self_address() \ No newline at end of file +contract Foo { + pub fn my_address(ctx: Context) -> address { + return ctx.self_address() + } +} diff --git a/crates/test-files/fixtures/features/send_value.fe b/crates/test-files/fixtures/features/send_value.fe index abe7649dc4..c98e6537fd 100644 --- a/crates/test-files/fixtures/features/send_value.fe +++ b/crates/test-files/fixtures/features/send_value.fe @@ -1,5 +1,7 @@ use std::context::Context -contract Foo: - pub fn send_them_wei(ctx: Context, to: address, wei: u256): +contract Foo { + pub fn send_them_wei(ctx: Context, to: address, wei: u256) { ctx.send_value(to, wei) + } +} diff --git a/crates/test-files/fixtures/features/short_circuit.fe b/crates/test-files/fixtures/features/short_circuit.fe index 18ce29faca..00ccdcc9c3 100644 --- a/crates/test-files/fixtures/features/short_circuit.fe +++ b/crates/test-files/fixtures/features/short_circuit.fe @@ -1,18 +1,23 @@ -contract Foo: - - pub fn bar(input: u256) -> u256: +contract Foo { + pub fn bar(input: u256) -> u256 { return 1 if input > 5 else revert_u256() + } - fn revert_u256() -> u256: + fn revert_u256() -> u256 { revert return 0 + } - fn revert_bool() -> bool: + fn revert_bool() -> bool { revert return true + } - pub fn short_circuit_and(let_through: bool) -> bool: + pub fn short_circuit_and(let_through: bool) -> bool { return let_through and revert_bool() + } - pub fn short_circuit_or(break_early: bool) -> bool: - return break_early or revert_bool() \ No newline at end of file + pub fn short_circuit_or(break_early: bool) -> bool { + return break_early or revert_bool() + } +} diff --git a/crates/test-files/fixtures/features/sized_vals_in_sto.fe b/crates/test-files/fixtures/features/sized_vals_in_sto.fe index 151343a246..3cba528604 100644 --- a/crates/test-files/fixtures/features/sized_vals_in_sto.fe +++ b/crates/test-files/fixtures/features/sized_vals_in_sto.fe @@ -1,37 +1,41 @@ use std::context::Context -contract Foo: +contract Foo { num: u256 nums: Array str: String<26> - event MyEvent: + event MyEvent { num: u256 nums: Array str: String<26> + } - pub fn write_num(self, x: u256): + pub fn write_num(self, x: u256) { self.num = x + } - pub fn read_num(self) -> u256: + pub fn read_num(self) -> u256 { return self.num + } - pub fn write_nums(self, x: Array): + pub fn write_nums(self, x: Array) { self.nums = x + } - pub fn read_nums(self) -> Array: + pub fn read_nums(self) -> Array { return self.nums.to_mem() + } - pub fn write_str(self, x: String<26>): + pub fn write_str(self, x: String<26>) { self.str = x + } - pub fn read_str(self) -> String<26>: + pub fn read_str(self) -> String<26> { return self.str.to_mem() + } - pub fn emit_event(self, ctx: Context): - emit MyEvent( - ctx, - num: self.num, - nums: self.nums.to_mem(), - str: self.str.to_mem() - ) \ No newline at end of file + pub fn emit_event(self, ctx: Context) { + emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) + } +} diff --git a/crates/test-files/fixtures/features/strings.fe b/crates/test-files/fixtures/features/strings.fe index e4bf4e4d44..21ba67e7e8 100644 --- a/crates/test-files/fixtures/features/strings.fe +++ b/crates/test-files/fixtures/features/strings.fe @@ -1,7 +1,7 @@ use std::context::Context -contract Foo: - event MyEvent: +contract Foo { + event MyEvent { s2: String<26> u: u256 s1: String<42> @@ -9,24 +9,30 @@ contract Foo: a: address s4: String<18> s5: String<100> + } - pub fn __init__(ctx: Context, s1: String<42>, a: address, s2: String<26>, u: u256, s3: String<100>): + pub fn __init__(ctx: Context, s1: String<42>, a: address, s2: String<26>, u: u256, s3: String<100>) { emit MyEvent(ctx, s2, u, s1, s3, a, s4: "static string", s5: String<100>("foo")) + } - pub fn bar(s1: String<100>, s2: String<100>) -> String<100>: + pub fn bar(s1: String<100>, s2: String<100>) -> String<100> { return s2 + } - pub fn return_static_string() -> String<43>: + pub fn return_static_string() -> String<43> { return "The quick brown fox jumps over the lazy dog" + } - pub fn return_casted_static_string() -> String<100>: + pub fn return_casted_static_string() -> String<100> { return String<100>("foo") + } - pub fn shorter_string_assign(): + pub fn shorter_string_assign() { let s: String<18> = "fe" + } - pub fn return_special_chars() -> String<18>: + pub fn return_special_chars() -> String<18> { return "\n\"'\r\t foo\\" - - + } +} diff --git a/crates/test-files/fixtures/features/struct_fns.fe b/crates/test-files/fixtures/features/struct_fns.fe index f482218239..fbf3f5569a 100644 --- a/crates/test-files/fixtures/features/struct_fns.fe +++ b/crates/test-files/fixtures/features/struct_fns.fe @@ -1,56 +1,60 @@ -struct Point: - pub x: u64 - pub y: u64 - - pub fn new(x: u64, y: u64) -> Point: - return Point(x, y) - - pub fn origin() -> Point: - return Point(x: 0, y: 0) - - # function name can match field name - pub fn x(self) -> u64: - return self.x - - pub fn set_x(self, _ x: u64) -> u64: - let old: u64 = self.x - self.x = x - return old - - pub fn reflect(self): - let x: u64 = self.x - let y: u64 = self.y - # self.x = self.y panics. see issue #590 - self.x = y - self.y = x - - pub fn translate(self, x: u64, y: u64): - self.x += x - self.y += y - - pub fn add(self, _ other: Point) -> Point: - let x: u64 = self.x + other.x - let y: u64 = self.y + other.y - return Point(x, y) - -pub fn do_pointy_things(): - let p1: Point = Point::origin() - p1.translate(x: 5, y: 10) - - let p2: Point = Point(x: 1, y: 2) - let p3: Point = p1.add(p2) - - assert p3.x == 6 and p3.y == 12 - - -contract Foo: - - pub fn bar(x: u64, y: u64) -> u64: - do_pointy_things() - - let p: Point = Point::new(x, y) - assert p.x == x and p.y == y - p.set_x(100) - p.reflect() - assert p.x() == y and p.y == 100 - return p.y +struct Point { + pub x: u64 + pub y: u64 + + pub fn new(x: u64, y: u64) -> Point { + return Point(x, y) + } + + pub fn origin() -> Point { + return Point(x: 0, y: 0) + } + + pub fn x(self) -> u64 { + return self.x + } + + pub fn set_x(self, _ x: u64) -> u64 { + let old: u64 = self.x + self.x = x + return old + } + + pub fn reflect(self) { + let x: u64 = self.x + let y: u64 = self.y + self.x = y + self.y = x + } + + pub fn translate(self, x: u64, y: u64) { + self.x += x + self.y += y + } + + pub fn add(self, _ other: Point) -> Point { + let x: u64 = self.x + other.x + let y: u64 = self.y + other.y + return Point(x, y) + } +} + +pub fn do_pointy_things() { + let p1: Point = Point::origin() + p1.translate(x: 5, y: 10) + let p2: Point = Point(x: 1, y: 2) + let p3: Point = p1.add(p2) + assert p3.x == 6 and p3.y == 12 +} + +contract Foo { + pub fn bar(x: u64, y: u64) -> u64 { + do_pointy_things() + let p: Point = Point::new(x, y) + assert p.x == x and p.y == y + p.set_x(100) + p.reflect() + assert p.x() == y and p.y == 100 + return p.y + } +} diff --git a/crates/test-files/fixtures/features/structs.fe b/crates/test-files/fixtures/features/structs.fe index 8c31dae130..20658f748c 100644 --- a/crates/test-files/fixtures/features/structs.fe +++ b/crates/test-files/fixtures/features/structs.fe @@ -1,167 +1,140 @@ -struct Point: +struct Point { pub x: u256 pub y: u256 +} -struct Bar: +struct Bar { pub name: String<3> pub numbers: Array pub point: Point pub something: (u256, bool) +} -struct Mixed: +struct Mixed { pub foo: u256 bar: bool - pub fn new(val: u256) -> Mixed: + pub fn new(val: u256) -> Mixed { return Mixed(foo: val, bar: false) + } +} -struct House: +struct House { pub price: u256 pub size: u256 pub rooms: u8 pub vacant: bool - pub fn encode(self) -> Array: + pub fn encode(self) -> Array { return self.abi_encode() + } - pub fn hash(self) -> u256: + pub fn hash(self) -> u256 { return keccak256(self.encode()) + } - pub fn price_per_sqft(self) -> u256: + pub fn price_per_sqft(self) -> u256 { return self.price / self.size + } - pub fn expand(self): + pub fn expand(self) { self.rooms += 1 self.size += 100 + } +} -contract Foo: +contract Foo { my_house: House my_bar: Bar - pub fn complex_struct_in_storage(self) -> String<3>: - self.my_bar = Bar( - name: "foo", - numbers: [1, 2], - point: Point(x: 100, y: 200), - something: (1, true), - ) - - # Asserting the values as they were set initially + pub fn complex_struct_in_storage(self) -> String<3> { + self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) assert self.my_bar.numbers[0] == 1 assert self.my_bar.numbers[1] == 2 assert self.my_bar.point.x == 100 assert self.my_bar.point.y == 200 assert self.my_bar.something.item0 == 1 assert self.my_bar.something.item1 - - # We can change the values of the array self.my_bar.numbers[0] = 10 self.my_bar.numbers[1] = 20 assert self.my_bar.numbers[0] == 10 assert self.my_bar.numbers[1] == 20 - # We can set the array itself self.my_bar.numbers = [1, 2] assert self.my_bar.numbers[0] == 1 assert self.my_bar.numbers[1] == 2 - - # We can change the values of the Point self.my_bar.point.x = 1000 self.my_bar.point.y = 2000 assert self.my_bar.point.x == 1000 assert self.my_bar.point.y == 2000 - # We can set the point itself self.my_bar.point = Point(x: 100, y: 200) assert self.my_bar.point.x == 100 assert self.my_bar.point.y == 200 - - # We can change the value of the tuple self.my_bar.something.item0 = 10 self.my_bar.something.item1 = false assert self.my_bar.something.item0 == 10 assert not self.my_bar.something.item1 - # We can set the tuple itself self.my_bar.something = (1, true) assert self.my_bar.something.item0 == 1 assert self.my_bar.something.item1 - return self.my_bar.name.to_mem() + } - pub fn complex_struct_in_memory(self) -> String<3>: - let val: Bar = Bar( - name: "foo", - numbers: [1, 2], - point: Point(x: 100, y: 200), - something: (1, true), - ) - - # Asserting the values as they were set initially + pub fn complex_struct_in_memory(self) -> String<3> { + let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) assert val.numbers[0] == 1 assert val.numbers[1] == 2 assert val.point.x == 100 assert val.point.y == 200 assert val.something.item0 == 1 assert val.something.item1 - - # We can change the values of the array val.numbers[0] = 10 val.numbers[1] = 20 assert val.numbers[0] == 10 assert val.numbers[1] == 20 - # We can set the array itself val.numbers = [1, 2] assert val.numbers[0] == 1 assert val.numbers[1] == 2 - - # We can change the values of the Point val.point.x = 1000 val.point.y = 2000 assert val.point.x == 1000 assert val.point.y == 2000 - # We can set the point itself val.point = Point(x: 100, y: 200) assert val.point.x == 100 assert val.point.y == 200 - - # We can change the value of the tuple val.something.item0 = 10 val.something.item1 = false assert val.something.item0 == 10 assert not val.something.item1 - # We can set the tuple itself val.something = (1, true) assert val.something.item0 == 1 assert val.something.item1 - return val.name + } - pub fn create_mixed(self) -> u256: - let mixed: Mixed = Mixed::new(val:1) + pub fn create_mixed(self) -> u256 { + let mixed: Mixed = Mixed::new(val: 1) return mixed.foo + } - pub fn set_house(self, data: House): + pub fn set_house(self, data: House) { self.my_house = data + } - pub fn get_house(self) -> House: + pub fn get_house(self) -> House { return self.my_house.to_mem() + } - pub fn create_house(self): - self.my_house = House( - price: 1, - size: 2, - rooms: u8(5), - vacant: false, - ) + pub fn create_house(self) { + self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) assert self.my_house.price == 1 assert self.my_house.size == 2 assert self.my_house.rooms == u8(5) assert self.my_house.vacant == false - # We change only the size and check other fields are unchanged self.my_house.size = 50 assert self.my_house.size == 50 assert self.my_house.price == 1 assert self.my_house.rooms == u8(5) assert self.my_house.vacant == false - # We change only the price and check other fields are unchanged self.my_house.price = 1000 assert self.my_house.size == 50 assert self.my_house.price == 1000 @@ -177,49 +150,35 @@ contract Foo: assert self.my_house.price == 1000 assert self.my_house.rooms == u8(100) assert self.my_house.vacant + } - pub fn bar() -> u256: - let building: House = House( - price: 300, - size: 500, - rooms: u8(20), - vacant: true, - ) + pub fn bar() -> u256 { + let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) assert building.size == 500 assert building.price == 300 assert building.rooms == u8(20) assert building.vacant - building.vacant = false building.price = 1 building.size = 2 building.rooms = u8(10) - assert building.vacant == false assert building.price == 1 assert building.size == 2 assert building.rooms == u8(10) - building.expand() assert building.size == 102 assert building.rooms == 11 - return building.size + } - pub fn encode_house() -> Array: - let house: House = House( - price: 300, - size: 500, - rooms: u8(20), - vacant: true, - ) + pub fn encode_house() -> Array { + let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) return house.encode() + } - pub fn hashed_house() -> u256: - let house: House = House( - price: 300, - size: 500, - rooms: u8(20), - vacant: true, - ) + pub fn hashed_house() -> u256 { + let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) return house.hash() + } +} diff --git a/crates/test-files/fixtures/features/ternary_expression.fe b/crates/test-files/fixtures/features/ternary_expression.fe index 6ded5c1cde..85a38bc039 100644 --- a/crates/test-files/fixtures/features/ternary_expression.fe +++ b/crates/test-files/fixtures/features/ternary_expression.fe @@ -1,4 +1,5 @@ -contract Foo: - - pub fn bar(input: u256) -> u256: - return 1 if input > 5 else 0 \ No newline at end of file +contract Foo { + pub fn bar(input: u256) -> u256 { + return 1 if input > 5 else 0 + } +} diff --git a/crates/test-files/fixtures/features/tuple_destructuring.fe b/crates/test-files/fixtures/features/tuple_destructuring.fe index 4c60e88093..b2dc186820 100644 --- a/crates/test-files/fixtures/features/tuple_destructuring.fe +++ b/crates/test-files/fixtures/features/tuple_destructuring.fe @@ -1,11 +1,15 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let (x, y): (u256, bool) = (42, true) return x + } - pub fn baz(n: u256, b: bool) -> u256: + pub fn baz(n: u256, b: bool) -> u256 { let (x, y): (u256, bool) = make_tuple(n, b) return x + } - fn make_tuple(n: u256, b: bool) -> (u256, bool): + fn make_tuple(n: u256, b: bool) -> (u256, bool) { return (n, b) + } +} diff --git a/crates/test-files/fixtures/features/two_contracts.fe b/crates/test-files/fixtures/features/two_contracts.fe index 552c27fb4e..63662b4f5d 100644 --- a/crates/test-files/fixtures/features/two_contracts.fe +++ b/crates/test-files/fixtures/features/two_contracts.fe @@ -1,23 +1,30 @@ use std::context::Context -contract Foo: +contract Foo { other: Bar - pub fn __init__(self, ctx: Context): + pub fn __init__(self, ctx: Context) { self.other = Bar.create(ctx, 0) + } - pub fn foo(self, ctx: Context) -> u256: + pub fn foo(self, ctx: Context) -> u256 { self.other.set_foo_addr(ctx.self_address()) return self.other.answer() + } - pub fn add(_ x: u256, _ y: u256) -> u256: + pub fn add(_ x: u256, _ y: u256) -> u256 { return x + y + } +} -contract Bar: +contract Bar { other: Foo - pub fn set_foo_addr(self, ctx: Context, _ addr: address): + pub fn set_foo_addr(self, ctx: Context, _ addr: address) { self.other = Foo(ctx, addr) + } - pub fn answer(self) -> u256: + pub fn answer(self) -> u256 { return self.other.add(20, 22) + } +} diff --git a/crates/test-files/fixtures/features/type_aliases.fe b/crates/test-files/fixtures/features/type_aliases.fe index 80738f72b9..8b6fe86ef7 100644 --- a/crates/test-files/fixtures/features/type_aliases.fe +++ b/crates/test-files/fixtures/features/type_aliases.fe @@ -1,30 +1,38 @@ use std::context::Context type Posts = Map + type Scoreboard = Map + type AuthorPosts = Map type Author = address + type Score = u64 + type PostId = u256 + type PostBody = String<32> -contract Forum: +contract Forum { posts: Posts authors: AuthorPosts scoreboard: Scoreboard - pub fn post(self, ctx: Context, body: PostBody): - # id: PostId = keccak256(body.abi_encode()) + pub fn post(self, ctx: Context, body: PostBody) { let id: PostId = 0 self.posts[id] = body self.authors[ctx.msg_sender()] self.scoreboard[id] = 0 + } - pub fn upvote(self, id: PostId) -> Score: + pub fn upvote(self, id: PostId) -> Score { let score: Score = self.scoreboard[id] + 1 self.scoreboard[id] = score return score + } - pub fn get_post(self, id: PostId) -> PostBody: - return self.posts[id].to_mem() \ No newline at end of file + pub fn get_post(self, id: PostId) -> PostBody { + return self.posts[id].to_mem() + } +} diff --git a/crates/test-files/fixtures/features/u128_u128_map.fe b/crates/test-files/fixtures/features/u128_u128_map.fe index 1c013d4e47..d6d70b67e3 100644 --- a/crates/test-files/fixtures/features/u128_u128_map.fe +++ b/crates/test-files/fixtures/features/u128_u128_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u128) -> u128: + pub fn read_bar(self, key: u128) -> u128 { return self.bar[key] + } - pub fn write_bar(self, key: u128, value: u128): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u128, value: u128) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/u16_u16_map.fe b/crates/test-files/fixtures/features/u16_u16_map.fe index 52df7ae2e3..6d98a40cde 100644 --- a/crates/test-files/fixtures/features/u16_u16_map.fe +++ b/crates/test-files/fixtures/features/u16_u16_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u16) -> u16: + pub fn read_bar(self, key: u16) -> u16 { return self.bar[key] + } - pub fn write_bar(self, key: u16, value: u16): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u16, value: u16) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/u256_u256_map.fe b/crates/test-files/fixtures/features/u256_u256_map.fe index e0946fc5c4..ceedbf4e3a 100644 --- a/crates/test-files/fixtures/features/u256_u256_map.fe +++ b/crates/test-files/fixtures/features/u256_u256_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u256) -> u256: + pub fn read_bar(self, key: u256) -> u256 { return self.bar[key] + } - pub fn write_bar(self, key: u256, value: u256): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u256, value: u256) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/u32_u32_map.fe b/crates/test-files/fixtures/features/u32_u32_map.fe index 8286418470..37730309fc 100644 --- a/crates/test-files/fixtures/features/u32_u32_map.fe +++ b/crates/test-files/fixtures/features/u32_u32_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u32) -> u32: + pub fn read_bar(self, key: u32) -> u32 { return self.bar[key] + } - pub fn write_bar(self, key: u32, value: u32): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u32, value: u32) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/u64_u64_map.fe b/crates/test-files/fixtures/features/u64_u64_map.fe index 248377e9a4..523b0201fc 100644 --- a/crates/test-files/fixtures/features/u64_u64_map.fe +++ b/crates/test-files/fixtures/features/u64_u64_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u64) -> u64: + pub fn read_bar(self, key: u64) -> u64 { return self.bar[key] + } - pub fn write_bar(self, key: u64, value: u64): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u64, value: u64) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/u8_u8_map.fe b/crates/test-files/fixtures/features/u8_u8_map.fe index 40e6fe90c9..d9cdd74259 100644 --- a/crates/test-files/fixtures/features/u8_u8_map.fe +++ b/crates/test-files/fixtures/features/u8_u8_map.fe @@ -1,8 +1,11 @@ -contract Foo: +contract Foo { bar: Map - pub fn read_bar(self, key: u8) -> u8: + pub fn read_bar(self, key: u8) -> u8 { return self.bar[key] + } - pub fn write_bar(self, key: u8, value: u8): - self.bar[key] = value \ No newline at end of file + pub fn write_bar(self, key: u8, value: u8) { + self.bar[key] = value + } +} diff --git a/crates/test-files/fixtures/features/while_loop.fe b/crates/test-files/fixtures/features/while_loop.fe index a34587ca9e..1eac9e0284 100644 --- a/crates/test-files/fixtures/features/while_loop.fe +++ b/crates/test-files/fixtures/features/while_loop.fe @@ -1,8 +1,12 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let val: u256 = 0 - while val < 2: + while val < 2 { val = val + 1 - if val == 2: + if val == 2 { val = 3 + } + } return val + } +} diff --git a/crates/test-files/fixtures/features/while_loop_test_from_sto.fe b/crates/test-files/fixtures/features/while_loop_test_from_sto.fe index 7ee5cca8f5..865acdef86 100644 --- a/crates/test-files/fixtures/features/while_loop_test_from_sto.fe +++ b/crates/test-files/fixtures/features/while_loop_test_from_sto.fe @@ -1,10 +1,11 @@ -contract Foo: +contract Foo { my_bool: bool - pub fn bar(self) -> u256: + pub fn bar(self) -> u256 { self.my_bool = false + while self.my_bool { - while self.my_bool: - pass - - return 42 \ No newline at end of file + } + return 42 + } +} diff --git a/crates/test-files/fixtures/features/while_loop_with_break.fe b/crates/test-files/fixtures/features/while_loop_with_break.fe index c5f2f3e265..38f9fd64be 100644 --- a/crates/test-files/fixtures/features/while_loop_with_break.fe +++ b/crates/test-files/fixtures/features/while_loop_with_break.fe @@ -1,7 +1,10 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let val: u256 = 0 - while val < 2: + while val < 2 { val = val + 1 break + } return val + } +} diff --git a/crates/test-files/fixtures/features/while_loop_with_break_2.fe b/crates/test-files/fixtures/features/while_loop_with_break_2.fe index e6e7412d35..e27f106540 100644 --- a/crates/test-files/fixtures/features/while_loop_with_break_2.fe +++ b/crates/test-files/fixtures/features/while_loop_with_break_2.fe @@ -1,8 +1,12 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let val: u256 = 0 - while val < 2: + while val < 2 { val = val + 1 - if val == 1: + if val == 1 { break + } + } return val + } +} diff --git a/crates/test-files/fixtures/features/while_loop_with_continue.fe b/crates/test-files/fixtures/features/while_loop_with_continue.fe index ead49e76d7..8823bbf924 100644 --- a/crates/test-files/fixtures/features/while_loop_with_continue.fe +++ b/crates/test-files/fixtures/features/while_loop_with_continue.fe @@ -1,11 +1,14 @@ -contract Foo: - pub fn bar() -> u256: +contract Foo { + pub fn bar() -> u256 { let i: u256 = 0 let counter: u256 = 0 - - while i < 2: + while i < 2 { i = i + 1 - if i == 1: + if i == 1 { continue + } counter = counter + 1 + } return counter + } +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/bar.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/bar.fe index 3cb373f595..6ab24bcb2f 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/bar.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/bar.fe @@ -1,3 +1,3 @@ - -pub fn file_items_work() -> bool: - return true +pub fn file_items_work() -> bool { + return true +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/bar/baz.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/bar/baz.fe index 90ddb562bd..e98036c2f1 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/bar/baz.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/bar/baz.fe @@ -1,3 +1,4 @@ -pub struct Baz: +pub struct Baz { pub my_bool: bool pub my_u256: u256 +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/bar/mee.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/bar/mee.fe index 05b8305f03..238c21dab1 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/bar/mee.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/bar/mee.fe @@ -1,6 +1,9 @@ -pub struct Mee: - pub fn kawum() -> u256: +pub struct Mee { + pub fn kawum() -> u256 { return 1 + } - pub fn rums(self) -> u256: - return 1 \ No newline at end of file + pub fn rums(self) -> u256 { + return 1 + } +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe index e98cb7b3d3..0eaa9b923d 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/bing.fe @@ -1,11 +1,15 @@ use std::error::Error -pub struct Bing: +pub struct Bing { pub my_address: address +} -pub fn get_42_backend() -> u256: +pub fn get_42_backend() -> u256 { return std::evm::add(21, 21) +} -pub contract BingContract: - pub fn add(_ x: u256, _ y: u256) -> u256: - return x + y +pub contract BingContract { + pub fn add(_ x: u256, _ y: u256) -> u256 { + return x + y + } +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dang.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dang.fe index 050377d346..9d3f08aae1 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dang.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dang.fe @@ -1 +1 @@ -type Dang = Array \ No newline at end of file +type Dang = Array diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dong.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dong.fe index 4741ddc957..b41de98145 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dong.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/ding/dong.fe @@ -1,9 +1,11 @@ use ingot::bing::Bing -pub struct Dyng: - pub my_address: address - pub my_u256: u256 - pub my_i8: i8 +pub struct Dyng { + pub my_address: address + pub my_u256: u256 + pub my_i8: i8 +} -fn get_bing() -> Bing: +fn get_bing() -> Bing { return Bing(my_address: address(0)) +} diff --git a/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe b/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe index 9a07c0a6ac..9db2e0a904 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe @@ -6,31 +6,35 @@ use ding::{dang::Dang as Dung, dong} use bing::BingContract use std::context::Context -contract Foo: - pub fn get_my_baz() -> Baz: +contract Foo { + pub fn get_my_baz() -> Baz { assert file_items_work() return Baz(my_bool: true, my_u256: 26) + } - pub fn get_my_bing() -> Bong: + pub fn get_my_bing() -> Bong { return Bong(my_address: address(42)) + } - pub fn get_42() -> u256: + pub fn get_42() -> u256 { return get_42_backend() + } - pub fn get_26() -> u256: + pub fn get_26() -> u256 { return std::evm::add(13, 13) + } - pub fn call_on_path(): + pub fn call_on_path() { assert bar::mee::Mee::kawum() == 1 assert bar::mee::Mee().rums() == 1 + } - pub fn get_my_dyng() -> dong::Dyng: - return dong::Dyng( - my_address: address(8), - my_u256: 42, - my_i8: -1 - ) + pub fn get_my_dyng() -> dong::Dyng { + return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) + } - pub fn create_bing_contract(ctx: Context) -> u256: + pub fn create_bing_contract(ctx: Context) -> u256 { let bing_contract: BingContract = BingContract.create(ctx, 0) - return bing_contract.add(40, 50) \ No newline at end of file + return bing_contract.add(40, 50) + } +} diff --git a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe index a3e230c8dd..7012642796 100644 --- a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe +++ b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/foo.fe @@ -1,9 +1,13 @@ -pub struct Foo: +pub struct Foo { my_address: address +} -pub struct Bar: +pub struct Bar { pub my_u256: u256 +} -pub contract FooBar: - pub fn add(_ x: u256, _ y: u256) -> u256: - return x + y \ No newline at end of file +pub contract FooBar { + pub fn add(_ x: u256, _ y: u256) -> u256 { + return x + y + } +} diff --git a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/main.fe b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/main.fe index ca69455de2..3631591b1c 100644 --- a/crates/test-files/fixtures/ingots/pub_contract_ingot/src/main.fe +++ b/crates/test-files/fixtures/ingots/pub_contract_ingot/src/main.fe @@ -1,12 +1,13 @@ use foo::{Foo, Bar, FooBar} use std::context::Context -contract FooBarBing: - pub fn get_bar() -> Bar: - return Bar( - my_u256: 24 - ) +contract FooBarBing { + pub fn get_bar() -> Bar { + return Bar(my_u256: 24) + } - pub fn create_foobar_contract(ctx: Context) -> u256: + pub fn create_foobar_contract(ctx: Context) -> u256 { let foo_bar: FooBar = FooBar.create(ctx, 0) return foo_bar.add(40, 50) + } +} diff --git a/crates/test-files/fixtures/ingots/visibility_ingot/src/foo.fe b/crates/test-files/fixtures/ingots/visibility_ingot/src/foo.fe index 88086f4800..9cc700fffd 100644 --- a/crates/test-files/fixtures/ingots/visibility_ingot/src/foo.fe +++ b/crates/test-files/fixtures/ingots/visibility_ingot/src/foo.fe @@ -1,11 +1,15 @@ -pub struct Bing: - pub my_address: address +pub struct Bing { + pub my_address: address +} -fn get_42_backend() -> u256: +fn get_42_backend() -> u256 { return 42 +} pub type Precision = u256 -contract BingContract: - pub fn add(x: u256, y: u256) -> u256: +contract BingContract { + pub fn add(x: u256, y: u256) -> u256 { return x + y + } +} diff --git a/crates/test-files/fixtures/ingots/visibility_ingot/src/main.fe b/crates/test-files/fixtures/ingots/visibility_ingot/src/main.fe index 4b276df221..bcc51b3858 100644 --- a/crates/test-files/fixtures/ingots/visibility_ingot/src/main.fe +++ b/crates/test-files/fixtures/ingots/visibility_ingot/src/main.fe @@ -1,8 +1,11 @@ use foo::{get_42_backend, Precision, Bing} -contract Foo: - pub fn get_addr() -> Bing: +contract Foo { + pub fn get_addr() -> Bing { return Bing(my_address: address(24)) + } - pub fn get_precision() -> Precision: - return 18 \ No newline at end of file + pub fn get_precision() -> Precision { + return 18 + } +} diff --git a/crates/test-files/fixtures/lowering/and_or.fe b/crates/test-files/fixtures/lowering/and_or.fe index 1ce17444e2..8e3b25c102 100644 --- a/crates/test-files/fixtures/lowering/and_or.fe +++ b/crates/test-files/fixtures/lowering/and_or.fe @@ -1,54 +1,65 @@ -contract Foo: - - pub fn bar() -> bool: +contract Foo { + pub fn bar() -> bool { return baz(false or true) + } - pub fn nested(): - if true: + pub fn nested() { + if true { let a: bool = true let b: bool = false let x: bool = true let y: bool = false return double_baz(a and b, x or y) + } + } - pub fn nested_ternary() -> bool: + pub fn nested_ternary() -> bool { let a: bool = true let b: bool = false let x: bool = true let y: bool = false return baz(a and b) and (x and y) + } - pub fn in_dec(): + pub fn in_dec() { let a: bool = true let b: bool = false let x: bool = true let y: bool = false - let z: (bool, bool) = (a and b, x or y) + } - pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_or(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { return first or second or third or fourth + } - pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: - return (first or second) or (third or fourth) + pub fn short_or2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { + return first or second or (third or fourth) + } - pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: - return (first or second) or third or fourth + pub fn short_or3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { + return first or second or third or fourth + } - pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_and(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { return first and second and third and fourth + } - pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: - return (first and second) and (third and fourth) + pub fn short_and2(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { + return first and second and (third and fourth) + } - pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: - return (first and second) and third and fourth + pub fn short_and3(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { + return first and second and third and fourth + } - pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool: + pub fn short_mixed(_ first: bool, _ second: bool, _ third: bool, _ fourth: bool) -> bool { return (first or second) and third or fourth + } - pub fn baz(_ val: bool) -> bool: + pub fn baz(_ val: bool) -> bool { return val + } - pub fn double_baz(_ val: bool, _ val2: bool): - pass + pub fn double_baz(_ val: bool, _ val2: bool) {} +} diff --git a/crates/test-files/fixtures/lowering/array_tuple.fe b/crates/test-files/fixtures/lowering/array_tuple.fe index fef394a25b..b4ecf7b4fe 100644 --- a/crates/test-files/fixtures/lowering/array_tuple.fe +++ b/crates/test-files/fixtures/lowering/array_tuple.fe @@ -1,6 +1,8 @@ -contract Foo: - tuples: (u256, address)[10] +contract Foo { + tuples: Array<(u256, address), 10> - pub fn bar(self, x: u256) -> u256: + pub fn bar(self, x: u256) -> u256 { self.tuples[0] = (x, address(x)) return self.tuples[0].item0 + } +} diff --git a/crates/test-files/fixtures/lowering/aug_assign.fe b/crates/test-files/fixtures/lowering/aug_assign.fe index 180e92fa8f..da6bbd2e38 100644 --- a/crates/test-files/fixtures/lowering/aug_assign.fe +++ b/crates/test-files/fixtures/lowering/aug_assign.fe @@ -1,57 +1,71 @@ -contract Foo: +contract Foo { my_num: u256 - pub fn add(a: u256, b: u256) -> u256: + pub fn add(a: u256, b: u256) -> u256 { a += b return a + } - pub fn sub(a: u256, b: u256) -> u256: + pub fn sub(a: u256, b: u256) -> u256 { a -= b return a + } - pub fn mul(a: u256, b: u256) -> u256: + pub fn mul(a: u256, b: u256) -> u256 { a *= b return a + } - pub fn div(a: u256, b: u256) -> u256: + pub fn div(a: u256, b: u256) -> u256 { a /= b return a + } - pub fn mod(a: u256, b: u256) -> u256: + pub fn mod(a: u256, b: u256) -> u256 { a %= b return a + } - pub fn pow(a: u256, b: u256) -> u256: + pub fn pow(a: u256, b: u256) -> u256 { a **= b return a + } - pub fn lshift(a: u8, b: u8) -> u8: + pub fn lshift(a: u8, b: u8) -> u8 { a <<= b return a + } - pub fn rshift(a: u8, b: u8) -> u8: + pub fn rshift(a: u8, b: u8) -> u8 { a >>= b return a + } - pub fn bit_or(a: u8, b: u8) -> u8: + pub fn bit_or(a: u8, b: u8) -> u8 { a |= b return a + } - pub fn bit_xor(a: u8, b: u8) -> u8: + pub fn bit_xor(a: u8, b: u8) -> u8 { a ^= b return a + } - pub fn bit_and(a: u8, b: u8) -> u8: + pub fn bit_and(a: u8, b: u8) -> u8 { a &= b return a + } - pub fn add_from_sto(self, a: u256, b: u256) -> u256: + pub fn add_from_sto(self, a: u256, b: u256) -> u256 { self.my_num = a self.my_num += b return self.my_num + } - pub fn add_from_mem(a: u256, b: u256) -> u256: + pub fn add_from_mem(a: u256, b: u256) -> u256 { let my_array: Array my_array[7] = a my_array[7] += b return my_array[7] + } +} diff --git a/crates/test-files/fixtures/lowering/base_tuple.fe b/crates/test-files/fixtures/lowering/base_tuple.fe index 9eb4ac0f72..8f23697ea5 100644 --- a/crates/test-files/fixtures/lowering/base_tuple.fe +++ b/crates/test-files/fixtures/lowering/base_tuple.fe @@ -1,31 +1,28 @@ use std::context::Context -contract Foo: +contract Foo { my_tuple_field: (bool, address) - event MyEvent: + event MyEvent { my_tuple: (bool, bool) my_other_tuple: (address, address) + } - pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool): + pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool) { return (my_num, my_bool) + } - pub fn baz() -> (u256, bool, u8, address): + pub fn baz() -> (u256, bool, u8, address) { return (999999, false, u8(42), address(26)) + } - pub fn bing(): + pub fn bing() { let foo: (address, address, u16, i32, bool) = (address(0), address(0), u16(0), i32(0), false) + } - pub fn bop( - my_tuple1: (u256, bool), - my_tuple2: (u256, bool, u8, address), - my_tuple3: (address, address, u16, i32, bool) - ): - pass + pub fn bop(my_tuple1: (u256, bool), my_tuple2: (u256, bool, u8, address), my_tuple3: (address, address, u16, i32, bool)) {} - pub fn food(ctx: Context): - emit MyEvent( - ctx, - my_tuple: (false, true), - my_other_tuple: (address(0), address(1)) - ) \ No newline at end of file + pub fn food(ctx: Context) { + emit MyEvent(ctx, my_tuple: (false, true), my_other_tuple: (address(0), address(1))) + } +} diff --git a/crates/test-files/fixtures/lowering/custom_empty_type.fe b/crates/test-files/fixtures/lowering/custom_empty_type.fe index 61e9b20874..8105cbc09e 100644 --- a/crates/test-files/fixtures/lowering/custom_empty_type.fe +++ b/crates/test-files/fixtures/lowering/custom_empty_type.fe @@ -1,6 +1,7 @@ -struct MyEmptyType: - pass +struct MyEmptyType {} -contract Foo: - pub fn bar() -> MyEmptyType: - return MyEmptyType() \ No newline at end of file +contract Foo { + pub fn bar() -> MyEmptyType { + return MyEmptyType() + } +} diff --git a/crates/test-files/fixtures/lowering/init.fe b/crates/test-files/fixtures/lowering/init.fe index 816492b73a..15237ae36c 100644 --- a/crates/test-files/fixtures/lowering/init.fe +++ b/crates/test-files/fixtures/lowering/init.fe @@ -1,3 +1,3 @@ -contract Foo: - pub fn __init__(): - pass \ No newline at end of file +contract Foo { + pub fn __init__() {} +} diff --git a/crates/test-files/fixtures/lowering/list_expressions.fe b/crates/test-files/fixtures/lowering/list_expressions.fe index a41fdbbdbe..57fce2eead 100644 --- a/crates/test-files/fixtures/lowering/list_expressions.fe +++ b/crates/test-files/fixtures/lowering/list_expressions.fe @@ -1,4 +1,6 @@ -contract Foo: - pub fn foo(): +contract Foo { + pub fn foo() { let x: Array = [10, 20, 30] [] + } +} diff --git a/crates/test-files/fixtures/lowering/map_tuple.fe b/crates/test-files/fixtures/lowering/map_tuple.fe index 3f4676dea7..c4a0814960 100644 --- a/crates/test-files/fixtures/lowering/map_tuple.fe +++ b/crates/test-files/fixtures/lowering/map_tuple.fe @@ -1,6 +1,8 @@ -contract Foo: +contract Foo { tuples: Map - pub fn bar(self, x: u256) -> u256: + pub fn bar(self, x: u256) -> u256 { self.tuples[0] = (address(100), (x, 5)) return self.tuples[0].item1.item0 + } +} diff --git a/crates/test-files/fixtures/lowering/module_const.fe b/crates/test-files/fixtures/lowering/module_const.fe index 25fadb684b..dd407602b7 100644 --- a/crates/test-files/fixtures/lowering/module_const.fe +++ b/crates/test-files/fixtures/lowering/module_const.fe @@ -1,43 +1,46 @@ const THREE: u256 = 3 -const TEN: u256 = 10 -const IS_ADMIN: bool = true -const UNIT: () = () - -struct Bar: - pub val: u256 - -contract Foo: - - table: Map - - pub fn revert_with_bar(): - revert Bar(val: TEN) - - pub fn return_unit(): - return UNIT - pub fn usage(self) -> u256: - - let my_calc: u256 = THREE * TEN - let my_other_calc: u256 = THREE * 3 - - let my_array: Array = [THREE, TEN] - let my_tuple: (u256, u256) = (THREE, TEN) - let my_bar: Bar = Bar(val: THREE) - - while THREE > 4: - pass - - for x in [THREE, TEN]: - pass +const TEN: u256 = 10 - self.table[TEN] = THREE +const IS_ADMIN: bool = true - if THREE == TEN: - pass - elif TEN == 10: - return THREE * TEN - elif IS_ADMIN: - revert Bar(val: THREE) +const UNIT: () = () - return self.table[THREE] +struct Bar { + pub val: u256 +} + +contract Foo { + table: Map + + pub fn revert_with_bar() { + revert Bar(val: TEN) + } + + pub fn return_unit() { + return UNIT + } + + pub fn usage(self) -> u256 { + let my_calc: u256 = THREE * TEN + let my_other_calc: u256 = THREE * 3 + let my_array: Array = [THREE, TEN] + let my_tuple: (u256, u256) = (THREE, TEN) + let my_bar: Bar = Bar(val: THREE) + while THREE > 4 { + + } + for x in [THREE, TEN] { + + } + self.table[TEN] = THREE + if THREE == TEN { + + } else if TEN == 10 { + return THREE * TEN + } else if IS_ADMIN { + revert Bar(val: THREE) + } + return self.table[THREE] + } +} diff --git a/crates/test-files/fixtures/lowering/module_fn.fe b/crates/test-files/fixtures/lowering/module_fn.fe index bcbd553fd1..ca0c758c95 100644 --- a/crates/test-files/fixtures/lowering/module_fn.fe +++ b/crates/test-files/fixtures/lowering/module_fn.fe @@ -1,14 +1,19 @@ -fn return_tuple() -> (address, (u256, u8)): - return (address(0), (10, 20)) +fn return_tuple() -> (address, (u256, u8)) { + return (address(0), (10, 20)) +} -fn return_array() -> Array: - return [1, 2, 3] +fn return_array() -> Array { + return [1, 2, 3] +} -contract Foo: - pub fn bar(self) -> u256: +contract Foo { + pub fn bar(self) -> u256 { let tuple: (address, (u256, u8)) = return_tuple() return tuple.item1.item0 + } - pub fn sum_things() -> u8: + pub fn sum_things() -> u8 { let x: Array = return_array() return x[0] + x[1] + x[2] + } +} diff --git a/crates/test-files/fixtures/lowering/module_level_events.fe b/crates/test-files/fixtures/lowering/module_level_events.fe index 34edb7c033..96b59c943e 100644 --- a/crates/test-files/fixtures/lowering/module_level_events.fe +++ b/crates/test-files/fixtures/lowering/module_level_events.fe @@ -1,10 +1,13 @@ use std::context::Context -event Transfer: +event Transfer { idx sender: address idx receiver: address value: u256 +} -contract Foo: - fn transfer(ctx: Context, to : address, value : u256): +contract Foo { + fn transfer(ctx: Context, to: address, value: u256) { emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) + } +} diff --git a/crates/test-files/fixtures/lowering/nested_tuple.fe b/crates/test-files/fixtures/lowering/nested_tuple.fe index d006ff11a4..130ddffca7 100644 --- a/crates/test-files/fixtures/lowering/nested_tuple.fe +++ b/crates/test-files/fixtures/lowering/nested_tuple.fe @@ -1,6 +1,8 @@ -contract Foo: +contract Foo { tup: (u256, (u8, bool), (address, (u8, u8))) - pub fn bar(self, x: u256) -> u8: + pub fn bar(self, x: u256) -> u8 { self.tup = (1, (0, true), (address(0), (10, 100))) return self.tup.item2.item1.item0 + } +} diff --git a/crates/test-files/fixtures/lowering/return_unit.fe b/crates/test-files/fixtures/lowering/return_unit.fe index 30cd57db69..b7c2581b90 100644 --- a/crates/test-files/fixtures/lowering/return_unit.fe +++ b/crates/test-files/fixtures/lowering/return_unit.fe @@ -1,29 +1,35 @@ -contract Foo: - pub fn explicit_return_a1(): - return +contract Foo { + pub fn explicit_return_a1() { + return + } - pub fn explicit_return_a2(): - return () + pub fn explicit_return_a2() { + return () + } - pub fn explicit_return_b1() -> (): - return + pub fn explicit_return_b1() -> () { + return + } - pub fn explicit_return_b2() -> (): - return () + pub fn explicit_return_b2() -> () { + return () + } - pub fn implicit_a1(): - pass + pub fn implicit_a1() {} - pub fn implicit_a2() -> (): - pass + pub fn implicit_a2() -> () {} - pub fn if_elif_else() -> (): - if true: - return () - elif false: - return - else: - pass + pub fn if_elif_else() -> () { + if true { + return () + } else if false { + return + } else { + + } + } - pub fn tuple_stmt(): - () \ No newline at end of file + pub fn tuple_stmt() { + () + } +} diff --git a/crates/test-files/fixtures/lowering/struct_fn.fe b/crates/test-files/fixtures/lowering/struct_fn.fe index 318d7e130a..b4463ff4aa 100644 --- a/crates/test-files/fixtures/lowering/struct_fn.fe +++ b/crates/test-files/fixtures/lowering/struct_fn.fe @@ -1,15 +1,19 @@ -struct Foo: - pub x: u256 +struct Foo { + pub x: u256 - pub fn set_x(self, _ new: u256) -> u256: - let old: u256 = self.get_x() - self.x = new - return old + pub fn set_x(self, _ new: u256) -> u256 { + let old: u256 = self.get_x() + self.x = new + return old + } - pub fn get_x(self) -> u256: - return self.x + pub fn get_x(self) -> u256 { + return self.x + } +} -fn main(): - let foo: Foo = Foo(x: 10) - foo.set_x(100) - assert foo.get_x() == 100 +fn main() { + let foo: Foo = Foo(x: 10) + foo.set_x(100) + assert foo.get_x() == 100 +} diff --git a/crates/test-files/fixtures/lowering/ternary.fe b/crates/test-files/fixtures/lowering/ternary.fe index 88db5a17c3..6bc804e83c 100644 --- a/crates/test-files/fixtures/lowering/ternary.fe +++ b/crates/test-files/fixtures/lowering/ternary.fe @@ -1,33 +1,35 @@ -contract Foo: - - pub fn bar(): +contract Foo { + pub fn bar() { return baz(1 if true else 0) + } - pub fn nested(): - if true: + pub fn nested() { + if true { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 return double_baz(a if true else b, x if true else y) + } + } - pub fn nested_ternary(): + pub fn nested_ternary() { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 - return baz(a if true else (x if true else y)) + return baz(a if true else x if true else y) + } - pub fn in_dec(): + pub fn in_dec() { let a: u256 = 10 let b: u256 = 20 let x: u256 = 10 let y: u256 = 20 - let z: (u256, u256) = (a if true else b, x if true else y) + } - pub fn baz(_ val: u256): - pass + pub fn baz(_ val: u256) {} - pub fn double_baz(_ val1: u256, _ val2: u256): - pass + pub fn double_baz(_ val1: u256, _ val2: u256) {} +} diff --git a/crates/test-files/fixtures/lowering/tuple_destruct.fe b/crates/test-files/fixtures/lowering/tuple_destruct.fe index 028a1ad6ce..a39d4ec9a5 100644 --- a/crates/test-files/fixtures/lowering/tuple_destruct.fe +++ b/crates/test-files/fixtures/lowering/tuple_destruct.fe @@ -1,6 +1,8 @@ -contract Foo: +contract Foo { my_sto_tuple: (bool, bool, address, u8) - pub fn bar(self, my_tuple: (u256, bool)): + pub fn bar(self, my_tuple: (u256, bool)) { let (my_u256, my_bool): (u256, bool) = my_tuple - let (a, b, c, d): (bool, bool, address, u8) = self.my_sto_tuple.to_mem() \ No newline at end of file + let (a, b, c, d): (bool, bool, address, u8) = self.my_sto_tuple.to_mem() + } +} diff --git a/crates/test-files/fixtures/lowering/type_alias_tuple.fe b/crates/test-files/fixtures/lowering/type_alias_tuple.fe index 8166372f0a..8cf28a6465 100644 --- a/crates/test-files/fixtures/lowering/type_alias_tuple.fe +++ b/crates/test-files/fixtures/lowering/type_alias_tuple.fe @@ -1,4 +1,5 @@ type Tup = (u8, address) -contract Foo: +contract Foo { tup: Tup +} diff --git a/crates/test-files/fixtures/lowering/unit_implicit.fe b/crates/test-files/fixtures/lowering/unit_implicit.fe index b70abda24d..bfc0c0a6ce 100644 --- a/crates/test-files/fixtures/lowering/unit_implicit.fe +++ b/crates/test-files/fixtures/lowering/unit_implicit.fe @@ -1,3 +1,3 @@ -contract Foo: - fn bar(): - pass \ No newline at end of file +contract Foo { + fn bar() {} +} diff --git a/crates/test-files/fixtures/printing/defs.fe b/crates/test-files/fixtures/printing/defs.fe index d81a44955f..3c6f843755 100644 --- a/crates/test-files/fixtures/printing/defs.fe +++ b/crates/test-files/fixtures/printing/defs.fe @@ -1,5 +1,3 @@ -pragma >=0.1.0 - use foo::bar as baz use foo::food use bing::bong::* @@ -30,20 +28,8 @@ contract Foo { field2: String<42> } - pub fn my_func(x: bool) { - if x { - std::solidity::bytes2::from_array([1, 2]) - let y: u8 = 10 - } else { - let nums: Array = [1, 2, 3] - let sum: u8 = 0 - for n in nums { - sum += v - } - while sum < 100 { - sum += 1 - } - } + pub fn my_func() { + std::solidity::bytes2::from_array([1, 2]) } fn my_other_func() {} @@ -51,4 +37,4 @@ contract Foo { contract Bar { pub fn __init__() {} -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/printing/guest_book_no_comments.fe b/crates/test-files/fixtures/printing/guest_book_no_comments.fe index f3fab3753e..c4aeb11aa8 100644 --- a/crates/test-files/fixtures/printing/guest_book_no_comments.fe +++ b/crates/test-files/fixtures/printing/guest_book_no_comments.fe @@ -13,4 +13,4 @@ contract GuestBook { pub fn get_msg(self, addr: address) -> String<100> { return self.messages[addr].to_mem() } -} \ No newline at end of file +} diff --git a/crates/test-files/fixtures/stress/abi_encoding_stress.fe b/crates/test-files/fixtures/stress/abi_encoding_stress.fe index 59fcb27816..0c1e913955 100644 --- a/crates/test-files/fixtures/stress/abi_encoding_stress.fe +++ b/crates/test-files/fixtures/stress/abi_encoding_stress.fe @@ -1,12 +1,13 @@ use std::context::Context -struct MyStruct: +struct MyStruct { pub my_num: u256 pub my_num2: u8 pub my_bool: bool pub my_addr: address +} -contract Foo: +contract Foo { my_addrs: Array my_u128: u128 my_string: String<10> @@ -14,72 +15,76 @@ contract Foo: my_bool: bool my_bytes: Array - event MyEvent: + event MyEvent { my_addrs: Array my_u128: u128 my_string: String<10> my_u16s: Array my_bool: bool my_bytes: Array + } - pub fn set_my_addrs(self, my_addrs: Array): + pub fn set_my_addrs(self, my_addrs: Array) { self.my_addrs = my_addrs + } - pub fn get_my_addrs(self) -> Array: + pub fn get_my_addrs(self) -> Array { return self.my_addrs.to_mem() + } - pub fn set_my_u128(self, my_u128: u128): + pub fn set_my_u128(self, my_u128: u128) { self.my_u128 = my_u128 + } - pub fn get_my_u128(self) -> u128: + pub fn get_my_u128(self) -> u128 { return self.my_u128 + } - pub fn set_my_string(self, my_string: String<10>): + pub fn set_my_string(self, my_string: String<10>) { self.my_string = my_string + } - pub fn get_my_string(self) -> String<10>: + pub fn get_my_string(self) -> String<10> { return self.my_string.to_mem() + } - pub fn set_my_u16s(self, my_u16s: Array): + pub fn set_my_u16s(self, my_u16s: Array) { self.my_u16s = my_u16s + } - pub fn get_my_u16s(self) -> Array: + pub fn get_my_u16s(self) -> Array { return self.my_u16s.to_mem() + } - pub fn set_my_bool(self, my_bool: bool): + pub fn set_my_bool(self, my_bool: bool) { self.my_bool = my_bool + } - pub fn get_my_bool(self) -> bool: + pub fn get_my_bool(self) -> bool { return self.my_bool + } - pub fn set_my_bytes(self, my_bytes: Array): + pub fn set_my_bytes(self, my_bytes: Array) { self.my_bytes = my_bytes + } - pub fn get_my_bytes(self) -> Array: + pub fn get_my_bytes(self) -> Array { return self.my_bytes.to_mem() + } - pub fn get_my_struct() -> MyStruct: - return MyStruct( - my_num: 42, - my_num2: u8(26), - my_bool: true, - my_addr: address(123456) - ) + pub fn get_my_struct() -> MyStruct { + return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) + } - pub fn mod_my_struct(my_struct: MyStruct) -> MyStruct: + pub fn mod_my_struct(my_struct: MyStruct) -> MyStruct { my_struct.my_num = 12341234 my_struct.my_num2 = u8(42) my_struct.my_bool = false my_struct.my_addr = address(9999) return my_struct + } - pub fn emit_my_event(self, ctx: Context): - emit MyEvent( - ctx, - my_addrs: self.my_addrs.to_mem(), - my_u128: self.my_u128, - my_string: self.my_string.to_mem(), - my_u16s: self.my_u16s.to_mem(), - my_bool: self.my_bool, - my_bytes: self.my_bytes.to_mem() - ) + pub fn emit_my_event(self, ctx: Context) { + emit MyEvent(ctx, my_addrs: self.my_addrs.to_mem(), my_u128: self.my_u128, my_string: self.my_string.to_mem(), my_u16s: self.my_u16s.to_mem(), my_bool: self.my_bool, my_bytes: self.my_bytes.to_mem()) + } +} diff --git a/crates/test-files/fixtures/stress/data_copying_stress.fe b/crates/test-files/fixtures/stress/data_copying_stress.fe index 9db0419e70..d9d0a819ed 100644 --- a/crates/test-files/fixtures/stress/data_copying_stress.fe +++ b/crates/test-files/fixtures/stress/data_copying_stress.fe @@ -1,63 +1,59 @@ use std::context::Context -contract Foo: +contract Foo { my_string: String<42> my_other_string: String<42> - my_u256: u256 my_other_u256: u256 - my_nums: Array - my_addrs: Array - event MyEvent: + event MyEvent { my_string: String<42> my_u256: u256 + } - pub fn set_my_vals( - self, - my_string: String<42>, - my_other_string: String<42>, - my_u256: u256, - my_other_u256: u256 - ): + pub fn set_my_vals(self, my_string: String<42>, my_other_string: String<42>, my_u256: u256, my_other_u256: u256) { self.my_string = my_string self.my_other_string = my_other_string self.my_u256 = my_u256 self.my_other_u256 = my_other_u256 + } - pub fn set_to_my_other_vals(self): + pub fn set_to_my_other_vals(self) { self.my_string = self.my_other_string self.my_u256 = self.my_other_u256 + } - pub fn multiple_references_shared_memory(my_array: Array): + pub fn multiple_references_shared_memory(my_array: Array) { let my_2nd_array: Array = my_array let my_3rd_array: Array = my_2nd_array - assert my_array[3] != 5 my_array[3] = 5 assert my_array[3] == 5 assert my_2nd_array[3] == 5 assert my_3rd_array[3] == 5 - my_3rd_array[3] = 50 assert my_array[3] == 50 assert my_2nd_array[3] == 50 assert my_3rd_array[3] == 50 + } - pub fn mutate_and_return(my_array: Array) -> Array: + pub fn mutate_and_return(my_array: Array) -> Array { my_array[3] = 5 return my_array + } - pub fn clone_and_return(my_array: Array) -> Array: + pub fn clone_and_return(my_array: Array) -> Array { return my_array.clone() + } - pub fn clone_mutate_and_return(my_array: Array) -> Array: + pub fn clone_mutate_and_return(my_array: Array) -> Array { my_array.clone()[3] = 5 return my_array + } - pub fn assign_my_nums_and_return(self) -> Array: + pub fn assign_my_nums_and_return(self) -> Array { let my_nums_mem: Array self.my_nums[0] = 42 self.my_nums[1] = 26 @@ -66,19 +62,21 @@ contract Foo: self.my_nums[4] = 255 my_nums_mem = self.my_nums.to_mem() return my_nums_mem + } - pub fn emit_my_event(self, ctx: Context): - emit_my_event_internal( - ctx, - self.my_string.to_mem(), - self.my_u256.to_mem() - ) + pub fn emit_my_event(self, ctx: Context) { + emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256.to_mem()) + } - fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256): + fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256) { emit MyEvent(ctx, my_string, my_u256) + } - pub fn set_my_addrs(self, my_addrs: Array): + pub fn set_my_addrs(self, my_addrs: Array) { self.my_addrs = my_addrs + } - pub fn get_my_second_addr(self) -> address: - return self.my_addrs[1] \ No newline at end of file + pub fn get_my_second_addr(self) -> address { + return self.my_addrs[1] + } +} diff --git a/crates/test-files/fixtures/stress/external_calls.fe b/crates/test-files/fixtures/stress/external_calls.fe index 69476959d6..56dbf5c0d7 100644 --- a/crates/test-files/fixtures/stress/external_calls.fe +++ b/crates/test-files/fixtures/stress/external_calls.fe @@ -1,97 +1,119 @@ use std::context::Context -struct SomeError: +struct SomeError { pub code: u256 +} -contract Foo: +contract Foo { my_tuple: (u256, address) my_string: String<100> - pub fn get_my_string(self) -> String<100>: + pub fn get_my_string(self) -> String<100> { return self.my_string.to_mem() + } - pub fn set_my_string(self, some_string: String<100>): + pub fn set_my_string(self, some_string: String<100>) { self.my_string = some_string + } - pub fn get_my_tuple(self) -> (u256, address): + pub fn get_my_tuple(self) -> (u256, address) { return self.my_tuple.to_mem() + } - pub fn set_my_tuple(self, some_tuple: (u256, address)): + pub fn set_my_tuple(self, some_tuple: (u256, address)) { self.my_tuple = some_tuple + } - pub fn set_my_string_and_tuple(self, some_string: String<100>, some_tuple: (u256, address)): + pub fn set_my_string_and_tuple(self, some_string: String<100>, some_tuple: (u256, address)) { self.my_string = some_string self.my_tuple = some_tuple + } - pub fn get_string() -> String<10>: + pub fn get_string() -> String<10> { return String<10>("hi") + } - pub fn get_array() -> Array: + pub fn get_array() -> Array { return [u16(1), u16(2), u16(3), u16(257)] + } - pub fn get_tuple() -> (u256, u256, bool): + pub fn get_tuple() -> (u256, u256, bool) { return (42, 26, false) + } - pub fn do_revert(): + pub fn do_revert() { revert + } - # Having the return type exercises a different path in the compiler - pub fn do_revert2() -> bool: + pub fn do_revert2() -> bool { revert + } - pub fn do_revert_with_data(): + pub fn do_revert_with_data() { revert SomeError(code: 4711) + } - # Having the return type exercises a different path in the compiler - pub fn do_revert_with_data2() -> bool: + pub fn do_revert_with_data2() -> bool { revert SomeError(code: 4711) + } +} -contract FooProxy: +contract FooProxy { foo: Foo - pub fn __init__(self, ctx: Context, foo_addr: address): + pub fn __init__(self, ctx: Context, foo_addr: address) { self.foo = Foo(ctx, foo_addr) + } - pub fn call_set_my_string(self, some_string: String<100>): + pub fn call_set_my_string(self, some_string: String<100>) { self.foo.set_my_string(some_string) + } - pub fn call_get_my_string(self) -> String<100>: + pub fn call_get_my_string(self) -> String<100> { return self.foo.get_my_string() + } - pub fn call_set_my_tuple(self, some_tuple: (u256, address)): + pub fn call_set_my_tuple(self, some_tuple: (u256, address)) { self.foo.set_my_tuple(some_tuple) + } - pub fn call_get_my_tuple(self) -> (u256, address): + pub fn call_get_my_tuple(self) -> (u256, address) { return self.foo.get_my_tuple() + } - pub fn call_set_my_string_and_tuple( - self, - some_string: String<100>, - some_tuple: (u256, address) - ): + pub fn call_set_my_string_and_tuple(self, some_string: String<100>, some_tuple: (u256, address)) { self.foo.set_my_string_and_tuple(some_string, some_tuple) + } - pub fn call_get_string(self) -> String<10>: + pub fn call_get_string(self) -> String<10> { return self.foo.get_string() + } - pub fn call_get_tuple(self) -> (u256, u256, bool): + pub fn call_get_tuple(self) -> (u256, u256, bool) { return self.foo.get_tuple() + } - pub fn call_get_array(self): + pub fn call_get_array(self) { let my_array: Array = self.foo.get_array() assert my_array[0] == u16(1) assert my_array[1] == u16(2) assert my_array[2] == u16(3) assert my_array[3] == u16(257) + } - pub fn call_do_revert(self): + pub fn call_do_revert(self) { self.foo.do_revert() + } - pub fn call_do_revert2(self): + pub fn call_do_revert2(self) { self.foo.do_revert2() + } - pub fn call_do_revert_with_data(self): + pub fn call_do_revert_with_data(self) { self.foo.do_revert_with_data() + } - pub fn call_do_revert_with_data2(self): + pub fn call_do_revert_with_data2(self) { self.foo.do_revert_with_data2() + } +} diff --git a/crates/test-files/fixtures/stress/tuple_stress.fe b/crates/test-files/fixtures/stress/tuple_stress.fe index 995161ecdd..3958f33343 100644 --- a/crates/test-files/fixtures/stress/tuple_stress.fe +++ b/crates/test-files/fixtures/stress/tuple_stress.fe @@ -1,48 +1,52 @@ use std::context::Context -contract Foo: +contract Foo { my_sto_tuple: (u256, i32) - event MyEvent: + event MyEvent { my_tuple: (u256, bool, address) + } - pub fn build_my_tuple( - my_num: u256, - my_bool: bool, - my_address: address - ) -> (u256, bool, address): + pub fn build_my_tuple(my_num: u256, my_bool: bool, my_address: address) -> (u256, bool, address) { return (my_num, my_bool, my_address) + } - pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256: + pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256 { return my_tuple.item0 + } - pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool: + pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool { return my_tuple.item1 + } - pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address: + pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address { return my_tuple.item2 + } - pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address: + pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address { return my_tuple.item10 + } - pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)): + pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)) { emit MyEvent(ctx, my_tuple) + } - pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32): + pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32) { assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) self.my_sto_tuple = (my_u256, my_i32) + } - pub fn get_my_sto_tuple(self) -> (u256, i32): + pub fn get_my_sto_tuple(self) -> (u256, i32) { return self.my_sto_tuple.to_mem() + } - pub fn build_tuple_and_emit(self, ctx: Context): + pub fn build_tuple_and_emit(self, ctx: Context) { let my_num: u256 = self.my_sto_tuple.item0 - let my_tuple: (u256, bool, address) = ( - self.my_sto_tuple.item0, - true and false, - address(26) - ) + let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) emit_my_event(ctx, my_tuple) + } - pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array: - return my_tuple.abi_encode() \ No newline at end of file + pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array { + return my_tuple.abi_encode() + } +}