From 7cc8015ba5b7a2a7da12c343b48dc5577766c43f Mon Sep 17 00:00:00 2001 From: Sean Billig Date: Sun, 21 Aug 2022 14:23:38 -0700 Subject: [PATCH] Basic `mut` enforcement, remove .clone() function --- crates/analyzer/src/builtins.rs | 1 - crates/analyzer/src/db/queries/functions.rs | 17 +- crates/analyzer/src/namespace/types.rs | 37 +- crates/analyzer/src/operations.rs | 2 + crates/analyzer/src/traversal/assignments.rs | 108 +- crates/analyzer/src/traversal/call_args.rs | 3 + crates/analyzer/src/traversal/declarations.rs | 118 +- crates/analyzer/src/traversal/expressions.rs | 202 +- crates/analyzer/src/traversal/functions.rs | 14 +- crates/analyzer/src/traversal/types.rs | 17 +- crates/analyzer/tests/errors.rs | 10 +- .../analysis__abi_decode_complex.snap | 12 +- .../analysis__abi_encoding_stress.snap | 90 +- .../analysis__address_bytes10_map.snap | 12 +- .../tests/snapshots/analysis__assert.snap | 30 +- .../snapshots/analysis__associated_fns.snap | 18 +- .../tests/snapshots/analysis__aug_assign.snap | 142 +- .../tests/snapshots/analysis__balances.snap | 4 +- .../tests/snapshots/analysis__base_tuple.snap | 2 +- .../snapshots/analysis__basic_ingot.snap | 30 +- .../analysis__call_statement_with_args.snap | 22 +- .../analysis__call_statement_with_args_2.snap | 22 +- ...analysis__call_statement_without_args.snap | 22 +- .../analysis__checked_arithmetic.snap | 144 +- .../snapshots/analysis__const_generics.snap | 2 +- .../snapshots/analysis__const_local.snap | 2 +- .../snapshots/analysis__constructor.snap | 2 +- .../snapshots/analysis__create2_contract.snap | 8 +- .../snapshots/analysis__create_contract.snap | 8 +- .../analysis__create_contract_from_init.snap | 4 +- .../analysis__data_copying_stress.snap | 510 ++-- .../snapshots/analysis__erc20_token.snap | 212 +- .../tests/snapshots/analysis__events.snap | 48 +- .../analysis__external_contract.snap | 50 +- .../analysis__for_loop_with_break.snap | 56 +- .../analysis__for_loop_with_continue.snap | 62 +- .../analysis__for_loop_with_static_array.snap | 54 +- .../tests/snapshots/analysis__guest_book.snap | 12 +- .../snapshots/analysis__if_statement.snap | 2 +- .../snapshots/analysis__if_statement_2.snap | 2 +- ...__if_statement_with_block_declaration.snap | 2 +- .../tests/snapshots/analysis__keccak.snap | 6 +- .../tests/snapshots/analysis__math.snap | 60 +- .../snapshots/analysis__module_const.snap | 2 +- .../analysis__module_level_events.snap | 2 +- .../snapshots/analysis__multi_param.snap | 40 +- .../tests/snapshots/analysis__nested_map.snap | 28 +- .../snapshots/analysis__numeric_sizes.snap | 96 +- .../tests/snapshots/analysis__ownable.snap | 38 +- .../analysis__pure_fn_standalone.snap | 44 +- .../analysis__return_addition_i256.snap | 2 +- .../analysis__return_addition_u128.snap | 2 +- .../analysis__return_addition_u256.snap | 2 +- .../snapshots/analysis__return_array.snap | 32 +- .../analysis__return_bitwiseand_u128.snap | 2 +- .../analysis__return_bitwiseand_u256.snap | 2 +- .../analysis__return_bitwiseor_u256.snap | 2 +- .../analysis__return_bitwiseshl_u256.snap | 2 +- .../analysis__return_bitwiseshr_i256.snap | 2 +- .../analysis__return_bitwiseshr_u256.snap | 2 +- .../analysis__return_bitwisexor_u256.snap | 2 +- .../analysis__return_bool_false.snap | 2 +- .../analysis__return_bool_inverted.snap | 2 +- .../analysis__return_bool_op_and.snap | 2 +- .../analysis__return_bool_op_or.snap | 2 +- .../snapshots/analysis__return_bool_true.snap | 2 +- .../analysis__return_builtin_attributes.snap | 20 +- .../analysis__return_complex_struct.snap | 8 +- .../analysis__return_division_i256.snap | 2 +- .../analysis__return_division_u256.snap | 2 +- .../analysis__return_empty_tuple.snap | 12 +- .../snapshots/analysis__return_eq_u256.snap | 2 +- .../snapshots/analysis__return_gt_i256.snap | 2 +- .../snapshots/analysis__return_gt_u256.snap | 2 +- .../snapshots/analysis__return_gte_i256.snap | 2 +- .../snapshots/analysis__return_gte_u256.snap | 2 +- .../snapshots/analysis__return_i128_cast.snap | 2 +- .../snapshots/analysis__return_i256.snap | 2 +- .../analysis__return_identity_u128.snap | 2 +- .../analysis__return_identity_u16.snap | 2 +- .../analysis__return_identity_u256.snap | 2 +- .../analysis__return_identity_u32.snap | 2 +- .../analysis__return_identity_u64.snap | 2 +- .../analysis__return_identity_u8.snap | 2 +- .../snapshots/analysis__return_lt_i256.snap | 2 +- .../snapshots/analysis__return_lt_u128.snap | 2 +- .../snapshots/analysis__return_lt_u256.snap | 2 +- .../snapshots/analysis__return_lte_i256.snap | 2 +- .../snapshots/analysis__return_lte_u256.snap | 2 +- .../snapshots/analysis__return_mod_i256.snap | 2 +- .../snapshots/analysis__return_mod_u256.snap | 2 +- .../snapshots/analysis__return_msg_sig.snap | 2 +- .../analysis__return_multiplication_i256.snap | 2 +- .../analysis__return_multiplication_u256.snap | 2 +- .../analysis__return_noteq_u256.snap | 2 +- .../snapshots/analysis__return_pow_i256.snap | 2 +- .../snapshots/analysis__return_pow_u256.snap | 2 +- .../analysis__return_subtraction_i256.snap | 2 +- .../analysis__return_subtraction_u256.snap | 2 +- .../snapshots/analysis__return_u128_cast.snap | 2 +- .../snapshots/analysis__return_u256.snap | 2 +- .../analysis__return_u256_from_called_fn.snap | 4 +- ..._return_u256_from_called_fn_with_args.snap | 20 +- .../tests/snapshots/analysis__revert.snap | 22 +- .../snapshots/analysis__self_address.snap | 2 +- .../tests/snapshots/analysis__send_value.snap | 6 +- .../analysis__simple_open_auction.snap | 110 +- .../analysis__sized_vals_in_sto.snap | 36 +- .../tests/snapshots/analysis__strings.snap | 10 +- .../tests/snapshots/analysis__struct_fns.snap | 120 +- .../tests/snapshots/analysis__structs.snap | 732 +++--- .../analysis__ternary_expression.snap | 2 +- .../snapshots/analysis__tuple_stress.snap | 46 +- .../snapshots/analysis__two_contracts.snap | 24 +- .../snapshots/analysis__type_aliases.snap | 200 +- .../snapshots/analysis__type_coercion.snap | 4 +- .../snapshots/analysis__u128_u128_map.snap | 12 +- .../snapshots/analysis__u16_u16_map.snap | 12 +- .../snapshots/analysis__u256_u256_map.snap | 12 +- .../snapshots/analysis__u32_u32_map.snap | 12 +- .../snapshots/analysis__u64_u64_map.snap | 12 +- .../tests/snapshots/analysis__u8_u8_map.snap | 12 +- .../tests/snapshots/analysis__uniswap.snap | 2062 ++++++++--------- .../tests/snapshots/analysis__while_loop.snap | 28 +- .../analysis__while_loop_with_break.snap | 24 +- .../analysis__while_loop_with_break_2.snap | 26 +- .../analysis__while_loop_with_continue.snap | 40 +- ..._call_non_pub_fn_on_external_contract.snap | 2 +- .../snapshots/errors__clone_arg_count.snap | 6 +- .../tests/snapshots/errors__const_assign.snap | 2 +- ...rs__ctx_builtins_param_incorrect_type.snap | 2 +- .../snapshots/errors__ctx_missing_create.snap | 2 +- .../errors__ctx_undefined_create.snap | 2 +- .../errors__ctx_undefined_create2.snap | 2 +- .../errors__duplicate_var_in_child_scope.snap | 10 +- .../snapshots/errors__missing_return.snap | 6 +- crates/mir/src/lower/function.rs | 6 +- .../compile_errors/bad_visibility/src/main.fe | 2 +- .../call_create2_with_wrong_type.fe | 2 +- .../call_create_with_wrong_type.fe | 2 +- .../call_event_with_wrong_types.fe | 2 +- .../call_non_pub_fn_on_external_contract.fe | 2 +- .../circular_dependency_create.fe | 2 +- .../circular_dependency_create2.fe | 2 +- .../compile_errors/ctx_missing_create.fe | 3 + .../ctx_missing_internal_call.fe | 2 +- .../compile_errors/ctx_missing_load.fe | 9 - .../duplicate_var_in_child_scope.fe | 4 +- .../duplicate_var_in_for_loop.fe | 2 +- .../fixtures/compile_errors/missing_return.fe | 2 +- .../fixtures/compile_errors/needs_mem_copy.fe | 2 +- .../fixtures/compile_errors/not_in_scope_2.fe | 2 +- .../fixtures/compile_errors/self_misuse.fe | 6 +- .../test-files/fixtures/demos/erc20_token.fe | 22 +- .../test-files/fixtures/demos/guest_book.fe | 2 +- .../fixtures/demos/simple_open_auction.fe | 8 +- crates/test-files/fixtures/demos/uniswap.fe | 49 +- .../fixtures/features/address_bytes10_map.fe | 2 +- .../fixtures/features/array_repeat.fe | 4 +- crates/test-files/fixtures/features/assert.fe | 4 +- .../fixtures/features/associated_fns.fe | 2 +- .../fixtures/features/aug_assign.fe | 26 +- .../features/call_statement_with_args.fe | 4 +- .../features/call_statement_with_args_2.fe | 4 +- .../features/call_statement_without_args.fe | 4 +- .../fixtures/features/constructor.fe | 2 +- .../fixtures/features/create2_contract.fe | 2 +- .../fixtures/features/create_contract.fe | 2 +- .../features/create_contract_from_init.fe | 2 +- .../features/ctx_param_external_func_call.fe | 4 +- .../features/ctx_param_internal_func_call.fe | 2 +- crates/test-files/fixtures/features/events.fe | 2 +- .../fixtures/features/external_contract.fe | 2 +- .../fixtures/features/for_loop_with_break.fe | 4 +- .../for_loop_with_complex_elem_array.fe | 6 +- .../features/for_loop_with_continue.fe | 4 +- .../features/for_loop_with_static_array.fe | 4 +- .../for_loop_with_static_array_from_sto.fe | 4 +- .../features/if_statement_test_from_sto.fe | 2 +- .../fixtures/features/int_literal_coercion.fe | 2 +- .../test-files/fixtures/features/map_tuple.fe | 2 +- crates/test-files/fixtures/features/math.fe | 4 +- .../fixtures/features/multi_param.fe | 2 +- .../fixtures/features/nested_map.fe | 4 +- .../test-files/fixtures/features/ownable.fe | 6 +- .../fixtures/features/pure_fn_standalone.fe | 4 +- .../fixtures/features/return_array.fe | 2 +- .../features/return_from_storage_array_i8.fe | 2 +- .../features/return_from_storage_i8.fe | 2 +- .../features/return_sum_list_expression_1.fe | 4 +- .../features/return_sum_list_expression_2.fe | 2 +- .../return_u256_from_called_fn_with_args.fe | 2 +- crates/test-files/fixtures/features/revert.fe | 4 +- .../fixtures/features/send_value.fe | 2 +- .../fixtures/features/simple_traits.fe | 2 +- .../fixtures/features/sized_vals_in_sto.fe | 8 +- .../test-files/fixtures/features/strings.fe | 2 +- .../fixtures/features/struct_fns.fe | 10 +- .../test-files/fixtures/features/structs.fe | 14 +- .../fixtures/features/two_contracts.fe | 6 +- .../fixtures/features/type_aliases.fe | 10 +- .../fixtures/features/u128_u128_map.fe | 2 +- .../fixtures/features/u16_u16_map.fe | 2 +- .../fixtures/features/u256_u256_map.fe | 2 +- .../fixtures/features/u32_u32_map.fe | 2 +- .../fixtures/features/u64_u64_map.fe | 2 +- .../test-files/fixtures/features/u8_u8_map.fe | 2 +- .../fixtures/features/while_loop.fe | 2 +- .../features/while_loop_test_from_sto.fe | 2 +- .../features/while_loop_with_break.fe | 2 +- .../features/while_loop_with_break_2.fe | 2 +- .../features/while_loop_with_continue.fe | 4 +- .../fixtures/ingots/basic_ingot/src/main.fe | 2 +- .../ingots/pub_contract_ingot/src/main.fe | 2 +- .../fixtures/stress/abi_encoding_stress.fe | 16 +- .../fixtures/stress/data_copying_stress.fe | 27 +- .../fixtures/stress/external_calls.fe | 8 +- .../fixtures/stress/tuple_stress.fe | 6 +- docs/src/quickstart/deploy_contract.md | 2 +- docs/src/quickstart/first_contract.md | 6 +- .../spec/data_layout/memory/clone_function.md | 4 +- docs/src/spec/expressions/indexing.md | 3 +- docs/src/spec/items/contracts.md | 2 +- docs/src/spec/items/events.md | 3 +- docs/src/spec/items/functions.md | 4 +- docs/src/spec/statements/assign.md | 5 +- docs/src/spec/statements/augassign.md | 22 +- docs/src/spec/statements/break.md | 4 +- docs/src/spec/statements/continue.md | 4 +- docs/src/spec/statements/emit.md | 2 +- docs/src/spec/statements/for.md | 2 +- docs/src/spec/statements/while.md | 2 +- docs/src/spec/type_system/types/contract.md | 2 +- docs/src/spec/type_system/types/map.md | 4 +- 234 files changed, 3366 insertions(+), 3332 deletions(-) delete mode 100644 crates/test-files/fixtures/compile_errors/ctx_missing_load.fe diff --git a/crates/analyzer/src/builtins.rs b/crates/analyzer/src/builtins.rs index 50ba800840..ef6e86b876 100644 --- a/crates/analyzer/src/builtins.rs +++ b/crates/analyzer/src/builtins.rs @@ -4,7 +4,6 @@ use strum::{AsRefStr, EnumIter, EnumString}; #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, EnumString, AsRefStr)] #[strum(serialize_all = "snake_case")] pub enum ValueMethod { - Clone, ToMem, AbiEncode, } diff --git a/crates/analyzer/src/db/queries/functions.rs b/crates/analyzer/src/db/queries/functions.rs index 1276af6c46..8a268a9624 100644 --- a/crates/analyzer/src/db/queries/functions.rs +++ b/crates/analyzer/src/db/queries/functions.rs @@ -85,7 +85,7 @@ pub fn function_signature( .iter() .enumerate() .filter_map(|(index, arg)| match &arg.kind { - ast::FunctionArg::Self_ { .. }=> { + ast::FunctionArg::Self_ { mut_ }=> { if matches!(fn_parent, Item::Module(_)) { scope.error( "`self` can only be used in contract, struct, trait or impl functions", @@ -93,7 +93,7 @@ pub fn function_signature( "not allowed in functions defined directly in a module", ); } else { - self_decl = Some(SelfDecl::Mutable); + self_decl = Some(SelfDecl { span: arg.span, mut_: mut_.clone() }); if index != 0 { scope.error( "`self` is not the first parameter", @@ -104,9 +104,15 @@ pub fn function_signature( } None } - ast::FunctionArg::Regular { mut_: _, label, name, typ: typedesc } => { + ast::FunctionArg::Regular { mut_, label, name, typ: typedesc } => { let typ = resolve_function_param_type(db, function, &mut scope, &typedesc).and_then(|typ| match typ { - typ if typ.has_fixed_size(db) => Ok(typ), + typ if typ.has_fixed_size(db) => { + if mut_.is_some() { + Ok(Type::Mut(typ).id(db)) + } else { + Ok(typ) + } + } _ => Err(TypeError::new(scope.error( "function parameter types must have fixed size", typedesc.span, @@ -177,6 +183,7 @@ pub fn function_signature( None } else { names.insert(&name.kind, index); + Some(types::FunctionParam::new( label.as_ref().map(|s| s.kind.as_str()), &name.kind, @@ -229,7 +236,7 @@ pub fn function_signature( } } -pub fn resolve_function_param_type( +fn resolve_function_param_type( db: &dyn AnalyzerDb, function: FunctionSigId, context: &mut dyn AnalyzerContext, diff --git a/crates/analyzer/src/namespace/types.rs b/crates/analyzer/src/namespace/types.rs index a545bd4c7d..c128166d26 100644 --- a/crates/analyzer/src/namespace/types.rs +++ b/crates/analyzer/src/namespace/types.rs @@ -83,6 +83,7 @@ impl TypeId { pub fn deref(self, db: &dyn AnalyzerDb) -> TypeId { match self.typ(db) { Type::SPtr(inner) => inner, + Type::Mut(inner) => inner.deref(db), _ => self, } } @@ -115,7 +116,18 @@ impl TypeId { matches!(self.typ(db), Type::Struct(_)) } pub fn is_sptr(&self, db: &dyn AnalyzerDb) -> bool { - matches!(self.typ(db), Type::SPtr(_)) + match self.typ(db) { + Type::SPtr(_) => true, + Type::Mut(inner) => inner.is_sptr(db), + _ => false, + } + } + pub fn is_generic(&self, db: &dyn AnalyzerDb) -> bool { + matches!(self.deref(db).typ(db), Type::Generic(_)) + } + + pub fn is_mut(&self, db: &dyn AnalyzerDb) -> bool { + matches!(self.typ(db), Type::Mut(_)) } pub fn name(&self, db: &dyn AnalyzerDb) -> SmolStr { @@ -245,9 +257,15 @@ pub struct FunctionSignature { pub return_type: Result, } -#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] -pub enum SelfDecl { - Mutable, +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +pub struct SelfDecl { + pub span: Span, + pub mut_: Option, +} +impl SelfDecl { + pub fn is_mut(&self) -> bool { + self.mut_.is_some() + } } #[derive(Clone, Debug, PartialEq, Eq, Hash)] @@ -669,9 +687,18 @@ impl DisplayWithDb for FunctionSignature { return_type, } = self; - write!(f, "self: {:?}, ", self_decl)?; write!(f, "params: [")?; let mut delim = ""; + if let Some(s) = self_decl { + write!( + f, + "{}{}", + if s.mut_.is_some() { "mut " } else { "" }, + "self" + )?; + delim = ", "; + } + for p in params { write!( f, diff --git a/crates/analyzer/src/operations.rs b/crates/analyzer/src/operations.rs index 65d83cfa57..a918098b6d 100644 --- a/crates/analyzer/src/operations.rs +++ b/crates/analyzer/src/operations.rs @@ -1,6 +1,7 @@ use crate::context::AnalyzerContext; use crate::errors::{BinaryOperationError, IndexingError}; use crate::namespace::types::{Array, Integer, Map, Type, TypeDowncast, TypeId}; + use crate::traversal::types::{deref_type, try_coerce_type}; use fe_parser::{ast as fe, node::Node}; @@ -53,6 +54,7 @@ fn index_map( index_expr: &Node, ) -> Result { let Map { key, value } = map; + if try_coerce_type(context, Some(index_expr), index, *key).is_err() { return Err(IndexingError::WrongIndexType); } diff --git a/crates/analyzer/src/traversal/assignments.rs b/crates/analyzer/src/traversal/assignments.rs index ac8cdcde03..2177e7fb95 100644 --- a/crates/analyzer/src/traversal/assignments.rs +++ b/crates/analyzer/src/traversal/assignments.rs @@ -2,12 +2,14 @@ use crate::context::{AnalyzerContext, NamedThing}; use crate::display::Displayable; use crate::errors::{self, FatalError, TypeCoercionError}; use crate::namespace::scopes::BlockScope; +use crate::namespace::types::{Type, TypeId}; use crate::operations; use crate::traversal::utils::add_bin_operations_errors; use crate::traversal::{expressions, types::try_coerce_type}; use fe_common::diagnostics::Label; use fe_parser::ast as fe; -use fe_parser::node::Node; +use fe_parser::node::{Node, Span}; +use smol_str::SmolStr; /// Gather context information for assignments and check for type errors. /// @@ -17,18 +19,13 @@ pub fn assign(scope: &mut BlockScope, stmt: &Node) -> Result<(), F fe::FuncStmt::Assign { target, value } => (target, value), _ => unreachable!(), }; - let target_attributes = expressions::expr(scope, target, None)?; - let expected_type = target_attributes.typ.deref(scope.db()); - let value_attributes = expressions::expr(scope, value, Some(expected_type))?; check_assign_target(scope, target)?; + let target_type = assign_target_type(scope, target)?; + let expected_type = target_type.deref(scope.db()); + let value_attributes = expressions::expr(scope, value, Some(expected_type))?; - match try_coerce_type( - scope, - Some(value), - value_attributes.typ, - target_attributes.typ, - ) { + match try_coerce_type(scope, Some(value), value_attributes.typ, target_type) { Err(TypeCoercionError::RequiresToMem) => { scope.add_diagnostic(errors::to_mem_error(value.span)); } @@ -40,7 +37,7 @@ pub fn assign(scope: &mut BlockScope, stmt: &Node) -> Result<(), F target.span, format!( "this variable has type `{}`", - target_attributes.typ.display(scope.db()) + target_type.display(scope.db()) ), ), Label::secondary( @@ -57,7 +54,7 @@ pub fn assign(scope: &mut BlockScope, stmt: &Node) -> Result<(), F Err(TypeCoercionError::SelfContractType) => { scope.add_diagnostic(errors::self_contract_type_error( value.span, - &target_attributes.typ.display(scope.db()), + &target_type.display(scope.db()), )); } Ok(_) => {} @@ -65,6 +62,44 @@ pub fn assign(scope: &mut BlockScope, stmt: &Node) -> Result<(), F Ok(()) } +fn assign_target_type( + scope: &mut BlockScope, + target: &Node, +) -> Result { + let attr = expressions::expr(scope, target, None)?; + match attr.typ.typ(scope.db()) { + Type::Mut(inner) => Ok(inner), + _ => { + let mut labels = vec![Label::primary(target.span, "not mutable")]; + if let Some((name, span)) = name_def_span(scope, target) { + labels.push(Label::secondary( + span, + &format!("consider changing this to be mutable: `mut {}`", name), + )); + } + scope.fancy_error( + &format!("cannot modify `{}`, as it is not mutable", &target.kind), + labels, + vec![], + ); + Ok(attr.typ) + } + } +} + +fn name_def_span(scope: &BlockScope, expr: &Node) -> Option<(SmolStr, Span)> { + match &expr.kind { + fe::Expr::Attribute { value, .. } | fe::Expr::Subscript { value, .. } => { + name_def_span(scope, value) + } + fe::Expr::Name(name) => { + let thing = scope.resolve_name(name, expr.span).ok()??; + thing.name_span(scope.db()).map(|span| (name.clone(), span)) + } + _ => None, + } +} + fn check_assign_target(scope: &mut BlockScope, expr: &Node) -> Result<(), FatalError> { use fe::Expr::*; @@ -82,7 +117,7 @@ fn check_assign_target(scope: &mut BlockScope, expr: &Node) -> Result< Some(NamedThing::Item(_)) | None => Err(invalid_assign_target(scope, expr)), Some(NamedThing::Variable { is_const, .. }) => { if is_const { - Err(FatalError::new(scope.fancy_error("cannot assign to constant variable", + Err(FatalError::new(scope.fancy_error("cannot assign to a constant value", vec![Label::primary(expr.span, "")], vec!["The left side of an assignment can be a variable name, attribute, subscript, or tuple.".into()]))) } else { @@ -96,38 +131,35 @@ fn check_assign_target(scope: &mut BlockScope, expr: &Node) -> Result< } fn invalid_assign_target(scope: &mut BlockScope, expr: &Node) -> FatalError { - FatalError::new(scope.fancy_error("invalid assignment target", - vec![Label::primary(expr.span, "")], - vec!["The left side of an assignment can be a variable name, attribute, subscript, or tuple.".into()])) + FatalError::new(scope.fancy_error( + "invalid assignment target", + vec![Label::primary(expr.span, "")], + vec!["The left side of an assignment can be a variable name, attribute, subscript, or tuple.".into()] + )) } /// Gather context information for assignments and check for type errors. pub fn aug_assign(scope: &mut BlockScope, stmt: &Node) -> Result<(), FatalError> { - if let fe::FuncStmt::AugAssign { target, op, value } = &stmt.kind { - check_assign_target(scope, target)?; - let target_attr = expressions::expr(scope, target, None)?; - let value_attr = expressions::expr(scope, value, Some(target_attr.typ))?; + let (target, op, value) = match &stmt.kind { + fe::FuncStmt::AugAssign { target, op, value } => (target, op, value), + _ => unreachable!(), + }; - if let Err(err) = operations::bin( + check_assign_target(scope, target)?; + let target_ty = assign_target_type(scope, target)?; // XXX check this + let value_attr = expressions::expr(scope, value, Some(target_ty))?; + + if let Err(err) = operations::bin(scope, target_ty, target, op.kind, value_attr.typ, value) { + add_bin_operations_errors( scope, - target_attr.typ, - target, - op.kind, + &op.kind, + target.span, + target_ty, + value.span, value_attr.typ, - value, - ) { - add_bin_operations_errors( - scope, - &op.kind, - target.span, - target_attr.typ, - value.span, - value_attr.typ, - err, - ); - } - return Ok(()); + err, + ); } - unreachable!() + Ok(()) } diff --git a/crates/analyzer/src/traversal/call_args.rs b/crates/analyzer/src/traversal/call_args.rs index ca80dab7c2..c7faeb0d7f 100644 --- a/crates/analyzer/src/traversal/call_args.rs +++ b/crates/analyzer/src/traversal/call_args.rs @@ -199,6 +199,9 @@ pub fn validate_named_args( Ok(_) => {} } } + if param_type.is_mut(context.db()) && !arg_type.is_mut(context.db()) { + context.error("XXX need mut", arg.span, "make this `mut`"); + } } Ok(()) } diff --git a/crates/analyzer/src/traversal/declarations.rs b/crates/analyzer/src/traversal/declarations.rs index a9bc3f6d03..e5f56b5925 100644 --- a/crates/analyzer/src/traversal/declarations.rs +++ b/crates/analyzer/src/traversal/declarations.rs @@ -10,70 +10,74 @@ use fe_parser::node::Node; /// Gather context information for var declarations and check for type errors. pub fn var_decl(scope: &mut BlockScope, stmt: &Node) -> Result<(), FatalError> { - if let fe::FuncStmt::VarDecl { - target, - typ, - value, - mut_: _, - } = &stmt.kind - { - let declared_type = types::type_desc(scope, typ)?; - if let Type::Map(_) = declared_type.typ(scope.db()) { - return Err(FatalError::new(scope.error( - "invalid variable type", - typ.span, - "`Map` type can only be used as a contract field", - ))); - } + let (target, typ, value, mut_) = match &stmt.kind { + fe::FuncStmt::VarDecl { + target, + typ, + value, + mut_, + } => (target, typ, value, mut_), + _ => unreachable!(), + }; - if let Some(value) = value { - let value_attributes = expressions::expr(scope, value, Some(declared_type))?; + let declared_type = types::type_desc(scope, typ)?; + if let Type::Map(_) = declared_type.typ(scope.db()) { + return Err(FatalError::new(scope.error( + "invalid variable type", + typ.span, + "`Map` type can only be used as a contract field", + ))); + } - match types::try_coerce_type(scope, Some(value), value_attributes.typ, declared_type) { - Err(TypeCoercionError::RequiresToMem) => { - scope.add_diagnostic(errors::to_mem_error(value.span)); - } - Err(TypeCoercionError::Incompatible) => { - scope.type_error( - "type mismatch", - value.span, - declared_type, - value_attributes.typ, - ); - } - Err(TypeCoercionError::SelfContractType) => { - scope.add_diagnostic(errors::self_contract_type_error( - value.span, - &declared_type.display(scope.db()), - )); - } - Ok(_) => {} + if let Some(value) = value { + let value_attributes = expressions::expr(scope, value, Some(declared_type))?; + + match types::try_coerce_type(scope, Some(value), value_attributes.typ, declared_type) { + Err(TypeCoercionError::RequiresToMem) => { + scope.add_diagnostic(errors::to_mem_error(value.span)); } - } else if matches!(declared_type.typ(scope.db()), Type::Array(_)) { - scope.error( - "uninitialized variable", - target.span, - "array types must be initialized at declaration site", - ); - } else if matches!(declared_type.typ(scope.db()), Type::Struct(_)) { - scope.error( - "uninitialized variable", - target.span, - "struct types must be initialized at declaration site", - ); - } else if matches!(declared_type.typ(scope.db()), Type::Tuple(_)) { - scope.error( - "uninitialized variable", - target.span, - "tuple types must be initialized at declaration site", - ); + Err(TypeCoercionError::Incompatible) => { + scope.type_error( + "type mismatch", + value.span, + declared_type, + value_attributes.typ, + ); + } + Err(TypeCoercionError::SelfContractType) => { + scope.add_diagnostic(errors::self_contract_type_error( + value.span, + &declared_type.display(scope.db()), + )); + } + Ok(_) => {} } + } else if matches!(declared_type.typ(scope.db()), Type::Array(_)) { + scope.error( + "uninitialized variable", + target.span, + "array types must be initialized at declaration site", + ); + } else if matches!(declared_type.typ(scope.db()), Type::Struct(_)) { + scope.error( + "uninitialized variable", + target.span, + "struct types must be initialized at declaration site", + ); + } else if matches!(declared_type.typ(scope.db()), Type::Tuple(_)) { + scope.error( + "uninitialized variable", + target.span, + "tuple types must be initialized at declaration site", + ); + } + if mut_.is_some() { + add_var(scope, target, Type::Mut(declared_type).id(scope.db()))?; + } else { add_var(scope, target, declared_type)?; - return Ok(()); } - - unreachable!() + Ok(()) } pub fn const_decl(scope: &mut BlockScope, stmt: &Node) -> Result<(), FatalError> { diff --git a/crates/analyzer/src/traversal/expressions.rs b/crates/analyzer/src/traversal/expressions.rs index e8e8dcdc6a..5e771b99b8 100644 --- a/crates/analyzer/src/traversal/expressions.rs +++ b/crates/analyzer/src/traversal/expressions.rs @@ -92,6 +92,7 @@ pub fn expr_list( let inner_type = if let Some(inner) = expected_inner { for elt in elts { let element_attributes = expr(context, elt, Some(inner))?; + match try_coerce_type(context, Some(elt), element_attributes.typ, inner) { Err(TypeCoercionError::RequiresToMem) => { context.add_diagnostic(errors::to_mem_error(elt.span)); @@ -116,6 +117,7 @@ pub fn expr_list( // of list. for elt in &elts[1..] { let element_attributes = expr(context, elt, Some(first_attr.typ))?; + match try_coerce_type(context, Some(elt), element_attributes.typ, first_attr.typ) { Err(TypeCoercionError::RequiresToMem) => { context.add_diagnostic(errors::to_mem_error(elt.span)); @@ -319,34 +321,37 @@ fn expr_named_thing( }, ); } - match target { - Item::Type(TypeDef::Struct(id)) => Ok(ExpressionAttributes::new( - context.db().intern_type(Type::Struct(id)), - )), - Item::Impl(id) => Ok(ExpressionAttributes::new(id.receiver(context.db()))), + let mut self_typ = match target { + Item::Type(TypeDef::Struct(s)) => Type::Struct(s).id(context.db()), + Item::Impl(id) => id.receiver(context.db()), // This can only happen when trait methods can implement a default body - Item::Trait(id) => Err(FatalError::new(context.fancy_error( - &format!( - "`{}` is a trait, and can't be used as an expression", - exp.kind - ), - vec![ - Label::primary( - id.name_span(context.db()), - &format!("`{}` is defined here as a trait", exp.kind), - ), - Label::primary( - exp.span, - &format!("`{}` is used here as a value", exp.kind), + Item::Trait(id) => { + return Err(FatalError::new(context.fancy_error( + &format!( + "`{}` is a trait, and can't be used as an expression", + exp.kind ), - ], - vec![], - ))), - Item::Type(TypeDef::Contract(id)) => Ok(ExpressionAttributes::new( - context.db().intern_type(Type::SelfContract(id)), - )), + vec![ + Label::primary( + id.name_span(context.db()), + &format!("`{}` is defined here as a trait", exp.kind), + ), + Label::primary( + exp.span, + &format!("`{}` is used here as a value", exp.kind), + ), + ], + vec![], + ))); + } + Item::Type(TypeDef::Contract(c)) => Type::SelfContract(c).id(context.db()), _ => unreachable!(), + }; + // If there's no `self` param, let it be mut. + if decl.map(|d| d.mut_.is_some()).unwrap_or(true) { + self_typ = Type::Mut(self_typ).id(context.db()); } + Ok(ExpressionAttributes::new(self_typ)) } else { Err(FatalError::new(context.fancy_error( "`self` can only be used in contract, struct, trait or impl functions", @@ -576,6 +581,9 @@ fn field_type( field_span: Span, ) -> Result { match obj.typ(context.db()) { + Type::Mut(inner) => { + Ok(Type::Mut(field_type(context, inner, field_name, field_span)?).id(context.db())) + } Type::SPtr(inner) => { Ok(Type::SPtr(field_type(context, inner, field_name, field_span)?).id(context.db())) } @@ -1513,117 +1521,60 @@ fn expr_call_builtin_value_method( "argument", ); + let ty = value_attrs.typ; let calltype = CallType::BuiltinValueMethod { method, typ: value_attrs.typ, }; match method { - ValueMethod::Clone => { - match value_attrs.typ.typ(context.db()) { - typ if typ.is_base() => { - context.fancy_error( - "`clone()` called on primitive type", - vec![ - Label::primary(value.span, "this value does not need to be cloned"), - Label::secondary(method_name.span, "hint: remove `.clone()`"), - ], - vec![], - ); - } - - Type::SPtr(inner) => { - if inner.is_map(context.db()) { - context.fancy_error( - "`clone()` called on a Map", - vec![ - Label::primary(value.span, "Maps can not be cloned"), - Label::secondary(method_name.span, "hint: remove `.clone()`"), - ], - vec![], - ); - } else { - context.fancy_error( - "`clone()` called on value in storage", - vec![ - Label::primary(value.span, "this value is in storage"), - Label::secondary(method_name.span, "hint: try `to_mem()` here"), - ], - vec![], - ); - } - value_attrs.typ = inner; - return Ok((value_attrs, calltype)); - } - - Type::Generic(_) => { - context.fancy_error( - "`clone()` called on generic type", - vec![ - Label::primary(value.span, "this value can not be cloned"), - Label::secondary(method_name.span, "hint: remove `.clone()`"), - ], - vec![], - ); - } - _ => {} - } - Ok((value_attrs, calltype)) - } ValueMethod::ToMem => { - match value_attrs.typ.typ(context.db()) { - typ if typ.is_base() => { - context.fancy_error( - "`to_mem()` called on primitive type", - vec![ - Label::primary( - value.span, - "this value does not need to be explicitly copied to memory", - ), - Label::secondary(method_name.span, "hint: remove `.to_mem()`"), - ], - vec![], - ); - } - - Type::SPtr(inner) => { - if inner.is_map(context.db()) { - context.fancy_error( - "`to_mem()` called on a Map", - vec![ - Label::primary(value.span, "Maps can not be copied to memory"), - Label::secondary(method_name.span, "hint: remove `.to_mem()`"), - ], - vec![], - ); - } - value_attrs.typ = inner; - return Ok((value_attrs, calltype)); - } - - Type::Generic(_) => { + if ty.is_base(context.db()) { + context.fancy_error( + "`to_mem()` called on primitive type", + vec![ + Label::primary( + value.span, + "this value does not need to be explicitly copied to memory", + ), + Label::secondary(method_name.span, "hint: remove `.to_mem()`"), + ], + vec![], + ); + } else if ty.is_sptr(context.db()) { + let inner = ty.deref(context.db()); + if inner.is_map(context.db()) { context.fancy_error( - "`to_mem()` called on generic type", + "`to_mem()` called on a Map", vec![ - Label::primary(value.span, "this value can not be copied to memory"), + Label::primary(value.span, "Maps can not be copied to memory"), Label::secondary(method_name.span, "hint: remove `.to_mem()`"), ], vec![], ); } - - _ => { - context.fancy_error( - "`to_mem()` called on value in memory", - vec![ - Label::primary(value.span, "this value is already in memory"), - Label::secondary( - method_name.span, - "hint: to make a copy, use `.clone()` here", - ), - ], - vec![], - ); - } + value_attrs.typ = inner; + return Ok((value_attrs, calltype)); + } else if ty.is_generic(context.db()) { + context.fancy_error( + "`to_mem()` called on generic type", + vec![ + Label::primary(value.span, "this value can not be copied to memory"), + Label::secondary(method_name.span, "hint: remove `.to_mem()`"), + ], + vec![], + ); + } else { + context.fancy_error( + "`to_mem()` called on value in memory", + vec![ + Label::primary(value.span, "this value is already in memory"), + Label::secondary( + method_name.span, + "hint: to make a copy, use `.clone()` here", + ), + ], + vec![], + ); } Ok((value_attrs, calltype)) } @@ -1721,8 +1672,9 @@ fn expr_call_type_attribute( for i in 0..arg_count { if let Some(attrs) = arg_attributes.get(i) { if i == 0 { - if let Some(context_type) = context.get_context_type() { - if attrs.typ != context_type { + if let Some(ctx_type) = context.get_context_type() { + // XXX require mut ctx + if attrs.typ != Type::Mut(ctx_type).id(context.db()) { context.fancy_error( &format!( "incorrect type for argument to `{}.{}`", @@ -1732,7 +1684,7 @@ fn expr_call_type_attribute( vec![Label::primary( args.kind[i].span, format!( - "this has type `{}`; expected `Context`", + "this has type `{}`; expected `mut Context`", &attrs.typ.display(context.db()) ), )], diff --git a/crates/analyzer/src/traversal/functions.rs b/crates/analyzer/src/traversal/functions.rs index cd8bc56784..1e638137a5 100644 --- a/crates/analyzer/src/traversal/functions.rs +++ b/crates/analyzer/src/traversal/functions.rs @@ -3,7 +3,7 @@ use crate::display::Displayable; use crate::errors::{self, FatalError, TypeCoercionError}; use crate::namespace::items::Item; use crate::namespace::scopes::{BlockScope, BlockScopeType}; -use crate::namespace::types::{EventField, Type, TypeDowncast, TypeId}; +use crate::namespace::types::{EventField, Type, TypeId}; use crate::traversal::types; use crate::traversal::{assignments, call_args, declarations, expressions}; use fe_common::diagnostics::Label; @@ -48,13 +48,13 @@ fn for_loop(scope: &mut BlockScope, stmt: &Node) -> Result<(), Fat fe::FuncStmt::For { target, iter, body } => { // Make sure iter is in the function scope & it should be an array. let iter_type = expressions::expr(scope, iter, None)?.typ; - let target_type = match iter_type.typ(scope.db()) { - Type::Array(array) => array.inner, - Type::SPtr(inner) if inner.as_array(scope.db()).is_some() => { - scope.add_diagnostic(errors::to_mem_error(iter.span)); - // `if let` guards are experimental (rust issue #51114) - inner.as_array(scope.db()).unwrap().inner + let target_type = match iter_type.deref(scope.db()).typ(scope.db()) { + Type::Array(array) => { + if iter_type.is_sptr(scope.db()) { + scope.add_diagnostic(errors::to_mem_error(iter.span)); + } + array.inner } _ => { return Err(FatalError::new(scope.register_diag(errors::type_error( diff --git a/crates/analyzer/src/traversal/types.rs b/crates/analyzer/src/traversal/types.rs index 9568ccb4c2..1d3d7d7dc2 100644 --- a/crates/analyzer/src/traversal/types.rs +++ b/crates/analyzer/src/traversal/types.rs @@ -12,6 +12,8 @@ use fe_common::Spanned; use fe_parser::ast; use fe_parser::node::{Node, Span}; +/// Try to perform an explicit type cast, eg `u256(my_address)` or `address(my_contract)`. +/// Returns nothing. Emits an error if the cast fails; explicit cast failures are not fatal. pub fn try_cast_type( context: &mut dyn AnalyzerContext, from: TypeId, @@ -22,12 +24,10 @@ pub fn try_cast_type( if into == from { return; } - if from.is_sptr(context.db()) { - let from = deref_type(context, from_expr, from); - return try_cast_type(context, from, from_expr, into, into_span); - } - match (from.typ(context.db()), into.typ(context.db())) { + (Type::SPtr(from), _) => try_cast_type(context, from, from_expr, into, into_span), + (Type::Mut(from), _) => try_cast_type(context, from, from_expr, into, into_span), + (Type::String(from), Type::String(into)) => { if from.max_size > into.max_size { context.error( @@ -103,6 +103,7 @@ pub fn try_cast_type( pub fn deref_type(context: &mut dyn AnalyzerContext, expr: &Node, ty: TypeId) -> TypeId { match ty.typ(context.db()) { + Type::Mut(inner) => deref_type(context, expr, inner), Type::SPtr(inner) => { context.update_expression(expr, &|attr| attr.type_coercion_chain.push(inner)); inner @@ -144,6 +145,10 @@ fn coerce( match (from.typ(context.db()), into.typ(context.db())) { (Type::SPtr(from), Type::SPtr(into)) => coerce(context, from_expr, from, into, chain), + // Strip off any `mut`s. + // Fn call `mut` is checked in `fn validate_arg_type`. + (Type::Mut(from), _) => coerce(context, from_expr, from, into, add_coercion(chain, from)), + (_, Type::Mut(into)) => coerce(context, from_expr, from, into, chain), // Primitive types can be moved from storage implicitly. // Contract type is also a primitive. @@ -152,7 +157,7 @@ fn coerce( from_expr, from_inner, into, - add_coercion(chain, into), + add_coercion(chain, from_inner), ), // complex types require .to_mem() diff --git a/crates/analyzer/tests/errors.rs b/crates/analyzer/tests/errors.rs index 51d81a2cff..72e1df15c8 100644 --- a/crates/analyzer/tests/errors.rs +++ b/crates/analyzer/tests/errors.rs @@ -102,8 +102,8 @@ test_stmt! { array_constructor_call, "u8[3]([1, 2, 3])" } test_stmt! { assert_reason_not_string, "assert true, 1" } test_stmt! { assign_int, "5 = 6" } test_stmt! { assign_call, "self.f() = 10" } -test_stmt! { assign_type_mismatch, "let x: u256 = 10\nx = address(0)" } -test_stmt! { aug_assign_non_numeric, "let a: u256 = 1\nlet b: bool = true\na += b" } +test_stmt! { assign_type_mismatch, "let mut x: u256 = 10\nx = address(0)" } +test_stmt! { aug_assign_non_numeric, "let mut a: u256 = 1\nlet b: bool = true\na += b" } test_stmt! { binary_op_add_sign_mismatch, "let a: u256 = 1\nlet b: i256 = 2\na + b" } test_stmt! { binary_op_lshift_bool, "let a: bool = true\nlet b: i256\na << b" } test_stmt! { binary_op_lshift_with_int, "let a: u256 = 1\nlet b: i256 = 2\na << b" } @@ -128,7 +128,6 @@ 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 { continue }" } test_stmt! { emit_undefined_event, "emit MyEvent()" } @@ -146,8 +145,8 @@ test_stmt! { map_no_type_arg_list, "let x: Map" } test_stmt! { map_one_type_arg, "let x: Map" } test_stmt! { map_map_key_type, "let x: Map, address>" } test_stmt! { map_constructor, "Map()" } -test_stmt! { non_bool_and, "let x: bool = true\nlet y: u256 = 1\nx = x and y" } -test_stmt! { non_bool_or, "let x: bool = true\nlet y: u256 = 1\nx = x or y" } +test_stmt! { non_bool_and, "let mut x: bool = true\nlet y: u256 = 1\nx = x and y" } +test_stmt! { non_bool_or, "let mut x: bool = true\nlet y: u256 = 1\nx = x or y" } test_stmt! { overflow_i128_neg, "i128(-170141183460469231731687303715884105729)" } test_stmt! { overflow_i128_pos, "i128(170141183460469231731687303715884105728)" } test_stmt! { overflow_i16_neg, "i16(-32769)" } @@ -340,7 +339,6 @@ test_file! { ctx_init } test_file! { ctx_undeclared } test_file! { ctx_missing_internal_call } test_file! { ctx_missing_create } -test_file! { ctx_missing_load } test_file! { ctx_missing_event } test_file! { ctx_builtins_param_incorrect_type } test_file! { ctx_undefined_create } diff --git a/crates/analyzer/tests/snapshots/analysis__abi_decode_complex.snap b/crates/analyzer/tests/snapshots/analysis__abi_decode_complex.snap index 86078f6a03..23b2a195b5 100644 --- a/crates/analyzer/tests/snapshots/analysis__abi_decode_complex.snap +++ b/crates/analyzer/tests/snapshots/analysis__abi_decode_complex.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn decode_static_complex(s: StaticComplex) -> StaticComplex { 3 │ │ return s 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: s, typ: StaticComplex }] -> StaticComplex + │ ╰─────^ params: [{ label: None, name: s, typ: StaticComplex }] -> StaticComplex note: ┌─ abi_decode_complex.fe:3:16 @@ -23,7 +23,7 @@ note: 6 │ ╭ pub fn decode_string_complex(s: StringComplex) -> StringComplex { 7 │ │ return s 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: s, typ: StringComplex }] -> StringComplex + │ ╰─────^ params: [{ label: None, name: s, typ: StringComplex }] -> StringComplex note: ┌─ abi_decode_complex.fe:7:16 @@ -37,7 +37,7 @@ note: 10 │ ╭ pub fn decode_bytes_complex(s: BytesComplex) -> BytesComplex { 11 │ │ return s 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: s, typ: BytesComplex }] -> BytesComplex + │ ╰─────^ params: [{ label: None, name: s, typ: BytesComplex }] -> BytesComplex note: ┌─ abi_decode_complex.fe:11:16 @@ -51,7 +51,7 @@ note: 14 │ ╭ pub fn decode_nested_dynamic_complex(s: NestedDynamicComplex) -> NestedDynamicComplex { 15 │ │ return s 16 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: s, typ: NestedDynamicComplex }] -> NestedDynamicComplex + │ ╰─────^ params: [{ label: None, name: s, typ: NestedDynamicComplex }] -> NestedDynamicComplex note: ┌─ abi_decode_complex.fe:15:16 @@ -65,7 +65,7 @@ note: 18 │ ╭ pub fn decode_static_complex_elem_array(arr: Array) -> Array { 19 │ │ return arr 20 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: arr, typ: Array }] -> Array + │ ╰─────^ params: [{ label: None, name: arr, typ: Array }] -> Array note: ┌─ abi_decode_complex.fe:19:16 @@ -79,7 +79,7 @@ note: 22 │ ╭ pub fn decode_dynamic_complex_elem_array(arr: Array) -> Array { 23 │ │ return arr 24 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: arr, typ: Array }] -> Array + │ ╰─────^ params: [{ label: None, name: arr, typ: Array }] -> Array note: ┌─ abi_decode_complex.fe:23:16 diff --git a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap index 6e43cd87a2..5b7047bb7f 100644 --- a/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__abi_encoding_stress.snap @@ -50,16 +50,16 @@ note: note: ┌─ abi_encoding_stress.fe:25:5 │ -25 │ ╭ pub fn set_my_addrs(self, my_addrs: Array) { +25 │ ╭ pub fn set_my_addrs(mut self, my_addrs: Array) { 26 │ │ self.my_addrs = my_addrs 27 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_addrs, typ: Array }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_addrs, typ: Array }] -> () note: ┌─ abi_encoding_stress.fe:26:9 │ 26 │ self.my_addrs = my_addrs - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:26:9 @@ -67,7 +67,7 @@ note: 26 │ self.my_addrs = my_addrs │ ^^^^^^^^^^^^^ ^^^^^^^^ Array │ │ - │ SPtr> + │ mut SPtr> note: ┌─ abi_encoding_stress.fe:29:5 @@ -75,7 +75,7 @@ note: 29 │ ╭ pub fn get_my_addrs(self) -> Array { 30 │ │ return self.my_addrs.to_mem() 31 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array + │ ╰─────^ params: [self] -> Array note: ┌─ abi_encoding_stress.fe:30:16 @@ -98,16 +98,16 @@ note: note: ┌─ abi_encoding_stress.fe:33:5 │ -33 │ ╭ pub fn set_my_u128(self, my_u128: u128) { +33 │ ╭ pub fn set_my_u128(mut self, my_u128: u128) { 34 │ │ self.my_u128 = my_u128 35 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_u128, typ: u128 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_u128, typ: u128 }] -> () note: ┌─ abi_encoding_stress.fe:34:9 │ 34 │ self.my_u128 = my_u128 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:34:9 @@ -115,7 +115,7 @@ note: 34 │ self.my_u128 = my_u128 │ ^^^^^^^^^^^^ ^^^^^^^ u128 │ │ - │ SPtr + │ mut SPtr note: ┌─ abi_encoding_stress.fe:37:5 @@ -123,7 +123,7 @@ note: 37 │ ╭ pub fn get_my_u128(self) -> u128 { 38 │ │ return self.my_u128 39 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u128 + │ ╰─────^ params: [self] -> u128 note: ┌─ abi_encoding_stress.fe:38:16 @@ -140,16 +140,16 @@ note: note: ┌─ abi_encoding_stress.fe:41:5 │ -41 │ ╭ pub fn set_my_string(self, my_string: String<10>) { +41 │ ╭ pub fn set_my_string(mut self, my_string: String<10>) { 42 │ │ self.my_string = my_string 43 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_string, typ: String<10> }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_string, typ: String<10> }] -> () note: ┌─ abi_encoding_stress.fe:42:9 │ 42 │ self.my_string = my_string - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:42:9 @@ -157,7 +157,7 @@ note: 42 │ self.my_string = my_string │ ^^^^^^^^^^^^^^ ^^^^^^^^^ String<10> │ │ - │ SPtr> + │ mut SPtr> note: ┌─ abi_encoding_stress.fe:45:5 @@ -165,7 +165,7 @@ note: 45 │ ╭ pub fn get_my_string(self) -> String<10> { 46 │ │ return self.my_string.to_mem() 47 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<10> + │ ╰─────^ params: [self] -> String<10> note: ┌─ abi_encoding_stress.fe:46:16 @@ -188,16 +188,16 @@ note: note: ┌─ abi_encoding_stress.fe:49:5 │ -49 │ ╭ pub fn set_my_u16s(self, my_u16s: Array) { +49 │ ╭ pub fn set_my_u16s(mut self, my_u16s: Array) { 50 │ │ self.my_u16s = my_u16s 51 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_u16s, typ: Array }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_u16s, typ: Array }] -> () note: ┌─ abi_encoding_stress.fe:50:9 │ 50 │ self.my_u16s = my_u16s - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:50:9 @@ -205,7 +205,7 @@ note: 50 │ self.my_u16s = my_u16s │ ^^^^^^^^^^^^ ^^^^^^^ Array │ │ - │ SPtr> + │ mut SPtr> note: ┌─ abi_encoding_stress.fe:53:5 @@ -213,7 +213,7 @@ note: 53 │ ╭ pub fn get_my_u16s(self) -> Array { 54 │ │ return self.my_u16s.to_mem() 55 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array + │ ╰─────^ params: [self] -> Array note: ┌─ abi_encoding_stress.fe:54:16 @@ -236,16 +236,16 @@ note: note: ┌─ abi_encoding_stress.fe:57:5 │ -57 │ ╭ pub fn set_my_bool(self, my_bool: bool) { +57 │ ╭ pub fn set_my_bool(mut self, my_bool: bool) { 58 │ │ self.my_bool = my_bool 59 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_bool, typ: bool }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_bool, typ: bool }] -> () note: ┌─ abi_encoding_stress.fe:58:9 │ 58 │ self.my_bool = my_bool - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:58:9 @@ -253,7 +253,7 @@ note: 58 │ self.my_bool = my_bool │ ^^^^^^^^^^^^ ^^^^^^^ bool │ │ - │ SPtr + │ mut SPtr note: ┌─ abi_encoding_stress.fe:61:5 @@ -261,7 +261,7 @@ note: 61 │ ╭ pub fn get_my_bool(self) -> bool { 62 │ │ return self.my_bool 63 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> bool + │ ╰─────^ params: [self] -> bool note: ┌─ abi_encoding_stress.fe:62:16 @@ -278,16 +278,16 @@ note: note: ┌─ abi_encoding_stress.fe:65:5 │ -65 │ ╭ pub fn set_my_bytes(self, my_bytes: Array) { +65 │ ╭ pub fn set_my_bytes(mut self, my_bytes: Array) { 66 │ │ self.my_bytes = my_bytes 67 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_bytes, typ: Array }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_bytes, typ: Array }] -> () note: ┌─ abi_encoding_stress.fe:66:9 │ 66 │ self.my_bytes = my_bytes - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ abi_encoding_stress.fe:66:9 @@ -295,7 +295,7 @@ note: 66 │ self.my_bytes = my_bytes │ ^^^^^^^^^^^^^ ^^^^^^^^ Array │ │ - │ SPtr> + │ mut SPtr> note: ┌─ abi_encoding_stress.fe:69:5 @@ -303,7 +303,7 @@ note: 69 │ ╭ pub fn get_my_bytes(self) -> Array { 70 │ │ return self.my_bytes.to_mem() 71 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array + │ ╰─────^ params: [self] -> Array note: ┌─ abi_encoding_stress.fe:70:16 @@ -329,7 +329,7 @@ note: 73 │ ╭ pub fn get_my_struct() -> MyStruct { 74 │ │ return MyStruct(my_num: 42, my_num2: u8(26), my_bool: true, my_addr: address(123456)) 75 │ │ } - │ ╰─────^ self: None, params: [] -> MyStruct + │ ╰─────^ params: [] -> MyStruct note: ┌─ abi_encoding_stress.fe:74:33 @@ -363,20 +363,20 @@ note: note: ┌─ abi_encoding_stress.fe:77:5 │ -77 │ ╭ pub fn mod_my_struct(my_struct: MyStruct) -> MyStruct { +77 │ ╭ pub fn mod_my_struct(mut my_struct: MyStruct) -> MyStruct { 78 │ │ my_struct.my_num = 12341234 79 │ │ my_struct.my_num2 = u8(42) 80 │ │ my_struct.my_bool = false 81 │ │ my_struct.my_addr = address(9999) 82 │ │ return my_struct 83 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_struct, typ: MyStruct }] -> MyStruct + │ ╰─────^ params: [{ label: None, name: my_struct, typ: mut MyStruct }] -> MyStruct note: ┌─ abi_encoding_stress.fe:78:9 │ 78 │ my_struct.my_num = 12341234 - │ ^^^^^^^^^ MyStruct + │ ^^^^^^^^^ mut MyStruct note: ┌─ abi_encoding_stress.fe:78:9 @@ -384,9 +384,9 @@ note: 78 │ my_struct.my_num = 12341234 │ ^^^^^^^^^^^^^^^^ ^^^^^^^^ u256 │ │ - │ u256 + │ mut u256 79 │ my_struct.my_num2 = u8(42) - │ ^^^^^^^^^ MyStruct + │ ^^^^^^^^^ mut MyStruct note: ┌─ abi_encoding_stress.fe:79:9 @@ -394,7 +394,7 @@ note: 79 │ my_struct.my_num2 = u8(42) │ ^^^^^^^^^^^^^^^^^ ^^ u8 │ │ - │ u8 + │ mut u8 note: ┌─ abi_encoding_stress.fe:79:29 @@ -402,7 +402,7 @@ note: 79 │ my_struct.my_num2 = u8(42) │ ^^^^^^ u8 80 │ my_struct.my_bool = false - │ ^^^^^^^^^ MyStruct + │ ^^^^^^^^^ mut MyStruct note: ┌─ abi_encoding_stress.fe:80:9 @@ -410,9 +410,9 @@ note: 80 │ my_struct.my_bool = false │ ^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ bool + │ mut bool 81 │ my_struct.my_addr = address(9999) - │ ^^^^^^^^^ MyStruct + │ ^^^^^^^^^ mut MyStruct note: ┌─ abi_encoding_stress.fe:81:9 @@ -420,7 +420,7 @@ note: 81 │ my_struct.my_addr = address(9999) │ ^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ address + │ mut address note: ┌─ abi_encoding_stress.fe:81:29 @@ -428,15 +428,15 @@ note: 81 │ my_struct.my_addr = address(9999) │ ^^^^^^^^^^^^^ address 82 │ return my_struct - │ ^^^^^^^^^ MyStruct + │ ^^^^^^^^^ mut MyStruct -> MyStruct note: ┌─ abi_encoding_stress.fe:85:5 │ -85 │ ╭ pub fn emit_my_event(self, ctx: Context) { +85 │ ╭ pub fn emit_my_event(self, mut ctx: Context) { 86 │ │ 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()) 87 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ abi_encoding_stress.fe:86:22 @@ -444,7 +444,7 @@ note: 86 │ 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 │ │ - │ Context + │ mut Context -> Context note: ┌─ abi_encoding_stress.fe:86:37 diff --git a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap index dd274cfb5d..4503ede18a 100644 --- a/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__address_bytes10_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: address) -> Array { 5 │ │ return self.bar[key].to_mem() 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: address }] -> Array + │ ╰─────^ params: [self, { label: None, name: key, typ: address }] -> Array note: ┌─ address_bytes10_map.fe:5:16 @@ -46,16 +46,16 @@ note: note: ┌─ address_bytes10_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: address, value: Array) { + 8 │ ╭ pub fn write_bar(mut self, key: address, value: Array) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: address }, { label: None, name: value, typ: Array }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: address }, { label: None, name: value, typ: Array }] -> () note: ┌─ address_bytes10_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ address_bytes10_map.fe:9:9 @@ -63,7 +63,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ address_bytes10_map.fe:9:9 @@ -71,6 +71,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ Array │ │ - │ SPtr> + │ mut SPtr> diff --git a/crates/analyzer/tests/snapshots/analysis__assert.snap b/crates/analyzer/tests/snapshots/analysis__assert.snap index 83c5d4a50f..f0921d533c 100644 --- a/crates/analyzer/tests/snapshots/analysis__assert.snap +++ b/crates/analyzer/tests/snapshots/analysis__assert.snap @@ -17,7 +17,7 @@ note: 5 │ ╭ pub fn bar(baz: u256) { 6 │ │ assert baz > 5 7 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: baz, typ: u256 }] -> () + │ ╰─────^ params: [{ label: None, name: baz, typ: u256 }] -> () note: ┌─ assert.fe:6:16 @@ -39,7 +39,7 @@ note: 9 │ ╭ pub fn revert_with_static_string(baz: u256) { 10 │ │ assert baz > 5, "Must be greater than five" 11 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: baz, typ: u256 }] -> () + │ ╰─────^ params: [{ label: None, name: baz, typ: u256 }] -> () note: ┌─ assert.fe:10:16 @@ -63,7 +63,7 @@ note: 13 │ ╭ pub fn revert_with(baz: u256, reason: String<1000>) { 14 │ │ assert baz > 5, reason 15 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: baz, typ: u256 }, { label: None, name: reason, typ: String<1000> }] -> () + │ ╰─────^ params: [{ label: None, name: baz, typ: u256 }, { label: None, name: reason, typ: String<1000> }] -> () note: ┌─ assert.fe:14:16 @@ -84,17 +84,17 @@ note: note: ┌─ assert.fe:17:5 │ -17 │ ╭ pub fn assert_sto_bool(self) { +17 │ ╭ pub fn assert_sto_bool(mut self) { 18 │ │ self.my_bool = false 19 │ │ assert self.my_bool 20 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ assert.fe:18:9 │ 18 │ self.my_bool = false - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ assert.fe:18:9 @@ -102,30 +102,30 @@ note: 18 │ self.my_bool = false │ ^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr + │ mut SPtr 19 │ assert self.my_bool - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ assert.fe:19:16 │ 19 │ assert self.my_bool - │ ^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^ mut SPtr -> SPtr -> bool note: ┌─ assert.fe:22:5 │ -22 │ ╭ pub fn assert_sto_string_msg(self) { +22 │ ╭ pub fn assert_sto_string_msg(mut self) { 23 │ │ self.my_string = "hello" 24 │ │ assert false, self.my_string.to_mem() 25 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ assert.fe:23:9 │ 23 │ self.my_string = "hello" - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ assert.fe:23:9 @@ -133,9 +133,9 @@ note: 23 │ self.my_string = "hello" │ ^^^^^^^^^^^^^^ ^^^^^^^ String<5> │ │ - │ SPtr> + │ mut SPtr> 24 │ assert false, self.my_string.to_mem() - │ ^^^^^ ^^^^ Foo + │ ^^^^^ ^^^^ mut Foo │ │ │ bool @@ -143,7 +143,7 @@ note: ┌─ assert.fe:24:23 │ 24 │ assert false, self.my_string.to_mem() - │ ^^^^^^^^^^^^^^ SPtr> + │ ^^^^^^^^^^^^^^ mut SPtr> note: ┌─ assert.fe:24:23 diff --git a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap index 10339628aa..0e250208db 100644 --- a/crates/analyzer/tests/snapshots/analysis__associated_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__associated_fns.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn square(x: u256) -> u256 { 3 │ │ return x * x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }] -> u256 note: ┌─ associated_fns.fe:3:16 @@ -37,7 +37,7 @@ note: 10 │ ╭ pub fn new(x: u256) -> MyStruct { 11 │ │ return MyStruct(x) 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }] -> MyStruct + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }] -> MyStruct note: ┌─ associated_fns.fe:11:25 @@ -60,17 +60,17 @@ note: note: ┌─ associated_fns.fe:18:5 │ -18 │ ╭ pub fn bar(self, val: u256) -> u256 { +18 │ ╭ pub fn bar(mut self, val: u256) -> u256 { 19 │ │ self.my_struct = MyStruct::new(x: val) 20 │ │ return Lib::square(x: self.my_struct.x) 21 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: val, typ: u256 }] -> u256 + │ ╰─────^ params: [mut self, { label: None, name: val, typ: u256 }] -> u256 note: ┌─ associated_fns.fe:19:9 │ 19 │ self.my_struct = MyStruct::new(x: val) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ associated_fns.fe:19:9 @@ -78,7 +78,7 @@ note: 19 │ self.my_struct = MyStruct::new(x: val) │ ^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ associated_fns.fe:19:26 @@ -86,19 +86,19 @@ note: 19 │ self.my_struct = MyStruct::new(x: val) │ ^^^^^^^^^^^^^^^^^^^^^ MyStruct 20 │ return Lib::square(x: self.my_struct.x) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ associated_fns.fe:20:31 │ 20 │ return Lib::square(x: self.my_struct.x) - │ ^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^ mut SPtr note: ┌─ associated_fns.fe:20:31 │ 20 │ return Lib::square(x: self.my_struct.x) - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: ┌─ associated_fns.fe:20:16 diff --git a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap index 1cdc34d981..0575994727 100644 --- a/crates/analyzer/tests/snapshots/analysis__aug_assign.snap +++ b/crates/analyzer/tests/snapshots/analysis__aug_assign.snap @@ -12,11 +12,11 @@ note: note: ┌─ aug_assign.fe:4:5 │ -4 │ ╭ pub fn add(a: u256, b: u256) -> u256 { +4 │ ╭ pub fn add(mut a: u256, b: u256) -> u256 { 5 │ │ a += b 6 │ │ return a 7 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:5:9 @@ -24,18 +24,18 @@ note: 5 │ a += b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 6 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:9:5 │ - 9 │ ╭ pub fn sub(a: u256, b: u256) -> u256 { + 9 │ ╭ pub fn sub(mut a: u256, b: u256) -> u256 { 10 │ │ a -= b 11 │ │ return a 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:10:9 @@ -43,18 +43,18 @@ note: 10 │ a -= b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 11 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:14:5 │ -14 │ ╭ pub fn mul(a: u256, b: u256) -> u256 { +14 │ ╭ pub fn mul(mut a: u256, b: u256) -> u256 { 15 │ │ a *= b 16 │ │ return a 17 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:15:9 @@ -62,18 +62,18 @@ note: 15 │ a *= b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 16 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:19:5 │ -19 │ ╭ pub fn div(a: u256, b: u256) -> u256 { +19 │ ╭ pub fn div(mut a: u256, b: u256) -> u256 { 20 │ │ a /= b 21 │ │ return a 22 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:20:9 @@ -81,18 +81,18 @@ note: 20 │ a /= b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 21 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:24:5 │ -24 │ ╭ pub fn mod(a: u256, b: u256) -> u256 { +24 │ ╭ pub fn mod(mut a: u256, b: u256) -> u256 { 25 │ │ a %= b 26 │ │ return a 27 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:25:9 @@ -100,18 +100,18 @@ note: 25 │ a %= b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 26 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:29:5 │ -29 │ ╭ pub fn pow(a: u256, b: u256) -> u256 { +29 │ ╭ pub fn pow(mut a: u256, b: u256) -> u256 { 30 │ │ a **= b 31 │ │ return a 32 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:30:9 @@ -119,18 +119,18 @@ note: 30 │ a **= b │ ^ ^ u256 │ │ - │ u256 + │ mut u256 31 │ return a - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ aug_assign.fe:34:5 │ -34 │ ╭ pub fn lshift(a: u8, b: u8) -> u8 { +34 │ ╭ pub fn lshift(mut a: u8, b: u8) -> u8 { 35 │ │ a <<= b 36 │ │ return a 37 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u8 }, { label: None, name: b, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u8 }, { label: None, name: b, typ: u8 }] -> u8 note: ┌─ aug_assign.fe:35:9 @@ -138,18 +138,18 @@ note: 35 │ a <<= b │ ^ ^ u8 │ │ - │ u8 + │ mut u8 36 │ return a - │ ^ u8 + │ ^ mut u8 -> u8 note: ┌─ aug_assign.fe:39:5 │ -39 │ ╭ pub fn rshift(a: u8, b: u8) -> u8 { +39 │ ╭ pub fn rshift(mut a: u8, b: u8) -> u8 { 40 │ │ a >>= b 41 │ │ return a 42 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u8 }, { label: None, name: b, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u8 }, { label: None, name: b, typ: u8 }] -> u8 note: ┌─ aug_assign.fe:40:9 @@ -157,18 +157,18 @@ note: 40 │ a >>= b │ ^ ^ u8 │ │ - │ u8 + │ mut u8 41 │ return a - │ ^ u8 + │ ^ mut u8 -> u8 note: ┌─ aug_assign.fe:44:5 │ -44 │ ╭ pub fn bit_or(a: u8, b: u8) -> u8 { +44 │ ╭ pub fn bit_or(mut a: u8, b: u8) -> u8 { 45 │ │ a |= b 46 │ │ return a 47 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u8 }, { label: None, name: b, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u8 }, { label: None, name: b, typ: u8 }] -> u8 note: ┌─ aug_assign.fe:45:9 @@ -176,18 +176,18 @@ note: 45 │ a |= b │ ^ ^ u8 │ │ - │ u8 + │ mut u8 46 │ return a - │ ^ u8 + │ ^ mut u8 -> u8 note: ┌─ aug_assign.fe:49:5 │ -49 │ ╭ pub fn bit_xor(a: u8, b: u8) -> u8 { +49 │ ╭ pub fn bit_xor(mut a: u8, b: u8) -> u8 { 50 │ │ a ^= b 51 │ │ return a 52 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u8 }, { label: None, name: b, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u8 }, { label: None, name: b, typ: u8 }] -> u8 note: ┌─ aug_assign.fe:50:9 @@ -195,18 +195,18 @@ note: 50 │ a ^= b │ ^ ^ u8 │ │ - │ u8 + │ mut u8 51 │ return a - │ ^ u8 + │ ^ mut u8 -> u8 note: ┌─ aug_assign.fe:54:5 │ -54 │ ╭ pub fn bit_and(a: u8, b: u8) -> u8 { +54 │ ╭ pub fn bit_and(mut a: u8, b: u8) -> u8 { 55 │ │ a &= b 56 │ │ return a 57 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u8 }, { label: None, name: b, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: a, typ: mut u8 }, { label: None, name: b, typ: u8 }] -> u8 note: ┌─ aug_assign.fe:55:9 @@ -214,25 +214,25 @@ note: 55 │ a &= b │ ^ ^ u8 │ │ - │ u8 + │ mut u8 56 │ return a - │ ^ u8 + │ ^ mut u8 -> u8 note: ┌─ aug_assign.fe:59:5 │ -59 │ ╭ pub fn add_from_sto(self, a: u256, b: u256) -> u256 { +59 │ ╭ pub fn add_from_sto(mut self, a: u256, b: u256) -> u256 { 60 │ │ self.my_num = a 61 │ │ self.my_num += b 62 │ │ return self.my_num 63 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [mut self, { label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 note: ┌─ aug_assign.fe:60:9 │ 60 │ self.my_num = a - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ aug_assign.fe:60:9 @@ -240,9 +240,9 @@ note: 60 │ self.my_num = a │ ^^^^^^^^^^^ ^ u256 │ │ - │ SPtr + │ mut SPtr 61 │ self.my_num += b - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ aug_assign.fe:61:9 @@ -250,50 +250,50 @@ note: 61 │ self.my_num += b │ ^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 62 │ return self.my_num - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ aug_assign.fe:62:16 │ 62 │ return self.my_num - │ ^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: ┌─ aug_assign.fe:65:5 │ 65 │ ╭ pub fn add_from_mem(a: u256, b: u256) -> u256 { -66 │ │ let my_array: Array = [0; 10] +66 │ │ let mut my_array: Array = [0; 10] 67 │ │ my_array[7] = a 68 │ │ my_array[7] += b 69 │ │ return my_array[7] 70 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> u256 note: - ┌─ aug_assign.fe:66:13 + ┌─ aug_assign.fe:66:17 │ -66 │ let my_array: Array = [0; 10] - │ ^^^^^^^^ Array +66 │ let mut my_array: Array = [0; 10] + │ ^^^^^^^^ mut Array note: - ┌─ aug_assign.fe:66:42 + ┌─ aug_assign.fe:66:46 │ -66 │ let my_array: Array = [0; 10] - │ ^ ^^ u256 - │ │ - │ u256 +66 │ let mut my_array: Array = [0; 10] + │ ^ ^^ u256 + │ │ + │ u256 note: - ┌─ aug_assign.fe:66:41 + ┌─ aug_assign.fe:66:45 │ -66 │ let my_array: Array = [0; 10] - │ ^^^^^^^ Array +66 │ let mut my_array: Array = [0; 10] + │ ^^^^^^^ Array 67 │ my_array[7] = a │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ aug_assign.fe:67:9 @@ -301,11 +301,11 @@ note: 67 │ my_array[7] = a │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 68 │ my_array[7] += b │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ aug_assign.fe:68:9 @@ -313,16 +313,16 @@ note: 68 │ my_array[7] += b │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 69 │ return my_array[7] │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ aug_assign.fe:69:16 │ 69 │ return my_array[7] - │ ^^^^^^^^^^^ u256 + │ ^^^^^^^^^^^ mut u256 -> u256 diff --git a/crates/analyzer/tests/snapshots/analysis__balances.snap b/crates/analyzer/tests/snapshots/analysis__balances.snap index 44cb7c044e..f84c368ccc 100644 --- a/crates/analyzer/tests/snapshots/analysis__balances.snap +++ b/crates/analyzer/tests/snapshots/analysis__balances.snap @@ -9,7 +9,7 @@ note: 4 │ ╭ pub fn my_balance(self, ctx: Context) -> u256 { 5 │ │ return ctx.self_balance() 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [self, { label: None, name: ctx, typ: Context }] -> u256 note: ┌─ balances.fe:5:16 @@ -29,7 +29,7 @@ note: 8 │ ╭ pub fn other_balance(self, ctx: Context, someone: address) -> u256 { 9 │ │ return ctx.balance_of(someone) 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: someone, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: None, name: ctx, typ: Context }, { label: None, name: someone, typ: address }] -> u256 note: ┌─ balances.fe:9:16 diff --git a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap index 9430f896e4..db0c6fe2d5 100644 --- a/crates/analyzer/tests/snapshots/analysis__base_tuple.snap +++ b/crates/analyzer/tests/snapshots/analysis__base_tuple.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(my_num: u256, my_bool: bool) -> (u256, bool) { 3 │ │ return (my_num, my_bool) 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_num, typ: u256 }, { label: None, name: my_bool, typ: bool }] -> (u256, bool) + │ ╰─────^ params: [{ label: None, name: my_num, typ: u256 }, { label: None, name: my_bool, typ: bool }] -> (u256, bool) note: ┌─ base_tuple.fe:3:17 diff --git a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap index d9559d5d11..6421b59799 100644 --- a/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap +++ b/crates/analyzer/tests/snapshots/analysis__basic_ingot.snap @@ -10,7 +10,7 @@ note: 10 │ │ assert file_items_work() 11 │ │ return Baz(my_bool: true, my_u256: 26) 12 │ │ } - │ ╰─────^ self: None, params: [] -> Baz + │ ╰─────^ params: [] -> Baz note: ┌─ ingots/basic_ingot/src/main.fe:10:16 @@ -34,7 +34,7 @@ note: 14 │ ╭ pub fn get_my_bing() -> Bong { 15 │ │ return Bong(my_address: address(42)) 16 │ │ } - │ ╰─────^ self: None, params: [] -> Bing + │ ╰─────^ params: [] -> Bing note: ┌─ ingots/basic_ingot/src/main.fe:15:41 @@ -60,7 +60,7 @@ note: 18 │ ╭ pub fn get_42() -> u256 { 19 │ │ return get_42_backend() 20 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ ingots/basic_ingot/src/main.fe:19:16 @@ -74,7 +74,7 @@ note: 22 │ ╭ pub fn get_26() -> u256 { 23 │ │ return std::evm::add(13, 13) 24 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ ingots/basic_ingot/src/main.fe:23:30 @@ -97,7 +97,7 @@ note: 27 │ │ assert bar::mee::Mee::kawum() == 1 28 │ │ assert bar::mee::Mee().rums() == 1 29 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ ingots/basic_ingot/src/main.fe:27:16 @@ -135,7 +135,7 @@ note: 31 │ ╭ pub fn get_my_dyng() -> dong::Dyng { 32 │ │ return dong::Dyng(my_address: address(8), my_u256: 42, my_i8: -1) 33 │ │ } - │ ╰─────^ self: None, params: [] -> Dyng + │ ╰─────^ params: [] -> Dyng note: ┌─ ingots/basic_ingot/src/main.fe:32:47 @@ -167,11 +167,11 @@ note: note: ┌─ ingots/basic_ingot/src/main.fe:35:5 │ -35 │ ╭ pub fn create_bing_contract(ctx: Context) -> u256 { +35 │ ╭ pub fn create_bing_contract(mut ctx: Context) -> u256 { 36 │ │ let bing_contract: BingContract = BingContract.create(ctx, 0) 37 │ │ return bing_contract.add(40, 50) 38 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }] -> u256 note: ┌─ ingots/basic_ingot/src/main.fe:36:13 @@ -185,7 +185,7 @@ note: 36 │ let bing_contract: BingContract = BingContract.create(ctx, 0) │ ^^^ ^ u256 │ │ - │ Context + │ mut Context note: ┌─ ingots/basic_ingot/src/main.fe:36:43 @@ -211,7 +211,7 @@ note: 1 │ ╭ pub fn file_items_work() -> bool { 2 │ │ return true 3 │ │ } - │ ╰─^ self: None, params: [] -> bool + │ ╰─^ params: [] -> bool note: ┌─ ingots/basic_ingot/src/bar.fe:2:12 @@ -232,7 +232,7 @@ note: 7 │ ╭ pub fn get_42_backend() -> u256 { 8 │ │ return std::evm::add(21, 21) 9 │ │ } - │ ╰─^ self: None, params: [] -> u256 + │ ╰─^ params: [] -> u256 note: ┌─ ingots/basic_ingot/src/bing.fe:8:26 @@ -254,7 +254,7 @@ note: 12 │ ╭ pub fn add(self, _ x: u256, _ y: u256) -> u256 { 13 │ │ return x + y 14 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [self, { label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 note: ┌─ ingots/basic_ingot/src/bing.fe:13:16 @@ -287,7 +287,7 @@ note: 2 │ ╭ pub fn kawum() -> u256 { 3 │ │ return 1 4 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ ingots/basic_ingot/src/bar/mee.fe:3:16 @@ -301,7 +301,7 @@ note: 6 │ ╭ pub fn rums(self) -> u256 { 7 │ │ return 1 8 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ ingots/basic_ingot/src/bar/mee.fe:7:16 @@ -333,7 +333,7 @@ note: 9 │ ╭ fn get_bing() -> Bing { 10 │ │ return Bing(my_address: address(0)) 11 │ │ } - │ ╰─^ self: None, params: [] -> Bing + │ ╰─^ params: [] -> Bing note: ┌─ ingots/basic_ingot/src/ding/dong.fe:10:37 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 b1541b7967..f27a2b1b49 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_with_args.snap @@ -12,16 +12,16 @@ note: note: ┌─ call_statement_with_args.fe:4:5 │ -4 │ ╭ fn assign(self, _ val: u256) { +4 │ ╭ fn assign(mut self, _ val: u256) { 5 │ │ self.baz[0] = val 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: val, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: Some("_"), name: val, typ: u256 }] -> () note: ┌─ call_statement_with_args.fe:5:9 │ 5 │ self.baz[0] = val - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_with_args.fe:5:9 @@ -29,7 +29,7 @@ note: 5 │ self.baz[0] = val │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_with_args.fe:5:9 @@ -37,16 +37,16 @@ note: 5 │ self.baz[0] = val │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ call_statement_with_args.fe:8:5 │ - 8 │ ╭ pub fn bar(self) -> u256 { + 8 │ ╭ pub fn bar(mut self) -> u256 { 9 │ │ self.assign(100) 10 │ │ return self.baz[0] 11 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [mut self] -> u256 note: ┌─ call_statement_with_args.fe:9:9 @@ -54,7 +54,7 @@ note: 9 │ self.assign(100) │ ^^^^ ^^^ u256 │ │ - │ Foo + │ mut Foo note: ┌─ call_statement_with_args.fe:9:9 @@ -62,7 +62,7 @@ note: 9 │ self.assign(100) │ ^^^^^^^^^^^^^^^^ () 10 │ return self.baz[0] - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_with_args.fe:10:16 @@ -70,12 +70,12 @@ note: 10 │ return self.baz[0] │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_with_args.fe:10:16 │ 10 │ return self.baz[0] - │ ^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 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 649f0c7666..474144823c 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,17 +12,17 @@ note: note: ┌─ call_statement_with_args_2.fe:4:5 │ -4 │ ╭ fn assign(self, _ val: u256) -> u256 { +4 │ ╭ fn assign(mut self, _ val: u256) -> u256 { 5 │ │ self.baz[0] = val 6 │ │ return val 7 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: val, typ: u256 }] -> u256 + │ ╰─────^ params: [mut self, { label: Some("_"), name: val, typ: u256 }] -> u256 note: ┌─ call_statement_with_args_2.fe:5:9 │ 5 │ self.baz[0] = val - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_with_args_2.fe:5:9 @@ -30,7 +30,7 @@ note: 5 │ self.baz[0] = val │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_with_args_2.fe:5:9 @@ -38,18 +38,18 @@ note: 5 │ self.baz[0] = val │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr + │ mut SPtr 6 │ return val │ ^^^ u256 note: ┌─ call_statement_with_args_2.fe:9:5 │ - 9 │ ╭ pub fn bar(self) -> u256 { + 9 │ ╭ pub fn bar(mut self) -> u256 { 10 │ │ self.assign(100) 11 │ │ return self.baz[0] 12 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [mut self] -> u256 note: ┌─ call_statement_with_args_2.fe:10:9 @@ -57,7 +57,7 @@ note: 10 │ self.assign(100) │ ^^^^ ^^^ u256 │ │ - │ Foo + │ mut Foo note: ┌─ call_statement_with_args_2.fe:10:9 @@ -65,7 +65,7 @@ note: 10 │ self.assign(100) │ ^^^^^^^^^^^^^^^^ u256 11 │ return self.baz[0] - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_with_args_2.fe:11:16 @@ -73,12 +73,12 @@ note: 11 │ return self.baz[0] │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_with_args_2.fe:11:16 │ 11 │ return self.baz[0] - │ ^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 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 7bf7a5d44a..c1deacdf3b 100644 --- a/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap +++ b/crates/analyzer/tests/snapshots/analysis__call_statement_without_args.snap @@ -12,16 +12,16 @@ note: note: ┌─ call_statement_without_args.fe:4:5 │ -4 │ ╭ fn assign(self) { +4 │ ╭ fn assign(mut self) { 5 │ │ self.baz[0] = 100 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ call_statement_without_args.fe:5:9 │ 5 │ self.baz[0] = 100 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_without_args.fe:5:9 @@ -29,7 +29,7 @@ note: 5 │ self.baz[0] = 100 │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_without_args.fe:5:9 @@ -37,22 +37,22 @@ note: 5 │ self.baz[0] = 100 │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ call_statement_without_args.fe:8:5 │ - 8 │ ╭ pub fn bar(self) -> u256 { + 8 │ ╭ pub fn bar(mut self) -> u256 { 9 │ │ self.assign() 10 │ │ return self.baz[0] 11 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [mut self] -> u256 note: ┌─ call_statement_without_args.fe:9:9 │ 9 │ self.assign() - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_without_args.fe:9:9 @@ -60,7 +60,7 @@ note: 9 │ self.assign() │ ^^^^^^^^^^^^^ () 10 │ return self.baz[0] - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ call_statement_without_args.fe:10:16 @@ -68,12 +68,12 @@ note: 10 │ return self.baz[0] │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ call_statement_without_args.fe:10:16 │ 10 │ return self.baz[0] - │ ^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 diff --git a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap index 346d2428e4..3eac2dd6df 100644 --- a/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap +++ b/crates/analyzer/tests/snapshots/analysis__checked_arithmetic.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn add_u256(left: u256, right: u256) -> u256 { 3 │ │ return left + right 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:3:16 @@ -31,7 +31,7 @@ note: 6 │ ╭ pub fn add_u128(left: u128, right: u128) -> u128 { 7 │ │ return left + right 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:7:16 @@ -53,7 +53,7 @@ note: 10 │ ╭ pub fn add_u64(left: u64, right: u64) -> u64 { 11 │ │ return left + right 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:11:16 @@ -75,7 +75,7 @@ note: 14 │ ╭ pub fn add_u32(left: u32, right: u32) -> u32 { 15 │ │ return left + right 16 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:15:16 @@ -97,7 +97,7 @@ note: 18 │ ╭ pub fn add_u16(left: u16, right: u16) -> u16 { 19 │ │ return left + right 20 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:19:16 @@ -119,7 +119,7 @@ note: 22 │ ╭ pub fn add_u8(left: u8, right: u8) -> u8 { 23 │ │ return left + right 24 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:23:16 @@ -141,7 +141,7 @@ note: 26 │ ╭ pub fn add_i256(left: i256, right: i256) -> i256 { 27 │ │ return left + right 28 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 note: ┌─ checked_arithmetic.fe:27:16 @@ -163,7 +163,7 @@ note: 30 │ ╭ pub fn add_i128(left: i128, right: i128) -> i128 { 31 │ │ return left + right 32 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 note: ┌─ checked_arithmetic.fe:31:16 @@ -185,7 +185,7 @@ note: 34 │ ╭ pub fn add_i64(left: i64, right: i64) -> i64 { 35 │ │ return left + right 36 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 note: ┌─ checked_arithmetic.fe:35:16 @@ -207,7 +207,7 @@ note: 38 │ ╭ pub fn add_i32(left: i32, right: i32) -> i32 { 39 │ │ return left + right 40 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 note: ┌─ checked_arithmetic.fe:39:16 @@ -229,7 +229,7 @@ note: 42 │ ╭ pub fn add_i16(left: i16, right: i16) -> i16 { 43 │ │ return left + right 44 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 note: ┌─ checked_arithmetic.fe:43:16 @@ -251,7 +251,7 @@ note: 46 │ ╭ pub fn add_i8(left: i8, right: i8) -> i8 { 47 │ │ return left + right 48 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 note: ┌─ checked_arithmetic.fe:47:16 @@ -273,7 +273,7 @@ note: 50 │ ╭ pub fn sub_u256(left: u256, right: u256) -> u256 { 51 │ │ return left - right 52 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:51:16 @@ -295,7 +295,7 @@ note: 54 │ ╭ pub fn sub_u128(left: u128, right: u128) -> u128 { 55 │ │ return left - right 56 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:55:16 @@ -317,7 +317,7 @@ note: 58 │ ╭ pub fn sub_u64(left: u64, right: u64) -> u64 { 59 │ │ return left - right 60 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:59:16 @@ -339,7 +339,7 @@ note: 62 │ ╭ pub fn sub_u32(left: u32, right: u32) -> u32 { 63 │ │ return left - right 64 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:63:16 @@ -361,7 +361,7 @@ note: 66 │ ╭ pub fn sub_u16(left: u16, right: u16) -> u16 { 67 │ │ return left - right 68 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:67:16 @@ -383,7 +383,7 @@ note: 70 │ ╭ pub fn sub_u8(left: u8, right: u8) -> u8 { 71 │ │ return left - right 72 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:71:16 @@ -405,7 +405,7 @@ note: 74 │ ╭ pub fn sub_i256(left: i256, right: i256) -> i256 { 75 │ │ return left - right 76 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 note: ┌─ checked_arithmetic.fe:75:16 @@ -427,7 +427,7 @@ note: 78 │ ╭ pub fn sub_i128(left: i128, right: i128) -> i128 { 79 │ │ return left - right 80 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 note: ┌─ checked_arithmetic.fe:79:16 @@ -449,7 +449,7 @@ note: 82 │ ╭ pub fn sub_i64(left: i64, right: i64) -> i64 { 83 │ │ return left - right 84 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 note: ┌─ checked_arithmetic.fe:83:16 @@ -471,7 +471,7 @@ note: 86 │ ╭ pub fn sub_i32(left: i32, right: i32) -> i32 { 87 │ │ return left - right 88 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 note: ┌─ checked_arithmetic.fe:87:16 @@ -493,7 +493,7 @@ note: 90 │ ╭ pub fn sub_i16(left: i16, right: i16) -> i16 { 91 │ │ return left - right 92 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 note: ┌─ checked_arithmetic.fe:91:16 @@ -515,7 +515,7 @@ note: 94 │ ╭ pub fn sub_i8(left: i8, right: i8) -> i8 { 95 │ │ return left - right 96 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 note: ┌─ checked_arithmetic.fe:95:16 @@ -537,7 +537,7 @@ note: 98 │ ╭ pub fn div_u256(left: u256, right: u256) -> u256 { 99 │ │ return left / right 100 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:99:16 @@ -559,7 +559,7 @@ note: 102 │ ╭ pub fn div_u128(left: u128, right: u128) -> u128 { 103 │ │ return left / right 104 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:103:16 @@ -581,7 +581,7 @@ note: 106 │ ╭ pub fn div_u64(left: u64, right: u64) -> u64 { 107 │ │ return left / right 108 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:107:16 @@ -603,7 +603,7 @@ note: 110 │ ╭ pub fn div_u32(left: u32, right: u32) -> u32 { 111 │ │ return left / right 112 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:111:16 @@ -625,7 +625,7 @@ note: 114 │ ╭ pub fn div_u16(left: u16, right: u16) -> u16 { 115 │ │ return left / right 116 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:115:16 @@ -647,7 +647,7 @@ note: 118 │ ╭ pub fn div_u8(left: u8, right: u8) -> u8 { 119 │ │ return left / right 120 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:119:16 @@ -669,7 +669,7 @@ note: 122 │ ╭ pub fn div_i256(left: i256, right: i256) -> i256 { 123 │ │ return left / right 124 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 note: ┌─ checked_arithmetic.fe:123:16 @@ -691,7 +691,7 @@ note: 126 │ ╭ pub fn div_i128(left: i128, right: i128) -> i128 { 127 │ │ return left / right 128 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 note: ┌─ checked_arithmetic.fe:127:16 @@ -713,7 +713,7 @@ note: 130 │ ╭ pub fn div_i64(left: i64, right: i64) -> i64 { 131 │ │ return left / right 132 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 note: ┌─ checked_arithmetic.fe:131:16 @@ -735,7 +735,7 @@ note: 134 │ ╭ pub fn div_i32(left: i32, right: i32) -> i32 { 135 │ │ return left / right 136 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 note: ┌─ checked_arithmetic.fe:135:16 @@ -757,7 +757,7 @@ note: 138 │ ╭ pub fn div_i16(left: i16, right: i16) -> i16 { 139 │ │ return left / right 140 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 note: ┌─ checked_arithmetic.fe:139:16 @@ -779,7 +779,7 @@ note: 142 │ ╭ pub fn div_i8(left: i8, right: i8) -> i8 { 143 │ │ return left / right 144 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 note: ┌─ checked_arithmetic.fe:143:16 @@ -801,7 +801,7 @@ note: 146 │ ╭ pub fn mul_u256(left: u256, right: u256) -> u256 { 147 │ │ return left * right 148 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:147:16 @@ -823,7 +823,7 @@ note: 150 │ ╭ pub fn mul_u128(left: u128, right: u128) -> u128 { 151 │ │ return left * right 152 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:151:16 @@ -845,7 +845,7 @@ note: 154 │ ╭ pub fn mul_u64(left: u64, right: u64) -> u64 { 155 │ │ return left * right 156 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:155:16 @@ -867,7 +867,7 @@ note: 158 │ ╭ pub fn mul_u32(left: u32, right: u32) -> u32 { 159 │ │ return left * right 160 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:159:16 @@ -889,7 +889,7 @@ note: 162 │ ╭ pub fn mul_u16(left: u16, right: u16) -> u16 { 163 │ │ return left * right 164 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:163:16 @@ -911,7 +911,7 @@ note: 166 │ ╭ pub fn mul_u8(left: u8, right: u8) -> u8 { 167 │ │ return left * right 168 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:167:16 @@ -933,7 +933,7 @@ note: 170 │ ╭ pub fn mul_i256(left: i256, right: i256) -> i256 { 171 │ │ return left * right 172 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 note: ┌─ checked_arithmetic.fe:171:16 @@ -955,7 +955,7 @@ note: 174 │ ╭ pub fn mul_i128(left: i128, right: i128) -> i128 { 175 │ │ return left * right 176 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 note: ┌─ checked_arithmetic.fe:175:16 @@ -977,7 +977,7 @@ note: 178 │ ╭ pub fn mul_i64(left: i64, right: i64) -> i64 { 179 │ │ return left * right 180 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 note: ┌─ checked_arithmetic.fe:179:16 @@ -999,7 +999,7 @@ note: 182 │ ╭ pub fn mul_i32(left: i32, right: i32) -> i32 { 183 │ │ return left * right 184 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 note: ┌─ checked_arithmetic.fe:183:16 @@ -1021,7 +1021,7 @@ note: 186 │ ╭ pub fn mul_i16(left: i16, right: i16) -> i16 { 187 │ │ return left * right 188 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 note: ┌─ checked_arithmetic.fe:187:16 @@ -1043,7 +1043,7 @@ note: 190 │ ╭ pub fn mul_i8(left: i8, right: i8) -> i8 { 191 │ │ return left * right 192 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 note: ┌─ checked_arithmetic.fe:191:16 @@ -1065,7 +1065,7 @@ note: 194 │ ╭ pub fn mod_u256(left: u256, right: u256) -> u256 { 195 │ │ return left % right 196 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:195:16 @@ -1087,7 +1087,7 @@ note: 198 │ ╭ pub fn mod_u128(left: u128, right: u128) -> u128 { 199 │ │ return left % right 200 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:199:16 @@ -1109,7 +1109,7 @@ note: 202 │ ╭ pub fn mod_u64(left: u64, right: u64) -> u64 { 203 │ │ return left % right 204 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:203:16 @@ -1131,7 +1131,7 @@ note: 206 │ ╭ pub fn mod_u32(left: u32, right: u32) -> u32 { 207 │ │ return left % right 208 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:207:16 @@ -1153,7 +1153,7 @@ note: 210 │ ╭ pub fn mod_u16(left: u16, right: u16) -> u16 { 211 │ │ return left % right 212 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:211:16 @@ -1175,7 +1175,7 @@ note: 214 │ ╭ pub fn mod_u8(left: u8, right: u8) -> u8 { 215 │ │ return left % right 216 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:215:16 @@ -1197,7 +1197,7 @@ note: 218 │ ╭ pub fn mod_i256(left: i256, right: i256) -> i256 { 219 │ │ return left % right 220 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: i256 }] -> i256 note: ┌─ checked_arithmetic.fe:219:16 @@ -1219,7 +1219,7 @@ note: 222 │ ╭ pub fn mod_i128(left: i128, right: i128) -> i128 { 223 │ │ return left % right 224 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: i128 }] -> i128 note: ┌─ checked_arithmetic.fe:223:16 @@ -1241,7 +1241,7 @@ note: 226 │ ╭ pub fn mod_i64(left: i64, right: i64) -> i64 { 227 │ │ return left % right 228 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: i64 }] -> i64 note: ┌─ checked_arithmetic.fe:227:16 @@ -1263,7 +1263,7 @@ note: 230 │ ╭ pub fn mod_i32(left: i32, right: i32) -> i32 { 231 │ │ return left % right 232 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: i32 }] -> i32 note: ┌─ checked_arithmetic.fe:231:16 @@ -1285,7 +1285,7 @@ note: 234 │ ╭ pub fn mod_i16(left: i16, right: i16) -> i16 { 235 │ │ return left % right 236 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: i16 }] -> i16 note: ┌─ checked_arithmetic.fe:235:16 @@ -1307,7 +1307,7 @@ note: 238 │ ╭ pub fn mod_i8(left: i8, right: i8) -> i8 { 239 │ │ return left % right 240 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: i8 }] -> i8 note: ┌─ checked_arithmetic.fe:239:16 @@ -1329,7 +1329,7 @@ note: 242 │ ╭ pub fn pow_u256(left: u256, right: u256) -> u256 { 243 │ │ return left ** right 244 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: left, typ: u256 }, { label: None, name: right, typ: u256 }] -> u256 note: ┌─ checked_arithmetic.fe:243:16 @@ -1351,7 +1351,7 @@ note: 246 │ ╭ pub fn pow_u128(left: u128, right: u128) -> u128 { 247 │ │ return left ** right 248 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: left, typ: u128 }, { label: None, name: right, typ: u128 }] -> u128 note: ┌─ checked_arithmetic.fe:247:16 @@ -1373,7 +1373,7 @@ note: 250 │ ╭ pub fn pow_u64(left: u64, right: u64) -> u64 { 251 │ │ return left ** right 252 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: left, typ: u64 }, { label: None, name: right, typ: u64 }] -> u64 note: ┌─ checked_arithmetic.fe:251:16 @@ -1395,7 +1395,7 @@ note: 254 │ ╭ pub fn pow_u32(left: u32, right: u32) -> u32 { 255 │ │ return left ** right 256 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: left, typ: u32 }, { label: None, name: right, typ: u32 }] -> u32 note: ┌─ checked_arithmetic.fe:255:16 @@ -1417,7 +1417,7 @@ note: 258 │ ╭ pub fn pow_u16(left: u16, right: u16) -> u16 { 259 │ │ return left ** right 260 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: left, typ: u16 }, { label: None, name: right, typ: u16 }] -> u16 note: ┌─ checked_arithmetic.fe:259:16 @@ -1439,7 +1439,7 @@ note: 262 │ ╭ pub fn pow_u8(left: u8, right: u8) -> u8 { 263 │ │ return left ** right 264 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: left, typ: u8 }, { label: None, name: right, typ: u8 }] -> u8 note: ┌─ checked_arithmetic.fe:263:16 @@ -1461,7 +1461,7 @@ note: 266 │ ╭ pub fn pow_i256(left: i256, right: u256) -> i256 { 267 │ │ return left ** right 268 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: u256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: left, typ: i256 }, { label: None, name: right, typ: u256 }] -> i256 note: ┌─ checked_arithmetic.fe:267:16 @@ -1483,7 +1483,7 @@ note: 270 │ ╭ pub fn pow_i128(left: i128, right: u128) -> i128 { 271 │ │ return left ** right 272 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: u128 }] -> i128 + │ ╰─────^ params: [{ label: None, name: left, typ: i128 }, { label: None, name: right, typ: u128 }] -> i128 note: ┌─ checked_arithmetic.fe:271:16 @@ -1505,7 +1505,7 @@ note: 274 │ ╭ pub fn pow_i64(left: i64, right: u64) -> i64 { 275 │ │ return left ** right 276 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: u64 }] -> i64 + │ ╰─────^ params: [{ label: None, name: left, typ: i64 }, { label: None, name: right, typ: u64 }] -> i64 note: ┌─ checked_arithmetic.fe:275:16 @@ -1527,7 +1527,7 @@ note: 278 │ ╭ pub fn pow_i32(left: i32, right: u32) -> i32 { 279 │ │ return left ** right 280 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: u32 }] -> i32 + │ ╰─────^ params: [{ label: None, name: left, typ: i32 }, { label: None, name: right, typ: u32 }] -> i32 note: ┌─ checked_arithmetic.fe:279:16 @@ -1549,7 +1549,7 @@ note: 282 │ ╭ pub fn pow_i16(left: i16, right: u16) -> i16 { 283 │ │ return left ** right 284 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: u16 }] -> i16 + │ ╰─────^ params: [{ label: None, name: left, typ: i16 }, { label: None, name: right, typ: u16 }] -> i16 note: ┌─ checked_arithmetic.fe:283:16 @@ -1571,7 +1571,7 @@ note: 286 │ ╭ pub fn pow_i8(left: i8, right: u8) -> i8 { 287 │ │ return left ** right 288 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: u8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: left, typ: i8 }, { label: None, name: right, typ: u8 }] -> i8 note: ┌─ checked_arithmetic.fe:287:16 diff --git a/crates/analyzer/tests/snapshots/analysis__const_generics.snap b/crates/analyzer/tests/snapshots/analysis__const_generics.snap index 29aaa68f2e..ee828c54a1 100644 --- a/crates/analyzer/tests/snapshots/analysis__const_generics.snap +++ b/crates/analyzer/tests/snapshots/analysis__const_generics.snap @@ -13,7 +13,7 @@ note: · │ 46 │ │ let array_with_const: Array = [i32(0); 8] 47 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ const_generics.fe:4:13 diff --git a/crates/analyzer/tests/snapshots/analysis__const_local.snap b/crates/analyzer/tests/snapshots/analysis__const_local.snap index a54a900f73..74dc7d665b 100644 --- a/crates/analyzer/tests/snapshots/analysis__const_local.snap +++ b/crates/analyzer/tests/snapshots/analysis__const_local.snap @@ -13,7 +13,7 @@ note: · │ 15 │ │ return C10 16 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ const_local.fe:3:15 diff --git a/crates/analyzer/tests/snapshots/analysis__constructor.snap b/crates/analyzer/tests/snapshots/analysis__constructor.snap index 378773d5d1..6c25bc8bc4 100644 --- a/crates/analyzer/tests/snapshots/analysis__constructor.snap +++ b/crates/analyzer/tests/snapshots/analysis__constructor.snap @@ -15,7 +15,7 @@ note: 8 │ ╭ pub fn read_bar(self) -> u256 { 9 │ │ return self.bar[42] 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ constructor.fe:9:16 diff --git a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap index fd9d3e226e..aa24c2a385 100644 --- a/crates/analyzer/tests/snapshots/analysis__create2_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create2_contract.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn get_my_num() -> u256 { 3 │ │ return 42 4 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ create2_contract.fe:3:16 @@ -20,11 +20,11 @@ note: note: ┌─ create2_contract.fe:8:5 │ - 8 │ ╭ pub fn create2_foo(ctx: Context) -> address { + 8 │ ╭ pub fn create2_foo(mut ctx: Context) -> address { 9 │ │ let foo: Foo = Foo.create2(ctx, 0, 52) 10 │ │ return address(foo) 11 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }] -> address note: ┌─ create2_contract.fe:9:13 @@ -39,7 +39,7 @@ note: │ ^^^ ^ ^^ u256 │ │ │ │ │ u256 - │ Context + │ mut Context note: ┌─ create2_contract.fe:9:24 diff --git a/crates/analyzer/tests/snapshots/analysis__create_contract.snap b/crates/analyzer/tests/snapshots/analysis__create_contract.snap index 95644fd00d..757d455b4f 100644 --- a/crates/analyzer/tests/snapshots/analysis__create_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__create_contract.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn get_my_num() -> u256 { 3 │ │ return 42 4 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ create_contract.fe:3:16 @@ -20,11 +20,11 @@ note: note: ┌─ create_contract.fe:8:5 │ - 8 │ ╭ pub fn create_foo(ctx: Context) -> address { + 8 │ ╭ pub fn create_foo(mut ctx: Context) -> address { 9 │ │ let foo: Foo = Foo.create(ctx, 0) 10 │ │ return address(foo) 11 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }] -> address note: ┌─ create_contract.fe:9:13 @@ -38,7 +38,7 @@ note: 9 │ let foo: Foo = Foo.create(ctx, 0) │ ^^^ ^ u256 │ │ - │ Context + │ mut Context note: ┌─ create_contract.fe:9:24 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 bcce512bf1..e93e8c3220 100644 --- a/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap +++ b/crates/analyzer/tests/snapshots/analysis__create_contract_from_init.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn get_my_num() -> u256 { 3 │ │ return 42 4 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ create_contract_from_init.fe:3:16 @@ -29,7 +29,7 @@ note: 14 │ ╭ pub fn get_foo_addr(self) -> address { 15 │ │ return self.foo_addr 16 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address + │ ╰─────^ params: [self] -> address note: ┌─ create_contract_from_init.fe:15:16 diff --git a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap index eacf4d5606..cacb5c85fb 100644 --- a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap @@ -30,19 +30,19 @@ note: note: ┌─ data_copying_stress.fe:14:5 │ -14 │ ╭ pub fn set_my_vals(self, my_string: String<42>, my_other_string: String<42>, my_u256: u256, my_other_u256: u256) { +14 │ ╭ pub fn set_my_vals(mut self, my_string: String<42>, my_other_string: String<42>, my_u256: u256, my_other_u256: u256) { 15 │ │ self.my_string = my_string 16 │ │ self.my_other_string = my_other_string 17 │ │ self.my_u256 = my_u256 18 │ │ self.my_other_u256 = my_other_u256 19 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_string, typ: String<42> }, { label: None, name: my_other_string, typ: String<42> }, { label: None, name: my_u256, typ: u256 }, { label: None, name: my_other_u256, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_string, typ: String<42> }, { label: None, name: my_other_string, typ: String<42> }, { label: None, name: my_u256, typ: u256 }, { label: None, name: my_other_u256, typ: u256 }] -> () note: ┌─ data_copying_stress.fe:15:9 │ 15 │ self.my_string = my_string - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:15:9 @@ -50,9 +50,9 @@ note: 15 │ self.my_string = my_string │ ^^^^^^^^^^^^^^ ^^^^^^^^^ String<42> │ │ - │ SPtr> + │ mut SPtr> 16 │ self.my_other_string = my_other_string - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:16:9 @@ -60,9 +60,9 @@ note: 16 │ self.my_other_string = my_other_string │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ String<42> │ │ - │ SPtr> + │ mut SPtr> 17 │ self.my_u256 = my_u256 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:17:9 @@ -70,9 +70,9 @@ note: 17 │ self.my_u256 = my_u256 │ ^^^^^^^^^^^^ ^^^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 18 │ self.my_other_u256 = my_other_u256 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:18:9 @@ -80,558 +80,564 @@ note: 18 │ self.my_other_u256 = my_other_u256 │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ data_copying_stress.fe:21:5 │ -21 │ ╭ pub fn set_to_my_other_vals(self) { +21 │ ╭ pub fn set_to_my_other_vals(mut self) { 22 │ │ self.my_string = self.my_other_string 23 │ │ self.my_u256 = self.my_other_u256 24 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ data_copying_stress.fe:22:9 │ 22 │ self.my_string = self.my_other_string - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:22:9 │ 22 │ self.my_string = self.my_other_string - │ ^^^^^^^^^^^^^^ ^^^^ Foo + │ ^^^^^^^^^^^^^^ ^^^^ mut Foo │ │ - │ SPtr> + │ mut SPtr> note: ┌─ data_copying_stress.fe:22:26 │ 22 │ self.my_string = self.my_other_string - │ ^^^^^^^^^^^^^^^^^^^^ SPtr> + │ ^^^^^^^^^^^^^^^^^^^^ mut SPtr> -> SPtr> 23 │ self.my_u256 = self.my_other_u256 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ data_copying_stress.fe:23:9 │ 23 │ self.my_u256 = self.my_other_u256 - │ ^^^^^^^^^^^^ ^^^^ Foo + │ ^^^^^^^^^^^^ ^^^^ mut Foo │ │ - │ SPtr + │ mut SPtr note: ┌─ data_copying_stress.fe:23:24 │ 23 │ self.my_u256 = self.my_other_u256 - │ ^^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr note: - ┌─ data_copying_stress.fe:26:5 + ┌─ data_copying_stress.fe:27:5 │ -26 │ ╭ pub fn multiple_references_shared_memory(my_array: Array) { -27 │ │ let my_2nd_array: Array = my_array -28 │ │ let my_3rd_array: Array = my_2nd_array -29 │ │ assert my_array[3] != 5 +27 │ ╭ pub fn multiple_references_shared_memory(mut my_array: Array) { +28 │ │ let my_2nd_array: Array = my_array +29 │ │ let mut my_3rd_array: Array = my_2nd_array +30 │ │ assert my_array[3] != 5 · │ -37 │ │ assert my_3rd_array[3] == 50 -38 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_array, typ: Array }] -> () +38 │ │ assert my_3rd_array[3] == 50 +39 │ │ } + │ ╰─────^ params: [{ label: None, name: my_array, typ: mut Array }] -> () note: - ┌─ data_copying_stress.fe:27:13 + ┌─ data_copying_stress.fe:28:13 │ -27 │ let my_2nd_array: Array = my_array - │ ^^^^^^^^^^^^ Array -28 │ let my_3rd_array: Array = my_2nd_array +28 │ let my_2nd_array: Array = my_array │ ^^^^^^^^^^^^ Array +29 │ let mut my_3rd_array: Array = my_2nd_array + │ ^^^^^^^^^^^^ mut Array note: - ┌─ data_copying_stress.fe:27:45 + ┌─ data_copying_stress.fe:28:45 │ -27 │ let my_2nd_array: Array = my_array - │ ^^^^^^^^ Array -28 │ let my_3rd_array: Array = my_2nd_array - │ ^^^^^^^^^^^^ Array -29 │ assert my_array[3] != 5 +28 │ let my_2nd_array: Array = my_array + │ ^^^^^^^^ mut Array -> Array +29 │ let mut my_3rd_array: Array = my_2nd_array + │ ^^^^^^^^^^^^ Array +30 │ assert my_array[3] != 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:29:16 + ┌─ data_copying_stress.fe:30:16 │ -29 │ assert my_array[3] != 5 +30 │ assert my_array[3] != 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ data_copying_stress.fe:29:16 + ┌─ data_copying_stress.fe:30:16 │ -29 │ assert my_array[3] != 5 +30 │ assert my_array[3] != 5 │ ^^^^^^^^^^^^^^^^ bool -30 │ my_array[3] = 5 +31 │ my_array[3] = 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:30:9 + ┌─ data_copying_stress.fe:31:9 │ -30 │ my_array[3] = 5 +31 │ my_array[3] = 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 -31 │ assert my_array[3] == 5 + │ mut u256 +32 │ assert my_array[3] == 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:31:16 + ┌─ data_copying_stress.fe:32:16 │ -31 │ assert my_array[3] == 5 +32 │ assert my_array[3] == 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ data_copying_stress.fe:31:16 + ┌─ data_copying_stress.fe:32:16 │ -31 │ assert my_array[3] == 5 +32 │ assert my_array[3] == 5 │ ^^^^^^^^^^^^^^^^ bool -32 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^ ^ u256 │ │ │ Array note: - ┌─ data_copying_stress.fe:32:16 + ┌─ data_copying_stress.fe:33:16 │ -32 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ data_copying_stress.fe:32:16 + ┌─ data_copying_stress.fe:33:16 │ -32 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^^^^^^^^^ bool -33 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:33:16 + ┌─ data_copying_stress.fe:34:16 │ -33 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ data_copying_stress.fe:33:16 + ┌─ data_copying_stress.fe:34:16 │ -33 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] == 5 │ ^^^^^^^^^^^^^^^^^^^^ bool -34 │ my_3rd_array[3] = 50 +35 │ my_3rd_array[3] = 50 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:34:9 + ┌─ data_copying_stress.fe:35:9 │ -34 │ my_3rd_array[3] = 50 +35 │ my_3rd_array[3] = 50 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 -35 │ assert my_array[3] == 50 + │ mut u256 +36 │ assert my_array[3] == 50 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:35:16 + ┌─ data_copying_stress.fe:36:16 │ -35 │ assert my_array[3] == 50 +36 │ assert my_array[3] == 50 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ data_copying_stress.fe:35:16 + ┌─ data_copying_stress.fe:36:16 │ -35 │ assert my_array[3] == 50 +36 │ assert my_array[3] == 50 │ ^^^^^^^^^^^^^^^^^ bool -36 │ assert my_2nd_array[3] == 50 +37 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^ ^ u256 │ │ │ Array note: - ┌─ data_copying_stress.fe:36:16 + ┌─ data_copying_stress.fe:37:16 │ -36 │ assert my_2nd_array[3] == 50 +37 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ │ u256 note: - ┌─ data_copying_stress.fe:36:16 + ┌─ data_copying_stress.fe:37:16 │ -36 │ assert my_2nd_array[3] == 50 +37 │ assert my_2nd_array[3] == 50 │ ^^^^^^^^^^^^^^^^^^^^^ bool -37 │ assert my_3rd_array[3] == 50 +38 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:37:16 + ┌─ data_copying_stress.fe:38:16 │ -37 │ assert my_3rd_array[3] == 50 +38 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ data_copying_stress.fe:37:16 + ┌─ data_copying_stress.fe:38:16 │ -37 │ assert my_3rd_array[3] == 50 +38 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^^^^^^^^^^ bool note: - ┌─ data_copying_stress.fe:40:5 + ┌─ data_copying_stress.fe:41:5 │ -40 │ ╭ pub fn mutate_and_return(my_array: Array) -> Array { -41 │ │ my_array[3] = 5 -42 │ │ return my_array -43 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_array, typ: Array }] -> Array +41 │ ╭ pub fn mutate_and_return(mut my_array: Array) -> Array { +42 │ │ my_array[3] = 5 +43 │ │ return my_array +44 │ │ } + │ ╰─────^ params: [{ label: None, name: my_array, typ: mut Array }] -> Array note: - ┌─ data_copying_stress.fe:41:9 + ┌─ data_copying_stress.fe:42:9 │ -41 │ my_array[3] = 5 +42 │ my_array[3] = 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:41:9 + ┌─ data_copying_stress.fe:42:9 │ -41 │ my_array[3] = 5 +42 │ my_array[3] = 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 -42 │ return my_array - │ ^^^^^^^^ Array + │ mut u256 +43 │ return my_array + │ ^^^^^^^^ mut Array -> Array note: - ┌─ data_copying_stress.fe:45:5 + ┌─ data_copying_stress.fe:46:5 │ -45 │ ╭ pub fn clone_and_return(my_array: Array) -> Array { -46 │ │ return my_array.clone() -47 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_array, typ: Array }] -> Array +46 │ ╭ pub fn clone_and_return(my_array: Array) -> Array { +47 │ │ let a: Array = my_array +48 │ │ return a +49 │ │ } + │ ╰─────^ params: [{ label: None, name: my_array, typ: Array }] -> Array note: - ┌─ data_copying_stress.fe:46:16 + ┌─ data_copying_stress.fe:47:13 │ -46 │ return my_array.clone() - │ ^^^^^^^^ Array +47 │ let a: Array = my_array + │ ^ Array note: - ┌─ data_copying_stress.fe:46:16 + ┌─ data_copying_stress.fe:47:34 │ -46 │ return my_array.clone() - │ ^^^^^^^^^^^^^^^^ Array +47 │ let a: Array = my_array + │ ^^^^^^^^ Array +48 │ return a + │ ^ Array note: - ┌─ data_copying_stress.fe:49:5 + ┌─ data_copying_stress.fe:51:5 │ -49 │ ╭ pub fn clone_mutate_and_return(my_array: Array) -> Array { -50 │ │ my_array.clone()[3] = 5 -51 │ │ return my_array -52 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_array, typ: Array }] -> Array +51 │ ╭ pub fn clone_mutate_and_return(my_array: Array) -> Array { +52 │ │ let mut a: Array = my_array +53 │ │ a[3] = 5 +54 │ │ return my_array +55 │ │ } + │ ╰─────^ params: [{ label: None, name: my_array, typ: Array }] -> Array note: - ┌─ data_copying_stress.fe:50:9 + ┌─ data_copying_stress.fe:52:17 │ -50 │ my_array.clone()[3] = 5 - │ ^^^^^^^^ Array +52 │ let mut a: Array = my_array + │ ^ mut Array note: - ┌─ data_copying_stress.fe:50:9 + ┌─ data_copying_stress.fe:52:38 │ -50 │ my_array.clone()[3] = 5 - │ ^^^^^^^^^^^^^^^^ ^ u256 - │ │ - │ Array +52 │ let mut a: Array = my_array + │ ^^^^^^^^ Array +53 │ a[3] = 5 + │ ^ ^ u256 + │ │ + │ mut Array note: - ┌─ data_copying_stress.fe:50:9 + ┌─ data_copying_stress.fe:53:9 │ -50 │ my_array.clone()[3] = 5 - │ ^^^^^^^^^^^^^^^^^^^ ^ u256 - │ │ - │ u256 -51 │ return my_array +53 │ a[3] = 5 + │ ^^^^ ^ u256 + │ │ + │ mut u256 +54 │ return my_array │ ^^^^^^^^ Array note: - ┌─ data_copying_stress.fe:54:5 + ┌─ data_copying_stress.fe:57:5 │ -54 │ ╭ pub fn assign_my_nums_and_return(self) -> Array { -55 │ │ let my_nums_mem: Array = [0; 5] -56 │ │ self.my_nums[0] = 42 -57 │ │ self.my_nums[1] = 26 +57 │ ╭ pub fn assign_my_nums_and_return(mut self) -> Array { +58 │ │ let mut my_nums_mem: Array = [0; 5] +59 │ │ self.my_nums[0] = 42 +60 │ │ self.my_nums[1] = 26 · │ -62 │ │ return my_nums_mem -63 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array +65 │ │ return my_nums_mem +66 │ │ } + │ ╰─────^ params: [mut self] -> Array note: - ┌─ data_copying_stress.fe:55:13 + ┌─ data_copying_stress.fe:58:17 │ -55 │ let my_nums_mem: Array = [0; 5] - │ ^^^^^^^^^^^ Array +58 │ let mut my_nums_mem: Array = [0; 5] + │ ^^^^^^^^^^^ mut Array note: - ┌─ data_copying_stress.fe:55:44 + ┌─ data_copying_stress.fe:58:48 │ -55 │ let my_nums_mem: Array = [0; 5] - │ ^ ^ u256 - │ │ - │ u256 +58 │ let mut my_nums_mem: Array = [0; 5] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ data_copying_stress.fe:55:43 + ┌─ data_copying_stress.fe:58:47 │ -55 │ let my_nums_mem: Array = [0; 5] - │ ^^^^^^ Array -56 │ self.my_nums[0] = 42 - │ ^^^^ Foo +58 │ let mut my_nums_mem: Array = [0; 5] + │ ^^^^^^ Array +59 │ self.my_nums[0] = 42 + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:56:9 + ┌─ data_copying_stress.fe:59:9 │ -56 │ self.my_nums[0] = 42 +59 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:56:9 + ┌─ data_copying_stress.fe:59:9 │ -56 │ self.my_nums[0] = 42 +59 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -57 │ self.my_nums[1] = 26 - │ ^^^^ Foo + │ mut SPtr +60 │ self.my_nums[1] = 26 + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:57:9 + ┌─ data_copying_stress.fe:60:9 │ -57 │ self.my_nums[1] = 26 +60 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:57:9 + ┌─ data_copying_stress.fe:60:9 │ -57 │ self.my_nums[1] = 26 +60 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -58 │ self.my_nums[2] = 0 - │ ^^^^ Foo + │ mut SPtr +61 │ self.my_nums[2] = 0 + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:58:9 + ┌─ data_copying_stress.fe:61:9 │ -58 │ self.my_nums[2] = 0 +61 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:58:9 + ┌─ data_copying_stress.fe:61:9 │ -58 │ self.my_nums[2] = 0 +61 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -59 │ self.my_nums[3] = 1 - │ ^^^^ Foo + │ mut SPtr +62 │ self.my_nums[3] = 1 + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:59:9 + ┌─ data_copying_stress.fe:62:9 │ -59 │ self.my_nums[3] = 1 +62 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:59:9 + ┌─ data_copying_stress.fe:62:9 │ -59 │ self.my_nums[3] = 1 +62 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -60 │ self.my_nums[4] = 255 - │ ^^^^ Foo + │ mut SPtr +63 │ self.my_nums[4] = 255 + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:60:9 + ┌─ data_copying_stress.fe:63:9 │ -60 │ self.my_nums[4] = 255 +63 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:60:9 + ┌─ data_copying_stress.fe:63:9 │ -60 │ self.my_nums[4] = 255 +63 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -61 │ my_nums_mem = self.my_nums.to_mem() - │ ^^^^^^^^^^^ ^^^^ Foo + │ mut SPtr +64 │ my_nums_mem = self.my_nums.to_mem() + │ ^^^^^^^^^^^ ^^^^ mut Foo │ │ - │ Array + │ mut Array note: - ┌─ data_copying_stress.fe:61:23 + ┌─ data_copying_stress.fe:64:23 │ -61 │ my_nums_mem = self.my_nums.to_mem() - │ ^^^^^^^^^^^^ SPtr> +64 │ my_nums_mem = self.my_nums.to_mem() + │ ^^^^^^^^^^^^ mut SPtr> note: - ┌─ data_copying_stress.fe:61:23 + ┌─ data_copying_stress.fe:64:23 │ -61 │ my_nums_mem = self.my_nums.to_mem() +64 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^ Array -62 │ return my_nums_mem - │ ^^^^^^^^^^^ Array +65 │ return my_nums_mem + │ ^^^^^^^^^^^ mut Array -> Array note: - ┌─ data_copying_stress.fe:65:5 + ┌─ data_copying_stress.fe:68:5 │ -65 │ ╭ pub fn emit_my_event(self, ctx: Context) { -66 │ │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) -67 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () +68 │ ╭ pub fn emit_my_event(self, mut ctx: Context) { +69 │ │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ │ } + │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: - ┌─ data_copying_stress.fe:66:32 + ┌─ data_copying_stress.fe:69:32 │ -66 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^ ^^^^ Foo │ │ - │ Context + │ mut Context note: - ┌─ data_copying_stress.fe:66:37 + ┌─ data_copying_stress.fe:69:37 │ -66 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^ SPtr> note: - ┌─ data_copying_stress.fe:66:37 + ┌─ data_copying_stress.fe:69:37 │ -66 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo │ │ │ String<42> note: - ┌─ data_copying_stress.fe:66:62 + ┌─ data_copying_stress.fe:69:62 │ -66 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ data_copying_stress.fe:66:9 + ┌─ data_copying_stress.fe:69:9 │ -66 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () note: - ┌─ data_copying_stress.fe:69:5 + ┌─ data_copying_stress.fe:72:5 │ -69 │ ╭ fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256) { -70 │ │ emit MyEvent(ctx, my_string, my_u256) -71 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: Some("_"), name: my_string, typ: String<42> }, { label: Some("_"), name: my_u256, typ: u256 }] -> () +72 │ ╭ fn emit_my_event_internal(mut ctx: Context, _ my_string: String<42>, _ my_u256: u256) { +73 │ │ emit MyEvent(ctx, my_string, my_u256) +74 │ │ } + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }, { label: Some("_"), name: my_string, typ: String<42> }, { label: Some("_"), name: my_u256, typ: u256 }] -> () note: - ┌─ data_copying_stress.fe:70:22 + ┌─ data_copying_stress.fe:73:22 │ -70 │ emit MyEvent(ctx, my_string, my_u256) +73 │ emit MyEvent(ctx, my_string, my_u256) │ ^^^ ^^^^^^^^^ ^^^^^^^ u256 │ │ │ │ │ String<42> - │ Context + │ mut Context -> Context note: - ┌─ data_copying_stress.fe:73:5 + ┌─ data_copying_stress.fe:76:5 │ -73 │ ╭ pub fn set_my_addrs(self, my_addrs: Array) { -74 │ │ self.my_addrs = my_addrs -75 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_addrs, typ: Array }] -> () +76 │ ╭ pub fn set_my_addrs(mut self, my_addrs: Array) { +77 │ │ self.my_addrs = my_addrs +78 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: my_addrs, typ: Array }] -> () note: - ┌─ data_copying_stress.fe:74:9 + ┌─ data_copying_stress.fe:77:9 │ -74 │ self.my_addrs = my_addrs - │ ^^^^ Foo +77 │ self.my_addrs = my_addrs + │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:74:9 + ┌─ data_copying_stress.fe:77:9 │ -74 │ self.my_addrs = my_addrs +77 │ self.my_addrs = my_addrs │ ^^^^^^^^^^^^^ ^^^^^^^^ Array │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ data_copying_stress.fe:77:5 + ┌─ data_copying_stress.fe:80:5 │ -77 │ ╭ pub fn get_my_second_addr(self) -> address { -78 │ │ return self.my_addrs[1] -79 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address +80 │ ╭ pub fn get_my_second_addr(self) -> address { +81 │ │ return self.my_addrs[1] +82 │ │ } + │ ╰─────^ params: [self] -> address note: - ┌─ data_copying_stress.fe:78:16 + ┌─ data_copying_stress.fe:81:16 │ -78 │ return self.my_addrs[1] +81 │ return self.my_addrs[1] │ ^^^^ Foo note: - ┌─ data_copying_stress.fe:78:16 + ┌─ data_copying_stress.fe:81:16 │ -78 │ return self.my_addrs[1] +81 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^ ^ u256 │ │ │ SPtr> note: - ┌─ data_copying_stress.fe:78:16 + ┌─ data_copying_stress.fe:81:16 │ -78 │ return self.my_addrs[1] +81 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^^^^ SPtr
-> address diff --git a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap index d350c8dc0a..7df9a7a053 100644 --- a/crates/analyzer/tests/snapshots/analysis__erc20_token.snap +++ b/crates/analyzer/tests/snapshots/analysis__erc20_token.snap @@ -45,7 +45,7 @@ note: 28 │ ╭ pub fn name(self) -> String<100> { 29 │ │ return self._name.to_mem() 30 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<100> + │ ╰─────^ params: [self] -> String<100> note: ┌─ erc20_token.fe:29:16 @@ -71,7 +71,7 @@ note: 32 │ ╭ pub fn symbol(self) -> String<100> { 33 │ │ return self._symbol.to_mem() 34 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<100> + │ ╰─────^ params: [self] -> String<100> note: ┌─ erc20_token.fe:33:16 @@ -97,7 +97,7 @@ note: 36 │ ╭ pub fn decimals(self) -> u8 { 37 │ │ return self._decimals 38 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u8 + │ ╰─────^ params: [self] -> u8 note: ┌─ erc20_token.fe:37:16 @@ -117,7 +117,7 @@ note: 40 │ ╭ pub fn totalSupply(self) -> u256 { 41 │ │ return self._total_supply 42 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ erc20_token.fe:41:16 @@ -137,7 +137,7 @@ note: 44 │ ╭ pub fn balanceOf(self, _ account: address) -> u256 { 45 │ │ return self._balances[account] 46 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: account, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: Some("_"), name: account, typ: address }] -> u256 note: ┌─ erc20_token.fe:45:16 @@ -162,20 +162,20 @@ note: note: ┌─ erc20_token.fe:48:5 │ -48 │ ╭ pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool { +48 │ ╭ pub fn transfer(mut self, mut ctx: Context, recipient: address, value: u256) -> bool { 49 │ │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) 50 │ │ return true 51 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ erc20_token.fe:49:9 │ 49 │ self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:49:37 @@ -200,7 +200,7 @@ note: 53 │ ╭ pub fn allowance(self, owner: address, spender: address) -> u256 { 54 │ │ return self._allowances[owner][spender] 55 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }] -> u256 note: ┌─ erc20_token.fe:54:16 @@ -233,20 +233,20 @@ note: note: ┌─ erc20_token.fe:57:5 │ -57 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { +57 │ ╭ pub fn approve(mut self, mut ctx: Context, spender: address, value: u256) -> bool { 58 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) 59 │ │ return true 60 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ erc20_token.fe:58:9 │ 58 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:58:35 @@ -268,19 +268,19 @@ note: note: ┌─ erc20_token.fe:62:5 │ -62 │ ╭ pub fn transferFrom(self, ctx: Context, sender: address, recipient: address, value: u256) -> bool { +62 │ ╭ pub fn transferFrom(mut self, mut ctx: Context, sender: address, recipient: address, value: u256) -> bool { 63 │ │ assert self._allowances[sender][ctx.msg_sender()] >= value 64 │ │ self._transfer(ctx, sender, recipient, value) 65 │ │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) 66 │ │ return true 67 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: sender, typ: address }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: sender, typ: address }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ erc20_token.fe:63:16 │ 63 │ assert self._allowances[sender][ctx.msg_sender()] >= value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:63:16 @@ -288,15 +288,15 @@ note: 63 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ erc20_token.fe:63:16 │ 63 │ assert self._allowances[sender][ctx.msg_sender()] >= value - │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:63:41 @@ -310,7 +310,7 @@ note: 63 │ assert self._allowances[sender][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:63:16 @@ -322,8 +322,8 @@ note: │ │ │ │ │ │ │ │ │ address │ │ │ address - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:64:9 @@ -331,17 +331,17 @@ note: 64 │ self._transfer(ctx, sender, recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () 65 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^ ^^^ ^^^^^^ ^^^ Context + │ ^^^^ ^^^ ^^^^^^ ^^^ mut Context │ │ │ │ │ │ │ address - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:65:52 │ 65 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ │ address @@ -351,15 +351,15 @@ note: 65 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ erc20_token.fe:65:77 │ 65 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) - │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:65:102 @@ -373,7 +373,7 @@ note: 65 │ self._approve(ctx, owner: sender, spender: ctx.msg_sender(), value: self._allowances[sender][ctx.msg_sender()] - value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:65:77 @@ -392,26 +392,26 @@ note: note: ┌─ erc20_token.fe:69:5 │ -69 │ ╭ pub fn increaseAllowance(self, ctx: Context, spender: address, addedValue: u256) -> bool { +69 │ ╭ pub fn increaseAllowance(mut self, mut ctx: Context, spender: address, addedValue: u256) -> bool { 70 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) 71 │ │ return true 72 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: spender, typ: address }, { label: None, name: addedValue, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: spender, typ: address }, { label: None, name: addedValue, typ: u256 }] -> bool note: ┌─ erc20_token.fe:70:9 │ 70 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:70:35 │ 70 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ mut ERC20 │ │ │ │ │ address │ address @@ -420,9 +420,9 @@ note: ┌─ erc20_token.fe:70:69 │ 70 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) - │ ^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ erc20_token.fe:70:86 @@ -436,7 +436,7 @@ note: 70 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:70:69 @@ -444,7 +444,7 @@ note: 70 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] + addedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:70:69 @@ -463,26 +463,26 @@ note: note: ┌─ erc20_token.fe:74:5 │ -74 │ ╭ pub fn decreaseAllowance(self, ctx: Context, spender: address, subtractedValue: u256) -> bool { +74 │ ╭ pub fn decreaseAllowance(mut self, mut ctx: Context, spender: address, subtractedValue: u256) -> bool { 75 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) 76 │ │ return true 77 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: spender, typ: address }, { label: None, name: subtractedValue, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: spender, typ: address }, { label: None, name: subtractedValue, typ: u256 }] -> bool note: ┌─ erc20_token.fe:75:9 │ 75 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ ERC20 + │ │ mut Context + │ mut ERC20 note: ┌─ erc20_token.fe:75:35 │ 75 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^ mut ERC20 │ │ │ │ │ address │ address @@ -491,9 +491,9 @@ note: ┌─ erc20_token.fe:75:69 │ 75 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) - │ ^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ erc20_token.fe:75:86 @@ -507,7 +507,7 @@ note: 75 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:75:69 @@ -515,7 +515,7 @@ note: 75 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value: self._allowances[ctx.msg_sender()][spender] - subtractedValue) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:75:69 @@ -534,14 +534,14 @@ note: note: ┌─ erc20_token.fe:79:5 │ -79 │ ╭ fn _transfer(self, ctx: Context, sender: address, recipient: address, value: u256) { +79 │ ╭ fn _transfer(mut self, mut ctx: Context, sender: address, recipient: address, value: u256) { 80 │ │ assert sender != address(0) 81 │ │ assert recipient != address(0) 82 │ │ _before_token_transfer(from: sender, to: recipient, value) · │ 85 │ │ emit Transfer(ctx, from: sender, to: recipient, value) 86 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: sender, typ: address }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: sender, typ: address }, { label: None, name: recipient, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ erc20_token.fe:80:16 @@ -590,7 +590,7 @@ note: 82 │ _before_token_transfer(from: sender, to: recipient, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () 83 │ self._balances[sender] = self._balances[sender] - value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:83:9 @@ -598,15 +598,15 @@ note: 83 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:83:9 │ 83 │ self._balances[sender] = self._balances[sender] - value - │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:83:34 @@ -614,7 +614,7 @@ note: 83 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:83:34 @@ -622,7 +622,7 @@ note: 83 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:83:34 @@ -630,7 +630,7 @@ note: 83 │ self._balances[sender] = self._balances[sender] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 84 │ self._balances[recipient] = self._balances[recipient] + value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:84:9 @@ -638,15 +638,15 @@ note: 84 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^ ^^^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:84:9 │ 84 │ self._balances[recipient] = self._balances[recipient] + value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:84:37 @@ -654,7 +654,7 @@ note: 84 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^ ^^^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:84:37 @@ -662,7 +662,7 @@ note: 84 │ self._balances[recipient] = self._balances[recipient] + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:84:37 @@ -674,19 +674,19 @@ note: │ │ │ │ │ │ │ address │ │ address - │ Context + │ mut Context -> Context note: ┌─ erc20_token.fe:88:5 │ -88 │ ╭ fn _mint(self, ctx: Context, account: address, value: u256) { +88 │ ╭ fn _mint(mut self, mut ctx: Context, account: address, value: u256) { 89 │ │ assert account != address(0) 90 │ │ _before_token_transfer(from: address(0), to: account, value) 91 │ │ self._total_supply = self._total_supply + value 92 │ │ self._balances[account] = self._balances[account] + value 93 │ │ emit Transfer(ctx, from: address(0), to: account, value) 94 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: account, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: account, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ erc20_token.fe:89:16 @@ -725,15 +725,15 @@ note: 90 │ _before_token_transfer(from: address(0), to: account, value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () 91 │ self._total_supply = self._total_supply + value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:91:9 │ 91 │ self._total_supply = self._total_supply + value - │ ^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:91:30 @@ -741,7 +741,7 @@ note: 91 │ self._total_supply = self._total_supply + value │ ^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:91:30 @@ -749,7 +749,7 @@ note: 91 │ self._total_supply = self._total_supply + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 92 │ self._balances[account] = self._balances[account] + value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:92:9 @@ -757,15 +757,15 @@ note: 92 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:92:9 │ 92 │ self._balances[account] = self._balances[account] + value - │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:92:35 @@ -773,7 +773,7 @@ note: 92 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:92:35 @@ -781,7 +781,7 @@ note: 92 │ self._balances[account] = self._balances[account] + value │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:92:35 @@ -791,7 +791,7 @@ note: 93 │ emit Transfer(ctx, from: address(0), to: account, value) │ ^^^ ^ u256 │ │ - │ Context + │ mut Context -> Context note: ┌─ erc20_token.fe:93:34 @@ -805,14 +805,14 @@ note: note: ┌─ erc20_token.fe:96:5 │ - 96 │ ╭ fn _burn(self, ctx: Context, account: address, value: u256) { + 96 │ ╭ fn _burn(mut self, mut ctx: Context, account: address, value: u256) { 97 │ │ assert account != address(0) 98 │ │ _before_token_transfer(from: account, to: address(0), value) 99 │ │ self._balances[account] = self._balances[account] - value 100 │ │ self._total_supply = self._total_supply - value 101 │ │ emit Transfer(ctx, from: account, to: address(0), value) 102 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: account, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: account, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ erc20_token.fe:97:16 @@ -852,7 +852,7 @@ note: 98 │ _before_token_transfer(from: account, to: address(0), value) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () 99 │ self._balances[account] = self._balances[account] - value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:99:9 @@ -860,15 +860,15 @@ note: 99 │ self._balances[account] = self._balances[account] - value │ ^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:99:9 │ 99 │ self._balances[account] = self._balances[account] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:99:35 @@ -876,7 +876,7 @@ note: 99 │ self._balances[account] = self._balances[account] - value │ ^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:99:35 @@ -884,7 +884,7 @@ note: 99 │ self._balances[account] = self._balances[account] - value │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:99:35 @@ -892,15 +892,15 @@ note: 99 │ self._balances[account] = self._balances[account] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 100 │ self._total_supply = self._total_supply - value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:100:9 │ 100 │ self._total_supply = self._total_supply - value - │ ^^^^^^^^^^^^^^^^^^ ^^^^ ERC20 + │ ^^^^^^^^^^^^^^^^^^ ^^^^ mut ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:100:30 @@ -908,7 +908,7 @@ note: 100 │ self._total_supply = self._total_supply - value │ ^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ erc20_token.fe:100:30 @@ -919,7 +919,7 @@ note: │ ^^^ ^^^^^^^ ^ u256 │ │ │ │ │ address - │ Context + │ mut Context -> Context note: ┌─ erc20_token.fe:101:47 @@ -932,13 +932,13 @@ note: note: ┌─ erc20_token.fe:104:5 │ -104 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { +104 │ ╭ fn _approve(mut self, mut ctx: Context, owner: address, spender: address, value: u256) { 105 │ │ assert owner != address(0) 106 │ │ assert spender != address(0) 107 │ │ self._allowances[owner][spender] = value 108 │ │ emit Approval(ctx, owner, spender, value) 109 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ erc20_token.fe:105:16 @@ -976,7 +976,7 @@ note: 106 │ assert spender != address(0) │ ^^^^^^^^^^^^^^^^^^^^^ bool 107 │ self._allowances[owner][spender] = value - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:107:9 @@ -984,7 +984,7 @@ note: 107 │ self._allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^ ^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ erc20_token.fe:107:9 @@ -992,7 +992,7 @@ note: 107 │ self._allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ erc20_token.fe:107:9 @@ -1000,27 +1000,27 @@ note: 107 │ self._allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 108 │ emit Approval(ctx, owner, spender, value) │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256 │ │ │ │ │ │ │ address │ │ address - │ Context + │ mut Context -> Context note: ┌─ erc20_token.fe:111:5 │ -111 │ ╭ fn _setup_decimals(self, _ decimals_: u8) { +111 │ ╭ fn _setup_decimals(mut self, _ decimals_: u8) { 112 │ │ self._decimals = decimals_ 113 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: decimals_, typ: u8 }] -> () + │ ╰─────^ params: [mut self, { label: Some("_"), name: decimals_, typ: u8 }] -> () note: ┌─ erc20_token.fe:112:9 │ 112 │ self._decimals = decimals_ - │ ^^^^ ERC20 + │ ^^^^ mut ERC20 note: ┌─ erc20_token.fe:112:9 @@ -1028,12 +1028,12 @@ note: 112 │ self._decimals = decimals_ │ ^^^^^^^^^^^^^^ ^^^^^^^^^ u8 │ │ - │ SPtr + │ mut SPtr note: ┌─ erc20_token.fe:115:5 │ 115 │ fn _before_token_transfer(from: address, to: address, _ value: u256) {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ self: None, params: [{ label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: Some("_"), name: value, typ: u256 }] -> () + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ params: [{ label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: Some("_"), name: value, typ: u256 }] -> () diff --git a/crates/analyzer/tests/snapshots/analysis__events.snap b/crates/analyzer/tests/snapshots/analysis__events.snap index fac8b3a3db..3310f2d3d2 100644 --- a/crates/analyzer/tests/snapshots/analysis__events.snap +++ b/crates/analyzer/tests/snapshots/analysis__events.snap @@ -43,7 +43,7 @@ note: 23 │ ╭ pub fn emit_nums(ctx: Context) { 24 │ │ emit Nums(ctx, num1: 26, num2: 42) 25 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> () note: ┌─ events.fe:24:19 @@ -60,7 +60,7 @@ note: 27 │ ╭ pub fn emit_bases(ctx: Context, addr: address) { 28 │ │ emit Bases(ctx, num: 26, addr) 29 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr, typ: address }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr, typ: address }] -> () note: ┌─ events.fe:28:20 @@ -77,7 +77,7 @@ note: 31 │ ╭ pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array) { 32 │ │ emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) 33 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr, typ: address }, { label: None, name: my_bytes, typ: Array }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr, typ: address }, { label: None, name: my_bytes, typ: Array }] -> () note: ┌─ events.fe:32:18 @@ -94,42 +94,42 @@ note: ┌─ events.fe:35:5 │ 35 │ ╭ pub fn emit_addresses(ctx: Context, addr1: address, addr2: address) { -36 │ │ let addrs: Array = [address(0); 2] +36 │ │ let mut addrs: Array = [address(0); 2] 37 │ │ addrs[0] = addr1 38 │ │ addrs[1] = addr2 39 │ │ emit Addresses(ctx, addrs) 40 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr1, typ: address }, { label: None, name: addr2, typ: address }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }, { label: None, name: addr1, typ: address }, { label: None, name: addr2, typ: address }] -> () note: - ┌─ events.fe:36:13 + ┌─ events.fe:36:17 │ -36 │ let addrs: Array = [address(0); 2] - │ ^^^^^ Array +36 │ let mut addrs: Array = [address(0); 2] + │ ^^^^^ mut Array note: - ┌─ events.fe:36:49 + ┌─ events.fe:36:53 │ -36 │ let addrs: Array = [address(0); 2] - │ ^ u256 +36 │ let mut addrs: Array = [address(0); 2] + │ ^ u256 note: - ┌─ events.fe:36:41 + ┌─ events.fe:36:45 │ -36 │ let addrs: Array = [address(0); 2] - │ ^^^^^^^^^^ ^ u256 - │ │ - │ address +36 │ let mut addrs: Array = [address(0); 2] + │ ^^^^^^^^^^ ^ u256 + │ │ + │ address note: - ┌─ events.fe:36:40 + ┌─ events.fe:36:44 │ -36 │ let addrs: Array = [address(0); 2] - │ ^^^^^^^^^^^^^^^ Array +36 │ let mut addrs: Array = [address(0); 2] + │ ^^^^^^^^^^^^^^^ Array 37 │ addrs[0] = addr1 │ ^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ events.fe:37:9 @@ -137,11 +137,11 @@ note: 37 │ addrs[0] = addr1 │ ^^^^^^^^ ^^^^^ address │ │ - │ address + │ mut address 38 │ addrs[1] = addr2 │ ^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ events.fe:38:9 @@ -149,9 +149,9 @@ note: 38 │ addrs[1] = addr2 │ ^^^^^^^^ ^^^^^ address │ │ - │ address + │ mut address 39 │ emit Addresses(ctx, addrs) - │ ^^^ ^^^^^ Array + │ ^^^ ^^^^^ mut Array -> Array │ │ │ Context diff --git a/crates/analyzer/tests/snapshots/analysis__external_contract.snap b/crates/analyzer/tests/snapshots/analysis__external_contract.snap index 9ed406c98c..c7f039bd0e 100644 --- a/crates/analyzer/tests/snapshots/analysis__external_contract.snap +++ b/crates/analyzer/tests/snapshots/analysis__external_contract.snap @@ -19,7 +19,7 @@ note: 8 │ ╭ pub fn emit_event(self, ctx: Context, my_num: u256, my_addrs: Array, my_string: String<11>) { 9 │ │ emit MyEvent(ctx, my_num, my_addrs, my_string) 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: my_num, typ: u256 }, { label: None, name: my_addrs, typ: Array }, { label: None, name: my_string, typ: String<11> }] -> () + │ ╰─────^ params: [self, { label: None, name: ctx, typ: Context }, { label: None, name: my_num, typ: u256 }, { label: None, name: my_addrs, typ: Array }, { label: None, name: my_string, typ: String<11> }] -> () note: ┌─ external_contract.fe:9:22 @@ -35,37 +35,37 @@ note: ┌─ external_contract.fe:12:5 │ 12 │ ╭ pub fn build_array(self, a: u256, b: u256) -> Array { -13 │ │ let my_array: Array = [0; 3] +13 │ │ let mut my_array: Array = [0; 3] 14 │ │ my_array[0] = a 15 │ │ my_array[1] = a * b 16 │ │ my_array[2] = b 17 │ │ return my_array 18 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> Array + │ ╰─────^ params: [self, { label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> Array note: - ┌─ external_contract.fe:13:13 + ┌─ external_contract.fe:13:17 │ -13 │ let my_array: Array = [0; 3] - │ ^^^^^^^^ Array +13 │ let mut my_array: Array = [0; 3] + │ ^^^^^^^^ mut Array note: - ┌─ external_contract.fe:13:41 + ┌─ external_contract.fe:13:45 │ -13 │ let my_array: Array = [0; 3] - │ ^ ^ u256 - │ │ - │ u256 +13 │ let mut my_array: Array = [0; 3] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ external_contract.fe:13:40 + ┌─ external_contract.fe:13:44 │ -13 │ let my_array: Array = [0; 3] - │ ^^^^^^ Array +13 │ let mut my_array: Array = [0; 3] + │ ^^^^^^ Array 14 │ my_array[0] = a │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ external_contract.fe:14:9 @@ -73,11 +73,11 @@ note: 14 │ my_array[0] = a │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 15 │ my_array[1] = a * b │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ external_contract.fe:15:9 @@ -86,7 +86,7 @@ note: │ ^^^^^^^^^^^ ^ ^ u256 │ │ │ │ │ u256 - │ u256 + │ mut u256 note: ┌─ external_contract.fe:15:23 @@ -96,7 +96,7 @@ note: 16 │ my_array[2] = b │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ external_contract.fe:16:9 @@ -104,9 +104,9 @@ note: 16 │ my_array[2] = b │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 17 │ return my_array - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array -> Array note: ┌─ external_contract.fe:20:5 @@ -114,7 +114,7 @@ note: 20 │ ╭ pub fn pure_add(_ x: u256, _ y: u256) -> u256 { 21 │ │ return x + y 22 │ │ } - │ ╰─────^ self: None, params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 note: ┌─ external_contract.fe:21:16 @@ -137,7 +137,7 @@ note: 27 │ │ let foo: Foo = Foo(foo_address) 28 │ │ foo.emit_event(ctx, my_num, my_addrs, my_string) 29 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: foo_address, typ: address }, { label: None, name: my_num, typ: u256 }, { label: None, name: my_addrs, typ: Array }, { label: None, name: my_string, typ: String<11> }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }, { label: None, name: foo_address, typ: address }, { label: None, name: my_num, typ: u256 }, { label: None, name: my_addrs, typ: Array }, { label: None, name: my_string, typ: String<11> }] -> () note: ┌─ external_contract.fe:27:13 @@ -177,7 +177,7 @@ note: 32 │ │ let foo: Foo = Foo(foo_address) 33 │ │ return foo.build_array(a, b) 34 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: foo_address, typ: address }, { label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> Array + │ ╰─────^ params: [{ label: None, name: foo_address, typ: address }, { label: None, name: a, typ: u256 }, { label: None, name: b, typ: u256 }] -> Array note: ┌─ external_contract.fe:32:13 @@ -214,7 +214,7 @@ note: 36 │ ╭ pub fn add(_ x: u256, _ y: u256) -> u256 { 37 │ │ return Foo::pure_add(x, y) 38 │ │ } - │ ╰─────^ self: None, params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 note: ┌─ external_contract.fe:37:30 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 3007121ce5..de989588b6 100644 --- a/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap +++ b/crates/analyzer/tests/snapshots/analysis__for_loop_with_break.snap @@ -7,42 +7,42 @@ note: ┌─ for_loop_with_break.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let my_array: Array = [0; 3] + 3 │ │ let mut my_array: Array = [0; 3] 4 │ │ my_array[0] = 5 5 │ │ my_array[1] = 10 · │ 14 │ │ return sum 15 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ for_loop_with_break.fe:3:13 + ┌─ for_loop_with_break.fe:3:17 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^^^ mut Array · -7 │ let sum: u256 = 0 - │ ^^^ u256 +7 │ let mut sum: u256 = 0 + │ ^^^ mut u256 8 │ for i in my_array { │ ^ u256 note: - ┌─ for_loop_with_break.fe:3:41 + ┌─ for_loop_with_break.fe:3:45 │ -3 │ let my_array: Array = [0; 3] - │ ^ ^ u256 - │ │ - │ u256 +3 │ let mut my_array: Array = [0; 3] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ for_loop_with_break.fe:3:40 + ┌─ for_loop_with_break.fe:3:44 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^ Array 4 │ my_array[0] = 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_break.fe:4:9 @@ -50,11 +50,11 @@ note: 4 │ my_array[0] = 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 5 │ my_array[1] = 10 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_break.fe:5:9 @@ -62,11 +62,11 @@ note: 5 │ my_array[1] = 10 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 6 │ my_array[2] = 15 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_break.fe:6:9 @@ -74,16 +74,16 @@ note: 6 │ my_array[2] = 15 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ u256 -7 │ let sum: u256 = 0 - │ ^ u256 + │ mut u256 +7 │ let mut sum: u256 = 0 + │ ^ u256 8 │ for i in my_array { - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array 9 │ sum = sum + i │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ for_loop_with_break.fe:9:19 @@ -93,7 +93,7 @@ note: 10 │ if sum == 15 { │ ^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ for_loop_with_break.fe:10:16 @@ -102,6 +102,6 @@ note: │ ^^^^^^^^^ bool · 14 │ return sum - │ ^^^ u256 + │ ^^^ mut u256 -> u256 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 a8cc59fae9..52d2bb56c8 100644 --- a/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap +++ b/crates/analyzer/tests/snapshots/analysis__for_loop_with_continue.snap @@ -7,42 +7,42 @@ note: ┌─ for_loop_with_continue.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let my_array: Array = [0; 5] + 3 │ │ let mut my_array: Array = [0; 5] 4 │ │ my_array[0] = 2 5 │ │ my_array[1] = 3 · │ 16 │ │ return sum 17 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ for_loop_with_continue.fe:3:13 + ┌─ for_loop_with_continue.fe:3:17 │ - 3 │ let my_array: Array = [0; 5] - │ ^^^^^^^^ Array + 3 │ let mut my_array: Array = [0; 5] + │ ^^^^^^^^ mut Array · - 9 │ let sum: u256 = 0 - │ ^^^ u256 + 9 │ let mut sum: u256 = 0 + │ ^^^ mut u256 10 │ for i in my_array { │ ^ u256 note: - ┌─ for_loop_with_continue.fe:3:41 + ┌─ for_loop_with_continue.fe:3:45 │ -3 │ let my_array: Array = [0; 5] - │ ^ ^ u256 - │ │ - │ u256 +3 │ let mut my_array: Array = [0; 5] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ for_loop_with_continue.fe:3:40 + ┌─ for_loop_with_continue.fe:3:44 │ -3 │ let my_array: Array = [0; 5] - │ ^^^^^^ Array +3 │ let mut my_array: Array = [0; 5] + │ ^^^^^^ Array 4 │ my_array[0] = 2 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_continue.fe:4:9 @@ -50,11 +50,11 @@ note: 4 │ my_array[0] = 2 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 5 │ my_array[1] = 3 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_continue.fe:5:9 @@ -62,11 +62,11 @@ note: 5 │ my_array[1] = 3 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 6 │ my_array[2] = 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_continue.fe:6:9 @@ -74,11 +74,11 @@ note: 6 │ my_array[2] = 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 7 │ my_array[3] = 6 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_continue.fe:7:9 @@ -86,11 +86,11 @@ note: 7 │ my_array[3] = 6 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 8 │ my_array[4] = 9 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_continue.fe:8:9 @@ -98,11 +98,11 @@ note: 8 │ my_array[4] = 9 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 - 9 │ let sum: u256 = 0 - │ ^ u256 + │ mut u256 + 9 │ let mut sum: u256 = 0 + │ ^ u256 10 │ for i in my_array { - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array 11 │ if i % 2 == 0 { │ ^ ^ u256 │ │ @@ -125,8 +125,8 @@ note: 14 │ sum = sum + i │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ for_loop_with_continue.fe:14:19 @@ -135,6 +135,6 @@ note: │ ^^^^^^^ u256 15 │ } 16 │ return sum - │ ^^^ u256 + │ ^^^ mut u256 -> u256 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 b5b7e0a6db..ea39c1fbb4 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 @@ -7,42 +7,42 @@ note: ┌─ for_loop_with_static_array.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let my_array: Array = [0; 3] + 3 │ │ let mut my_array: Array = [0; 3] 4 │ │ my_array[0] = 5 5 │ │ my_array[1] = 10 · │ 11 │ │ return sum 12 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ for_loop_with_static_array.fe:3:13 + ┌─ for_loop_with_static_array.fe:3:17 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^^^ mut Array · -7 │ let sum: u256 = 0 - │ ^^^ u256 +7 │ let mut sum: u256 = 0 + │ ^^^ mut u256 8 │ for i in my_array { │ ^ u256 note: - ┌─ for_loop_with_static_array.fe:3:41 + ┌─ for_loop_with_static_array.fe:3:45 │ -3 │ let my_array: Array = [0; 3] - │ ^ ^ u256 - │ │ - │ u256 +3 │ let mut my_array: Array = [0; 3] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ for_loop_with_static_array.fe:3:40 + ┌─ for_loop_with_static_array.fe:3:44 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^ Array 4 │ my_array[0] = 5 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_static_array.fe:4:9 @@ -50,11 +50,11 @@ note: 4 │ my_array[0] = 5 │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 5 │ my_array[1] = 10 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_static_array.fe:5:9 @@ -62,11 +62,11 @@ note: 5 │ my_array[1] = 10 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 6 │ my_array[2] = 15 │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ for_loop_with_static_array.fe:6:9 @@ -74,16 +74,16 @@ note: 6 │ my_array[2] = 15 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ u256 -7 │ let sum: u256 = 0 - │ ^ u256 + │ mut u256 +7 │ let mut sum: u256 = 0 + │ ^ u256 8 │ for i in my_array { - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array 9 │ sum = sum + i │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ for_loop_with_static_array.fe:9:19 @@ -92,6 +92,6 @@ note: │ ^^^^^^^ u256 10 │ } 11 │ return sum - │ ^^^ u256 + │ ^^^ mut u256 -> u256 diff --git a/crates/analyzer/tests/snapshots/analysis__guest_book.snap b/crates/analyzer/tests/snapshots/analysis__guest_book.snap index 3f6220bbaa..58a6bf7d8a 100644 --- a/crates/analyzer/tests/snapshots/analysis__guest_book.snap +++ b/crates/analyzer/tests/snapshots/analysis__guest_book.snap @@ -18,20 +18,20 @@ note: note: ┌─ guest_book.fe:14:5 │ -14 │ ╭ pub fn sign(self, ctx: Context, book_msg: String<100>) { +14 │ ╭ pub fn sign(mut self, ctx: Context, book_msg: String<100>) { 15 │ │ // All storage access is explicit using `self.` 16 │ │ self.messages[ctx.msg_sender()] = book_msg 17 │ │ · │ 20 │ │ emit Signed(ctx, book_msg) 21 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: book_msg, typ: String<100> }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }, { label: None, name: book_msg, typ: String<100> }] -> () note: ┌─ guest_book.fe:16:9 │ 16 │ self.messages[ctx.msg_sender()] = book_msg - │ ^^^^ GuestBook + │ ^^^^ mut GuestBook note: ┌─ guest_book.fe:16:9 @@ -39,7 +39,7 @@ note: 16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^^^^^^^^^^ ^^^ Context │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ guest_book.fe:16:23 @@ -53,7 +53,7 @@ note: 16 │ self.messages[ctx.msg_sender()] = book_msg │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ String<100> │ │ - │ SPtr> + │ mut SPtr> · 20 │ emit Signed(ctx, book_msg) │ ^^^ ^^^^^^^^ String<100> @@ -68,7 +68,7 @@ note: 25 │ │ // has to be done explicitly via `to_mem()` 26 │ │ return self.messages[addr].to_mem() 27 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: addr, typ: address }] -> String<100> + │ ╰─────^ params: [self, { label: None, name: addr, typ: address }] -> String<100> note: ┌─ guest_book.fe:26:16 diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement.snap b/crates/analyzer/tests/snapshots/analysis__if_statement.snap index 8ac36bd0ef..65044826a1 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement.snap @@ -13,7 +13,7 @@ note: 6 │ │ return 0 7 │ │ } 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: input, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: input, typ: u256 }] -> u256 note: ┌─ if_statement.fe:3:12 diff --git a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap index 58a38f5ea5..8cd438f8f7 100644 --- a/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap +++ b/crates/analyzer/tests/snapshots/analysis__if_statement_2.snap @@ -13,7 +13,7 @@ note: · │ 8 │ │ return 0 9 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: val, typ: u256 }] -> u256 note: ┌─ if_statement_2.fe:3:12 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 a16ad8363b..0eab265537 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 @@ -13,7 +13,7 @@ note: · │ 9 │ │ } 10 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ if_statement_with_block_declaration.fe:4:17 diff --git a/crates/analyzer/tests/snapshots/analysis__keccak.snap b/crates/analyzer/tests/snapshots/analysis__keccak.snap index 72e0f003ce..93d830c0d3 100644 --- a/crates/analyzer/tests/snapshots/analysis__keccak.snap +++ b/crates/analyzer/tests/snapshots/analysis__keccak.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn return_hash_from_u8(val: Array) -> u256 { 3 │ │ return keccak256(val) 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: Array }] -> u256 + │ ╰─────^ params: [{ label: None, name: val, typ: Array }] -> u256 note: ┌─ keccak.fe:3:26 @@ -29,7 +29,7 @@ note: 6 │ ╭ pub fn return_hash_from_foo(val: Array) -> u256 { 7 │ │ return keccak256(val) 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: Array }] -> u256 + │ ╰─────^ params: [{ label: None, name: val, typ: Array }] -> u256 note: ┌─ keccak.fe:7:26 @@ -49,7 +49,7 @@ note: 10 │ ╭ pub fn return_hash_from_u256(val: Array) -> u256 { 11 │ │ return keccak256(val) 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: Array }] -> u256 + │ ╰─────^ params: [{ label: None, name: val, typ: Array }] -> u256 note: ┌─ keccak.fe:11:26 diff --git a/crates/analyzer/tests/snapshots/analysis__math.snap b/crates/analyzer/tests/snapshots/analysis__math.snap index 857f06db98..f0e6c4b1c9 100644 --- a/crates/analyzer/tests/snapshots/analysis__math.snap +++ b/crates/analyzer/tests/snapshots/analysis__math.snap @@ -7,22 +7,22 @@ note: ┌─ math.fe:2:5 │ 2 │ ╭ pub fn sqrt(val: u256) -> u256 { - 3 │ │ let z: u256 + 3 │ │ let mut z: u256 4 │ │ if val > 3 { 5 │ │ z = val · │ 14 │ │ return z 15 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: val, typ: u256 }] -> u256 note: - ┌─ math.fe:3:13 + ┌─ math.fe:3:17 │ -3 │ let z: u256 - │ ^ u256 +3 │ let mut z: u256 + │ ^ mut u256 · -6 │ let x: u256 = val / 2 + 1 - │ ^ u256 +6 │ let mut x: u256 = val / 2 + 1 + │ ^ mut u256 note: ┌─ math.fe:4:12 @@ -40,29 +40,29 @@ note: 5 │ z = val │ ^ ^^^ u256 │ │ - │ u256 -6 │ let x: u256 = val / 2 + 1 - │ ^^^ ^ u256 - │ │ - │ u256 + │ mut u256 +6 │ let mut x: u256 = val / 2 + 1 + │ ^^^ ^ u256 + │ │ + │ u256 note: - ┌─ math.fe:6:27 + ┌─ math.fe:6:31 │ -6 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^ ^ u256 - │ │ - │ u256 +6 │ let mut x: u256 = val / 2 + 1 + │ ^^^^^^^ ^ u256 + │ │ + │ u256 note: - ┌─ math.fe:6:27 + ┌─ math.fe:6:31 │ -6 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^^^^^ u256 +6 │ let mut x: u256 = val / 2 + 1 + │ ^^^^^^^^^^^ u256 7 │ while x < z { - │ ^ ^ u256 + │ ^ ^ mut u256 │ │ - │ u256 + │ mut u256 note: ┌─ math.fe:7:19 @@ -70,20 +70,20 @@ note: 7 │ while x < z { │ ^^^^^ bool 8 │ z = x - │ ^ ^ u256 + │ ^ ^ mut u256 -> u256 │ │ - │ u256 + │ mut u256 9 │ x = (val / x + x) / 2 - │ ^ ^^^ ^ u256 + │ ^ ^^^ ^ mut u256 │ │ │ │ │ u256 - │ u256 + │ mut u256 note: ┌─ math.fe:9:22 │ 9 │ x = (val / x + x) / 2 - │ ^^^^^^^ ^ u256 + │ ^^^^^^^ ^ mut u256 │ │ │ u256 @@ -114,10 +114,10 @@ note: 12 │ z = 1 │ ^ ^ u256 │ │ - │ u256 + │ mut u256 13 │ } 14 │ return z - │ ^ u256 + │ ^ mut u256 -> u256 note: ┌─ math.fe:17:5 @@ -125,7 +125,7 @@ note: 17 │ ╭ pub fn min(x: u256, y: u256) -> u256 { 18 │ │ return x if x < y else y 19 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ math.fe:18:21 diff --git a/crates/analyzer/tests/snapshots/analysis__module_const.snap b/crates/analyzer/tests/snapshots/analysis__module_const.snap index ecc95f9b18..7b4e91b2f6 100644 --- a/crates/analyzer/tests/snapshots/analysis__module_const.snap +++ b/crates/analyzer/tests/snapshots/analysis__module_const.snap @@ -43,7 +43,7 @@ note: 13 │ │ let _my_array: MY_ARRAY = [true; { C4 }] 14 │ │ return C4 15 │ │ } - │ ╰─────^ self: None, params: [] -> i32 + │ ╰─────^ params: [] -> i32 note: ┌─ module_const.fe:10:15 diff --git a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap index 2544d9d468..00b6d1aac3 100644 --- a/crates/analyzer/tests/snapshots/analysis__module_level_events.snap +++ b/crates/analyzer/tests/snapshots/analysis__module_level_events.snap @@ -19,7 +19,7 @@ note: 8 │ ╭ fn transfer(ctx: Context, to: address, value: u256) { 9 │ │ emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) 10 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ module_level_events.fe:9:23 diff --git a/crates/analyzer/tests/snapshots/analysis__multi_param.snap b/crates/analyzer/tests/snapshots/analysis__multi_param.snap index 63d2c80d46..85f71cc5f7 100644 --- a/crates/analyzer/tests/snapshots/analysis__multi_param.snap +++ b/crates/analyzer/tests/snapshots/analysis__multi_param.snap @@ -7,37 +7,37 @@ note: ┌─ multi_param.fe:2:5 │ 2 │ ╭ pub fn bar(x: u256, y: u256, z: u256) -> Array { -3 │ │ let my_array: Array = [0; 3] +3 │ │ let mut my_array: Array = [0; 3] 4 │ │ my_array[0] = x 5 │ │ my_array[1] = y 6 │ │ my_array[2] = z 7 │ │ return my_array 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }, { label: None, name: z, typ: u256 }] -> Array + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }, { label: None, name: z, typ: u256 }] -> Array note: - ┌─ multi_param.fe:3:13 + ┌─ multi_param.fe:3:17 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^^^ mut Array note: - ┌─ multi_param.fe:3:41 + ┌─ multi_param.fe:3:45 │ -3 │ let my_array: Array = [0; 3] - │ ^ ^ u256 - │ │ - │ u256 +3 │ let mut my_array: Array = [0; 3] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ multi_param.fe:3:40 + ┌─ multi_param.fe:3:44 │ -3 │ let my_array: Array = [0; 3] - │ ^^^^^^ Array +3 │ let mut my_array: Array = [0; 3] + │ ^^^^^^ Array 4 │ my_array[0] = x │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ multi_param.fe:4:9 @@ -45,11 +45,11 @@ note: 4 │ my_array[0] = x │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 5 │ my_array[1] = y │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ multi_param.fe:5:9 @@ -57,11 +57,11 @@ note: 5 │ my_array[1] = y │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 6 │ my_array[2] = z │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ multi_param.fe:6:9 @@ -69,8 +69,8 @@ note: 6 │ my_array[2] = z │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 7 │ return my_array - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array -> Array diff --git a/crates/analyzer/tests/snapshots/analysis__nested_map.snap b/crates/analyzer/tests/snapshots/analysis__nested_map.snap index 7a22995890..0fe3c4332f 100644 --- a/crates/analyzer/tests/snapshots/analysis__nested_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__nested_map.snap @@ -17,7 +17,7 @@ note: 5 │ ╭ pub fn read_bar(self, a: address, b: address) -> u256 { 6 │ │ return self.bar[a][b] 7 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: address }, { label: None, name: b, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: None, name: a, typ: address }, { label: None, name: b, typ: address }] -> u256 note: ┌─ nested_map.fe:6:16 @@ -50,16 +50,16 @@ note: note: ┌─ nested_map.fe:9:5 │ - 9 │ ╭ pub fn write_bar(self, a: address, b: address, value: u256) { + 9 │ ╭ pub fn write_bar(mut self, a: address, b: address, value: u256) { 10 │ │ self.bar[a][b] = value 11 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: address }, { label: None, name: b, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: a, typ: address }, { label: None, name: b, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ nested_map.fe:10:9 │ 10 │ self.bar[a][b] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ nested_map.fe:10:9 @@ -67,7 +67,7 @@ note: 10 │ self.bar[a][b] = value │ ^^^^^^^^ ^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ nested_map.fe:10:9 @@ -75,7 +75,7 @@ note: 10 │ self.bar[a][b] = value │ ^^^^^^^^^^^ ^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ nested_map.fe:10:9 @@ -83,7 +83,7 @@ note: 10 │ self.bar[a][b] = value │ ^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ nested_map.fe:13:5 @@ -91,7 +91,7 @@ note: 13 │ ╭ pub fn read_baz(self, a: address, b: u256) -> bool { 14 │ │ return self.baz[a][b] 15 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: address }, { label: None, name: b, typ: u256 }] -> bool + │ ╰─────^ params: [self, { label: None, name: a, typ: address }, { label: None, name: b, typ: u256 }] -> bool note: ┌─ nested_map.fe:14:16 @@ -124,16 +124,16 @@ note: note: ┌─ nested_map.fe:17:5 │ -17 │ ╭ pub fn write_baz(self, a: address, b: u256, value: bool) { +17 │ ╭ pub fn write_baz(mut self, a: address, b: u256, value: bool) { 18 │ │ self.baz[a][b] = value 19 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: a, typ: address }, { label: None, name: b, typ: u256 }, { label: None, name: value, typ: bool }] -> () + │ ╰─────^ params: [mut self, { label: None, name: a, typ: address }, { label: None, name: b, typ: u256 }, { label: None, name: value, typ: bool }] -> () note: ┌─ nested_map.fe:18:9 │ 18 │ self.baz[a][b] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ nested_map.fe:18:9 @@ -141,7 +141,7 @@ note: 18 │ self.baz[a][b] = value │ ^^^^^^^^ ^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ nested_map.fe:18:9 @@ -149,7 +149,7 @@ note: 18 │ self.baz[a][b] = value │ ^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ nested_map.fe:18:9 @@ -157,6 +157,6 @@ note: 18 │ self.baz[a][b] = value │ ^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap b/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap index 25946c9416..9a31a8c384 100644 --- a/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap +++ b/crates/analyzer/tests/snapshots/analysis__numeric_sizes.snap @@ -153,7 +153,7 @@ note: 33 │ ╭ pub fn get_u8_min() -> u8 { 34 │ │ return u8(0) 35 │ │ } - │ ╰─────^ self: None, params: [] -> u8 + │ ╰─────^ params: [] -> u8 note: ┌─ numeric_sizes.fe:34:19 @@ -173,7 +173,7 @@ note: 36 │ ╭ pub fn get_u8_const_min() -> u8 { 37 │ │ return U8_MIN 38 │ │ } - │ ╰─────^ self: None, params: [] -> u8 + │ ╰─────^ params: [] -> u8 note: ┌─ numeric_sizes.fe:37:16 @@ -187,7 +187,7 @@ note: 40 │ ╭ pub fn get_u16_min() -> u16 { 41 │ │ return u16(0) 42 │ │ } - │ ╰─────^ self: None, params: [] -> u16 + │ ╰─────^ params: [] -> u16 note: ┌─ numeric_sizes.fe:41:20 @@ -207,7 +207,7 @@ note: 44 │ ╭ pub fn get_u16_const_min() -> u16 { 45 │ │ return U16_MIN 46 │ │ } - │ ╰─────^ self: None, params: [] -> u16 + │ ╰─────^ params: [] -> u16 note: ┌─ numeric_sizes.fe:45:16 @@ -221,7 +221,7 @@ note: 48 │ ╭ pub fn get_u32_min() -> u32 { 49 │ │ return u32(0) 50 │ │ } - │ ╰─────^ self: None, params: [] -> u32 + │ ╰─────^ params: [] -> u32 note: ┌─ numeric_sizes.fe:49:20 @@ -241,7 +241,7 @@ note: 52 │ ╭ pub fn get_u32_const_min() -> u32 { 53 │ │ return U32_MIN 54 │ │ } - │ ╰─────^ self: None, params: [] -> u32 + │ ╰─────^ params: [] -> u32 note: ┌─ numeric_sizes.fe:53:16 @@ -255,7 +255,7 @@ note: 56 │ ╭ pub fn get_u64_min() -> u64 { 57 │ │ return u64(0) 58 │ │ } - │ ╰─────^ self: None, params: [] -> u64 + │ ╰─────^ params: [] -> u64 note: ┌─ numeric_sizes.fe:57:20 @@ -275,7 +275,7 @@ note: 60 │ ╭ pub fn get_u64_const_min() -> u64 { 61 │ │ return U64_MIN 62 │ │ } - │ ╰─────^ self: None, params: [] -> u64 + │ ╰─────^ params: [] -> u64 note: ┌─ numeric_sizes.fe:61:16 @@ -289,7 +289,7 @@ note: 64 │ ╭ pub fn get_u128_min() -> u128 { 65 │ │ return u128(0) 66 │ │ } - │ ╰─────^ self: None, params: [] -> u128 + │ ╰─────^ params: [] -> u128 note: ┌─ numeric_sizes.fe:65:21 @@ -309,7 +309,7 @@ note: 68 │ ╭ pub fn get_u128_const_min() -> u128 { 69 │ │ return U128_MIN 70 │ │ } - │ ╰─────^ self: None, params: [] -> u128 + │ ╰─────^ params: [] -> u128 note: ┌─ numeric_sizes.fe:69:16 @@ -323,7 +323,7 @@ note: 72 │ ╭ pub fn get_u256_min() -> u256 { 73 │ │ return u256(0) 74 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ numeric_sizes.fe:73:21 @@ -343,7 +343,7 @@ note: 76 │ ╭ pub fn get_u256_const_min() -> u256 { 77 │ │ return U256_MIN 78 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ numeric_sizes.fe:77:16 @@ -357,7 +357,7 @@ note: 80 │ ╭ pub fn get_i8_min() -> i8 { 81 │ │ return i8(-128) 82 │ │ } - │ ╰─────^ self: None, params: [] -> i8 + │ ╰─────^ params: [] -> i8 note: ┌─ numeric_sizes.fe:81:20 @@ -383,7 +383,7 @@ note: 84 │ ╭ pub fn get_i8_const_min() -> i8 { 85 │ │ return I8_MIN 86 │ │ } - │ ╰─────^ self: None, params: [] -> i8 + │ ╰─────^ params: [] -> i8 note: ┌─ numeric_sizes.fe:85:16 @@ -397,7 +397,7 @@ note: 88 │ ╭ pub fn get_i16_min() -> i16 { 89 │ │ return i16(-32768) 90 │ │ } - │ ╰─────^ self: None, params: [] -> i16 + │ ╰─────^ params: [] -> i16 note: ┌─ numeric_sizes.fe:89:21 @@ -423,7 +423,7 @@ note: 92 │ ╭ pub fn get_i16_const_min() -> i16 { 93 │ │ return I16_MIN 94 │ │ } - │ ╰─────^ self: None, params: [] -> i16 + │ ╰─────^ params: [] -> i16 note: ┌─ numeric_sizes.fe:93:16 @@ -437,7 +437,7 @@ note: 96 │ ╭ pub fn get_i32_min() -> i32 { 97 │ │ return i32(-2147483648) 98 │ │ } - │ ╰─────^ self: None, params: [] -> i32 + │ ╰─────^ params: [] -> i32 note: ┌─ numeric_sizes.fe:97:21 @@ -463,7 +463,7 @@ note: 100 │ ╭ pub fn get_i32_const_min() -> i32 { 101 │ │ return I32_MIN 102 │ │ } - │ ╰─────^ self: None, params: [] -> i32 + │ ╰─────^ params: [] -> i32 note: ┌─ numeric_sizes.fe:101:16 @@ -477,7 +477,7 @@ note: 104 │ ╭ pub fn get_i64_min() -> i64 { 105 │ │ return i64(-9223372036854775808) 106 │ │ } - │ ╰─────^ self: None, params: [] -> i64 + │ ╰─────^ params: [] -> i64 note: ┌─ numeric_sizes.fe:105:21 @@ -503,7 +503,7 @@ note: 108 │ ╭ pub fn get_i64_const_min() -> i64 { 109 │ │ return I64_MIN 110 │ │ } - │ ╰─────^ self: None, params: [] -> i64 + │ ╰─────^ params: [] -> i64 note: ┌─ numeric_sizes.fe:109:16 @@ -517,7 +517,7 @@ note: 112 │ ╭ pub fn get_i128_min() -> i128 { 113 │ │ return i128(-170141183460469231731687303715884105728) 114 │ │ } - │ ╰─────^ self: None, params: [] -> i128 + │ ╰─────^ params: [] -> i128 note: ┌─ numeric_sizes.fe:113:22 @@ -543,7 +543,7 @@ note: 116 │ ╭ pub fn get_i128_const_min() -> i128 { 117 │ │ return I128_MIN 118 │ │ } - │ ╰─────^ self: None, params: [] -> i128 + │ ╰─────^ params: [] -> i128 note: ┌─ numeric_sizes.fe:117:16 @@ -557,7 +557,7 @@ note: 120 │ ╭ pub fn get_i256_min() -> i256 { 121 │ │ return i256(-57896044618658097711785492504343953926634992332820282019728792003956564819968) 122 │ │ } - │ ╰─────^ self: None, params: [] -> i256 + │ ╰─────^ params: [] -> i256 note: ┌─ numeric_sizes.fe:121:22 @@ -583,7 +583,7 @@ note: 124 │ ╭ pub fn get_i256_const_min() -> i256 { 125 │ │ return I256_MIN 126 │ │ } - │ ╰─────^ self: None, params: [] -> i256 + │ ╰─────^ params: [] -> i256 note: ┌─ numeric_sizes.fe:125:16 @@ -597,7 +597,7 @@ note: 128 │ ╭ pub fn get_u8_max() -> u8 { 129 │ │ return u8(255) 130 │ │ } - │ ╰─────^ self: None, params: [] -> u8 + │ ╰─────^ params: [] -> u8 note: ┌─ numeric_sizes.fe:129:19 @@ -617,7 +617,7 @@ note: 132 │ ╭ pub fn get_u8_const_max() -> u8 { 133 │ │ return U8_MAX 134 │ │ } - │ ╰─────^ self: None, params: [] -> u8 + │ ╰─────^ params: [] -> u8 note: ┌─ numeric_sizes.fe:133:16 @@ -631,7 +631,7 @@ note: 136 │ ╭ pub fn get_u16_max() -> u16 { 137 │ │ return u16(65535) 138 │ │ } - │ ╰─────^ self: None, params: [] -> u16 + │ ╰─────^ params: [] -> u16 note: ┌─ numeric_sizes.fe:137:20 @@ -651,7 +651,7 @@ note: 140 │ ╭ pub fn get_u16_const_max() -> u16 { 141 │ │ return U16_MAX 142 │ │ } - │ ╰─────^ self: None, params: [] -> u16 + │ ╰─────^ params: [] -> u16 note: ┌─ numeric_sizes.fe:141:16 @@ -665,7 +665,7 @@ note: 144 │ ╭ pub fn get_u32_max() -> u32 { 145 │ │ return u32(4294967295) 146 │ │ } - │ ╰─────^ self: None, params: [] -> u32 + │ ╰─────^ params: [] -> u32 note: ┌─ numeric_sizes.fe:145:20 @@ -685,7 +685,7 @@ note: 148 │ ╭ pub fn get_u32_const_max() -> u32 { 149 │ │ return U32_MAX 150 │ │ } - │ ╰─────^ self: None, params: [] -> u32 + │ ╰─────^ params: [] -> u32 note: ┌─ numeric_sizes.fe:149:16 @@ -699,7 +699,7 @@ note: 152 │ ╭ pub fn get_u64_max() -> u64 { 153 │ │ return u64(18446744073709551615) 154 │ │ } - │ ╰─────^ self: None, params: [] -> u64 + │ ╰─────^ params: [] -> u64 note: ┌─ numeric_sizes.fe:153:20 @@ -719,7 +719,7 @@ note: 156 │ ╭ pub fn get_u64_const_max() -> u64 { 157 │ │ return U64_MAX 158 │ │ } - │ ╰─────^ self: None, params: [] -> u64 + │ ╰─────^ params: [] -> u64 note: ┌─ numeric_sizes.fe:157:16 @@ -733,7 +733,7 @@ note: 160 │ ╭ pub fn get_u128_max() -> u128 { 161 │ │ return u128(340282366920938463463374607431768211455) 162 │ │ } - │ ╰─────^ self: None, params: [] -> u128 + │ ╰─────^ params: [] -> u128 note: ┌─ numeric_sizes.fe:161:21 @@ -753,7 +753,7 @@ note: 164 │ ╭ pub fn get_u128_const_max() -> u128 { 165 │ │ return U128_MAX 166 │ │ } - │ ╰─────^ self: None, params: [] -> u128 + │ ╰─────^ params: [] -> u128 note: ┌─ numeric_sizes.fe:165:16 @@ -767,7 +767,7 @@ note: 168 │ ╭ pub fn get_u256_max() -> u256 { 169 │ │ return u256(115792089237316195423570985008687907853269984665640564039457584007913129639935) 170 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ numeric_sizes.fe:169:21 @@ -787,7 +787,7 @@ note: 172 │ ╭ pub fn get_u256_const_max() -> u256 { 173 │ │ return U256_MAX 174 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ numeric_sizes.fe:173:16 @@ -801,7 +801,7 @@ note: 176 │ ╭ pub fn get_i8_max() -> i8 { 177 │ │ return i8(127) 178 │ │ } - │ ╰─────^ self: None, params: [] -> i8 + │ ╰─────^ params: [] -> i8 note: ┌─ numeric_sizes.fe:177:19 @@ -821,7 +821,7 @@ note: 180 │ ╭ pub fn get_i8_const_max() -> i8 { 181 │ │ return I8_MAX 182 │ │ } - │ ╰─────^ self: None, params: [] -> i8 + │ ╰─────^ params: [] -> i8 note: ┌─ numeric_sizes.fe:181:16 @@ -835,7 +835,7 @@ note: 184 │ ╭ pub fn get_i16_max() -> i16 { 185 │ │ return i16(32767) 186 │ │ } - │ ╰─────^ self: None, params: [] -> i16 + │ ╰─────^ params: [] -> i16 note: ┌─ numeric_sizes.fe:185:20 @@ -855,7 +855,7 @@ note: 188 │ ╭ pub fn get_i16_const_max() -> i16 { 189 │ │ return I16_MAX 190 │ │ } - │ ╰─────^ self: None, params: [] -> i16 + │ ╰─────^ params: [] -> i16 note: ┌─ numeric_sizes.fe:189:16 @@ -869,7 +869,7 @@ note: 192 │ ╭ pub fn get_i32_max() -> i32 { 193 │ │ return i32(2147483647) 194 │ │ } - │ ╰─────^ self: None, params: [] -> i32 + │ ╰─────^ params: [] -> i32 note: ┌─ numeric_sizes.fe:193:20 @@ -889,7 +889,7 @@ note: 196 │ ╭ pub fn get_i32_const_max() -> i32 { 197 │ │ return I32_MAX 198 │ │ } - │ ╰─────^ self: None, params: [] -> i32 + │ ╰─────^ params: [] -> i32 note: ┌─ numeric_sizes.fe:197:16 @@ -903,7 +903,7 @@ note: 200 │ ╭ pub fn get_i64_max() -> i64 { 201 │ │ return i64(9223372036854775807) 202 │ │ } - │ ╰─────^ self: None, params: [] -> i64 + │ ╰─────^ params: [] -> i64 note: ┌─ numeric_sizes.fe:201:20 @@ -923,7 +923,7 @@ note: 204 │ ╭ pub fn get_i64_const_max() -> i64 { 205 │ │ return I64_MAX 206 │ │ } - │ ╰─────^ self: None, params: [] -> i64 + │ ╰─────^ params: [] -> i64 note: ┌─ numeric_sizes.fe:205:16 @@ -937,7 +937,7 @@ note: 208 │ ╭ pub fn get_i128_max() -> i128 { 209 │ │ return i128(170141183460469231731687303715884105727) 210 │ │ } - │ ╰─────^ self: None, params: [] -> i128 + │ ╰─────^ params: [] -> i128 note: ┌─ numeric_sizes.fe:209:21 @@ -957,7 +957,7 @@ note: 212 │ ╭ pub fn get_i128_const_max() -> i128 { 213 │ │ return I128_MAX 214 │ │ } - │ ╰─────^ self: None, params: [] -> i128 + │ ╰─────^ params: [] -> i128 note: ┌─ numeric_sizes.fe:213:16 @@ -971,7 +971,7 @@ note: 216 │ ╭ pub fn get_i256_max() -> i256 { 217 │ │ return i256(57896044618658097711785492504343953926634992332820282019728792003956564819967) 218 │ │ } - │ ╰─────^ self: None, params: [] -> i256 + │ ╰─────^ params: [] -> i256 note: ┌─ numeric_sizes.fe:217:21 @@ -991,7 +991,7 @@ note: 220 │ ╭ pub fn get_i256_const_max() -> i256 { 221 │ │ return I256_MAX 222 │ │ } - │ ╰─────^ self: None, params: [] -> i256 + │ ╰─────^ params: [] -> i256 note: ┌─ numeric_sizes.fe:221:16 diff --git a/crates/analyzer/tests/snapshots/analysis__ownable.snap b/crates/analyzer/tests/snapshots/analysis__ownable.snap index 2b537a608a..c571642c29 100644 --- a/crates/analyzer/tests/snapshots/analysis__ownable.snap +++ b/crates/analyzer/tests/snapshots/analysis__ownable.snap @@ -23,7 +23,7 @@ note: 13 │ ╭ pub fn owner(self) -> address { 14 │ │ return self._owner 15 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address + │ ╰─────^ params: [self] -> address note: ┌─ ownable.fe:14:16 @@ -40,24 +40,24 @@ note: note: ┌─ ownable.fe:17:5 │ -17 │ ╭ pub fn renounceOwnership(self, ctx: Context) { +17 │ ╭ pub fn renounceOwnership(mut self, mut ctx: Context) { 18 │ │ assert ctx.msg_sender() == self._owner 19 │ │ self._owner = address(0) 20 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) 21 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ ownable.fe:18:16 │ 18 │ assert ctx.msg_sender() == self._owner - │ ^^^ Context + │ ^^^ mut Context note: ┌─ ownable.fe:18:16 │ 18 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable + │ ^^^^^^^^^^^^^^^^ ^^^^ mut Ownable │ │ │ address @@ -65,7 +65,7 @@ note: ┌─ ownable.fe:18:36 │ 18 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^ SPtr
-> address + │ ^^^^^^^^^^^ mut SPtr
-> address note: ┌─ ownable.fe:18:16 @@ -73,7 +73,7 @@ note: 18 │ assert ctx.msg_sender() == self._owner │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 19 │ self._owner = address(0) - │ ^^^^ Ownable + │ ^^^^ mut Ownable note: ┌─ ownable.fe:19:9 @@ -81,7 +81,7 @@ note: 19 │ self._owner = address(0) │ ^^^^^^^^^^^ ^ u256 │ │ - │ SPtr
+ │ mut SPtr
note: ┌─ ownable.fe:19:23 @@ -89,9 +89,9 @@ note: 19 │ self._owner = address(0) │ ^^^^^^^^^^ address 20 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner: address(0)) - │ ^^^ ^^^ Context + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: ┌─ ownable.fe:20:55 @@ -110,25 +110,25 @@ note: note: ┌─ ownable.fe:23:5 │ -23 │ ╭ pub fn transferOwnership(self, ctx: Context, newOwner: address) { +23 │ ╭ pub fn transferOwnership(mut self, mut ctx: Context, newOwner: address) { 24 │ │ assert ctx.msg_sender() == self._owner 25 │ │ assert newOwner != address(0) 26 │ │ self._owner = newOwner 27 │ │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) 28 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: newOwner, typ: address }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: newOwner, typ: address }] -> () note: ┌─ ownable.fe:24:16 │ 24 │ assert ctx.msg_sender() == self._owner - │ ^^^ Context + │ ^^^ mut Context note: ┌─ ownable.fe:24:16 │ 24 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^^^^^^ ^^^^ Ownable + │ ^^^^^^^^^^^^^^^^ ^^^^ mut Ownable │ │ │ address @@ -136,7 +136,7 @@ note: ┌─ ownable.fe:24:36 │ 24 │ assert ctx.msg_sender() == self._owner - │ ^^^^^^^^^^^ SPtr
-> address + │ ^^^^^^^^^^^ mut SPtr
-> address note: ┌─ ownable.fe:24:16 @@ -160,7 +160,7 @@ note: 25 │ assert newOwner != address(0) │ ^^^^^^^^^^^^^^^^^^^^^^ bool 26 │ self._owner = newOwner - │ ^^^^ Ownable + │ ^^^^ mut Ownable note: ┌─ ownable.fe:26:9 @@ -168,11 +168,11 @@ note: 26 │ self._owner = newOwner │ ^^^^^^^^^^^ ^^^^^^^^ address │ │ - │ SPtr
+ │ mut SPtr
27 │ emit OwnershipTransferred(ctx, previousOwner: ctx.msg_sender(), newOwner) - │ ^^^ ^^^ Context + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: ┌─ ownable.fe:27:55 diff --git a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap index b16d9b8106..34fcbc6e5b 100644 --- a/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap +++ b/crates/analyzer/tests/snapshots/analysis__pure_fn_standalone.snap @@ -9,7 +9,7 @@ note: 1 │ ╭ fn add_bonus(_ x: u256) -> u256 { 2 │ │ return x + 10 3 │ │ } - │ ╰─^ self: None, params: [{ label: Some("_"), name: x, typ: u256 }] -> u256 + │ ╰─^ params: [{ label: Some("_"), name: x, typ: u256 }] -> u256 note: ┌─ pure_fn_standalone.fe:2:12 @@ -36,20 +36,20 @@ note: note: ┌─ pure_fn_standalone.fe:9:5 │ - 9 │ ╭ fn add_points(self, _ user: address, _ val: u256) { + 9 │ ╭ fn add_points(mut self, _ user: address, _ val: u256) { 10 │ │ if self.cool_users[user] { 11 │ │ self.points[user] += add_bonus(val) 12 │ │ } else { 13 │ │ self.points[user] += val 14 │ │ } 15 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: user, typ: address }, { label: Some("_"), name: val, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: Some("_"), name: user, typ: address }, { label: Some("_"), name: val, typ: u256 }] -> () note: ┌─ pure_fn_standalone.fe:10:12 │ 10 │ if self.cool_users[user] { - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ pure_fn_standalone.fe:10:12 @@ -57,15 +57,15 @@ note: 10 │ if self.cool_users[user] { │ ^^^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ pure_fn_standalone.fe:10:12 │ 10 │ if self.cool_users[user] { - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> bool 11 │ self.points[user] += add_bonus(val) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ pure_fn_standalone.fe:11:13 @@ -73,7 +73,7 @@ note: 11 │ self.points[user] += add_bonus(val) │ ^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ pure_fn_standalone.fe:11:13 @@ -81,7 +81,7 @@ note: 11 │ self.points[user] += add_bonus(val) │ ^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ pure_fn_standalone.fe:11:34 @@ -90,7 +90,7 @@ note: │ ^^^^^^^^^^^^^^ u256 12 │ } else { 13 │ self.points[user] += val - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ pure_fn_standalone.fe:13:13 @@ -98,7 +98,7 @@ note: 13 │ self.points[user] += val │ ^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ pure_fn_standalone.fe:13:13 @@ -106,19 +106,19 @@ note: 13 │ self.points[user] += val │ ^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ pure_fn_standalone.fe:17:5 │ -17 │ ╭ pub fn bar(self, _ x: u256) -> u256 { +17 │ ╭ pub fn bar(mut self, _ x: u256) -> u256 { 18 │ │ let a: address = address(x) 19 │ │ self.add_points(a, 100) 20 │ │ self.cool_users[a] = true 21 │ │ self.add_points(a, 100) 22 │ │ return self.points[a] 23 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: x, typ: u256 }] -> u256 + │ ╰─────^ params: [mut self, { label: Some("_"), name: x, typ: u256 }] -> u256 note: ┌─ pure_fn_standalone.fe:18:13 @@ -141,7 +141,7 @@ note: │ ^^^^ ^ ^^^ u256 │ │ │ │ │ address - │ Foo + │ mut Foo note: ┌─ pure_fn_standalone.fe:19:9 @@ -149,7 +149,7 @@ note: 19 │ self.add_points(a, 100) │ ^^^^^^^^^^^^^^^^^^^^^^^ () 20 │ self.cool_users[a] = true - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ pure_fn_standalone.fe:20:9 @@ -157,7 +157,7 @@ note: 20 │ self.cool_users[a] = true │ ^^^^^^^^^^^^^^^ ^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ pure_fn_standalone.fe:20:9 @@ -165,12 +165,12 @@ note: 20 │ self.cool_users[a] = true │ ^^^^^^^^^^^^^^^^^^ ^^^^ bool │ │ - │ SPtr + │ mut SPtr 21 │ self.add_points(a, 100) │ ^^^^ ^ ^^^ u256 │ │ │ │ │ address - │ Foo + │ mut Foo note: ┌─ pure_fn_standalone.fe:21:9 @@ -178,7 +178,7 @@ note: 21 │ self.add_points(a, 100) │ ^^^^^^^^^^^^^^^^^^^^^^^ () 22 │ return self.points[a] - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ pure_fn_standalone.fe:22:16 @@ -186,12 +186,12 @@ note: 22 │ return self.points[a] │ ^^^^^^^^^^^ ^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ pure_fn_standalone.fe:22:16 │ 22 │ return self.points[a] - │ ^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap index ebc766a232..d0ed43a2f3 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x + y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 note: ┌─ return_addition_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap index f7983ec7b1..4381c3f146 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u128.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u128, y: u128) -> u128 { 3 │ │ return x + y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> u128 note: ┌─ return_addition_u128.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap index 18db2375e7..4f9b26a986 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_addition_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x + y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_addition_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_array.snap b/crates/analyzer/tests/snapshots/analysis__return_array.snap index fc832f5cf2..7c7fa4cb10 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_array.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_array.snap @@ -7,35 +7,35 @@ note: ┌─ return_array.fe:2:5 │ 2 │ ╭ pub fn bar(x: u256) -> Array { -3 │ │ let my_array: Array = [0; 5] +3 │ │ let mut my_array: Array = [0; 5] 4 │ │ my_array[3] = x 5 │ │ return my_array 6 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }] -> Array + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }] -> Array note: - ┌─ return_array.fe:3:13 + ┌─ return_array.fe:3:17 │ -3 │ let my_array: Array = [0; 5] - │ ^^^^^^^^ Array +3 │ let mut my_array: Array = [0; 5] + │ ^^^^^^^^ mut Array note: - ┌─ return_array.fe:3:41 + ┌─ return_array.fe:3:45 │ -3 │ let my_array: Array = [0; 5] - │ ^ ^ u256 - │ │ - │ u256 +3 │ let mut my_array: Array = [0; 5] + │ ^ ^ u256 + │ │ + │ u256 note: - ┌─ return_array.fe:3:40 + ┌─ return_array.fe:3:44 │ -3 │ let my_array: Array = [0; 5] - │ ^^^^^^ Array +3 │ let mut my_array: Array = [0; 5] + │ ^^^^^^ Array 4 │ my_array[3] = x │ ^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ return_array.fe:4:9 @@ -43,8 +43,8 @@ note: 4 │ my_array[3] = x │ ^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 5 │ return my_array - │ ^^^^^^^^ Array + │ ^^^^^^^^ mut Array -> Array diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap index e77e202e2e..427d39ae45 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u128.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u128, y: u128) -> u128 { 3 │ │ return x & y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> u128 note: ┌─ return_bitwiseand_u128.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap index 63026e9288..0082a764e2 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseand_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x & y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_bitwiseand_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap index 41b72a0070..d3659a5c10 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseor_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x | y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_bitwiseor_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap index d111840048..cce9b48058 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshl_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x << y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_bitwiseshl_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap index f66adc9ac3..3d7e20a7bc 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: u256) -> i256 { 3 │ │ return x >> y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: u256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: u256 }] -> i256 note: ┌─ return_bitwiseshr_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap index ca716e82ed..95a8fafd09 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwiseshr_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x >> y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_bitwiseshr_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap index 1cd599d444..13ba9b7b99 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bitwisexor_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x ^ y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_bitwisexor_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap index 0fe9b74328..7aaf74d095 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_false.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> bool { 3 │ │ return false 4 │ │ } - │ ╰─────^ self: None, params: [] -> bool + │ ╰─────^ params: [] -> bool note: ┌─ return_bool_false.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap index c2251767ff..55f3247edb 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_inverted.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(some_condition: bool) -> bool { 3 │ │ return not some_condition 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: some_condition, typ: bool }] -> bool + │ ╰─────^ params: [{ label: None, name: some_condition, typ: bool }] -> bool note: ┌─ return_bool_inverted.fe:3:20 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 b9ab5233f3..c41a59b061 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_and.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: bool, y: bool) -> bool { 3 │ │ return x and y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: bool }, { label: None, name: y, typ: bool }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: bool }, { label: None, name: y, typ: bool }] -> bool note: ┌─ return_bool_op_and.fe:3:16 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 544cf9be2c..9c5b368b4b 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_op_or.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: bool, y: bool) -> bool { 3 │ │ return x or y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: bool }, { label: None, name: y, typ: bool }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: bool }, { label: None, name: y, typ: bool }] -> bool note: ┌─ return_bool_op_or.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap b/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap index 6072b88bea..7758942363 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_bool_true.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> bool { 3 │ │ return true 4 │ │ } - │ ╰─────^ self: None, params: [] -> bool + │ ╰─────^ params: [] -> bool note: ┌─ return_bool_true.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap index 232b2323e4..26ef87ec82 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_builtin_attributes.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn base_fee(ctx: Context) -> u256 { 3 │ │ return ctx.base_fee() 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:3:16 @@ -29,7 +29,7 @@ note: 6 │ ╭ pub fn coinbase(ctx: Context) -> address { 7 │ │ return ctx.block_coinbase() 8 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> address note: ┌─ return_builtin_attributes.fe:7:16 @@ -49,7 +49,7 @@ note: 10 │ ╭ pub fn difficulty(ctx: Context) -> u256 { 11 │ │ return ctx.block_difficulty() 12 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:11:16 @@ -69,7 +69,7 @@ note: 14 │ ╭ pub fn number(ctx: Context) -> u256 { 15 │ │ return ctx.block_number() 16 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:15:16 @@ -89,7 +89,7 @@ note: 18 │ ╭ pub fn timestamp(ctx: Context) -> u256 { 19 │ │ return ctx.block_timestamp() 20 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:19:16 @@ -109,7 +109,7 @@ note: 22 │ ╭ pub fn chainid(ctx: Context) -> u256 { 23 │ │ return ctx.chain_id() 24 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:23:16 @@ -129,7 +129,7 @@ note: 26 │ ╭ pub fn sender(ctx: Context) -> address { 27 │ │ return ctx.msg_sender() 28 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> address note: ┌─ return_builtin_attributes.fe:27:16 @@ -149,7 +149,7 @@ note: 30 │ ╭ pub fn value(ctx: Context) -> u256 { 31 │ │ return ctx.msg_value() 32 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:31:16 @@ -169,7 +169,7 @@ note: 34 │ ╭ pub fn origin(ctx: Context) -> address { 35 │ │ return ctx.tx_origin() 36 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> address note: ┌─ return_builtin_attributes.fe:35:16 @@ -189,7 +189,7 @@ note: 38 │ ╭ pub fn gas_price(ctx: Context) -> u256 { 39 │ │ return ctx.tx_gas_price() 40 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_builtin_attributes.fe:39:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_complex_struct.snap b/crates/analyzer/tests/snapshots/analysis__return_complex_struct.snap index 98e67a1ba9..baf1ef6633 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_complex_struct.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_complex_struct.snap @@ -53,7 +53,7 @@ note: 31 │ │ let complex: StaticComplex = StaticComplex(inner, outer_x: 30) 32 │ │ return complex 33 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> StaticComplex + │ ╰─────^ params: [self] -> StaticComplex note: ┌─ return_complex_struct.fe:30:13 @@ -96,7 +96,7 @@ note: 37 │ │ let complex: StringComplex = StringComplex(string: "Hello", outer_x: 30) 38 │ │ return complex 39 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> StringComplex + │ ╰─────^ params: [self] -> StringComplex note: ┌─ return_complex_struct.fe:37:13 @@ -127,7 +127,7 @@ note: 42 │ │ let complex: BytesComplex = BytesComplex(bytes: [1, 2, 3, 4, 5, 6, 7, 8], outer_x: 30) 43 │ │ return complex 44 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> BytesComplex + │ ╰─────^ params: [self] -> BytesComplex note: ┌─ return_complex_struct.fe:42:13 @@ -175,7 +175,7 @@ note: 50 │ │ let complex: NestedDynamicComplex = NestedDynamicComplex(bytes_complex, static_complex, string_complex) 51 │ │ return complex 52 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> NestedDynamicComplex + │ ╰─────^ params: [self] -> NestedDynamicComplex note: ┌─ return_complex_struct.fe:47:13 diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap index d3b35b835e..b077bcb805 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x / y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 note: ┌─ return_division_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap index 126fba4a72..7bd677ad86 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_division_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x / y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_division_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap b/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap index 4d07c8898b..72193edde1 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_empty_tuple.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn explicit_return_a1() { 3 │ │ return 4 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ return_unit.fe:6:5 @@ -17,7 +17,7 @@ note: 6 │ ╭ pub fn explicit_return_a2() { 7 │ │ return () 8 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ return_unit.fe:7:16 @@ -31,7 +31,7 @@ note: 10 │ ╭ pub fn explicit_return_b1() -> () { 11 │ │ return 12 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ return_unit.fe:14:5 @@ -39,7 +39,7 @@ note: 14 │ ╭ pub fn explicit_return_b2() -> () { 15 │ │ return () 16 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ return_unit.fe:15:16 @@ -51,12 +51,12 @@ note: ┌─ return_unit.fe:18:5 │ 18 │ pub fn implicit_a1() {} - │ ^^^^^^^^^^^^^^^^^^^^^^^ self: None, params: [] -> () + │ ^^^^^^^^^^^^^^^^^^^^^^^ params: [] -> () note: ┌─ return_unit.fe:20:5 │ 20 │ pub fn implicit_a2() -> () {} - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ self: None, params: [] -> () + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ params: [] -> () diff --git a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap index e31da73d95..7a90de302d 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_eq_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x == y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_eq_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap index a27c51841c..c419304192 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x > y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool note: ┌─ return_gt_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap index 202e33de48..038ce3db0e 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gt_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x > y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_gt_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap index 30f2f67df6..c243159af2 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x >= y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool note: ┌─ return_gte_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap index 7479681cfc..52922d4e04 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_gte_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x >= y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_gte_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap b/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap index cbc772c471..240cb23c23 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_i128_cast.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> i128 { 3 │ │ return i128(-3) 4 │ │ } - │ ╰─────^ self: None, params: [] -> i128 + │ ╰─────^ params: [] -> i128 note: ┌─ return_i128_cast.fe:3:22 diff --git a/crates/analyzer/tests/snapshots/analysis__return_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_i256.snap index f1be9859e0..8147869e7e 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> i256 { 3 │ │ return -3 4 │ │ } - │ ╰─────^ self: None, params: [] -> i256 + │ ╰─────^ params: [] -> i256 note: ┌─ return_i256.fe:3:17 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap index 9889fa0d92..0ca8531699 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u128.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u128) -> u128 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u128 }] -> u128 + │ ╰─────^ params: [{ label: None, name: x, typ: u128 }] -> u128 note: ┌─ return_identity_u128.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap index 3fd84b0ffe..09b5a23c76 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u16.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u16) -> u16 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u16 }] -> u16 + │ ╰─────^ params: [{ label: None, name: x, typ: u16 }] -> u16 note: ┌─ return_identity_u16.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap index f3271defec..e0bb569c04 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256) -> u256 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }] -> u256 note: ┌─ return_identity_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap index bd42491a95..4775487917 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u32.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u32) -> u32 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u32 }] -> u32 + │ ╰─────^ params: [{ label: None, name: x, typ: u32 }] -> u32 note: ┌─ return_identity_u32.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap index 8e7bdd9a74..61806bc9fd 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u64.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u64) -> u64 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: x, typ: u64 }] -> u64 note: ┌─ return_identity_u64.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap index faf3f51628..1ee738b5c4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_identity_u8.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u8) -> u8 { 3 │ │ return x 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u8 }] -> u8 + │ ╰─────^ params: [{ label: None, name: x, typ: u8 }] -> u8 note: ┌─ return_identity_u8.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap index c42d47ef06..2f64a913dc 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x < y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool note: ┌─ return_lt_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap index 1d5516f95c..0be4229dd8 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u128.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u128, y: u128) -> bool { 3 │ │ return x < y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u128 }, { label: None, name: y, typ: u128 }] -> bool note: ┌─ return_lt_u128.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap index 348ba86c2b..7802f013b4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lt_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x < y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_lt_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap index 72a71a49a2..9dc36d8ab4 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> bool { 3 │ │ return x <= y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> bool note: ┌─ return_lte_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap index 449b86e5b0..71bdbeeddf 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_lte_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x <= y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_lte_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap index c126b6715e..e81660e700 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x % y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 note: ┌─ return_mod_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap index e3c804bada..335549e14a 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_mod_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x % y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_mod_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap index f4654274cd..c1d68d0b19 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_msg_sig.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(ctx: Context) -> u256 { 3 │ │ return ctx.msg_sig() 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> u256 note: ┌─ return_msg_sig.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap index 26733a432b..7ec855cfa2 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x * y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 note: ┌─ return_multiplication_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap index 051777fbc4..9e1711cc99 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_multiplication_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x * y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_multiplication_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap index 9abf749980..8ba2555952 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_noteq_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> bool { 3 │ │ return x != y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> bool note: ┌─ return_noteq_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap index d5862949be..9f6a6ff5df 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i8, y: u8) -> i8 { 3 │ │ return x ** y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i8 }, { label: None, name: y, typ: u8 }] -> i8 + │ ╰─────^ params: [{ label: None, name: x, typ: i8 }, { label: None, name: y, typ: u8 }] -> i8 note: ┌─ return_pow_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap index 202c2e8a9c..e95641b3c6 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_pow_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x ** y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_pow_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap index 46b376829b..18b7e13c66 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_i256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: i256, y: i256) -> i256 { 3 │ │ return x - y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 + │ ╰─────^ params: [{ label: None, name: x, typ: i256 }, { label: None, name: y, typ: i256 }] -> i256 note: ┌─ return_subtraction_i256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap index 96bd5f92f6..3da3767469 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_subtraction_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(x: u256, y: u256) -> u256 { 3 │ │ return x - y 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: x, typ: u256 }, { label: None, name: y, typ: u256 }] -> u256 note: ┌─ return_subtraction_u256.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap b/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap index a40baad700..2004eb6875 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u128_cast.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> u128 { 3 │ │ return u128(42) 4 │ │ } - │ ╰─────^ self: None, params: [] -> u128 + │ ╰─────^ params: [] -> u128 note: ┌─ return_u128_cast.fe:3:21 diff --git a/crates/analyzer/tests/snapshots/analysis__return_u256.snap b/crates/analyzer/tests/snapshots/analysis__return_u256.snap index 6764a59322..cb30664e81 100644 --- a/crates/analyzer/tests/snapshots/analysis__return_u256.snap +++ b/crates/analyzer/tests/snapshots/analysis__return_u256.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar() -> u256 { 3 │ │ return 42 4 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ return_u256.fe:3:16 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 708fdb03b4..74e74e34da 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 @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(self) -> u256 { 3 │ │ return foo() 4 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ return_u256_from_called_fn.fe:3:16 @@ -23,7 +23,7 @@ note: 6 │ ╭ pub fn foo() -> u256 { 7 │ │ return 42 8 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ return_u256_from_called_fn.fe:7:16 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 571c27b9a7..8a6ebde73e 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 @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn foo(_ v1: u256, _ v2: u256, _ v3: u256, _ v4: u256, _ v5: u256) -> u256 { 5 │ │ return v1 + v2 + v3 + v4 + v5 6 │ │ } - │ ╰─────^ self: None, params: [{ label: Some("_"), name: v1, typ: u256 }, { label: Some("_"), name: v2, typ: u256 }, { label: Some("_"), name: v3, typ: u256 }, { label: Some("_"), name: v4, typ: u256 }, { label: Some("_"), name: v5, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: Some("_"), name: v1, typ: u256 }, { label: Some("_"), name: v2, typ: u256 }, { label: Some("_"), name: v3, typ: u256 }, { label: Some("_"), name: v4, typ: u256 }, { label: Some("_"), name: v5, typ: u256 }] -> u256 note: ┌─ return_u256_from_called_fn_with_args.fe:5:16 @@ -61,7 +61,7 @@ note: 8 │ ╭ pub fn cem() -> u256 { 9 │ │ return 100 10 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ return_u256_from_called_fn_with_args.fe:9:16 @@ -72,17 +72,17 @@ note: note: ┌─ return_u256_from_called_fn_with_args.fe:12:5 │ -12 │ ╭ pub fn bar(self) -> u256 { +12 │ ╭ pub fn bar(mut self) -> u256 { 13 │ │ self.baz[0] = 43 14 │ │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) 15 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [mut self] -> u256 note: ┌─ return_u256_from_called_fn_with_args.fe:13:9 │ 13 │ self.baz[0] = 43 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ return_u256_from_called_fn_with_args.fe:13:9 @@ -90,7 +90,7 @@ note: 13 │ self.baz[0] = 43 │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ return_u256_from_called_fn_with_args.fe:13:9 @@ -98,7 +98,7 @@ note: 13 │ self.baz[0] = 43 │ ^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr + │ mut SPtr 14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^ ^ ^^^^^ ^^ ^^ u256 │ │ │ │ │ @@ -111,7 +111,7 @@ note: ┌─ return_u256_from_called_fn_with_args.fe:14:33 │ 14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) - │ ^^^^^^^ ^^^^ Foo + │ ^^^^^^^ ^^^^ mut Foo │ │ │ u256 @@ -121,13 +121,13 @@ note: 14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) │ ^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ return_u256_from_called_fn_with_args.fe:14:42 │ 14 │ return foo(5, 2, cem(), 25 + 25, self.baz[0]) - │ ^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: ┌─ return_u256_from_called_fn_with_args.fe:14:16 diff --git a/crates/analyzer/tests/snapshots/analysis__revert.snap b/crates/analyzer/tests/snapshots/analysis__revert.snap index 3c980cff8a..36d480e6e9 100644 --- a/crates/analyzer/tests/snapshots/analysis__revert.snap +++ b/crates/analyzer/tests/snapshots/analysis__revert.snap @@ -23,15 +23,15 @@ note: 9 │ ╭ pub fn bar() -> u256 { 10 │ │ revert 11 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ revert.fe:13:5 │ -13 │ ╭ pub fn revert_custom_error(ctx: Context) { +13 │ ╭ pub fn revert_custom_error(mut ctx: Context) { 14 │ │ ctx.send_value(to: address(0), wei: 100) 15 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }] -> () note: ┌─ revert.fe:14:9 @@ -39,7 +39,7 @@ note: 14 │ ctx.send_value(to: address(0), wei: 100) │ ^^^ ^ u256 │ │ - │ Context + │ mut Context note: ┌─ revert.fe:14:28 @@ -61,7 +61,7 @@ note: 17 │ ╭ pub fn revert_other_error() { 18 │ │ revert OtherError(msg: 1, val: true) 19 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ revert.fe:18:32 @@ -80,17 +80,17 @@ note: note: ┌─ revert.fe:21:5 │ -21 │ ╭ pub fn revert_other_error_from_sto(self) { +21 │ ╭ pub fn revert_other_error_from_sto(mut self) { 22 │ │ self.my_other_error = OtherError(msg: 1, val: true) 23 │ │ revert self.my_other_error.to_mem() 24 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ revert.fe:22:9 │ 22 │ self.my_other_error = OtherError(msg: 1, val: true) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ revert.fe:22:9 @@ -99,7 +99,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool │ │ │ │ │ u256 - │ SPtr + │ mut SPtr note: ┌─ revert.fe:22:31 @@ -107,13 +107,13 @@ note: 22 │ self.my_other_error = OtherError(msg: 1, val: true) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OtherError 23 │ revert self.my_other_error.to_mem() - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ revert.fe:23:16 │ 23 │ revert self.my_other_error.to_mem() - │ ^^^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ revert.fe:23:16 diff --git a/crates/analyzer/tests/snapshots/analysis__self_address.snap b/crates/analyzer/tests/snapshots/analysis__self_address.snap index 9a7a5af531..6964541896 100644 --- a/crates/analyzer/tests/snapshots/analysis__self_address.snap +++ b/crates/analyzer/tests/snapshots/analysis__self_address.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn my_address(ctx: Context) -> address { 3 │ │ return ctx.self_address() 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }] -> address + │ ╰─────^ params: [{ label: None, name: ctx, typ: Context }] -> address note: ┌─ self_address.fe:3:16 diff --git a/crates/analyzer/tests/snapshots/analysis__send_value.snap b/crates/analyzer/tests/snapshots/analysis__send_value.snap index bd97f2ad44..05456d8362 100644 --- a/crates/analyzer/tests/snapshots/analysis__send_value.snap +++ b/crates/analyzer/tests/snapshots/analysis__send_value.snap @@ -6,10 +6,10 @@ expression: "build_snapshot(&db, module)" note: ┌─ send_value.fe:2:5 │ -2 │ ╭ pub fn send_them_wei(ctx: Context, to: address, wei: u256) { +2 │ ╭ pub fn send_them_wei(mut ctx: Context, to: address, wei: u256) { 3 │ │ ctx.send_value(to, wei) 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }, { label: None, name: wei, typ: u256 }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }, { label: None, name: to, typ: address }, { label: None, name: wei, typ: u256 }] -> () note: ┌─ send_value.fe:3:9 @@ -18,7 +18,7 @@ note: │ ^^^ ^^ ^^^ u256 │ │ │ │ │ address - │ Context + │ mut Context note: ┌─ send_value.fe:3:9 diff --git a/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap b/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap index 6326204224..5da0c494a7 100644 --- a/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap +++ b/crates/analyzer/tests/snapshots/analysis__simple_open_auction.snap @@ -47,26 +47,26 @@ note: note: ┌─ simple_open_auction.fe:40:5 │ -40 │ ╭ pub fn bid(self, ctx: Context) { +40 │ ╭ pub fn bid(mut self, mut ctx: Context) { 41 │ │ if ctx.block_timestamp() > self.auction_end_time { 42 │ │ revert AuctionAlreadyEnded() 43 │ │ } · │ 53 │ │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) 54 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ simple_open_auction.fe:41:12 │ 41 │ if ctx.block_timestamp() > self.auction_end_time { - │ ^^^ Context + │ ^^^ mut Context note: ┌─ simple_open_auction.fe:41:12 │ 41 │ if ctx.block_timestamp() > self.auction_end_time { - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ │ u256 @@ -74,7 +74,7 @@ note: ┌─ simple_open_auction.fe:41:36 │ 41 │ if ctx.block_timestamp() > self.auction_end_time { - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> u256 note: ┌─ simple_open_auction.fe:41:12 @@ -85,13 +85,13 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^ AuctionAlreadyEnded 43 │ } 44 │ if ctx.msg_value() <= self.highest_bid { - │ ^^^ Context + │ ^^^ mut Context note: ┌─ simple_open_auction.fe:44:12 │ 44 │ if ctx.msg_value() <= self.highest_bid { - │ ^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ │ u256 @@ -99,7 +99,7 @@ note: ┌─ simple_open_auction.fe:44:31 │ 44 │ if ctx.msg_value() <= self.highest_bid { - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> u256 note: ┌─ simple_open_auction.fe:44:12 @@ -107,13 +107,13 @@ note: 44 │ if ctx.msg_value() <= self.highest_bid { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 45 │ revert BidNotHighEnough(highest_bid: self.highest_bid) - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:45:50 │ 45 │ revert BidNotHighEnough(highest_bid: self.highest_bid) - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: ┌─ simple_open_auction.fe:45:20 @@ -122,7 +122,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ BidNotHighEnough 46 │ } 47 │ if self.highest_bid != 0 { - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:47:12 @@ -130,7 +130,7 @@ note: 47 │ if self.highest_bid != 0 { │ ^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ simple_open_auction.fe:47:12 @@ -138,46 +138,46 @@ note: 47 │ if self.highest_bid != 0 { │ ^^^^^^^^^^^^^^^^^^^^^ bool 48 │ self.pending_returns[self.highest_bidder] += self.highest_bid - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:48:13 │ 48 │ self.pending_returns[self.highest_bidder] += self.highest_bid - │ ^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ - │ SPtr> + │ mut SPtr> note: ┌─ simple_open_auction.fe:48:34 │ 48 │ self.pending_returns[self.highest_bidder] += self.highest_bid - │ ^^^^^^^^^^^^^^^^^^^ SPtr
-> address + │ ^^^^^^^^^^^^^^^^^^^ mut SPtr
-> SPtr
-> address note: ┌─ simple_open_auction.fe:48:13 │ 48 │ self.pending_returns[self.highest_bidder] += self.highest_bid - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ simple_open_auction.fe:48:58 │ 48 │ self.pending_returns[self.highest_bidder] += self.highest_bid - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> u256 49 │ } 50 │ self.highest_bidder = ctx.msg_sender() - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:50:9 │ 50 │ self.highest_bidder = ctx.msg_sender() - │ ^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr
+ │ mut SPtr
note: ┌─ simple_open_auction.fe:50:31 @@ -185,15 +185,15 @@ note: 50 │ self.highest_bidder = ctx.msg_sender() │ ^^^^^^^^^^^^^^^^ address 51 │ self.highest_bid = ctx.msg_value() - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:51:9 │ 51 │ self.highest_bid = ctx.msg_value() - │ ^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr + │ mut SPtr note: ┌─ simple_open_auction.fe:51:28 @@ -202,15 +202,15 @@ note: │ ^^^^^^^^^^^^^^^ u256 52 │ 53 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) - │ ^^^ ^^^ Context + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: ┌─ simple_open_auction.fe:53:47 │ 53 │ emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) - │ ^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ │ address @@ -223,14 +223,14 @@ note: note: ┌─ simple_open_auction.fe:56:5 │ -56 │ ╭ pub fn withdraw(self, ctx: Context) -> bool { +56 │ ╭ pub fn withdraw(mut self, ctx: Context) -> bool { 57 │ │ let amount: u256 = self.pending_returns[ctx.msg_sender()] 58 │ │ 59 │ │ if amount > 0 { · │ 63 │ │ return true 64 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }] -> bool note: ┌─ simple_open_auction.fe:57:13 @@ -242,7 +242,7 @@ note: ┌─ simple_open_auction.fe:57:28 │ 57 │ let amount: u256 = self.pending_returns[ctx.msg_sender()] - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:57:28 @@ -250,7 +250,7 @@ note: 57 │ let amount: u256 = self.pending_returns[ctx.msg_sender()] │ ^^^^^^^^^^^^^^^^^^^^ ^^^ Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ simple_open_auction.fe:57:49 @@ -262,7 +262,7 @@ note: ┌─ simple_open_auction.fe:57:28 │ 57 │ let amount: u256 = self.pending_returns[ctx.msg_sender()] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 58 │ 59 │ if amount > 0 { │ ^^^^^^ ^ u256 @@ -275,7 +275,7 @@ note: 59 │ if amount > 0 { │ ^^^^^^^^^^ bool 60 │ self.pending_returns[ctx.msg_sender()] = 0 - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:60:13 @@ -283,7 +283,7 @@ note: 60 │ self.pending_returns[ctx.msg_sender()] = 0 │ ^^^^^^^^^^^^^^^^^^^^ ^^^ Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ simple_open_auction.fe:60:34 @@ -297,7 +297,7 @@ note: 60 │ self.pending_returns[ctx.msg_sender()] = 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr + │ mut SPtr 61 │ ctx.send_value(to: ctx.msg_sender(), wei: amount) │ ^^^ ^^^ Context │ │ @@ -323,26 +323,26 @@ note: note: ┌─ simple_open_auction.fe:66:5 │ -66 │ ╭ pub fn action_end(self, ctx: Context) { +66 │ ╭ pub fn action_end(mut self, mut ctx: Context) { 67 │ │ if ctx.block_timestamp() <= self.auction_end_time { 68 │ │ revert AuctionNotYetEnded() 69 │ │ } · │ 76 │ │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) 77 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ simple_open_auction.fe:67:12 │ 67 │ if ctx.block_timestamp() <= self.auction_end_time { - │ ^^^ Context + │ ^^^ mut Context note: ┌─ simple_open_auction.fe:67:12 │ 67 │ if ctx.block_timestamp() <= self.auction_end_time { - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ │ u256 @@ -350,7 +350,7 @@ note: ┌─ simple_open_auction.fe:67:37 │ 67 │ if ctx.block_timestamp() <= self.auction_end_time { - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> u256 note: ┌─ simple_open_auction.fe:67:12 @@ -361,18 +361,18 @@ note: │ ^^^^^^^^^^^^^^^^^^^^ AuctionNotYetEnded 69 │ } 70 │ if self.ended { - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:70:12 │ 70 │ if self.ended { - │ ^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^ mut SPtr -> SPtr -> bool 71 │ revert AuctionEndAlreadyCalled() │ ^^^^^^^^^^^^^^^^^^^^^^^^^ AuctionEndAlreadyCalled 72 │ } 73 │ self.ended = true - │ ^^^^ SimpleOpenAuction + │ ^^^^ mut SimpleOpenAuction note: ┌─ simple_open_auction.fe:73:9 @@ -380,44 +380,44 @@ note: 73 │ self.ended = true │ ^^^^^^^^^^ ^^^^ bool │ │ - │ SPtr + │ mut SPtr 74 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) - │ ^^^ ^^^^ SimpleOpenAuction + │ ^^^ ^^^^ mut SimpleOpenAuction │ │ - │ Context + │ mut Context -> Context note: ┌─ simple_open_auction.fe:74:40 │ 74 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) - │ ^^^^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ - │ SPtr
-> address + │ mut SPtr
-> SPtr
-> address note: ┌─ simple_open_auction.fe:74:69 │ 74 │ emit AuctionEnded(ctx, winner: self.highest_bidder, amount: self.highest_bid) - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 75 │ 76 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) - │ ^^^ ^^^^ SimpleOpenAuction + │ ^^^ ^^^^ mut SimpleOpenAuction │ │ - │ Context + │ mut Context note: ┌─ simple_open_auction.fe:76:28 │ 76 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) - │ ^^^^^^^^^^^^^^^^ ^^^^ SimpleOpenAuction + │ ^^^^^^^^^^^^^^^^ ^^^^ mut SimpleOpenAuction │ │ - │ SPtr
-> address + │ mut SPtr
-> SPtr
-> address note: ┌─ simple_open_auction.fe:76:51 │ 76 │ ctx.send_value(to: self.beneficiary, wei: self.highest_bid) - │ ^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: ┌─ simple_open_auction.fe:76:9 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 0cf5d77569..b87a2f6e64 100644 --- a/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap +++ b/crates/analyzer/tests/snapshots/analysis__sized_vals_in_sto.snap @@ -26,16 +26,16 @@ note: note: ┌─ sized_vals_in_sto.fe:12:5 │ -12 │ ╭ pub fn write_num(self, x: u256) { +12 │ ╭ pub fn write_num(mut self, x: u256) { 13 │ │ self.num = x 14 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: x, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: x, typ: u256 }] -> () note: ┌─ sized_vals_in_sto.fe:13:9 │ 13 │ self.num = x - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ sized_vals_in_sto.fe:13:9 @@ -43,7 +43,7 @@ note: 13 │ self.num = x │ ^^^^^^^^ ^ u256 │ │ - │ SPtr + │ mut SPtr note: ┌─ sized_vals_in_sto.fe:16:5 @@ -51,7 +51,7 @@ note: 16 │ ╭ pub fn read_num(self) -> u256 { 17 │ │ return self.num 18 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ sized_vals_in_sto.fe:17:16 @@ -68,16 +68,16 @@ note: note: ┌─ sized_vals_in_sto.fe:20:5 │ -20 │ ╭ pub fn write_nums(self, x: Array) { +20 │ ╭ pub fn write_nums(mut self, x: Array) { 21 │ │ self.nums = x 22 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: x, typ: Array }] -> () + │ ╰─────^ params: [mut self, { label: None, name: x, typ: Array }] -> () note: ┌─ sized_vals_in_sto.fe:21:9 │ 21 │ self.nums = x - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ sized_vals_in_sto.fe:21:9 @@ -85,7 +85,7 @@ note: 21 │ self.nums = x │ ^^^^^^^^^ ^ Array │ │ - │ SPtr> + │ mut SPtr> note: ┌─ sized_vals_in_sto.fe:24:5 @@ -93,7 +93,7 @@ note: 24 │ ╭ pub fn read_nums(self) -> Array { 25 │ │ return self.nums.to_mem() 26 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array + │ ╰─────^ params: [self] -> Array note: ┌─ sized_vals_in_sto.fe:25:16 @@ -116,16 +116,16 @@ note: note: ┌─ sized_vals_in_sto.fe:28:5 │ -28 │ ╭ pub fn write_str(self, x: String<26>) { +28 │ ╭ pub fn write_str(mut self, x: String<26>) { 29 │ │ self.str = x 30 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: x, typ: String<26> }] -> () + │ ╰─────^ params: [mut self, { label: None, name: x, typ: String<26> }] -> () note: ┌─ sized_vals_in_sto.fe:29:9 │ 29 │ self.str = x - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ sized_vals_in_sto.fe:29:9 @@ -133,7 +133,7 @@ note: 29 │ self.str = x │ ^^^^^^^^ ^ String<26> │ │ - │ SPtr> + │ mut SPtr> note: ┌─ sized_vals_in_sto.fe:32:5 @@ -141,7 +141,7 @@ note: 32 │ ╭ pub fn read_str(self) -> String<26> { 33 │ │ return self.str.to_mem() 34 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<26> + │ ╰─────^ params: [self] -> String<26> note: ┌─ sized_vals_in_sto.fe:33:16 @@ -164,10 +164,10 @@ note: note: ┌─ sized_vals_in_sto.fe:36:5 │ -36 │ ╭ pub fn emit_event(self, ctx: Context) { +36 │ ╭ pub fn emit_event(self, mut ctx: Context) { 37 │ │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) 38 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ sized_vals_in_sto.fe:37:22 @@ -175,7 +175,7 @@ note: 37 │ emit MyEvent(ctx, num: self.num, nums: self.nums.to_mem(), str: self.str.to_mem()) │ ^^^ ^^^^ Foo │ │ - │ Context + │ mut Context -> Context note: ┌─ sized_vals_in_sto.fe:37:32 diff --git a/crates/analyzer/tests/snapshots/analysis__strings.snap b/crates/analyzer/tests/snapshots/analysis__strings.snap index 4a81f518f7..b12884b7b3 100644 --- a/crates/analyzer/tests/snapshots/analysis__strings.snap +++ b/crates/analyzer/tests/snapshots/analysis__strings.snap @@ -27,7 +27,7 @@ note: 16 │ ╭ pub fn bar(s1: String<100>, s2: String<100>) -> String<100> { 17 │ │ return s2 18 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: s1, typ: String<100> }, { label: None, name: s2, typ: String<100> }] -> String<100> + │ ╰─────^ params: [{ label: None, name: s1, typ: String<100> }, { label: None, name: s2, typ: String<100> }] -> String<100> note: ┌─ strings.fe:17:16 @@ -41,7 +41,7 @@ note: 20 │ ╭ pub fn return_static_string() -> String<43> { 21 │ │ return "The quick brown fox jumps over the lazy dog" 22 │ │ } - │ ╰─────^ self: None, params: [] -> String<43> + │ ╰─────^ params: [] -> String<43> note: ┌─ strings.fe:21:16 @@ -55,7 +55,7 @@ note: 24 │ ╭ pub fn return_casted_static_string() -> String<100> { 25 │ │ return String<100>("foo") 26 │ │ } - │ ╰─────^ self: None, params: [] -> String<100> + │ ╰─────^ params: [] -> String<100> note: ┌─ strings.fe:25:28 @@ -75,7 +75,7 @@ note: 28 │ ╭ pub fn shorter_string_assign() { 29 │ │ let s: String<18> = "fe" 30 │ │ } - │ ╰─────^ self: None, params: [] -> () + │ ╰─────^ params: [] -> () note: ┌─ strings.fe:29:13 @@ -96,7 +96,7 @@ note: 33 │ │ return "\n\"'\r\t 34 │ │ foo\\" 35 │ │ } - │ ╰─────^ self: None, params: [] -> String<18> + │ ╰─────^ params: [] -> String<18> note: ┌─ strings.fe:33:16 diff --git a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap index c00200c08c..f9879f93b2 100644 --- a/crates/analyzer/tests/snapshots/analysis__struct_fns.snap +++ b/crates/analyzer/tests/snapshots/analysis__struct_fns.snap @@ -17,7 +17,7 @@ note: 5 │ ╭ fn internal_new(x: u64, y: u64) -> Point { 6 │ │ return Point(x, y) 7 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> Point + │ ╰─────^ params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> Point note: ┌─ struct_fns.fe:6:22 @@ -39,7 +39,7 @@ note: 9 │ ╭ pub fn new(x: u64, y: u64) -> Point { 10 │ │ return Point::internal_new(x, y) 11 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> Point + │ ╰─────^ params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> Point note: ┌─ struct_fns.fe:10:36 @@ -61,7 +61,7 @@ note: 13 │ ╭ pub fn origin() -> Point { 14 │ │ return Point(x: 0, y: 0) 15 │ │ } - │ ╰─────^ self: None, params: [] -> Point + │ ╰─────^ params: [] -> Point note: ┌─ struct_fns.fe:14:25 @@ -83,7 +83,7 @@ note: 17 │ ╭ pub fn x(self) -> u64 { 18 │ │ return self.x 19 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u64 + │ ╰─────^ params: [self] -> u64 note: ┌─ struct_fns.fe:18:16 @@ -100,12 +100,12 @@ note: note: ┌─ struct_fns.fe:21:5 │ -21 │ ╭ pub fn set_x(self, _ x: u64) -> u64 { +21 │ ╭ pub fn set_x(mut self, _ x: u64) -> u64 { 22 │ │ let old: u64 = self.x 23 │ │ self.x = x 24 │ │ return old 25 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: x, typ: u64 }] -> u64 + │ ╰─────^ params: [mut self, { label: Some("_"), name: x, typ: u64 }] -> u64 note: ┌─ struct_fns.fe:22:13 @@ -117,15 +117,15 @@ note: ┌─ struct_fns.fe:22:24 │ 22 │ let old: u64 = self.x - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:22:24 │ 22 │ let old: u64 = self.x - │ ^^^^^^ u64 + │ ^^^^^^ mut u64 -> u64 23 │ self.x = x - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:23:9 @@ -133,20 +133,20 @@ note: 23 │ self.x = x │ ^^^^^^ ^ u64 │ │ - │ u64 + │ mut u64 24 │ return old │ ^^^ u64 note: ┌─ struct_fns.fe:27:5 │ -27 │ ╭ pub fn reflect(self) { +27 │ ╭ pub fn reflect(mut self) { 28 │ │ let x: u64 = self.x 29 │ │ let y: u64 = self.y 30 │ │ self.x = y 31 │ │ self.y = x 32 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ struct_fns.fe:28:13 @@ -160,23 +160,23 @@ note: ┌─ struct_fns.fe:28:22 │ 28 │ let x: u64 = self.x - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:28:22 │ 28 │ let x: u64 = self.x - │ ^^^^^^ u64 + │ ^^^^^^ mut u64 -> u64 29 │ let y: u64 = self.y - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:29:22 │ 29 │ let y: u64 = self.y - │ ^^^^^^ u64 + │ ^^^^^^ mut u64 -> u64 30 │ self.x = y - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:30:9 @@ -184,9 +184,9 @@ note: 30 │ self.x = y │ ^^^^^^ ^ u64 │ │ - │ u64 + │ mut u64 31 │ self.y = x - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:31:9 @@ -194,22 +194,22 @@ note: 31 │ self.y = x │ ^^^^^^ ^ u64 │ │ - │ u64 + │ mut u64 note: ┌─ struct_fns.fe:34:5 │ -34 │ ╭ pub fn translate(self, x: u64, y: u64) { +34 │ ╭ pub fn translate(mut self, x: u64, y: u64) { 35 │ │ self.x += x 36 │ │ self.y += y 37 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> () note: ┌─ struct_fns.fe:35:9 │ 35 │ self.x += x - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:35:9 @@ -217,9 +217,9 @@ note: 35 │ self.x += x │ ^^^^^^ ^ u64 │ │ - │ u64 + │ mut u64 36 │ self.y += y - │ ^^^^ Point + │ ^^^^ mut Point note: ┌─ struct_fns.fe:36:9 @@ -227,7 +227,7 @@ note: 36 │ self.y += y │ ^^^^^^ ^ u64 │ │ - │ u64 + │ mut u64 note: ┌─ struct_fns.fe:39:5 @@ -237,7 +237,7 @@ note: 41 │ │ let y: u64 = self.y + other.y 42 │ │ return Point(x, y) 43 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: other, typ: Point }] -> Point + │ ╰─────^ params: [self, { label: Some("_"), name: other, typ: Point }] -> Point note: ┌─ struct_fns.fe:40:13 @@ -309,19 +309,19 @@ note: ┌─ struct_fns.fe:46:1 │ 46 │ ╭ pub fn do_pointy_things() { -47 │ │ let p1: Point = Point::origin() +47 │ │ let mut p1: Point = Point::origin() 48 │ │ p1.translate(x: 5, y: 10) 49 │ │ let p2: Point = Point(x: 1, y: 2) 50 │ │ let p3: Point = p1.add(p2) 51 │ │ assert p3.x == 6 and p3.y == 12 52 │ │ } - │ ╰─^ self: None, params: [] -> () + │ ╰─^ params: [] -> () note: - ┌─ struct_fns.fe:47:9 + ┌─ struct_fns.fe:47:13 │ -47 │ let p1: Point = Point::origin() - │ ^^ Point +47 │ let mut p1: Point = Point::origin() + │ ^^ mut Point 48 │ p1.translate(x: 5, y: 10) 49 │ let p2: Point = Point(x: 1, y: 2) │ ^^ Point @@ -329,15 +329,15 @@ note: │ ^^ Point note: - ┌─ struct_fns.fe:47:21 + ┌─ struct_fns.fe:47:25 │ -47 │ let p1: Point = Point::origin() - │ ^^^^^^^^^^^^^^^ Point +47 │ let mut p1: Point = Point::origin() + │ ^^^^^^^^^^^^^^^ Point 48 │ p1.translate(x: 5, y: 10) │ ^^ ^ ^^ u64 │ │ │ │ │ u64 - │ Point + │ mut Point note: ┌─ struct_fns.fe:48:5 @@ -357,7 +357,7 @@ note: 50 │ let p3: Point = p1.add(p2) │ ^^ ^^ Point │ │ - │ Point + │ mut Point note: ┌─ struct_fns.fe:50:21 @@ -408,36 +408,36 @@ note: │ 55 │ ╭ pub fn bar(x: u64, y: u64) -> u64 { 56 │ │ do_pointy_things() -57 │ │ let p: Point = Point::new(x, y) +57 │ │ let mut p: Point = Point::new(x, y) 58 │ │ assert p.x == x and p.y == y · │ 62 │ │ return p.y 63 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> u64 + │ ╰─────^ params: [{ label: None, name: x, typ: u64 }, { label: None, name: y, typ: u64 }] -> u64 note: - ┌─ struct_fns.fe:57:13 + ┌─ struct_fns.fe:57:17 │ -57 │ let p: Point = Point::new(x, y) - │ ^ Point +57 │ let mut p: Point = Point::new(x, y) + │ ^ mut Point note: ┌─ struct_fns.fe:56:9 │ 56 │ do_pointy_things() │ ^^^^^^^^^^^^^^^^^^ () -57 │ let p: Point = Point::new(x, y) - │ ^ ^ u64 - │ │ - │ u64 +57 │ let mut p: Point = Point::new(x, y) + │ ^ ^ u64 + │ │ + │ u64 note: - ┌─ struct_fns.fe:57:24 + ┌─ struct_fns.fe:57:28 │ -57 │ let p: Point = Point::new(x, y) - │ ^^^^^^^^^^^^^^^^ Point +57 │ let mut p: Point = Point::new(x, y) + │ ^^^^^^^^^^^^^^^^ Point 58 │ assert p.x == x and p.y == y - │ ^ Point + │ ^ mut Point note: ┌─ struct_fns.fe:58:16 @@ -445,13 +445,13 @@ note: 58 │ assert p.x == x and p.y == y │ ^^^ ^ u64 │ │ - │ u64 + │ mut u64 note: ┌─ struct_fns.fe:58:16 │ 58 │ assert p.x == x and p.y == y - │ ^^^^^^^^ ^ Point + │ ^^^^^^^^ ^ mut Point │ │ │ bool @@ -461,7 +461,7 @@ note: 58 │ assert p.x == x and p.y == y │ ^^^ ^ u64 │ │ - │ u64 + │ mut u64 note: ┌─ struct_fns.fe:58:29 @@ -477,7 +477,7 @@ note: 59 │ p.set_x(100) │ ^ ^^^ u64 │ │ - │ Point + │ mut Point note: ┌─ struct_fns.fe:59:9 @@ -485,7 +485,7 @@ note: 59 │ p.set_x(100) │ ^^^^^^^^^^^^ u64 60 │ p.reflect() - │ ^ Point + │ ^ mut Point note: ┌─ struct_fns.fe:60:9 @@ -493,7 +493,7 @@ note: 60 │ p.reflect() │ ^^^^^^^^^^^ () 61 │ assert p.x() == y and p.y == 100 - │ ^ Point + │ ^ mut Point note: ┌─ struct_fns.fe:61:16 @@ -507,7 +507,7 @@ note: ┌─ struct_fns.fe:61:16 │ 61 │ assert p.x() == y and p.y == 100 - │ ^^^^^^^^^^ ^ Point + │ ^^^^^^^^^^ ^ mut Point │ │ │ bool @@ -517,7 +517,7 @@ note: 61 │ assert p.x() == y and p.y == 100 │ ^^^ ^^^ u64 │ │ - │ u64 + │ mut u64 note: ┌─ struct_fns.fe:61:31 @@ -531,12 +531,12 @@ note: 61 │ assert p.x() == y and p.y == 100 │ ^^^^^^^^^^^^^^^^^^^^^^^^^ bool 62 │ return p.y - │ ^ Point + │ ^ mut Point note: ┌─ struct_fns.fe:62:16 │ 62 │ return p.y - │ ^^^ u64 + │ ^^^ mut u64 -> u64 diff --git a/crates/analyzer/tests/snapshots/analysis__structs.snap b/crates/analyzer/tests/snapshots/analysis__structs.snap index bd343900f9..4d9ac8918f 100644 --- a/crates/analyzer/tests/snapshots/analysis__structs.snap +++ b/crates/analyzer/tests/snapshots/analysis__structs.snap @@ -37,7 +37,7 @@ note: 17 │ ╭ pub fn new(val: u256) -> Mixed { 18 │ │ return Mixed(foo: val, bar: false) 19 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: val, typ: u256 }] -> Mixed + │ ╰─────^ params: [{ label: None, name: val, typ: u256 }] -> Mixed note: ┌─ structs.fe:18:27 @@ -71,7 +71,7 @@ note: 28 │ ╭ pub fn encode(self) -> Array { 29 │ │ return self.abi_encode() 30 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> Array + │ ╰─────^ params: [self] -> Array note: ┌─ structs.fe:29:16 @@ -91,7 +91,7 @@ note: 32 │ ╭ pub fn hash(self) -> u256 { 33 │ │ return keccak256(self.encode()) 34 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ structs.fe:33:26 @@ -117,7 +117,7 @@ note: 36 │ ╭ pub fn price_per_sqft(self) -> u256 { 37 │ │ return self.price / self.size 38 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ structs.fe:37:16 @@ -148,17 +148,17 @@ note: note: ┌─ structs.fe:40:5 │ -40 │ ╭ pub fn expand(self) { +40 │ ╭ pub fn expand(mut self) { 41 │ │ self.rooms += 1 42 │ │ self.size += 100 43 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ structs.fe:41:9 │ 41 │ self.rooms += 1 - │ ^^^^ House + │ ^^^^ mut House note: ┌─ structs.fe:41:9 @@ -166,9 +166,9 @@ note: 41 │ self.rooms += 1 │ ^^^^^^^^^^ ^ u8 │ │ - │ u8 + │ mut u8 42 │ self.size += 100 - │ ^^^^ House + │ ^^^^ mut House note: ┌─ structs.fe:42:9 @@ -176,7 +176,7 @@ note: 42 │ self.size += 100 │ ^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:47:5 @@ -189,20 +189,20 @@ note: note: ┌─ structs.fe:50:5 │ -50 │ ╭ pub fn complex_struct_in_storage(self) -> String<3> { +50 │ ╭ pub fn complex_struct_in_storage(mut 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 · │ 79 │ │ return self.my_bar.name.to_mem() 80 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<3> + │ ╰─────^ params: [mut self] -> String<3> note: ┌─ structs.fe:51:9 │ 51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:51:9 @@ -212,7 +212,7 @@ note: │ │ │ │ │ │ │ u256 │ │ String<3> - │ SPtr + │ mut SPtr note: ┌─ structs.fe:51:49 @@ -244,13 +244,13 @@ note: 51 │ self.my_bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bar 52 │ assert self.my_bar.numbers[0] == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:52:16 │ 52 │ assert self.my_bar.numbers[0] == 1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:52:16 @@ -258,7 +258,7 @@ note: 52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:52:16 @@ -266,7 +266,7 @@ note: 52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:52:16 @@ -274,13 +274,13 @@ note: 52 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 53 │ assert self.my_bar.numbers[1] == 2 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:53:16 │ 53 │ assert self.my_bar.numbers[1] == 2 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:53:16 @@ -288,7 +288,7 @@ note: 53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:53:16 @@ -296,7 +296,7 @@ note: 53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:53:16 @@ -304,19 +304,19 @@ note: 53 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 54 │ assert self.my_bar.point.x == 100 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:54:16 │ 54 │ assert self.my_bar.point.x == 100 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:54:16 │ 54 │ assert self.my_bar.point.x == 100 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:54:16 @@ -324,7 +324,7 @@ note: 54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:54:16 @@ -332,19 +332,19 @@ note: 54 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 55 │ assert self.my_bar.point.y == 200 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:55:16 │ 55 │ assert self.my_bar.point.y == 200 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:55:16 │ 55 │ assert self.my_bar.point.y == 200 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:55:16 @@ -352,7 +352,7 @@ note: 55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:55:16 @@ -360,19 +360,19 @@ note: 55 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 56 │ assert self.my_bar.something.item0 == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:56:16 │ 56 │ assert self.my_bar.something.item0 == 1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:56:16 │ 56 │ assert self.my_bar.something.item0 == 1 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:56:16 @@ -380,7 +380,7 @@ note: 56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:56:16 @@ -388,33 +388,33 @@ note: 56 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 57 │ assert self.my_bar.something.item1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:57:16 │ 57 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:57:16 │ 57 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:57:16 │ 57 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> bool 58 │ self.my_bar.numbers[0] = 10 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:58:9 │ 58 │ self.my_bar.numbers[0] = 10 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:58:9 @@ -422,7 +422,7 @@ note: 58 │ self.my_bar.numbers[0] = 10 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:58:9 @@ -430,15 +430,15 @@ note: 58 │ self.my_bar.numbers[0] = 10 │ ^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr + │ mut SPtr 59 │ self.my_bar.numbers[1] = 20 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:59:9 │ 59 │ self.my_bar.numbers[1] = 20 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:59:9 @@ -446,7 +446,7 @@ note: 59 │ self.my_bar.numbers[1] = 20 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:59:9 @@ -454,15 +454,15 @@ note: 59 │ self.my_bar.numbers[1] = 20 │ ^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr + │ mut SPtr 60 │ assert self.my_bar.numbers[0] == 10 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:60:16 │ 60 │ assert self.my_bar.numbers[0] == 10 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:60:16 @@ -470,7 +470,7 @@ note: 60 │ assert self.my_bar.numbers[0] == 10 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:60:16 @@ -478,7 +478,7 @@ note: 60 │ assert self.my_bar.numbers[0] == 10 │ ^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:60:16 @@ -486,13 +486,13 @@ note: 60 │ assert self.my_bar.numbers[0] == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 61 │ assert self.my_bar.numbers[1] == 20 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:61:16 │ 61 │ assert self.my_bar.numbers[1] == 20 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:61:16 @@ -500,7 +500,7 @@ note: 61 │ assert self.my_bar.numbers[1] == 20 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:61:16 @@ -508,7 +508,7 @@ note: 61 │ assert self.my_bar.numbers[1] == 20 │ ^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:61:16 @@ -516,13 +516,13 @@ note: 61 │ assert self.my_bar.numbers[1] == 20 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 62 │ self.my_bar.numbers = [1, 2] - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:62:9 │ 62 │ self.my_bar.numbers = [1, 2] - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:62:9 @@ -531,7 +531,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^ ^ ^ u256 │ │ │ │ │ u256 - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:62:31 @@ -539,13 +539,13 @@ note: 62 │ self.my_bar.numbers = [1, 2] │ ^^^^^^ Array 63 │ assert self.my_bar.numbers[0] == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:63:16 │ 63 │ assert self.my_bar.numbers[0] == 1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:63:16 @@ -553,7 +553,7 @@ note: 63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:63:16 @@ -561,7 +561,7 @@ note: 63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:63:16 @@ -569,13 +569,13 @@ note: 63 │ assert self.my_bar.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 64 │ assert self.my_bar.numbers[1] == 2 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:64:16 │ 64 │ assert self.my_bar.numbers[1] == 2 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:64:16 @@ -583,7 +583,7 @@ note: 64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ structs.fe:64:16 @@ -591,7 +591,7 @@ note: 64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:64:16 @@ -599,19 +599,19 @@ note: 64 │ assert self.my_bar.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 65 │ self.my_bar.point.x = 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:65:9 │ 65 │ self.my_bar.point.x = 1000 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:65:9 │ 65 │ self.my_bar.point.x = 1000 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:65:9 @@ -619,21 +619,21 @@ note: 65 │ self.my_bar.point.x = 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr + │ mut SPtr 66 │ self.my_bar.point.y = 2000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:66:9 │ 66 │ self.my_bar.point.y = 2000 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:66:9 │ 66 │ self.my_bar.point.y = 2000 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:66:9 @@ -641,21 +641,21 @@ note: 66 │ self.my_bar.point.y = 2000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr + │ mut SPtr 67 │ assert self.my_bar.point.x == 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:67:16 │ 67 │ assert self.my_bar.point.x == 1000 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:67:16 │ 67 │ assert self.my_bar.point.x == 1000 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:67:16 @@ -663,7 +663,7 @@ note: 67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:67:16 @@ -671,19 +671,19 @@ note: 67 │ assert self.my_bar.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 68 │ assert self.my_bar.point.y == 2000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:68:16 │ 68 │ assert self.my_bar.point.y == 2000 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:68:16 │ 68 │ assert self.my_bar.point.y == 2000 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:68:16 @@ -691,7 +691,7 @@ note: 68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:68:16 @@ -699,13 +699,13 @@ note: 68 │ assert self.my_bar.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 69 │ self.my_bar.point = Point(x: 100, y: 200) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:69:9 │ 69 │ self.my_bar.point = Point(x: 100, y: 200) - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:69:9 @@ -714,7 +714,7 @@ note: │ ^^^^^^^^^^^^^^^^^ ^^^ ^^^ u256 │ │ │ │ │ u256 - │ SPtr + │ mut SPtr note: ┌─ structs.fe:69:29 @@ -722,19 +722,19 @@ note: 69 │ self.my_bar.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^^^^^^^^^^^ Point 70 │ assert self.my_bar.point.x == 100 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:70:16 │ 70 │ assert self.my_bar.point.x == 100 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:70:16 │ 70 │ assert self.my_bar.point.x == 100 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:70:16 @@ -742,7 +742,7 @@ note: 70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:70:16 @@ -750,19 +750,19 @@ note: 70 │ assert self.my_bar.point.x == 100 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 71 │ assert self.my_bar.point.y == 200 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:71:16 │ 71 │ assert self.my_bar.point.y == 200 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:71:16 │ 71 │ assert self.my_bar.point.y == 200 - │ ^^^^^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:71:16 @@ -770,7 +770,7 @@ note: 71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:71:16 @@ -778,19 +778,19 @@ note: 71 │ assert self.my_bar.point.y == 200 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 72 │ self.my_bar.something.item0 = 10 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:72:9 │ 72 │ self.my_bar.something.item0 = 10 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:72:9 │ 72 │ self.my_bar.something.item0 = 10 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:72:9 @@ -798,21 +798,21 @@ note: 72 │ self.my_bar.something.item0 = 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr + │ mut SPtr 73 │ self.my_bar.something.item1 = false - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:73:9 │ 73 │ self.my_bar.something.item1 = false - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:73:9 │ 73 │ self.my_bar.something.item1 = false - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:73:9 @@ -820,21 +820,21 @@ note: 73 │ self.my_bar.something.item1 = false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr + │ mut SPtr 74 │ assert self.my_bar.something.item0 == 10 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:74:16 │ 74 │ assert self.my_bar.something.item0 == 10 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:74:16 │ 74 │ assert self.my_bar.something.item0 == 10 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:74:16 @@ -842,7 +842,7 @@ note: 74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:74:16 @@ -850,25 +850,25 @@ note: 74 │ assert self.my_bar.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 75 │ assert not self.my_bar.something.item1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:75:20 │ 75 │ assert not self.my_bar.something.item1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:75:20 │ 75 │ assert not self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:75:20 │ 75 │ assert not self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> bool note: ┌─ structs.fe:75:16 @@ -876,13 +876,13 @@ note: 75 │ assert not self.my_bar.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 76 │ self.my_bar.something = (1, true) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:76:9 │ 76 │ self.my_bar.something = (1, true) - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:76:9 @@ -891,7 +891,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool │ │ │ │ │ u256 - │ SPtr<(u256, bool)> + │ mut SPtr<(u256, bool)> note: ┌─ structs.fe:76:33 @@ -899,19 +899,19 @@ note: 76 │ self.my_bar.something = (1, true) │ ^^^^^^^^^ (u256, bool) 77 │ assert self.my_bar.something.item0 == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:77:16 │ 77 │ assert self.my_bar.something.item0 == 1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:77:16 │ 77 │ assert self.my_bar.something.item0 == 1 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:77:16 @@ -919,7 +919,7 @@ note: 77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:77:16 @@ -927,39 +927,39 @@ note: 77 │ assert self.my_bar.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 78 │ assert self.my_bar.something.item1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:78:16 │ 78 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:78:16 │ 78 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^ SPtr<(u256, bool)> + │ ^^^^^^^^^^^^^^^^^^^^^ mut SPtr<(u256, bool)> note: ┌─ structs.fe:78:16 │ 78 │ assert self.my_bar.something.item1 - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> bool 79 │ return self.my_bar.name.to_mem() - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:79:16 │ 79 │ return self.my_bar.name.to_mem() - │ ^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:79:16 │ 79 │ return self.my_bar.name.to_mem() - │ ^^^^^^^^^^^^^^^^ SPtr> + │ ^^^^^^^^^^^^^^^^ mut SPtr> note: ┌─ structs.fe:79:16 @@ -970,61 +970,61 @@ note: note: ┌─ structs.fe:82:5 │ - 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)) + 82 │ ╭ pub fn complex_struct_in_memory() -> String<3> { + 83 │ │ let mut 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 · │ 111 │ │ return val.name 112 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> String<3> + │ ╰─────^ params: [] -> String<3> note: - ┌─ structs.fe:83:13 + ┌─ structs.fe:83:17 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^ Bar +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^ mut Bar note: - ┌─ structs.fe:83:34 + ┌─ structs.fe:83:38 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^^ ^ ^ u256 - │ │ │ - │ │ u256 - │ String<3> +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^ ^ ^ u256 + │ │ │ + │ │ u256 + │ String<3> note: - ┌─ structs.fe:83:50 + ┌─ structs.fe:83:54 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^^^ ^^^ ^^^ u256 - │ │ │ - │ │ u256 - │ Array +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^ ^^^ ^^^ u256 + │ │ │ + │ │ u256 + │ Array note: - ┌─ structs.fe:83:65 + ┌─ structs.fe:83:69 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool - │ │ │ - │ │ u256 - │ Point +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^ ^ ^^^^ bool + │ │ │ + │ │ u256 + │ Point note: - ┌─ structs.fe:83:99 + ┌─ structs.fe:83:103 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^^^^^^ (u256, bool) +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^ (u256, bool) note: - ┌─ structs.fe:83:24 + ┌─ structs.fe:83:28 │ -83 │ let val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bar +83 │ let mut val: Bar = Bar(name: "foo", numbers: [1, 2], point: Point(x: 100, y: 200), something: (1, true)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Bar 84 │ assert val.numbers[0] == 1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:84:16 @@ -1032,7 +1032,7 @@ note: 84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:84:16 @@ -1040,7 +1040,7 @@ note: 84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:84:16 @@ -1048,7 +1048,7 @@ note: 84 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ bool 85 │ assert val.numbers[1] == 2 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:85:16 @@ -1056,7 +1056,7 @@ note: 85 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:85:16 @@ -1064,7 +1064,7 @@ note: 85 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:85:16 @@ -1072,13 +1072,13 @@ note: 85 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ bool 86 │ assert val.point.x == 100 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:86:16 │ 86 │ assert val.point.x == 100 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:86:16 @@ -1086,7 +1086,7 @@ note: 86 │ assert val.point.x == 100 │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:86:16 @@ -1094,13 +1094,13 @@ note: 86 │ assert val.point.x == 100 │ ^^^^^^^^^^^^^^^^^^ bool 87 │ assert val.point.y == 200 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:87:16 │ 87 │ assert val.point.y == 200 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:87:16 @@ -1108,7 +1108,7 @@ note: 87 │ assert val.point.y == 200 │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:87:16 @@ -1116,13 +1116,13 @@ note: 87 │ assert val.point.y == 200 │ ^^^^^^^^^^^^^^^^^^ bool 88 │ assert val.something.item0 == 1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:88:16 │ 88 │ assert val.something.item0 == 1 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:88:16 @@ -1130,7 +1130,7 @@ note: 88 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:88:16 @@ -1138,21 +1138,21 @@ note: 88 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 89 │ assert val.something.item1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:89:16 │ 89 │ assert val.something.item1 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:89:16 │ 89 │ assert val.something.item1 - │ ^^^^^^^^^^^^^^^^^^^ bool + │ ^^^^^^^^^^^^^^^^^^^ mut bool -> bool 90 │ val.numbers[0] = 10 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:90:9 @@ -1160,7 +1160,7 @@ note: 90 │ val.numbers[0] = 10 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:90:9 @@ -1168,9 +1168,9 @@ note: 90 │ val.numbers[0] = 10 │ ^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 91 │ val.numbers[1] = 20 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:91:9 @@ -1178,7 +1178,7 @@ note: 91 │ val.numbers[1] = 20 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:91:9 @@ -1186,9 +1186,9 @@ note: 91 │ val.numbers[1] = 20 │ ^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 92 │ assert val.numbers[0] == 10 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:92:16 @@ -1196,7 +1196,7 @@ note: 92 │ assert val.numbers[0] == 10 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:92:16 @@ -1204,7 +1204,7 @@ note: 92 │ assert val.numbers[0] == 10 │ ^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:92:16 @@ -1212,7 +1212,7 @@ note: 92 │ assert val.numbers[0] == 10 │ ^^^^^^^^^^^^^^^^^^^^ bool 93 │ assert val.numbers[1] == 20 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:93:16 @@ -1220,7 +1220,7 @@ note: 93 │ assert val.numbers[1] == 20 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:93:16 @@ -1228,7 +1228,7 @@ note: 93 │ assert val.numbers[1] == 20 │ ^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:93:16 @@ -1236,7 +1236,7 @@ note: 93 │ assert val.numbers[1] == 20 │ ^^^^^^^^^^^^^^^^^^^^ bool 94 │ val.numbers = [1, 2] - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:94:9 @@ -1245,7 +1245,7 @@ note: │ ^^^^^^^^^^^ ^ ^ u256 │ │ │ │ │ u256 - │ Array + │ mut Array note: ┌─ structs.fe:94:23 @@ -1253,7 +1253,7 @@ note: 94 │ val.numbers = [1, 2] │ ^^^^^^ Array 95 │ assert val.numbers[0] == 1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:95:16 @@ -1261,7 +1261,7 @@ note: 95 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:95:16 @@ -1269,7 +1269,7 @@ note: 95 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:95:16 @@ -1277,7 +1277,7 @@ note: 95 │ assert val.numbers[0] == 1 │ ^^^^^^^^^^^^^^^^^^^ bool 96 │ assert val.numbers[1] == 2 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:96:16 @@ -1285,7 +1285,7 @@ note: 96 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^ ^ u256 │ │ - │ Array + │ mut Array note: ┌─ structs.fe:96:16 @@ -1293,7 +1293,7 @@ note: 96 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:96:16 @@ -1301,13 +1301,13 @@ note: 96 │ assert val.numbers[1] == 2 │ ^^^^^^^^^^^^^^^^^^^ bool 97 │ val.point.x = 1000 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:97:9 │ 97 │ val.point.x = 1000 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:97:9 @@ -1315,15 +1315,15 @@ note: 97 │ val.point.x = 1000 │ ^^^^^^^^^^^ ^^^^ u256 │ │ - │ u256 + │ mut u256 98 │ val.point.y = 2000 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:98:9 │ 98 │ val.point.y = 2000 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:98:9 @@ -1331,15 +1331,15 @@ note: 98 │ val.point.y = 2000 │ ^^^^^^^^^^^ ^^^^ u256 │ │ - │ u256 + │ mut u256 99 │ assert val.point.x == 1000 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:99:16 │ 99 │ assert val.point.x == 1000 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:99:16 @@ -1347,7 +1347,7 @@ note: 99 │ assert val.point.x == 1000 │ ^^^^^^^^^^^ ^^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:99:16 @@ -1355,13 +1355,13 @@ note: 99 │ assert val.point.x == 1000 │ ^^^^^^^^^^^^^^^^^^^ bool 100 │ assert val.point.y == 2000 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:100:16 │ 100 │ assert val.point.y == 2000 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:100:16 @@ -1369,7 +1369,7 @@ note: 100 │ assert val.point.y == 2000 │ ^^^^^^^^^^^ ^^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:100:16 @@ -1377,7 +1377,7 @@ note: 100 │ assert val.point.y == 2000 │ ^^^^^^^^^^^^^^^^^^^ bool 101 │ val.point = Point(x: 100, y: 200) - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:101:9 @@ -1386,7 +1386,7 @@ note: │ ^^^^^^^^^ ^^^ ^^^ u256 │ │ │ │ │ u256 - │ Point + │ mut Point note: ┌─ structs.fe:101:21 @@ -1394,13 +1394,13 @@ note: 101 │ val.point = Point(x: 100, y: 200) │ ^^^^^^^^^^^^^^^^^^^^^ Point 102 │ assert val.point.x == 100 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:102:16 │ 102 │ assert val.point.x == 100 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:102:16 @@ -1408,7 +1408,7 @@ note: 102 │ assert val.point.x == 100 │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:102:16 @@ -1416,13 +1416,13 @@ note: 102 │ assert val.point.x == 100 │ ^^^^^^^^^^^^^^^^^^ bool 103 │ assert val.point.y == 200 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:103:16 │ 103 │ assert val.point.y == 200 - │ ^^^^^^^^^ Point + │ ^^^^^^^^^ mut Point note: ┌─ structs.fe:103:16 @@ -1430,7 +1430,7 @@ note: 103 │ assert val.point.y == 200 │ ^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:103:16 @@ -1438,13 +1438,13 @@ note: 103 │ assert val.point.y == 200 │ ^^^^^^^^^^^^^^^^^^ bool 104 │ val.something.item0 = 10 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:104:9 │ 104 │ val.something.item0 = 10 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:104:9 @@ -1452,15 +1452,15 @@ note: 104 │ val.something.item0 = 10 │ ^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 105 │ val.something.item1 = false - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:105:9 │ 105 │ val.something.item1 = false - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:105:9 @@ -1468,15 +1468,15 @@ note: 105 │ val.something.item1 = false │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ bool + │ mut bool 106 │ assert val.something.item0 == 10 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:106:16 │ 106 │ assert val.something.item0 == 10 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:106:16 @@ -1484,7 +1484,7 @@ note: 106 │ assert val.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:106:16 @@ -1492,19 +1492,19 @@ note: 106 │ assert val.something.item0 == 10 │ ^^^^^^^^^^^^^^^^^^^^^^^^^ bool 107 │ assert not val.something.item1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:107:20 │ 107 │ assert not val.something.item1 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:107:20 │ 107 │ assert not val.something.item1 - │ ^^^^^^^^^^^^^^^^^^^ bool + │ ^^^^^^^^^^^^^^^^^^^ mut bool note: ┌─ structs.fe:107:16 @@ -1512,7 +1512,7 @@ note: 107 │ assert not val.something.item1 │ ^^^^^^^^^^^^^^^^^^^^^^^ bool 108 │ val.something = (1, true) - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:108:9 @@ -1521,7 +1521,7 @@ note: │ ^^^^^^^^^^^^^ ^ ^^^^ bool │ │ │ │ │ u256 - │ (u256, bool) + │ mut (u256, bool) note: ┌─ structs.fe:108:25 @@ -1529,13 +1529,13 @@ note: 108 │ val.something = (1, true) │ ^^^^^^^^^ (u256, bool) 109 │ assert val.something.item0 == 1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:109:16 │ 109 │ assert val.something.item0 == 1 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:109:16 @@ -1543,7 +1543,7 @@ note: 109 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:109:16 @@ -1551,27 +1551,27 @@ note: 109 │ assert val.something.item0 == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 110 │ assert val.something.item1 - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:110:16 │ 110 │ assert val.something.item1 - │ ^^^^^^^^^^^^^ (u256, bool) + │ ^^^^^^^^^^^^^ mut (u256, bool) note: ┌─ structs.fe:110:16 │ 110 │ assert val.something.item1 - │ ^^^^^^^^^^^^^^^^^^^ bool + │ ^^^^^^^^^^^^^^^^^^^ mut bool -> bool 111 │ return val.name - │ ^^^ Bar + │ ^^^ mut Bar note: ┌─ structs.fe:111:16 │ 111 │ return val.name - │ ^^^^^^^^ String<3> + │ ^^^^^^^^ mut String<3> -> String<3> note: ┌─ structs.fe:114:5 @@ -1580,7 +1580,7 @@ note: 115 │ │ let mixed: Mixed = Mixed::new(val: 1) 116 │ │ return mixed.foo 117 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ structs.fe:115:13 @@ -1611,16 +1611,16 @@ note: note: ┌─ structs.fe:119:5 │ -119 │ ╭ pub fn set_house(self, data: House) { +119 │ ╭ pub fn set_house(mut self, data: House) { 120 │ │ self.my_house = data 121 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: data, typ: House }] -> () + │ ╰─────^ params: [mut self, { label: None, name: data, typ: House }] -> () note: ┌─ structs.fe:120:9 │ 120 │ self.my_house = data - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:120:9 @@ -1628,7 +1628,7 @@ note: 120 │ self.my_house = data │ ^^^^^^^^^^^^^ ^^^^ House │ │ - │ SPtr + │ mut SPtr note: ┌─ structs.fe:123:5 @@ -1636,7 +1636,7 @@ note: 123 │ ╭ pub fn get_house(self) -> House { 124 │ │ return self.my_house.to_mem() 125 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> House + │ ╰─────^ params: [self] -> House note: ┌─ structs.fe:124:16 @@ -1659,20 +1659,20 @@ note: note: ┌─ structs.fe:127:5 │ -127 │ ╭ pub fn create_house(self) { +127 │ ╭ pub fn create_house(mut 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 · │ 152 │ │ assert self.my_house.vacant 153 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [mut self] -> () note: ┌─ structs.fe:128:9 │ 128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:128:9 @@ -1682,7 +1682,7 @@ note: │ │ │ │ │ │ │ u256 │ │ u256 - │ SPtr + │ mut SPtr note: ┌─ structs.fe:128:57 @@ -1698,13 +1698,13 @@ note: 128 │ self.my_house = House(price: 1, size: 2, rooms: u8(5), vacant: false) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House 129 │ assert self.my_house.price == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:129:16 │ 129 │ assert self.my_house.price == 1 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:129:16 @@ -1712,7 +1712,7 @@ note: 129 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:129:16 @@ -1720,13 +1720,13 @@ note: 129 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 130 │ assert self.my_house.size == 2 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:130:16 │ 130 │ assert self.my_house.size == 2 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:130:16 @@ -1734,7 +1734,7 @@ note: 130 │ assert self.my_house.size == 2 │ ^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:130:16 @@ -1742,13 +1742,13 @@ note: 130 │ assert self.my_house.size == 2 │ ^^^^^^^^^^^^^^^^^^^^^^^ bool 131 │ assert self.my_house.rooms == u8(5) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:131:16 │ 131 │ assert self.my_house.rooms == u8(5) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:131:16 @@ -1756,7 +1756,7 @@ note: 131 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8 │ │ - │ SPtr -> u8 + │ mut SPtr -> u8 note: ┌─ structs.fe:131:39 @@ -1770,13 +1770,13 @@ note: 131 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 132 │ assert self.my_house.vacant == false - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:132:16 │ 132 │ assert self.my_house.vacant == false - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:132:16 @@ -1784,7 +1784,7 @@ note: 132 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr -> bool + │ mut SPtr -> bool note: ┌─ structs.fe:132:16 @@ -1792,13 +1792,13 @@ note: 132 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 133 │ self.my_house.size = 50 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:133:9 │ 133 │ self.my_house.size = 50 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:133:9 @@ -1806,15 +1806,15 @@ note: 133 │ self.my_house.size = 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr + │ mut SPtr 134 │ assert self.my_house.size == 50 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:134:16 │ 134 │ assert self.my_house.size == 50 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:134:16 @@ -1822,7 +1822,7 @@ note: 134 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:134:16 @@ -1830,13 +1830,13 @@ note: 134 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 135 │ assert self.my_house.price == 1 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:135:16 │ 135 │ assert self.my_house.price == 1 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:135:16 @@ -1844,7 +1844,7 @@ note: 135 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:135:16 @@ -1852,13 +1852,13 @@ note: 135 │ assert self.my_house.price == 1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 136 │ assert self.my_house.rooms == u8(5) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:136:16 │ 136 │ assert self.my_house.rooms == u8(5) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:136:16 @@ -1866,7 +1866,7 @@ note: 136 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8 │ │ - │ SPtr -> u8 + │ mut SPtr -> u8 note: ┌─ structs.fe:136:39 @@ -1880,13 +1880,13 @@ note: 136 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 137 │ assert self.my_house.vacant == false - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:137:16 │ 137 │ assert self.my_house.vacant == false - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:137:16 @@ -1894,7 +1894,7 @@ note: 137 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr -> bool + │ mut SPtr -> bool note: ┌─ structs.fe:137:16 @@ -1902,13 +1902,13 @@ note: 137 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 138 │ self.my_house.price = 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:138:9 │ 138 │ self.my_house.price = 1000 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:138:9 @@ -1916,15 +1916,15 @@ note: 138 │ self.my_house.price = 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr + │ mut SPtr 139 │ assert self.my_house.size == 50 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:139:16 │ 139 │ assert self.my_house.size == 50 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:139:16 @@ -1932,7 +1932,7 @@ note: 139 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:139:16 @@ -1940,13 +1940,13 @@ note: 139 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 140 │ assert self.my_house.price == 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:140:16 │ 140 │ assert self.my_house.price == 1000 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:140:16 @@ -1954,7 +1954,7 @@ note: 140 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:140:16 @@ -1962,13 +1962,13 @@ note: 140 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 141 │ assert self.my_house.rooms == u8(5) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:141:16 │ 141 │ assert self.my_house.rooms == u8(5) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:141:16 @@ -1976,7 +1976,7 @@ note: 141 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8 │ │ - │ SPtr -> u8 + │ mut SPtr -> u8 note: ┌─ structs.fe:141:39 @@ -1990,13 +1990,13 @@ note: 141 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 142 │ assert self.my_house.vacant == false - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:142:16 │ 142 │ assert self.my_house.vacant == false - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:142:16 @@ -2004,7 +2004,7 @@ note: 142 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ SPtr -> bool + │ mut SPtr -> bool note: ┌─ structs.fe:142:16 @@ -2012,13 +2012,13 @@ note: 142 │ assert self.my_house.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 143 │ self.my_house.vacant = true - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:143:9 │ 143 │ self.my_house.vacant = true - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:143:9 @@ -2026,15 +2026,15 @@ note: 143 │ self.my_house.vacant = true │ ^^^^^^^^^^^^^^^^^^^^ ^^^^ bool │ │ - │ SPtr + │ mut SPtr 144 │ assert self.my_house.size == 50 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:144:16 │ 144 │ assert self.my_house.size == 50 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:144:16 @@ -2042,7 +2042,7 @@ note: 144 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:144:16 @@ -2050,13 +2050,13 @@ note: 144 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 145 │ assert self.my_house.price == 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:145:16 │ 145 │ assert self.my_house.price == 1000 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:145:16 @@ -2064,7 +2064,7 @@ note: 145 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:145:16 @@ -2072,13 +2072,13 @@ note: 145 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 146 │ assert self.my_house.rooms == u8(5) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:146:16 │ 146 │ assert self.my_house.rooms == u8(5) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:146:16 @@ -2086,7 +2086,7 @@ note: 146 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^ ^ u8 │ │ - │ SPtr -> u8 + │ mut SPtr -> u8 note: ┌─ structs.fe:146:39 @@ -2100,27 +2100,27 @@ note: 146 │ assert self.my_house.rooms == u8(5) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 147 │ assert self.my_house.vacant - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:147:16 │ 147 │ assert self.my_house.vacant - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:147:16 │ 147 │ assert self.my_house.vacant - │ ^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> bool 148 │ self.my_house.rooms = u8(100) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:148:9 │ 148 │ self.my_house.rooms = u8(100) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:148:9 @@ -2128,7 +2128,7 @@ note: 148 │ self.my_house.rooms = u8(100) │ ^^^^^^^^^^^^^^^^^^^ ^^^ u8 │ │ - │ SPtr + │ mut SPtr note: ┌─ structs.fe:148:31 @@ -2136,13 +2136,13 @@ note: 148 │ self.my_house.rooms = u8(100) │ ^^^^^^^ u8 149 │ assert self.my_house.size == 50 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:149:16 │ 149 │ assert self.my_house.size == 50 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:149:16 @@ -2150,7 +2150,7 @@ note: 149 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:149:16 @@ -2158,13 +2158,13 @@ note: 149 │ assert self.my_house.size == 50 │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 150 │ assert self.my_house.price == 1000 - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:150:16 │ 150 │ assert self.my_house.price == 1000 - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:150:16 @@ -2172,7 +2172,7 @@ note: 150 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^ ^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ structs.fe:150:16 @@ -2180,13 +2180,13 @@ note: 150 │ assert self.my_house.price == 1000 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 151 │ assert self.my_house.rooms == u8(100) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:151:16 │ 151 │ assert self.my_house.rooms == u8(100) - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:151:16 @@ -2194,7 +2194,7 @@ note: 151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^^^^^^^^^^^^^ ^^^ u8 │ │ - │ SPtr -> u8 + │ mut SPtr -> u8 note: ┌─ structs.fe:151:39 @@ -2208,62 +2208,62 @@ note: 151 │ assert self.my_house.rooms == u8(100) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 152 │ assert self.my_house.vacant - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ structs.fe:152:16 │ 152 │ assert self.my_house.vacant - │ ^^^^^^^^^^^^^ SPtr + │ ^^^^^^^^^^^^^ mut SPtr note: ┌─ structs.fe:152:16 │ 152 │ assert self.my_house.vacant - │ ^^^^^^^^^^^^^^^^^^^^ SPtr -> bool + │ ^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> bool note: ┌─ structs.fe:155:5 │ 155 │ ╭ pub fn bar() -> u256 { -156 │ │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) +156 │ │ let mut building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) 157 │ │ assert building.size == 500 158 │ │ assert building.price == 300 · │ 172 │ │ return building.size 173 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ structs.fe:156:13 + ┌─ structs.fe:156:17 │ -156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) - │ ^^^^^^^^ House +156 │ let mut building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^^^ mut House note: - ┌─ structs.fe:156:44 + ┌─ structs.fe:156:48 │ -156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) - │ ^^^ ^^^ ^^ u8 - │ │ │ - │ │ u256 - │ u256 +156 │ let mut building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^ ^^^ ^^ u8 + │ │ │ + │ │ u256 + │ u256 note: - ┌─ structs.fe:156:67 + ┌─ structs.fe:156:71 │ -156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) - │ ^^^^^^ ^^^^ bool - │ │ - │ u8 +156 │ let mut building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^ ^^^^ bool + │ │ + │ u8 note: - ┌─ structs.fe:156:31 + ┌─ structs.fe:156:35 │ -156 │ let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House +156 │ let mut building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ House 157 │ assert building.size == 500 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:157:16 @@ -2271,7 +2271,7 @@ note: 157 │ assert building.size == 500 │ ^^^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:157:16 @@ -2279,7 +2279,7 @@ note: 157 │ assert building.size == 500 │ ^^^^^^^^^^^^^^^^^^^^ bool 158 │ assert building.price == 300 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:158:16 @@ -2287,7 +2287,7 @@ note: 158 │ assert building.price == 300 │ ^^^^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:158:16 @@ -2295,7 +2295,7 @@ note: 158 │ assert building.price == 300 │ ^^^^^^^^^^^^^^^^^^^^^ bool 159 │ assert building.rooms == u8(20) - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:159:16 @@ -2303,7 +2303,7 @@ note: 159 │ assert building.rooms == u8(20) │ ^^^^^^^^^^^^^^ ^^ u8 │ │ - │ u8 + │ mut u8 note: ┌─ structs.fe:159:34 @@ -2317,15 +2317,15 @@ note: 159 │ assert building.rooms == u8(20) │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 160 │ assert building.vacant - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:160:16 │ 160 │ assert building.vacant - │ ^^^^^^^^^^^^^^^ bool + │ ^^^^^^^^^^^^^^^ mut bool -> bool 161 │ building.vacant = false - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:161:9 @@ -2333,9 +2333,9 @@ note: 161 │ building.vacant = false │ ^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ bool + │ mut bool 162 │ building.price = 1 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:162:9 @@ -2343,9 +2343,9 @@ note: 162 │ building.price = 1 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 163 │ building.size = 2 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:163:9 @@ -2353,9 +2353,9 @@ note: 163 │ building.size = 2 │ ^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 164 │ building.rooms = u8(10) - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:164:9 @@ -2363,7 +2363,7 @@ note: 164 │ building.rooms = u8(10) │ ^^^^^^^^^^^^^^ ^^ u8 │ │ - │ u8 + │ mut u8 note: ┌─ structs.fe:164:26 @@ -2371,7 +2371,7 @@ note: 164 │ building.rooms = u8(10) │ ^^^^^^ u8 165 │ assert building.vacant == false - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:165:16 @@ -2379,7 +2379,7 @@ note: 165 │ assert building.vacant == false │ ^^^^^^^^^^^^^^^ ^^^^^ bool │ │ - │ bool + │ mut bool note: ┌─ structs.fe:165:16 @@ -2387,7 +2387,7 @@ note: 165 │ assert building.vacant == false │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 166 │ assert building.price == 1 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:166:16 @@ -2395,7 +2395,7 @@ note: 166 │ assert building.price == 1 │ ^^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:166:16 @@ -2403,7 +2403,7 @@ note: 166 │ assert building.price == 1 │ ^^^^^^^^^^^^^^^^^^^ bool 167 │ assert building.size == 2 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:167:16 @@ -2411,7 +2411,7 @@ note: 167 │ assert building.size == 2 │ ^^^^^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:167:16 @@ -2419,7 +2419,7 @@ note: 167 │ assert building.size == 2 │ ^^^^^^^^^^^^^^^^^^ bool 168 │ assert building.rooms == u8(10) - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:168:16 @@ -2427,7 +2427,7 @@ note: 168 │ assert building.rooms == u8(10) │ ^^^^^^^^^^^^^^ ^^ u8 │ │ - │ u8 + │ mut u8 note: ┌─ structs.fe:168:34 @@ -2441,7 +2441,7 @@ note: 168 │ assert building.rooms == u8(10) │ ^^^^^^^^^^^^^^^^^^^^^^^^ bool 169 │ building.expand() - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:169:9 @@ -2449,7 +2449,7 @@ note: 169 │ building.expand() │ ^^^^^^^^^^^^^^^^^ () 170 │ assert building.size == 102 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:170:16 @@ -2457,7 +2457,7 @@ note: 170 │ assert building.size == 102 │ ^^^^^^^^^^^^^ ^^^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ structs.fe:170:16 @@ -2465,7 +2465,7 @@ note: 170 │ assert building.size == 102 │ ^^^^^^^^^^^^^^^^^^^^ bool 171 │ assert building.rooms == 11 - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:171:16 @@ -2473,7 +2473,7 @@ note: 171 │ assert building.rooms == 11 │ ^^^^^^^^^^^^^^ ^^ u8 │ │ - │ u8 + │ mut u8 note: ┌─ structs.fe:171:16 @@ -2481,13 +2481,13 @@ note: 171 │ assert building.rooms == 11 │ ^^^^^^^^^^^^^^^^^^^^ bool 172 │ return building.size - │ ^^^^^^^^ House + │ ^^^^^^^^ mut House note: ┌─ structs.fe:172:16 │ 172 │ return building.size - │ ^^^^^^^^^^^^^ u256 + │ ^^^^^^^^^^^^^ mut u256 -> u256 note: ┌─ structs.fe:175:5 @@ -2496,7 +2496,7 @@ note: 176 │ │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) 177 │ │ return house.encode() 178 │ │ } - │ ╰─────^ self: None, params: [] -> Array + │ ╰─────^ params: [] -> Array note: ┌─ structs.fe:176:13 @@ -2542,7 +2542,7 @@ note: 181 │ │ let house: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) 182 │ │ return house.hash() 183 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: ┌─ structs.fe:181:13 diff --git a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap index c3e5fc6383..02fffb0ecd 100644 --- a/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap +++ b/crates/analyzer/tests/snapshots/analysis__ternary_expression.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn bar(input: u256) -> u256 { 3 │ │ return 1 if input > 5 else 0 4 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: input, typ: u256 }] -> u256 + │ ╰─────^ params: [{ label: None, name: input, typ: u256 }] -> u256 note: ┌─ ternary_expression.fe:3:21 diff --git a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap index 42164665c5..75e377f2e3 100644 --- a/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__tuple_stress.snap @@ -21,7 +21,7 @@ note: 8 │ ╭ pub fn build_my_tuple(my_num: u256, my_bool: bool, my_address: address) -> (u256, bool, address) { 9 │ │ return (my_num, my_bool, my_address) 10 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_num, typ: u256 }, { label: None, name: my_bool, typ: bool }, { label: None, name: my_address, typ: address }] -> (u256, bool, address) + │ ╰─────^ params: [{ label: None, name: my_num, typ: u256 }, { label: None, name: my_bool, typ: bool }, { label: None, name: my_address, typ: address }] -> (u256, bool, address) note: ┌─ tuple_stress.fe:9:17 @@ -44,7 +44,7 @@ note: 12 │ ╭ pub fn read_my_tuple_item0(my_tuple: (u256, bool, address)) -> u256 { 13 │ │ return my_tuple.item0 14 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> u256 + │ ╰─────^ params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> u256 note: ┌─ tuple_stress.fe:13:16 @@ -64,7 +64,7 @@ note: 16 │ ╭ pub fn read_my_tuple_item1(my_tuple: (u256, bool, address)) -> bool { 17 │ │ return my_tuple.item1 18 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> bool + │ ╰─────^ params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> bool note: ┌─ tuple_stress.fe:17:16 @@ -84,7 +84,7 @@ note: 20 │ ╭ pub fn read_my_tuple_item2(my_tuple: (u256, bool, address)) -> address { 21 │ │ return my_tuple.item2 22 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> address + │ ╰─────^ params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> address note: ┌─ tuple_stress.fe:21:16 @@ -104,7 +104,7 @@ note: 24 │ ╭ pub fn read_my_tuple_item10(my_tuple: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address)) -> address { 25 │ │ return my_tuple.item10 26 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_tuple, typ: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address) }] -> address + │ ╰─────^ params: [{ label: None, name: my_tuple, typ: (u256, u256, u256, u256, u256, u256, u256, u256, u256, u256, address) }] -> address note: ┌─ tuple_stress.fe:25:16 @@ -121,10 +121,10 @@ note: note: ┌─ tuple_stress.fe:28:5 │ -28 │ ╭ pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)) { +28 │ ╭ pub fn emit_my_event(mut ctx: Context, my_tuple: (u256, bool, address)) { 29 │ │ emit MyEvent(ctx, my_tuple) 30 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: ctx, typ: Context }, { label: None, name: my_tuple, typ: (u256, bool, address) }] -> () + │ ╰─────^ params: [{ label: None, name: ctx, typ: mut Context }, { label: None, name: my_tuple, typ: (u256, bool, address) }] -> () note: ┌─ tuple_stress.fe:29:22 @@ -132,28 +132,28 @@ note: 29 │ emit MyEvent(ctx, my_tuple) │ ^^^ ^^^^^^^^ (u256, bool, address) │ │ - │ Context + │ mut Context -> Context note: ┌─ tuple_stress.fe:32:5 │ -32 │ ╭ pub fn set_my_sto_tuple(self, my_u256: u256, my_i32: i32) { +32 │ ╭ pub fn set_my_sto_tuple(mut self, my_u256: u256, my_i32: i32) { 33 │ │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) 34 │ │ self.my_sto_tuple = (my_u256, my_i32) 35 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: my_u256, typ: u256 }, { label: None, name: my_i32, typ: i32 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: my_u256, typ: u256 }, { label: None, name: my_i32, typ: i32 }] -> () note: ┌─ tuple_stress.fe:33:16 │ 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ tuple_stress.fe:33:16 │ 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) - │ ^^^^^^^^^^^^^^^^^ SPtr<(u256, i32)> + │ ^^^^^^^^^^^^^^^^^ mut SPtr<(u256, i32)> note: ┌─ tuple_stress.fe:33:16 @@ -161,7 +161,7 @@ note: 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ tuple_stress.fe:33:43 @@ -173,7 +173,7 @@ note: ┌─ tuple_stress.fe:33:16 │ 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut Foo │ │ │ bool @@ -181,7 +181,7 @@ note: ┌─ tuple_stress.fe:33:55 │ 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) - │ ^^^^^^^^^^^^^^^^^ SPtr<(u256, i32)> + │ ^^^^^^^^^^^^^^^^^ mut SPtr<(u256, i32)> note: ┌─ tuple_stress.fe:33:55 @@ -189,7 +189,7 @@ note: 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^ i32 │ │ - │ SPtr -> i32 + │ mut SPtr -> i32 note: ┌─ tuple_stress.fe:33:82 @@ -209,7 +209,7 @@ note: 33 │ assert self.my_sto_tuple.item0 == u256(0) and self.my_sto_tuple.item1 == i32(0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 34 │ self.my_sto_tuple = (my_u256, my_i32) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ tuple_stress.fe:34:9 @@ -218,7 +218,7 @@ note: │ ^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^ i32 │ │ │ │ │ u256 - │ SPtr<(u256, i32)> + │ mut SPtr<(u256, i32)> note: ┌─ tuple_stress.fe:34:29 @@ -232,7 +232,7 @@ note: 37 │ ╭ pub fn get_my_sto_tuple(self) -> (u256, i32) { 38 │ │ return self.my_sto_tuple.to_mem() 39 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> (u256, i32) + │ ╰─────^ params: [self] -> (u256, i32) note: ┌─ tuple_stress.fe:38:16 @@ -255,12 +255,12 @@ note: note: ┌─ tuple_stress.fe:41:5 │ -41 │ ╭ pub fn build_tuple_and_emit(self, ctx: Context) { +41 │ ╭ pub fn build_tuple_and_emit(self, mut ctx: Context) { 42 │ │ let my_num: u256 = self.my_sto_tuple.item0 43 │ │ let my_tuple: (u256, bool, address) = (self.my_sto_tuple.item0, true and false, address(26)) 44 │ │ emit_my_event(ctx, my_tuple) 45 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () + │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: ┌─ tuple_stress.fe:42:13 @@ -327,7 +327,7 @@ note: 44 │ emit_my_event(ctx, my_tuple) │ ^^^ ^^^^^^^^ (u256, bool, address) │ │ - │ Context + │ mut Context note: ┌─ tuple_stress.fe:44:9 @@ -341,7 +341,7 @@ note: 47 │ ╭ pub fn encode_my_tuple(my_tuple: (u256, bool, address)) -> Array { 48 │ │ return my_tuple.abi_encode() 49 │ │ } - │ ╰─────^ self: None, params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> Array + │ ╰─────^ params: [{ label: None, name: my_tuple, typ: (u256, bool, address) }] -> Array note: ┌─ tuple_stress.fe:48:16 diff --git a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap index 7d19ca1f78..9380b39d05 100644 --- a/crates/analyzer/tests/snapshots/analysis__two_contracts.snap +++ b/crates/analyzer/tests/snapshots/analysis__two_contracts.snap @@ -12,17 +12,17 @@ note: note: ┌─ two_contracts.fe:8:5 │ - 8 │ ╭ pub fn foo(self, ctx: Context) -> u256 { + 8 │ ╭ pub fn foo(mut self, ctx: Context) -> u256 { 9 │ │ self.other.set_foo_addr(ctx.self_address()) 10 │ │ return self.other.answer() 11 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> u256 + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }] -> u256 note: ┌─ two_contracts.fe:9:9 │ 9 │ self.other.set_foo_addr(ctx.self_address()) - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ two_contracts.fe:9:9 @@ -30,7 +30,7 @@ note: 9 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^^^^^^^ ^^^ Context │ │ - │ SPtr -> Bar + │ mut SPtr -> Bar note: ┌─ two_contracts.fe:9:33 @@ -44,13 +44,13 @@ note: 9 │ self.other.set_foo_addr(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () 10 │ return self.other.answer() - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ two_contracts.fe:10:16 │ 10 │ return self.other.answer() - │ ^^^^^^^^^^ SPtr -> Bar + │ ^^^^^^^^^^ mut SPtr -> Bar note: ┌─ two_contracts.fe:10:16 @@ -64,7 +64,7 @@ note: 13 │ ╭ pub fn add(self, _ x: u256, _ y: u256) -> u256 { 14 │ │ return x + y 15 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 + │ ╰─────^ params: [self, { label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 note: ┌─ two_contracts.fe:14:16 @@ -89,16 +89,16 @@ note: note: ┌─ two_contracts.fe:21:5 │ -21 │ ╭ pub fn set_foo_addr(self, _ addr: address) { +21 │ ╭ pub fn set_foo_addr(mut self, _ addr: address) { 22 │ │ self.other = Foo(addr) 23 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: addr, typ: address }] -> () + │ ╰─────^ params: [mut self, { label: Some("_"), name: addr, typ: address }] -> () note: ┌─ two_contracts.fe:22:9 │ 22 │ self.other = Foo(addr) - │ ^^^^ Bar + │ ^^^^ mut Bar note: ┌─ two_contracts.fe:22:9 @@ -106,7 +106,7 @@ note: 22 │ self.other = Foo(addr) │ ^^^^^^^^^^ ^^^^ address │ │ - │ SPtr + │ mut SPtr note: ┌─ two_contracts.fe:22:22 @@ -120,7 +120,7 @@ note: 25 │ ╭ pub fn answer(self) -> u256 { 26 │ │ return self.other.add(20, 22) 27 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 + │ ╰─────^ params: [self] -> u256 note: ┌─ two_contracts.fe:26:16 diff --git a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap index cb8f4f48a3..f9d82b53d4 100644 --- a/crates/analyzer/tests/snapshots/analysis__type_aliases.snap +++ b/crates/analyzer/tests/snapshots/analysis__type_aliases.snap @@ -10,228 +10,228 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> note: - ┌─ type_aliases.fe:3:1 + ┌─ type_aliases.fe:2:1 │ -3 │ type Scoreboard = Map +2 │ type Scoreboard = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:5:1 + ┌─ type_aliases.fe:3:1 │ -5 │ type AuthorPosts = Map +3 │ type AuthorPosts = Map │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:7:1 + ┌─ type_aliases.fe:4:1 │ -7 │ type Author = address +4 │ type Author = address │ ^^^^^^^^^^^^^^^^^^^^^ address note: - ┌─ type_aliases.fe:9:1 + ┌─ type_aliases.fe:5:1 │ -9 │ type Score = u64 +5 │ type Score = u64 │ ^^^^^^^^^^^^^^^^ u64 note: - ┌─ type_aliases.fe:11:1 - │ -11 │ type PostId = u256 - │ ^^^^^^^^^^^^^^^^^^ u256 + ┌─ type_aliases.fe:6:1 + │ +6 │ type PostId = u256 + │ ^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ type_aliases.fe:13:1 - │ -13 │ type PostBody = String<32> - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ String<32> + ┌─ type_aliases.fe:7:1 + │ +7 │ type PostBody = String<32> + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ String<32> note: - ┌─ type_aliases.fe:16:5 + ┌─ type_aliases.fe:10:5 │ -16 │ posts: Posts +10 │ posts: Posts │ ^^^^^^^^^^^^ Map> -17 │ authors: AuthorPosts +11 │ authors: AuthorPosts │ ^^^^^^^^^^^^^^^^^^^^ Map -18 │ scoreboard: Scoreboard +12 │ scoreboard: Scoreboard │ ^^^^^^^^^^^^^^^^^^^^^^ Map note: - ┌─ type_aliases.fe:20:5 + ┌─ type_aliases.fe:14:5 │ -20 │ ╭ pub fn post(self, ctx: Context, body: PostBody) { -21 │ │ let id: PostId = 0 -22 │ │ self.posts[id] = body -23 │ │ self.authors[ctx.msg_sender()] -24 │ │ self.scoreboard[id] = 0 -25 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: body, typ: String<32> }] -> () +14 │ ╭ pub fn post(mut self, ctx: Context, body: PostBody) { +15 │ │ let id: PostId = 0 +16 │ │ self.posts[id] = body +17 │ │ self.authors[ctx.msg_sender()] +18 │ │ self.scoreboard[id] = 0 +19 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }, { label: None, name: body, typ: String<32> }] -> () note: - ┌─ type_aliases.fe:21:13 + ┌─ type_aliases.fe:15:13 │ -21 │ let id: PostId = 0 +15 │ let id: PostId = 0 │ ^^ u256 note: - ┌─ type_aliases.fe:21:26 + ┌─ type_aliases.fe:15:26 │ -21 │ let id: PostId = 0 +15 │ let id: PostId = 0 │ ^ u256 -22 │ self.posts[id] = body - │ ^^^^ Forum +16 │ self.posts[id] = body + │ ^^^^ mut Forum note: - ┌─ type_aliases.fe:22:9 + ┌─ type_aliases.fe:16:9 │ -22 │ self.posts[id] = body +16 │ self.posts[id] = body │ ^^^^^^^^^^ ^^ u256 │ │ - │ SPtr>> + │ mut SPtr>> note: - ┌─ type_aliases.fe:22:9 + ┌─ type_aliases.fe:16:9 │ -22 │ self.posts[id] = body +16 │ self.posts[id] = body │ ^^^^^^^^^^^^^^ ^^^^ String<32> │ │ - │ SPtr> -23 │ self.authors[ctx.msg_sender()] - │ ^^^^ Forum + │ mut SPtr> +17 │ self.authors[ctx.msg_sender()] + │ ^^^^ mut Forum note: - ┌─ type_aliases.fe:23:9 + ┌─ type_aliases.fe:17:9 │ -23 │ self.authors[ctx.msg_sender()] +17 │ self.authors[ctx.msg_sender()] │ ^^^^^^^^^^^^ ^^^ Context │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ type_aliases.fe:23:22 + ┌─ type_aliases.fe:17:22 │ -23 │ self.authors[ctx.msg_sender()] +17 │ self.authors[ctx.msg_sender()] │ ^^^^^^^^^^^^^^^^ address note: - ┌─ type_aliases.fe:23:9 + ┌─ type_aliases.fe:17:9 │ -23 │ self.authors[ctx.msg_sender()] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -24 │ self.scoreboard[id] = 0 - │ ^^^^ Forum +17 │ self.authors[ctx.msg_sender()] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr +18 │ self.scoreboard[id] = 0 + │ ^^^^ mut Forum note: - ┌─ type_aliases.fe:24:9 + ┌─ type_aliases.fe:18:9 │ -24 │ self.scoreboard[id] = 0 +18 │ self.scoreboard[id] = 0 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ type_aliases.fe:24:9 + ┌─ type_aliases.fe:18:9 │ -24 │ self.scoreboard[id] = 0 +18 │ self.scoreboard[id] = 0 │ ^^^^^^^^^^^^^^^^^^^ ^ u64 │ │ - │ SPtr + │ mut SPtr note: - ┌─ type_aliases.fe:27:5 + ┌─ type_aliases.fe:21:5 │ -27 │ ╭ pub fn upvote(self, id: PostId) -> Score { -28 │ │ let score: Score = self.scoreboard[id] + 1 -29 │ │ self.scoreboard[id] = score -30 │ │ return score -31 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: id, typ: u256 }] -> u64 +21 │ ╭ pub fn upvote(mut self, id: PostId) -> Score { +22 │ │ let score: Score = self.scoreboard[id] + 1 +23 │ │ self.scoreboard[id] = score +24 │ │ return score +25 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: id, typ: u256 }] -> u64 note: - ┌─ type_aliases.fe:28:13 + ┌─ type_aliases.fe:22:13 │ -28 │ let score: Score = self.scoreboard[id] + 1 +22 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^ u64 note: - ┌─ type_aliases.fe:28:28 + ┌─ type_aliases.fe:22:28 │ -28 │ let score: Score = self.scoreboard[id] + 1 - │ ^^^^ Forum +22 │ let score: Score = self.scoreboard[id] + 1 + │ ^^^^ mut Forum note: - ┌─ type_aliases.fe:28:28 + ┌─ type_aliases.fe:22:28 │ -28 │ let score: Score = self.scoreboard[id] + 1 +22 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ type_aliases.fe:28:28 + ┌─ type_aliases.fe:22:28 │ -28 │ let score: Score = self.scoreboard[id] + 1 +22 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^^^^^ ^ u64 │ │ - │ SPtr -> u64 + │ mut SPtr -> u64 note: - ┌─ type_aliases.fe:28:28 + ┌─ type_aliases.fe:22:28 │ -28 │ let score: Score = self.scoreboard[id] + 1 +22 │ let score: Score = self.scoreboard[id] + 1 │ ^^^^^^^^^^^^^^^^^^^^^^^ u64 -29 │ self.scoreboard[id] = score - │ ^^^^ Forum +23 │ self.scoreboard[id] = score + │ ^^^^ mut Forum note: - ┌─ type_aliases.fe:29:9 + ┌─ type_aliases.fe:23:9 │ -29 │ self.scoreboard[id] = score +23 │ self.scoreboard[id] = score │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ type_aliases.fe:29:9 + ┌─ type_aliases.fe:23:9 │ -29 │ self.scoreboard[id] = score +23 │ self.scoreboard[id] = score │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u64 │ │ - │ SPtr -30 │ return score + │ mut SPtr +24 │ return score │ ^^^^^ u64 note: - ┌─ type_aliases.fe:33:5 + ┌─ type_aliases.fe:27:5 │ -33 │ ╭ pub fn get_post(self, id: PostId) -> PostBody { -34 │ │ return self.posts[id].to_mem() -35 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: id, typ: u256 }] -> String<32> +27 │ ╭ pub fn get_post(self, id: PostId) -> PostBody { +28 │ │ return self.posts[id].to_mem() +29 │ │ } + │ ╰─────^ params: [self, { label: None, name: id, typ: u256 }] -> String<32> note: - ┌─ type_aliases.fe:34:16 + ┌─ type_aliases.fe:28:16 │ -34 │ return self.posts[id].to_mem() +28 │ return self.posts[id].to_mem() │ ^^^^ Forum note: - ┌─ type_aliases.fe:34:16 + ┌─ type_aliases.fe:28:16 │ -34 │ return self.posts[id].to_mem() +28 │ return self.posts[id].to_mem() │ ^^^^^^^^^^ ^^ u256 │ │ │ SPtr>> note: - ┌─ type_aliases.fe:34:16 + ┌─ type_aliases.fe:28:16 │ -34 │ return self.posts[id].to_mem() +28 │ return self.posts[id].to_mem() │ ^^^^^^^^^^^^^^ SPtr> note: - ┌─ type_aliases.fe:34:16 + ┌─ type_aliases.fe:28:16 │ -34 │ return self.posts[id].to_mem() +28 │ return self.posts[id].to_mem() │ ^^^^^^^^^^^^^^^^^^^^^^^ String<32> diff --git a/crates/analyzer/tests/snapshots/analysis__type_coercion.snap b/crates/analyzer/tests/snapshots/analysis__type_coercion.snap index eb8fac95ea..5324e8c0fb 100644 --- a/crates/analyzer/tests/snapshots/analysis__type_coercion.snap +++ b/crates/analyzer/tests/snapshots/analysis__type_coercion.snap @@ -18,7 +18,7 @@ note: 6 │ │ let elem: i32 = self.s[index] 7 │ │ return elem 8 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: index, typ: u8 }] -> i32 + │ ╰─────^ params: [self, { label: None, name: index, typ: u8 }] -> i32 note: ┌─ type_coercion.fe:6:13 @@ -54,7 +54,7 @@ note: 10 │ ╭ pub fn tuple(self) { 11 │ │ let a: (i32, i32) = (self.x, self.x) 12 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> () + │ ╰─────^ params: [self] -> () note: ┌─ type_coercion.fe:11:13 diff --git a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap index 0bb3170b1b..8d7ab3a6c8 100644 --- a/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u128_u128_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u128) -> u128 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u128 }] -> u128 + │ ╰─────^ params: [self, { label: None, name: key, typ: u128 }] -> u128 note: ┌─ u128_u128_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u128_u128_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u128, value: u128) { + 8 │ ╭ pub fn write_bar(mut self, key: u128, value: u128) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u128 }, { label: None, name: value, typ: u128 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u128 }, { label: None, name: value, typ: u128 }] -> () note: ┌─ u128_u128_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u128_u128_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u128 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u128_u128_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u128 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap index 4b3b91ffef..1bdbf7314a 100644 --- a/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u16_u16_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u16) -> u16 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u16 }] -> u16 + │ ╰─────^ params: [self, { label: None, name: key, typ: u16 }] -> u16 note: ┌─ u16_u16_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u16_u16_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u16, value: u16) { + 8 │ ╭ pub fn write_bar(mut self, key: u16, value: u16) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u16 }, { label: None, name: value, typ: u16 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u16 }, { label: None, name: value, typ: u16 }] -> () note: ┌─ u16_u16_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u16_u16_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u16 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u16_u16_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u16 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap index dede819b88..d6ad4d333f 100644 --- a/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u256_u256_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u256) -> u256 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u256 }] -> u256 + │ ╰─────^ params: [self, { label: None, name: key, typ: u256 }] -> u256 note: ┌─ u256_u256_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u256_u256_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u256, value: u256) { + 8 │ ╭ pub fn write_bar(mut self, key: u256, value: u256) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u256 }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u256 }, { label: None, name: value, typ: u256 }] -> () note: ┌─ u256_u256_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u256_u256_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u256 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u256_u256_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap index a36aa04cd4..83b4ff82aa 100644 --- a/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u32_u32_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u32) -> u32 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u32 }] -> u32 + │ ╰─────^ params: [self, { label: None, name: key, typ: u32 }] -> u32 note: ┌─ u32_u32_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u32_u32_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u32, value: u32) { + 8 │ ╭ pub fn write_bar(mut self, key: u32, value: u32) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u32 }, { label: None, name: value, typ: u32 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u32 }, { label: None, name: value, typ: u32 }] -> () note: ┌─ u32_u32_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u32_u32_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u32 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u32_u32_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u32 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap index 1a2e2b9708..53de2ab4cd 100644 --- a/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u64_u64_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u64) -> u64 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u64 }] -> u64 + │ ╰─────^ params: [self, { label: None, name: key, typ: u64 }] -> u64 note: ┌─ u64_u64_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u64_u64_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u64, value: u64) { + 8 │ ╭ pub fn write_bar(mut self, key: u64, value: u64) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u64 }, { label: None, name: value, typ: u64 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u64 }, { label: None, name: value, typ: u64 }] -> () note: ┌─ u64_u64_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u64_u64_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u64 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u64_u64_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u64 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap index 4692be3fc7..58cb847354 100644 --- a/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap +++ b/crates/analyzer/tests/snapshots/analysis__u8_u8_map.snap @@ -15,7 +15,7 @@ note: 4 │ ╭ pub fn read_bar(self, key: u8) -> u8 { 5 │ │ return self.bar[key] 6 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u8 }] -> u8 + │ ╰─────^ params: [self, { label: None, name: key, typ: u8 }] -> u8 note: ┌─ u8_u8_map.fe:5:16 @@ -40,16 +40,16 @@ note: note: ┌─ u8_u8_map.fe:8:5 │ - 8 │ ╭ pub fn write_bar(self, key: u8, value: u8) { + 8 │ ╭ pub fn write_bar(mut self, key: u8, value: u8) { 9 │ │ self.bar[key] = value 10 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: key, typ: u8 }, { label: None, name: value, typ: u8 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: key, typ: u8 }, { label: None, name: value, typ: u8 }] -> () note: ┌─ u8_u8_map.fe:9:9 │ 9 │ self.bar[key] = value - │ ^^^^ Foo + │ ^^^^ mut Foo note: ┌─ u8_u8_map.fe:9:9 @@ -57,7 +57,7 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^ ^^^ u8 │ │ - │ SPtr> + │ mut SPtr> note: ┌─ u8_u8_map.fe:9:9 @@ -65,6 +65,6 @@ note: 9 │ self.bar[key] = value │ ^^^^^^^^^^^^^ ^^^^^ u8 │ │ - │ SPtr + │ mut SPtr diff --git a/crates/analyzer/tests/snapshots/analysis__uniswap.snap b/crates/analyzer/tests/snapshots/analysis__uniswap.snap index c31a9cafed..e922aae107 100644 --- a/crates/analyzer/tests/snapshots/analysis__uniswap.snap +++ b/crates/analyzer/tests/snapshots/analysis__uniswap.snap @@ -9,7 +9,7 @@ note: 2 │ ╭ pub fn balanceOf(self, _ account: address) -> u256 { 3 │ │ return 0 4 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: account, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: Some("_"), name: account, typ: address }] -> u256 note: ┌─ uniswap.fe:3:16 @@ -23,7 +23,7 @@ note: 6 │ ╭ pub fn transfer(self, to: address, _ amount: u256) -> bool { 7 │ │ return false 8 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: to, typ: address }, { label: Some("_"), name: amount, typ: u256 }] -> bool + │ ╰─────^ params: [self, { label: None, name: to, typ: address }, { label: Some("_"), name: amount, typ: u256 }] -> bool note: ┌─ uniswap.fe:7:16 @@ -137,7 +137,7 @@ note: 76 │ ╭ pub fn factory(self) -> address { 77 │ │ return self.factory 78 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address + │ ╰─────^ params: [self] -> address note: ┌─ uniswap.fe:77:16 @@ -157,7 +157,7 @@ note: 80 │ ╭ pub fn token0(self) -> address { 81 │ │ return address(self.token0) 82 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address + │ ╰─────^ params: [self] -> address note: ┌─ uniswap.fe:81:24 @@ -169,7 +169,7 @@ note: ┌─ uniswap.fe:81:24 │ 81 │ return address(self.token0) - │ ^^^^^^^^^^^ SPtr -> ERC20 + │ ^^^^^^^^^^^ SPtr note: ┌─ uniswap.fe:81:16 @@ -183,7 +183,7 @@ note: 84 │ ╭ pub fn token1(self) -> address { 85 │ │ return address(self.token1) 86 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address + │ ╰─────^ params: [self] -> address note: ┌─ uniswap.fe:85:24 @@ -195,7 +195,7 @@ note: ┌─ uniswap.fe:85:24 │ 85 │ return address(self.token1) - │ ^^^^^^^^^^^ SPtr -> ERC20 + │ ^^^^^^^^^^^ SPtr note: ┌─ uniswap.fe:85:16 @@ -206,26 +206,26 @@ note: note: ┌─ uniswap.fe:88:5 │ -88 │ ╭ fn _mint(self, ctx: Context, to: address, value: u256) { +88 │ ╭ fn _mint(mut self, mut ctx: Context, to: address, value: u256) { 89 │ │ self.total_supply = self.total_supply + value 90 │ │ self.balances[to] = self.balances[to] + value 91 │ │ emit Transfer(ctx, from: address(0), to, value) 92 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ uniswap.fe:89:9 │ 89 │ self.total_supply = self.total_supply + value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:89:9 │ 89 │ self.total_supply = self.total_supply + value - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:89:29 @@ -233,7 +233,7 @@ note: 89 │ self.total_supply = self.total_supply + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:89:29 @@ -241,7 +241,7 @@ note: 89 │ self.total_supply = self.total_supply + value │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256 90 │ self.balances[to] = self.balances[to] + value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:90:9 @@ -249,15 +249,15 @@ note: 90 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:90:9 │ 90 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:90:29 @@ -265,7 +265,7 @@ note: 90 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:90:29 @@ -273,7 +273,7 @@ note: 90 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:90:29 @@ -283,7 +283,7 @@ note: 91 │ emit Transfer(ctx, from: address(0), to, value) │ ^^^ ^ u256 │ │ - │ Context + │ mut Context -> Context note: ┌─ uniswap.fe:91:34 @@ -297,18 +297,18 @@ note: note: ┌─ uniswap.fe:94:5 │ -94 │ ╭ fn _burn(self, ctx: Context, from: address, value: u256) { +94 │ ╭ fn _burn(mut self, mut ctx: Context, from: address, value: u256) { 95 │ │ self.balances[from] = self.balances[from] - value 96 │ │ self.total_supply = self.total_supply - value 97 │ │ emit Transfer(ctx, from, to: address(0), value) 98 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: from, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: from, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ uniswap.fe:95:9 │ 95 │ self.balances[from] = self.balances[from] - value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:95:9 @@ -316,15 +316,15 @@ note: 95 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:95:9 │ 95 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:95:31 @@ -332,7 +332,7 @@ note: 95 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:95:31 @@ -340,7 +340,7 @@ note: 95 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:95:31 @@ -348,15 +348,15 @@ note: 95 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 96 │ self.total_supply = self.total_supply - value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:96:9 │ 96 │ self.total_supply = self.total_supply - value - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:96:29 @@ -364,7 +364,7 @@ note: 96 │ self.total_supply = self.total_supply - value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:96:29 @@ -375,7 +375,7 @@ note: │ ^^^ ^^^^ ^ u256 │ │ │ │ │ address - │ Context + │ mut Context -> Context note: ┌─ uniswap.fe:97:38 @@ -388,17 +388,17 @@ note: note: ┌─ uniswap.fe:100:5 │ -100 │ ╭ fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { +100 │ ╭ fn _approve(mut self, mut ctx: Context, owner: address, spender: address, value: u256) { 101 │ │ self.allowances[owner][spender] = value 102 │ │ emit Approval(ctx, owner, spender, value) 103 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: owner, typ: address }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ uniswap.fe:101:9 │ 101 │ self.allowances[owner][spender] = value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:101:9 @@ -406,7 +406,7 @@ note: 101 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^ ^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ uniswap.fe:101:9 @@ -414,7 +414,7 @@ note: 101 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:101:9 @@ -422,29 +422,29 @@ note: 101 │ self.allowances[owner][spender] = value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 102 │ emit Approval(ctx, owner, spender, value) │ ^^^ ^^^^^ ^^^^^^^ ^^^^^ u256 │ │ │ │ │ │ │ address │ │ address - │ Context + │ mut Context -> Context note: ┌─ uniswap.fe:105:5 │ -105 │ ╭ fn _transfer(self, ctx: Context, from: address, to: address, value: u256) { +105 │ ╭ fn _transfer(mut self, mut ctx: Context, from: address, to: address, value: u256) { 106 │ │ self.balances[from] = self.balances[from] - value 107 │ │ self.balances[to] = self.balances[to] + value 108 │ │ emit Transfer(ctx, from, to, value) 109 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> () note: ┌─ uniswap.fe:106:9 │ 106 │ self.balances[from] = self.balances[from] - value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:106:9 @@ -452,15 +452,15 @@ note: 106 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:106:9 │ 106 │ self.balances[from] = self.balances[from] - value - │ ^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:106:31 @@ -468,7 +468,7 @@ note: 106 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:106:31 @@ -476,7 +476,7 @@ note: 106 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:106:31 @@ -484,7 +484,7 @@ note: 106 │ self.balances[from] = self.balances[from] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 107 │ self.balances[to] = self.balances[to] + value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:107:9 @@ -492,15 +492,15 @@ note: 107 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:107:9 │ 107 │ self.balances[to] = self.balances[to] + value - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:107:29 @@ -508,7 +508,7 @@ note: 107 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^ ^^ address │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:107:29 @@ -516,7 +516,7 @@ note: 107 │ self.balances[to] = self.balances[to] + value │ ^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:107:29 @@ -528,25 +528,25 @@ note: │ │ │ │ │ │ │ address │ │ address - │ Context + │ mut Context -> Context note: ┌─ uniswap.fe:111:5 │ -111 │ ╭ pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { +111 │ ╭ pub fn approve(mut self, mut ctx: Context, spender: address, value: u256) -> bool { 112 │ │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) 113 │ │ return true 114 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: spender, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ uniswap.fe:112:9 │ 112 │ self._approve(ctx, owner: ctx.msg_sender(), spender, value) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: ┌─ uniswap.fe:112:35 @@ -568,20 +568,20 @@ note: note: ┌─ uniswap.fe:116:5 │ -116 │ ╭ pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool { +116 │ ╭ pub fn transfer(mut self, mut ctx: Context, to: address, value: u256) -> bool { 117 │ │ self._transfer(ctx, from: ctx.msg_sender(), to, value) 118 │ │ return true 119 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ uniswap.fe:117:9 │ 117 │ self._transfer(ctx, from: ctx.msg_sender(), to, value) - │ ^^^^ ^^^ ^^^ Context + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: ┌─ uniswap.fe:117:35 @@ -603,19 +603,19 @@ note: note: ┌─ uniswap.fe:121:5 │ -121 │ ╭ pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool { +121 │ ╭ pub fn transferFrom(mut self, mut ctx: Context, from: address, to: address, value: u256) -> bool { 122 │ │ assert self.allowances[from][ctx.msg_sender()] >= value 123 │ │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value 124 │ │ self._transfer(ctx, from, to, value) 125 │ │ return true 126 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> bool + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: from, typ: address }, { label: None, name: to, typ: address }, { label: None, name: value, typ: u256 }] -> bool note: ┌─ uniswap.fe:122:16 │ 122 │ assert self.allowances[from][ctx.msg_sender()] >= value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:122:16 @@ -623,15 +623,15 @@ note: 122 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ uniswap.fe:122:16 │ 122 │ assert self.allowances[from][ctx.msg_sender()] >= value - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:122:38 @@ -645,7 +645,7 @@ note: 122 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:122:16 @@ -653,7 +653,7 @@ note: 122 │ assert self.allowances[from][ctx.msg_sender()] >= value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:123:9 @@ -661,15 +661,15 @@ note: 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ uniswap.fe:123:9 │ 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:123:31 @@ -681,9 +681,9 @@ note: ┌─ uniswap.fe:123:9 │ 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:123:51 @@ -691,15 +691,15 @@ note: 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^ ^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: ┌─ uniswap.fe:123:51 │ 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value - │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ Context + │ ^^^^^^^^^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: ┌─ uniswap.fe:123:73 @@ -713,7 +713,7 @@ note: 123 │ self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:123:51 @@ -725,8 +725,8 @@ note: │ │ │ │ │ │ │ │ │ address │ │ │ address - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: ┌─ uniswap.fe:124:9 @@ -742,7 +742,7 @@ note: 128 │ ╭ pub fn balanceOf(self, _ account: address) -> u256 { 129 │ │ return self.balances[account] 130 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: Some("_"), name: account, typ: address }] -> u256 + │ ╰─────^ params: [self, { label: Some("_"), name: account, typ: address }] -> u256 note: ┌─ uniswap.fe:129:16 @@ -770,7 +770,7 @@ note: 132 │ ╭ pub fn get_reserves(self) -> (u256, u256, u256) { 133 │ │ return (self.reserve0, self.reserve1, self.block_timestamp_last) 134 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> (u256, u256, u256) + │ ╰─────^ params: [self] -> (u256, u256, u256) note: ┌─ uniswap.fe:133:17 @@ -809,12 +809,12 @@ note: note: ┌─ uniswap.fe:137:5 │ -137 │ ╭ pub fn initialize(self, ctx: Context, token0: ERC20, token1: ERC20) { +137 │ ╭ pub fn initialize(mut self, ctx: Context, token0: ERC20, token1: ERC20) { 138 │ │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" 139 │ │ self.token0 = token0 140 │ │ self.token1 = token1 141 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: token0, typ: ERC20 }, { label: None, name: token1, typ: ERC20 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }, { label: None, name: token0, typ: ERC20 }, { label: None, name: token1, typ: ERC20 }] -> () note: ┌─ uniswap.fe:138:16 @@ -826,7 +826,7 @@ note: ┌─ uniswap.fe:138:16 │ 138 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" - │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ │ address @@ -834,7 +834,7 @@ note: ┌─ uniswap.fe:138:36 │ 138 │ assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" - │ ^^^^^^^^^^^^ SPtr
-> address + │ ^^^^^^^^^^^^ mut SPtr
-> address note: ┌─ uniswap.fe:138:16 @@ -844,7 +844,7 @@ note: │ │ │ bool 139 │ self.token0 = token0 - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:139:9 @@ -852,9 +852,9 @@ note: 139 │ self.token0 = token0 │ ^^^^^^^^^^^ ^^^^^^ ERC20 │ │ - │ SPtr + │ mut SPtr 140 │ self.token1 = token1 - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:140:9 @@ -862,19 +862,19 @@ note: 140 │ self.token1 = token1 │ ^^^^^^^^^^^ ^^^^^^ ERC20 │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:144:5 │ -144 │ ╭ fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { +144 │ ╭ fn _update(mut self, mut ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { 145 │ │ // changed from u32s 146 │ │ // TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) 147 │ │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 · │ 156 │ │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) 157 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: balance0, typ: u256 }, { label: None, name: balance1, typ: u256 }, { label: None, name: reserve0, typ: u256 }, { label: None, name: reserve1, typ: u256 }] -> () + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: balance0, typ: u256 }, { label: None, name: balance1, typ: u256 }, { label: None, name: reserve0, typ: u256 }, { label: None, name: reserve1, typ: u256 }] -> () note: ┌─ uniswap.fe:147:13 @@ -888,7 +888,7 @@ note: ┌─ uniswap.fe:147:37 │ 147 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 - │ ^^^ Context + │ ^^^ mut Context note: ┌─ uniswap.fe:147:37 @@ -911,7 +911,7 @@ note: 147 │ let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 148 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last - │ ^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ │ u256 @@ -919,7 +919,7 @@ note: ┌─ uniswap.fe:148:52 │ 148 │ let time_elapsed: u256 = block_timestamp - self.block_timestamp_last - │ ^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> u256 note: ┌─ uniswap.fe:148:34 @@ -967,15 +967,15 @@ note: 149 │ if time_elapsed > 0 and reserve0 != 0 and reserve1 != 0 { │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool 150 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:150:13 │ 150 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:150:43 @@ -984,7 +984,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:150:73 @@ -1006,15 +1006,15 @@ note: 150 │ self.price0_cumulative_last = self.price0_cumulative_last + reserve1 / reserve0 * time_elapsed │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 151 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:151:13 │ 151 │ self.price1_cumulative_last = self.price1_cumulative_last + reserve0 / reserve1 * time_elapsed - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr + │ mut SPtr note: ┌─ uniswap.fe:151:43 @@ -1023,7 +1023,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 - │ SPtr -> u256 + │ mut SPtr -> u256 note: ┌─ uniswap.fe:151:73 @@ -1046,7 +1046,7 @@ note: │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 152 │ } 153 │ self.reserve0 = balance0 - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:153:9 @@ -1054,9 +1054,9 @@ note: 153 │ self.reserve0 = balance0 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 154 │ self.reserve1 = balance1 - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:154:9 @@ -1064,9 +1064,9 @@ note: 154 │ self.reserve1 = balance1 │ ^^^^^^^^^^^^^ ^^^^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 155 │ self.block_timestamp_last = block_timestamp - │ ^^^^ UniswapV2Pair + │ ^^^^ mut UniswapV2Pair note: ┌─ uniswap.fe:155:9 @@ -1074,1406 +1074,1406 @@ note: 155 │ self.block_timestamp_last = block_timestamp │ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ u256 │ │ - │ SPtr + │ mut SPtr 156 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) - │ ^^^ ^^^^ UniswapV2Pair + │ ^^^ ^^^^ mut UniswapV2Pair │ │ - │ Context + │ mut Context -> Context note: ┌─ uniswap.fe:156:34 │ 156 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) - │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Pair + │ ^^^^^^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ - │ SPtr -> u256 + │ mut SPtr -> SPtr -> u256 note: ┌─ uniswap.fe:156:59 │ 156 │ emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) - │ ^^^^^^^^^^^^^ SPtr -> u256 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: - ┌─ uniswap.fe:159:5 + ┌─ uniswap.fe:160:5 │ -159 │ ╭ fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool { -160 │ │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() -161 │ │ let fee_on: bool = fee_to != address(0) -162 │ │ let k_last: u256 = self.k_last +160 │ ╭ fn _mint_fee(mut self, mut ctx: Context, reserve0: u256, reserve1: u256) -> bool { +161 │ │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() +162 │ │ let fee_on: bool = fee_to != address(0) +163 │ │ let k_last: u256 = self.k_last · │ -179 │ │ return fee_on -180 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: reserve0, typ: u256 }, { label: None, name: reserve1, typ: u256 }] -> bool +180 │ │ return fee_on +181 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: reserve0, typ: u256 }, { label: None, name: reserve1, typ: u256 }] -> bool note: - ┌─ uniswap.fe:160:13 + ┌─ uniswap.fe:161:13 │ -160 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() +161 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() │ ^^^^^^ address -161 │ let fee_on: bool = fee_to != address(0) +162 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^ bool -162 │ let k_last: u256 = self.k_last +163 │ let k_last: u256 = self.k_last │ ^^^^^^ u256 · -165 │ let root_k: u256 = sqrt(reserve0 * reserve1) +166 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^ u256 -166 │ let root_k_last: u256 = sqrt(k_last) +167 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^^^^^^ u256 -167 │ if root_k > root_k_last { -168 │ let numerator: u256 = self.total_supply * root_k - root_k_last +168 │ if root_k > root_k_last { +169 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^ u256 -169 │ let denominator: u256 = root_k * 5 + root_k_last +170 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^^ u256 -170 │ let liquidity: u256 = numerator / denominator +171 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^ u256 note: - ┌─ uniswap.fe:160:48 + ┌─ uniswap.fe:161:48 │ -160 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() - │ ^^^^ UniswapV2Pair +161 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:160:48 + ┌─ uniswap.fe:161:48 │ -160 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() - │ ^^^^^^^^^^^^ SPtr
-> address +161 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() + │ ^^^^^^^^^^^^ mut SPtr
note: - ┌─ uniswap.fe:160:31 + ┌─ uniswap.fe:161:31 │ -160 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() +161 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Factory note: - ┌─ uniswap.fe:160:31 + ┌─ uniswap.fe:161:31 │ -160 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() +161 │ let fee_to: address = UniswapV2Factory(self.factory).fee_to() │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address -161 │ let fee_on: bool = fee_to != address(0) +162 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^ ^ u256 │ │ │ address note: - ┌─ uniswap.fe:161:38 + ┌─ uniswap.fe:162:38 │ -161 │ let fee_on: bool = fee_to != address(0) +162 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^ address note: - ┌─ uniswap.fe:161:28 + ┌─ uniswap.fe:162:28 │ -161 │ let fee_on: bool = fee_to != address(0) +162 │ let fee_on: bool = fee_to != address(0) │ ^^^^^^^^^^^^^^^^^^^^ bool -162 │ let k_last: u256 = self.k_last - │ ^^^^ UniswapV2Pair +163 │ let k_last: u256 = self.k_last + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:162:28 + ┌─ uniswap.fe:163:28 │ -162 │ let k_last: u256 = self.k_last - │ ^^^^^^^^^^^ SPtr -> u256 -163 │ if fee_on { +163 │ let k_last: u256 = self.k_last + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +164 │ if fee_on { │ ^^^^^^ bool -164 │ if k_last != 0 { +165 │ if k_last != 0 { │ ^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:164:16 + ┌─ uniswap.fe:165:16 │ -164 │ if k_last != 0 { +165 │ if k_last != 0 { │ ^^^^^^^^^^^ bool -165 │ let root_k: u256 = sqrt(reserve0 * reserve1) +166 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:165:41 + ┌─ uniswap.fe:166:41 │ -165 │ let root_k: u256 = sqrt(reserve0 * reserve1) +166 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:165:36 + ┌─ uniswap.fe:166:36 │ -165 │ let root_k: u256 = sqrt(reserve0 * reserve1) +166 │ let root_k: u256 = sqrt(reserve0 * reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -166 │ let root_k_last: u256 = sqrt(k_last) +167 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^ u256 note: - ┌─ uniswap.fe:166:41 + ┌─ uniswap.fe:167:41 │ -166 │ let root_k_last: u256 = sqrt(k_last) +167 │ let root_k_last: u256 = sqrt(k_last) │ ^^^^^^^^^^^^ u256 -167 │ if root_k > root_k_last { +168 │ if root_k > root_k_last { │ ^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:167:20 + ┌─ uniswap.fe:168:20 │ -167 │ if root_k > root_k_last { +168 │ if root_k > root_k_last { │ ^^^^^^^^^^^^^^^^^^^^ bool -168 │ let numerator: u256 = self.total_supply * root_k - root_k_last - │ ^^^^ UniswapV2Pair +169 │ let numerator: u256 = self.total_supply * root_k - root_k_last + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:168:43 + ┌─ uniswap.fe:169:43 │ -168 │ let numerator: u256 = self.total_supply * root_k - root_k_last +169 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^ ^^^^^^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: - ┌─ uniswap.fe:168:43 + ┌─ uniswap.fe:169:43 │ -168 │ let numerator: u256 = self.total_supply * root_k - root_k_last +169 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:168:43 + ┌─ uniswap.fe:169:43 │ -168 │ let numerator: u256 = self.total_supply * root_k - root_k_last +169 │ let numerator: u256 = self.total_supply * root_k - root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -169 │ let denominator: u256 = root_k * 5 + root_k_last +170 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:169:45 + ┌─ uniswap.fe:170:45 │ -169 │ let denominator: u256 = root_k * 5 + root_k_last +170 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:169:45 + ┌─ uniswap.fe:170:45 │ -169 │ let denominator: u256 = root_k * 5 + root_k_last +170 │ let denominator: u256 = root_k * 5 + root_k_last │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256 -170 │ let liquidity: u256 = numerator / denominator +171 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:170:43 + ┌─ uniswap.fe:171:43 │ -170 │ let liquidity: u256 = numerator / denominator +171 │ let liquidity: u256 = numerator / denominator │ ^^^^^^^^^^^^^^^^^^^^^^^ u256 -171 │ if liquidity > 0 { +172 │ if liquidity > 0 { │ ^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:171:24 + ┌─ uniswap.fe:172:24 │ -171 │ if liquidity > 0 { +172 │ if liquidity > 0 { │ ^^^^^^^^^^^^^ bool -172 │ self._mint(ctx, to: fee_to, value: liquidity) +173 │ self._mint(ctx, to: fee_to, value: liquidity) │ ^^^^ ^^^ ^^^^^^ ^^^^^^^^^ u256 │ │ │ │ │ │ │ address - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:172:25 + ┌─ uniswap.fe:173:25 │ -172 │ self._mint(ctx, to: fee_to, value: liquidity) +173 │ self._mint(ctx, to: fee_to, value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () · -176 │ } else if k_last != 0 { +177 │ } else if k_last != 0 { │ ^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:176:19 + ┌─ uniswap.fe:177:19 │ -176 │ } else if k_last != 0 { +177 │ } else if k_last != 0 { │ ^^^^^^^^^^^ bool -177 │ self.k_last = 0 - │ ^^^^ UniswapV2Pair +178 │ self.k_last = 0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:177:13 + ┌─ uniswap.fe:178:13 │ -177 │ self.k_last = 0 +178 │ self.k_last = 0 │ ^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -178 │ } -179 │ return fee_on + │ mut SPtr +179 │ } +180 │ return fee_on │ ^^^^^^ bool note: - ┌─ uniswap.fe:183:5 + ┌─ uniswap.fe:184:5 │ -183 │ ╭ pub fn mint(self, ctx: Context, to: address) -> u256 { -184 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 -185 │ │ let reserve0: u256 = self.reserve0 -186 │ │ let reserve1: u256 = self.reserve1 +184 │ ╭ pub fn mint(mut self, mut ctx: Context, to: address) -> u256 { +185 │ │ let MINIMUM_LIQUIDITY: u256 = 1000 +186 │ │ let reserve0: u256 = self.reserve0 +187 │ │ let reserve1: u256 = self.reserve1 · │ -207 │ │ return liquidity -208 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }] -> u256 +208 │ │ return liquidity +209 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: to, typ: address }] -> u256 note: - ┌─ uniswap.fe:184:13 + ┌─ uniswap.fe:185:13 │ -184 │ let MINIMUM_LIQUIDITY: u256 = 1000 +185 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^^^^^^^^^^^^^^ u256 -185 │ let reserve0: u256 = self.reserve0 +186 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^ u256 -186 │ let reserve1: u256 = self.reserve1 +187 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^ u256 -187 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) +188 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) │ ^^^^^^^^ u256 -188 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) +189 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) │ ^^^^^^^^ u256 -189 │ let amount0: u256 = balance0 - self.reserve0 +190 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^ u256 -190 │ let amount1: u256 = balance1 - self.reserve1 +191 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^ u256 -191 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +192 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^ bool -192 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee +193 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee │ ^^^^^^^^^^^^ u256 -193 │ let liquidity: u256 = 0 - │ ^^^^^^^^^ u256 +194 │ let mut liquidity: u256 = 0 + │ ^^^^^^^^^ mut u256 note: - ┌─ uniswap.fe:184:39 + ┌─ uniswap.fe:185:39 │ -184 │ let MINIMUM_LIQUIDITY: u256 = 1000 +185 │ let MINIMUM_LIQUIDITY: u256 = 1000 │ ^^^^ u256 -185 │ let reserve0: u256 = self.reserve0 - │ ^^^^ UniswapV2Pair +186 │ let reserve0: u256 = self.reserve0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:185:30 + ┌─ uniswap.fe:186:30 │ -185 │ let reserve0: u256 = self.reserve0 - │ ^^^^^^^^^^^^^ SPtr -> u256 -186 │ let reserve1: u256 = self.reserve1 - │ ^^^^ UniswapV2Pair +186 │ let reserve0: u256 = self.reserve0 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +187 │ let reserve1: u256 = self.reserve1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:186:30 + ┌─ uniswap.fe:187:30 │ -186 │ let reserve1: u256 = self.reserve1 - │ ^^^^^^^^^^^^^ SPtr -> u256 -187 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) - │ ^^^^ UniswapV2Pair +187 │ let reserve1: u256 = self.reserve1 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +188 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:187:30 + ┌─ uniswap.fe:188:30 │ -187 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^ ^^^ Context +188 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr -> ERC20 + │ mut SPtr -> ERC20 note: - ┌─ uniswap.fe:187:52 + ┌─ uniswap.fe:188:52 │ -187 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) +188 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:187:30 + ┌─ uniswap.fe:188:30 │ -187 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) +188 │ let balance0: u256 = self.token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -188 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) - │ ^^^^ UniswapV2Pair +189 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:188:30 + ┌─ uniswap.fe:189:30 │ -188 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^ ^^^ Context +189 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr -> ERC20 + │ mut SPtr -> ERC20 note: - ┌─ uniswap.fe:188:52 + ┌─ uniswap.fe:189:52 │ -188 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) +189 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:188:30 + ┌─ uniswap.fe:189:30 │ -188 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) +189 │ let balance1: u256 = self.token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -189 │ let amount0: u256 = balance0 - self.reserve0 - │ ^^^^^^^^ ^^^^ UniswapV2Pair +190 │ let amount0: u256 = balance0 - self.reserve0 + │ ^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ │ u256 note: - ┌─ uniswap.fe:189:40 + ┌─ uniswap.fe:190:40 │ -189 │ let amount0: u256 = balance0 - self.reserve0 - │ ^^^^^^^^^^^^^ SPtr -> u256 +190 │ let amount0: u256 = balance0 - self.reserve0 + │ ^^^^^^^^^^^^^ mut SPtr -> u256 note: - ┌─ uniswap.fe:189:29 + ┌─ uniswap.fe:190:29 │ -189 │ let amount0: u256 = balance0 - self.reserve0 +190 │ let amount0: u256 = balance0 - self.reserve0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256 -190 │ let amount1: u256 = balance1 - self.reserve1 - │ ^^^^^^^^ ^^^^ UniswapV2Pair +191 │ let amount1: u256 = balance1 - self.reserve1 + │ ^^^^^^^^ ^^^^ mut UniswapV2Pair │ │ │ u256 note: - ┌─ uniswap.fe:190:40 + ┌─ uniswap.fe:191:40 │ -190 │ let amount1: u256 = balance1 - self.reserve1 - │ ^^^^^^^^^^^^^ SPtr -> u256 +191 │ let amount1: u256 = balance1 - self.reserve1 + │ ^^^^^^^^^^^^^ mut SPtr -> u256 note: - ┌─ uniswap.fe:190:29 + ┌─ uniswap.fe:191:29 │ -190 │ let amount1: u256 = balance1 - self.reserve1 +191 │ let amount1: u256 = balance1 - self.reserve1 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256 -191 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +192 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ │ │ u256 - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:191:28 + ┌─ uniswap.fe:192:28 │ -191 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +192 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -192 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee - │ ^^^^ UniswapV2Pair +193 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:192:34 + ┌─ uniswap.fe:193:34 │ -192 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee - │ ^^^^^^^^^^^^^^^^^ SPtr -> u256 -193 │ let liquidity: u256 = 0 - │ ^ u256 -194 │ if total_supply == 0 { +193 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since totalSupply can update in _mintFee + │ ^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +194 │ let mut liquidity: u256 = 0 + │ ^ u256 +195 │ if total_supply == 0 { │ ^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:194:12 + ┌─ uniswap.fe:195:12 │ -194 │ if total_supply == 0 { +195 │ if total_supply == 0 { │ ^^^^^^^^^^^^^^^^^ bool -195 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +196 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256 │ │ │ │ │ u256 - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:195:30 + ┌─ uniswap.fe:196:30 │ -195 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +196 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:195:25 + ┌─ uniswap.fe:196:25 │ -195 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +196 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:195:25 + ┌─ uniswap.fe:196:25 │ -195 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY +196 │ liquidity = sqrt(amount0 * amount1) - MINIMUM_LIQUIDITY │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -196 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens +197 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^ ^^^ ^ u256 │ │ │ - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:196:33 + ┌─ uniswap.fe:197:33 │ -196 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens +197 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256 │ │ │ address note: - ┌─ uniswap.fe:196:13 + ┌─ uniswap.fe:197:13 │ -196 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens +197 │ self._mint(ctx, to: address(0), value: MINIMUM_LIQUIDITY) // permanently lock the first MINIMUM_LIQUIDITY tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -197 │ } else { -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +198 │ } else { +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256 │ │ │ │ │ u256 - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:198:29 + ┌─ uniswap.fe:199:29 │ -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:198:29 + ┌─ uniswap.fe:199:29 │ -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^^^^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:198:64 + ┌─ uniswap.fe:199:64 │ -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:198:64 + ┌─ uniswap.fe:199:64 │ -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:198:25 + ┌─ uniswap.fe:199:25 │ -198 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) +199 │ liquidity = min(amount0 * total_supply / reserve0, amount1 * total_supply / reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -199 │ } -200 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +200 │ } +201 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:200:16 + ┌─ uniswap.fe:201:16 │ -200 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" +201 │ assert liquidity > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED" │ ^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40> │ │ │ bool -201 │ self._mint(ctx, to, value: liquidity) - │ ^^^^ ^^^ ^^ ^^^^^^^^^ u256 +202 │ self._mint(ctx, to, value: liquidity) + │ ^^^^ ^^^ ^^ ^^^^^^^^^ mut u256 -> u256 │ │ │ │ │ │ │ address - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:201:9 + ┌─ uniswap.fe:202:9 │ -201 │ self._mint(ctx, to, value: liquidity) +202 │ self._mint(ctx, to, value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -202 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +203 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ │ │ │ │ │ │ u256 │ │ │ │ u256 │ │ │ u256 - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:202:9 + ┌─ uniswap.fe:203:9 │ -202 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +203 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -203 │ if fee_on { +204 │ if fee_on { │ ^^^^^^ bool -204 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date - │ ^^^^ UniswapV2Pair +205 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:204:13 + ┌─ uniswap.fe:205:13 │ -204 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date +205 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 - │ SPtr + │ mut SPtr note: - ┌─ uniswap.fe:204:27 + ┌─ uniswap.fe:205:27 │ -204 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date +205 │ self.k_last = reserve0 * reserve1 // reserve0 and reserve1 are up-to-date │ ^^^^^^^^^^^^^^^^^^^ u256 -205 │ } -206 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) - │ ^^^ ^^^ Context +206 │ } +207 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: - ┌─ uniswap.fe:206:32 + ┌─ uniswap.fe:207:32 │ -206 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) +207 │ emit Mint(ctx, sender: ctx.msg_sender(), amount0, amount1) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ u256 │ │ │ │ │ u256 │ address -207 │ return liquidity - │ ^^^^^^^^^ u256 +208 │ return liquidity + │ ^^^^^^^^^ mut u256 -> u256 note: - ┌─ uniswap.fe:211:5 + ┌─ uniswap.fe:212:5 │ -211 │ ╭ pub fn burn(self, ctx: Context, to: address) -> (u256, u256) { -212 │ │ let reserve0: u256 = self.reserve0 -213 │ │ let reserve1: u256 = self.reserve1 -214 │ │ let token0: ERC20 = self.token0 +212 │ ╭ pub fn burn(mut self, mut ctx: Context, to: address) -> (u256, u256) { +213 │ │ let reserve0: u256 = self.reserve0 +214 │ │ let reserve1: u256 = self.reserve1 +215 │ │ let token0: ERC20 = self.token0 · │ -235 │ │ return (amount0, amount1) -236 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }] -> (u256, u256) +236 │ │ return (amount0, amount1) +237 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: to, typ: address }] -> (u256, u256) note: - ┌─ uniswap.fe:212:13 + ┌─ uniswap.fe:213:13 │ -212 │ let reserve0: u256 = self.reserve0 +213 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^ u256 -213 │ let reserve1: u256 = self.reserve1 +214 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^ u256 -214 │ let token0: ERC20 = self.token0 +215 │ let token0: ERC20 = self.token0 │ ^^^^^^ ERC20 -215 │ let token1: ERC20 = self.token1 +216 │ let token1: ERC20 = self.token1 │ ^^^^^^ ERC20 -216 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^^^ u256 -217 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^^^ u256 -218 │ let liquidity: u256 = self.balances[ctx.self_address()] +217 │ let mut balance0: u256 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^^^ mut u256 +218 │ let mut balance1: u256 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^^^ mut u256 +219 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^ u256 -219 │ -220 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +220 │ +221 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^ bool -221 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee +222 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee │ ^^^^^^^^^^^^ u256 -222 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution +223 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^ u256 -223 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution +224 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^ u256 note: - ┌─ uniswap.fe:212:30 + ┌─ uniswap.fe:213:30 │ -212 │ let reserve0: u256 = self.reserve0 - │ ^^^^ UniswapV2Pair +213 │ let reserve0: u256 = self.reserve0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:212:30 + ┌─ uniswap.fe:213:30 │ -212 │ let reserve0: u256 = self.reserve0 - │ ^^^^^^^^^^^^^ SPtr -> u256 -213 │ let reserve1: u256 = self.reserve1 - │ ^^^^ UniswapV2Pair +213 │ let reserve0: u256 = self.reserve0 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +214 │ let reserve1: u256 = self.reserve1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:213:30 + ┌─ uniswap.fe:214:30 │ -213 │ let reserve1: u256 = self.reserve1 - │ ^^^^^^^^^^^^^ SPtr -> u256 -214 │ let token0: ERC20 = self.token0 - │ ^^^^ UniswapV2Pair +214 │ let reserve1: u256 = self.reserve1 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +215 │ let token0: ERC20 = self.token0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:214:29 + ┌─ uniswap.fe:215:29 │ -214 │ let token0: ERC20 = self.token0 - │ ^^^^^^^^^^^ SPtr -> ERC20 -215 │ let token1: ERC20 = self.token1 - │ ^^^^ UniswapV2Pair +215 │ let token0: ERC20 = self.token0 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> ERC20 +216 │ let token1: ERC20 = self.token1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:215:29 + ┌─ uniswap.fe:216:29 │ -215 │ let token1: ERC20 = self.token1 - │ ^^^^^^^^^^^ SPtr -> ERC20 -216 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^ ^^^ Context - │ │ - │ ERC20 +216 │ let token1: ERC20 = self.token1 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> ERC20 +217 │ let mut balance0: u256 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^ ^^^ mut Context + │ │ + │ ERC20 note: - ┌─ uniswap.fe:216:47 + ┌─ uniswap.fe:217:51 │ -216 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^^^^^^^^ address +217 │ let mut balance0: u256 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:216:30 + ┌─ uniswap.fe:217:34 │ -216 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -217 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^ ^^^ Context - │ │ - │ ERC20 +217 │ let mut balance0: u256 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 +218 │ let mut balance1: u256 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^ ^^^ mut Context + │ │ + │ ERC20 note: - ┌─ uniswap.fe:217:47 + ┌─ uniswap.fe:218:51 │ -217 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^^^^^^^^ address +218 │ let mut balance1: u256 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:217:30 + ┌─ uniswap.fe:218:34 │ -217 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -218 │ let liquidity: u256 = self.balances[ctx.self_address()] - │ ^^^^ UniswapV2Pair +218 │ let mut balance1: u256 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 +219 │ let liquidity: u256 = self.balances[ctx.self_address()] + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:218:31 + ┌─ uniswap.fe:219:31 │ -218 │ let liquidity: u256 = self.balances[ctx.self_address()] - │ ^^^^^^^^^^^^^ ^^^ Context +219 │ let liquidity: u256 = self.balances[ctx.self_address()] + │ ^^^^^^^^^^^^^ ^^^ mut Context │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ uniswap.fe:218:45 + ┌─ uniswap.fe:219:45 │ -218 │ let liquidity: u256 = self.balances[ctx.self_address()] +219 │ let liquidity: u256 = self.balances[ctx.self_address()] │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:218:31 + ┌─ uniswap.fe:219:31 │ -218 │ let liquidity: u256 = self.balances[ctx.self_address()] - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SPtr -> u256 -219 │ -220 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +219 │ let liquidity: u256 = self.balances[ctx.self_address()] + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +220 │ +221 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ │ │ u256 - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:220:28 + ┌─ uniswap.fe:221:28 │ -220 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) +221 │ let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -221 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee - │ ^^^^ UniswapV2Pair +222 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:221:34 + ┌─ uniswap.fe:222:34 │ -221 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee - │ ^^^^^^^^^^^^^^^^^ SPtr -> u256 -222 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution - │ ^^^^^^^^^ ^^^^^^^^ u256 +222 │ let total_supply: u256 = self.total_supply // gas savings, must be defined here since total_supply can update in _mintFee + │ ^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +223 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution + │ ^^^^^^^^^ ^^^^^^^^ mut u256 │ │ │ u256 note: - ┌─ uniswap.fe:222:29 + ┌─ uniswap.fe:223:29 │ -222 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution +223 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:222:29 + ┌─ uniswap.fe:223:29 │ -222 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution +223 │ let amount0: u256 = (liquidity * balance0) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -223 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution - │ ^^^^^^^^^ ^^^^^^^^ u256 +224 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution + │ ^^^^^^^^^ ^^^^^^^^ mut u256 │ │ │ u256 note: - ┌─ uniswap.fe:223:29 + ┌─ uniswap.fe:224:29 │ -223 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution +224 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:223:29 + ┌─ uniswap.fe:224:29 │ -223 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution +224 │ let amount1: u256 = (liquidity * balance1) / total_supply // using balances ensures pro-rata distribution │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -224 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +225 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:224:16 + ┌─ uniswap.fe:225:16 │ -224 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +225 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ ^^^^^^^ ^ u256 │ │ │ │ │ u256 │ bool note: - ┌─ uniswap.fe:224:32 + ┌─ uniswap.fe:225:32 │ -224 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +225 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:224:16 + ┌─ uniswap.fe:225:16 │ -224 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" +225 │ assert amount0 > 0 and amount1 > 0, "UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<40> │ │ │ bool -225 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) - │ ^^^^ ^^^ ^^^ Context +226 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) + │ ^^^^ ^^^ ^^^ mut Context │ │ │ - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:225:31 + ┌─ uniswap.fe:226:31 │ -225 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) +226 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ u256 │ │ │ address note: - ┌─ uniswap.fe:225:9 + ┌─ uniswap.fe:226:9 │ -225 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) +226 │ self._burn(ctx, from: ctx.self_address(), value: liquidity) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -226 │ token0.transfer(to, amount0) +227 │ token0.transfer(to, amount0) │ ^^^^^^ ^^ ^^^^^^^ u256 │ │ │ │ │ address │ ERC20 note: - ┌─ uniswap.fe:226:9 + ┌─ uniswap.fe:227:9 │ -226 │ token0.transfer(to, amount0) +227 │ token0.transfer(to, amount0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -227 │ token1.transfer(to, amount1) +228 │ token1.transfer(to, amount1) │ ^^^^^^ ^^ ^^^^^^^ u256 │ │ │ │ │ address │ ERC20 note: - ┌─ uniswap.fe:227:9 + ┌─ uniswap.fe:228:9 │ -227 │ token1.transfer(to, amount1) +228 │ token1.transfer(to, amount1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -228 │ balance0 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^^^ ^^^^^^ ^^^ Context +229 │ balance0 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^^^ ^^^^^^ ^^^ mut Context │ │ │ │ │ ERC20 - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:228:37 + ┌─ uniswap.fe:229:37 │ -228 │ balance0 = token0.balanceOf(ctx.self_address()) +229 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:228:20 + ┌─ uniswap.fe:229:20 │ -228 │ balance0 = token0.balanceOf(ctx.self_address()) +229 │ balance0 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -229 │ balance1 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^^^ ^^^^^^ ^^^ Context +230 │ balance1 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^^^ ^^^^^^ ^^^ mut Context │ │ │ │ │ ERC20 - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:229:37 + ┌─ uniswap.fe:230:37 │ -229 │ balance1 = token1.balanceOf(ctx.self_address()) +230 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:229:20 + ┌─ uniswap.fe:230:20 │ -229 │ balance1 = token1.balanceOf(ctx.self_address()) +230 │ balance1 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -230 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +231 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ │ │ │ │ │ │ u256 - │ │ │ │ u256 - │ │ │ u256 - │ │ Context - │ UniswapV2Pair + │ │ │ │ mut u256 -> u256 + │ │ │ mut u256 -> u256 + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:230:9 + ┌─ uniswap.fe:231:9 │ -230 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +231 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -231 │ if fee_on { +232 │ if fee_on { │ ^^^^^^ bool -232 │ self.k_last = reserve0 * reserve1 - │ ^^^^ UniswapV2Pair +233 │ self.k_last = reserve0 * reserve1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:232:13 + ┌─ uniswap.fe:233:13 │ -232 │ self.k_last = reserve0 * reserve1 +233 │ self.k_last = reserve0 * reserve1 │ ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 - │ SPtr + │ mut SPtr note: - ┌─ uniswap.fe:232:27 + ┌─ uniswap.fe:233:27 │ -232 │ self.k_last = reserve0 * reserve1 +233 │ self.k_last = reserve0 * reserve1 │ ^^^^^^^^^^^^^^^^^^^ u256 -233 │ } -234 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) - │ ^^^ ^^^ Context +234 │ } +235 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: - ┌─ uniswap.fe:234:32 + ┌─ uniswap.fe:235:32 │ -234 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) +235 │ emit Burn(ctx, sender: ctx.msg_sender(), amount0, amount1, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^ ^^^^^^^ ^^ address │ │ │ │ │ │ │ u256 │ │ u256 │ address -235 │ return (amount0, amount1) +236 │ return (amount0, amount1) │ ^^^^^^^ ^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:235:16 + ┌─ uniswap.fe:236:16 │ -235 │ return (amount0, amount1) +236 │ return (amount0, amount1) │ ^^^^^^^^^^^^^^^^^^ (u256, u256) note: - ┌─ uniswap.fe:241:5 + ┌─ uniswap.fe:242:5 │ -241 │ ╭ pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address) { -242 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" -243 │ │ let reserve0: u256 = self.reserve0 -244 │ │ let reserve1: u256 = self.reserve1 +242 │ ╭ pub fn swap(mut self, mut ctx: Context, amount0_out: u256, amount1_out: u256, to: address) { +243 │ │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +244 │ │ let reserve0: u256 = self.reserve0 +245 │ │ let reserve1: u256 = self.reserve1 · │ -277 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) -278 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: amount0_out, typ: u256 }, { label: None, name: amount1_out, typ: u256 }, { label: None, name: to, typ: address }] -> () +278 │ │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +279 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: None, name: amount0_out, typ: u256 }, { label: None, name: amount1_out, typ: u256 }, { label: None, name: to, typ: address }] -> () note: - ┌─ uniswap.fe:243:13 + ┌─ uniswap.fe:244:13 │ -243 │ let reserve0: u256 = self.reserve0 +244 │ let reserve0: u256 = self.reserve0 │ ^^^^^^^^ u256 -244 │ let reserve1: u256 = self.reserve1 +245 │ let reserve1: u256 = self.reserve1 │ ^^^^^^^^ u256 · -247 │ let token0: ERC20 = self.token0 +248 │ let token0: ERC20 = self.token0 │ ^^^^^^ ERC20 -248 │ let token1: ERC20 = self.token1 +249 │ let token1: ERC20 = self.token1 │ ^^^^^^ ERC20 · -263 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +264 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^ u256 -264 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +265 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^ u256 -265 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +266 │ +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^ u256 -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^ u256 · -271 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +272 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^^^ u256 -272 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +273 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:242:16 + ┌─ uniswap.fe:243:16 │ -242 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +243 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:242:16 + ┌─ uniswap.fe:243:16 │ -242 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +243 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^ u256 │ │ │ │ │ u256 │ bool note: - ┌─ uniswap.fe:242:35 + ┌─ uniswap.fe:243:35 │ -242 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +243 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:242:16 + ┌─ uniswap.fe:243:16 │ -242 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" +243 │ assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<37> │ │ │ bool -243 │ let reserve0: u256 = self.reserve0 - │ ^^^^ UniswapV2Pair +244 │ let reserve0: u256 = self.reserve0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:243:30 + ┌─ uniswap.fe:244:30 │ -243 │ let reserve0: u256 = self.reserve0 - │ ^^^^^^^^^^^^^ SPtr -> u256 -244 │ let reserve1: u256 = self.reserve1 - │ ^^^^ UniswapV2Pair +244 │ let reserve0: u256 = self.reserve0 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +245 │ let reserve1: u256 = self.reserve1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:244:30 + ┌─ uniswap.fe:245:30 │ -244 │ let reserve1: u256 = self.reserve1 - │ ^^^^^^^^^^^^^ SPtr -> u256 -245 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +245 │ let reserve1: u256 = self.reserve1 + │ ^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +246 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^ ^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:245:16 + ┌─ uniswap.fe:246:16 │ -245 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +246 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 │ bool note: - ┌─ uniswap.fe:245:43 + ┌─ uniswap.fe:246:43 │ -245 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +246 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:245:16 + ┌─ uniswap.fe:246:16 │ -245 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" +246 │ assert amount0_out < reserve0 and amount1_out < reserve1, "UniswapV2: INSUFFICIENT_LIQUIDITY" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<33> │ │ │ bool -246 │ -247 │ let token0: ERC20 = self.token0 - │ ^^^^ UniswapV2Pair +247 │ +248 │ let token0: ERC20 = self.token0 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:247:29 + ┌─ uniswap.fe:248:29 │ -247 │ let token0: ERC20 = self.token0 - │ ^^^^^^^^^^^ SPtr -> ERC20 -248 │ let token1: ERC20 = self.token1 - │ ^^^^ UniswapV2Pair +248 │ let token0: ERC20 = self.token0 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> ERC20 +249 │ let token1: ERC20 = self.token1 + │ ^^^^ mut UniswapV2Pair note: - ┌─ uniswap.fe:248:29 + ┌─ uniswap.fe:249:29 │ -248 │ let token1: ERC20 = self.token1 - │ ^^^^^^^^^^^ SPtr -> ERC20 +249 │ let token1: ERC20 = self.token1 + │ ^^^^^^^^^^^ mut SPtr -> SPtr -> ERC20 · -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^ ^^^^^^ ERC20 │ │ │ address note: - ┌─ uniswap.fe:251:22 + ┌─ uniswap.fe:252:22 │ -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:251:16 + ┌─ uniswap.fe:252:16 │ -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^^^^ ERC20 │ │ │ │ │ address │ bool note: - ┌─ uniswap.fe:251:48 + ┌─ uniswap.fe:252:48 │ -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:251:42 + ┌─ uniswap.fe:252:42 │ -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:251:16 + ┌─ uniswap.fe:252:16 │ -251 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" +252 │ assert to != address(token0) and to != address(token1), "UniswapV2: INVALID_TO" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ String<21> │ │ │ bool -252 │ -253 │ if amount0_out > 0 { +253 │ +254 │ if amount0_out > 0 { │ ^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:253:12 + ┌─ uniswap.fe:254:12 │ -253 │ if amount0_out > 0 { +254 │ if amount0_out > 0 { │ ^^^^^^^^^^^^^^^ bool -254 │ token0.transfer(to, amount0_out) // optimistically transfer tokens +255 │ token0.transfer(to, amount0_out) // optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256 │ │ │ │ │ address │ ERC20 note: - ┌─ uniswap.fe:254:13 + ┌─ uniswap.fe:255:13 │ -254 │ token0.transfer(to, amount0_out) // optimistically transfer tokens +255 │ token0.transfer(to, amount0_out) // optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -255 │ } -256 │ if amount1_out > 0 { +256 │ } +257 │ if amount1_out > 0 { │ ^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:256:12 + ┌─ uniswap.fe:257:12 │ -256 │ if amount1_out > 0 { +257 │ if amount1_out > 0 { │ ^^^^^^^^^^^^^^^ bool -257 │ token1.transfer(to, amount1_out) // optimistically transfer tokens +258 │ token1.transfer(to, amount1_out) // optimistically transfer tokens │ ^^^^^^ ^^ ^^^^^^^^^^^ u256 │ │ │ │ │ address │ ERC20 note: - ┌─ uniswap.fe:257:13 + ┌─ uniswap.fe:258:13 │ -257 │ token1.transfer(to, amount1_out) // optimistically transfer tokens +258 │ token1.transfer(to, amount1_out) // optimistically transfer tokens │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool · -263 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) - │ ^^^^^^ ^^^ Context +264 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) + │ ^^^^^^ ^^^ mut Context │ │ │ ERC20 note: - ┌─ uniswap.fe:263:47 + ┌─ uniswap.fe:264:47 │ -263 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +264 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:263:30 + ┌─ uniswap.fe:264:30 │ -263 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) +264 │ let balance0: u256 = token0.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -264 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) - │ ^^^^^^ ^^^ Context +265 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) + │ ^^^^^^ ^^^ mut Context │ │ │ ERC20 note: - ┌─ uniswap.fe:264:47 + ┌─ uniswap.fe:265:47 │ -264 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +265 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:264:30 + ┌─ uniswap.fe:265:30 │ -264 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) +265 │ let balance1: u256 = token1.balanceOf(ctx.self_address()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -265 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +266 │ +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:266:82 + ┌─ uniswap.fe:267:82 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:266:32 + ┌─ uniswap.fe:267:32 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool │ │ │ u256 note: - ┌─ uniswap.fe:266:44 + ┌─ uniswap.fe:267:44 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:266:43 + ┌─ uniswap.fe:267:43 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:266:32 + ┌─ uniswap.fe:267:32 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:266:32 + ┌─ uniswap.fe:267:32 │ -266 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 +267 │ let amount0_in: u256 = balance0 - (reserve0 - amount0_out) if balance0 > reserve0 - amount0_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:267:82 + ┌─ uniswap.fe:268:82 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:267:32 + ┌─ uniswap.fe:268:32 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool │ │ │ u256 note: - ┌─ uniswap.fe:267:44 + ┌─ uniswap.fe:268:44 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^ ^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:267:43 + ┌─ uniswap.fe:268:43 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:267:32 + ┌─ uniswap.fe:268:32 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:267:32 + ┌─ uniswap.fe:268:32 │ -267 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 +268 │ let amount1_in: u256 = balance1 - (reserve1 - amount1_out) if balance1 > reserve1 - amount1_out else 0 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -268 │ -269 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +269 │ +270 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:269:16 + ┌─ uniswap.fe:270:16 │ -269 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +270 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256 │ │ │ │ │ u256 │ bool note: - ┌─ uniswap.fe:269:34 + ┌─ uniswap.fe:270:34 │ -269 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +270 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:269:16 + ┌─ uniswap.fe:270:16 │ -269 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" +270 │ assert amount0_in > 0 or amount1_in > 0, "UniswapV2: INSUFFICIENT_INPUT_AMOUNT" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<36> │ │ │ bool -270 │ -271 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +271 │ +272 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^ ^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:271:39 + ┌─ uniswap.fe:272:39 │ -271 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +272 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:271:57 + ┌─ uniswap.fe:272:57 │ -271 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +272 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:271:39 + ┌─ uniswap.fe:272:39 │ -271 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 +272 │ let balance0_adjusted: u256 = balance0 * 1000 - amount0_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -272 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +273 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^ ^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:272:39 + ┌─ uniswap.fe:273:39 │ -272 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +273 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:272:57 + ┌─ uniswap.fe:273:57 │ -272 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +273 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:272:39 + ┌─ uniswap.fe:273:39 │ -272 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 +273 │ let balance1_adjusted: u256 = balance1 * 1000 - amount1_in * 3 │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -273 │ -274 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +274 │ +275 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:274:16 + ┌─ uniswap.fe:275:16 │ -274 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +275 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ u256 │ u256 note: - ┌─ uniswap.fe:274:57 + ┌─ uniswap.fe:275:57 │ -274 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +275 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:274:57 + ┌─ uniswap.fe:275:57 │ -274 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +275 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:274:16 + ┌─ uniswap.fe:275:16 │ -274 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" +275 │ assert balance0_adjusted * balance1_adjusted >= reserve0 * reserve1 * 1000000, "UniswapV2: K" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ String<12> │ │ │ bool -275 │ -276 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +276 │ +277 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^ ^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ ^^^^^^^^ u256 │ │ │ │ │ │ │ │ │ │ │ u256 │ │ │ │ u256 │ │ │ u256 - │ │ Context - │ UniswapV2Pair + │ │ mut Context + │ mut UniswapV2Pair note: - ┌─ uniswap.fe:276:9 + ┌─ uniswap.fe:277:9 │ -276 │ self._update(ctx, balance0, balance1, reserve0, reserve1) +277 │ self._update(ctx, balance0, balance1, reserve0, reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -277 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) - │ ^^^ ^^^ Context +278 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) + │ ^^^ ^^^ mut Context │ │ - │ Context + │ mut Context -> Context note: - ┌─ uniswap.fe:277:32 + ┌─ uniswap.fe:278:32 │ -277 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) +278 │ emit Swap(ctx, sender: ctx.msg_sender(), amount0_in, amount1_in, amount0_out, amount1_out, to) │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^ address │ │ │ │ │ │ │ │ │ │ │ u256 @@ -2483,44 +2483,44 @@ note: │ address note: - ┌─ uniswap.fe:281:5 + ┌─ uniswap.fe:282:5 │ -281 │ ╭ pub fn skim(self, ctx: Context, to: address) { -282 │ │ let token0: ERC20 = self.token0 // gas savings -283 │ │ let token1: ERC20 = self.token1 // gas savings -284 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) -285 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) -286 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }] -> () +282 │ ╭ pub fn skim(self, ctx: Context, to: address) { +283 │ │ let token0: ERC20 = self.token0 // gas savings +284 │ │ let token1: ERC20 = self.token1 // gas savings +285 │ │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +286 │ │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +287 │ │ } + │ ╰─────^ params: [self, { label: None, name: ctx, typ: Context }, { label: None, name: to, typ: address }] -> () note: - ┌─ uniswap.fe:282:13 + ┌─ uniswap.fe:283:13 │ -282 │ let token0: ERC20 = self.token0 // gas savings +283 │ let token0: ERC20 = self.token0 // gas savings │ ^^^^^^ ERC20 -283 │ let token1: ERC20 = self.token1 // gas savings +284 │ let token1: ERC20 = self.token1 // gas savings │ ^^^^^^ ERC20 note: - ┌─ uniswap.fe:282:29 + ┌─ uniswap.fe:283:29 │ -282 │ let token0: ERC20 = self.token0 // gas savings +283 │ let token0: ERC20 = self.token0 // gas savings │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:282:29 + ┌─ uniswap.fe:283:29 │ -282 │ let token0: ERC20 = self.token0 // gas savings +283 │ let token0: ERC20 = self.token0 // gas savings │ ^^^^^^^^^^^ SPtr -> ERC20 -283 │ let token1: ERC20 = self.token1 // gas savings +284 │ let token1: ERC20 = self.token1 // gas savings │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:283:29 + ┌─ uniswap.fe:284:29 │ -283 │ let token1: ERC20 = self.token1 // gas savings +284 │ let token1: ERC20 = self.token1 // gas savings │ ^^^^^^^^^^^ SPtr -> ERC20 -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context │ │ │ │ │ │ │ ERC20 @@ -2528,37 +2528,37 @@ note: │ ERC20 note: - ┌─ uniswap.fe:284:46 + ┌─ uniswap.fe:285:46 │ -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:284:29 + ┌─ uniswap.fe:285:29 │ -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair │ │ │ u256 note: - ┌─ uniswap.fe:284:68 + ┌─ uniswap.fe:285:68 │ -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ uniswap.fe:284:29 + ┌─ uniswap.fe:285:29 │ -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:284:9 + ┌─ uniswap.fe:285:9 │ -284 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) +285 │ token0.transfer(to, token0.balanceOf(ctx.self_address()) - self.reserve0) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^ ^^ ^^^^^^ ^^^ Context │ │ │ │ │ │ │ ERC20 @@ -2566,805 +2566,805 @@ note: │ ERC20 note: - ┌─ uniswap.fe:285:46 + ┌─ uniswap.fe:286:46 │ -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:285:29 + ┌─ uniswap.fe:286:29 │ -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair │ │ │ u256 note: - ┌─ uniswap.fe:285:68 + ┌─ uniswap.fe:286:68 │ -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ uniswap.fe:285:29 + ┌─ uniswap.fe:286:29 │ -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:285:9 + ┌─ uniswap.fe:286:9 │ -285 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) +286 │ token1.transfer(to, token1.balanceOf(ctx.self_address()) - self.reserve1) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bool note: - ┌─ uniswap.fe:289:5 + ┌─ uniswap.fe:290:5 │ -289 │ ╭ pub fn sync(self, ctx: Context) { -290 │ │ let token0: ERC20 = self.token0 -291 │ │ let token1: ERC20 = self.token1 -292 │ │ self._update(ctx, +290 │ ╭ pub fn sync(self, mut ctx: Context) { +291 │ │ let token0: ERC20 = self.token0 +292 │ │ let token1: ERC20 = self.token1 +293 │ │ self._update(ctx, · │ -296 │ │ reserve1: self.reserve1) -297 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }] -> () +297 │ │ reserve1: self.reserve1) +298 │ │ } + │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: - ┌─ uniswap.fe:290:13 + ┌─ uniswap.fe:291:13 │ -290 │ let token0: ERC20 = self.token0 +291 │ let token0: ERC20 = self.token0 │ ^^^^^^ ERC20 -291 │ let token1: ERC20 = self.token1 +292 │ let token1: ERC20 = self.token1 │ ^^^^^^ ERC20 note: - ┌─ uniswap.fe:290:29 + ┌─ uniswap.fe:291:29 │ -290 │ let token0: ERC20 = self.token0 +291 │ let token0: ERC20 = self.token0 │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:290:29 + ┌─ uniswap.fe:291:29 │ -290 │ let token0: ERC20 = self.token0 +291 │ let token0: ERC20 = self.token0 │ ^^^^^^^^^^^ SPtr -> ERC20 -291 │ let token1: ERC20 = self.token1 +292 │ let token1: ERC20 = self.token1 │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:291:29 + ┌─ uniswap.fe:292:29 │ -291 │ let token1: ERC20 = self.token1 +292 │ let token1: ERC20 = self.token1 │ ^^^^^^^^^^^ SPtr -> ERC20 -292 │ self._update(ctx, - │ ^^^^ ^^^ Context +293 │ self._update(ctx, + │ ^^^^ ^^^ mut Context │ │ │ UniswapV2Pair -293 │ balance0: token0.balanceOf(ctx.self_address()), - │ ^^^^^^ ^^^ Context +294 │ balance0: token0.balanceOf(ctx.self_address()), + │ ^^^^^^ ^^^ mut Context │ │ │ ERC20 note: - ┌─ uniswap.fe:293:49 + ┌─ uniswap.fe:294:49 │ -293 │ balance0: token0.balanceOf(ctx.self_address()), +294 │ balance0: token0.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:293:32 + ┌─ uniswap.fe:294:32 │ -293 │ balance0: token0.balanceOf(ctx.self_address()), +294 │ balance0: token0.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -294 │ balance1: token1.balanceOf(ctx.self_address()), - │ ^^^^^^ ^^^ Context +295 │ balance1: token1.balanceOf(ctx.self_address()), + │ ^^^^^^ ^^^ mut Context │ │ │ ERC20 note: - ┌─ uniswap.fe:294:49 + ┌─ uniswap.fe:295:49 │ -294 │ balance1: token1.balanceOf(ctx.self_address()), +295 │ balance1: token1.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:294:32 + ┌─ uniswap.fe:295:32 │ -294 │ balance1: token1.balanceOf(ctx.self_address()), +295 │ balance1: token1.balanceOf(ctx.self_address()), │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -295 │ reserve0: self.reserve0, +296 │ reserve0: self.reserve0, │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:295:32 + ┌─ uniswap.fe:296:32 │ -295 │ reserve0: self.reserve0, +296 │ reserve0: self.reserve0, │ ^^^^^^^^^^^^^ SPtr -> u256 -296 │ reserve1: self.reserve1) +297 │ reserve1: self.reserve1) │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:296:32 + ┌─ uniswap.fe:297:32 │ -296 │ reserve1: self.reserve1) +297 │ reserve1: self.reserve1) │ ^^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ uniswap.fe:292:9 + ┌─ uniswap.fe:293:9 │ -292 │ ╭ self._update(ctx, -293 │ │ balance0: token0.balanceOf(ctx.self_address()), -294 │ │ balance1: token1.balanceOf(ctx.self_address()), -295 │ │ reserve0: self.reserve0, -296 │ │ reserve1: self.reserve1) +293 │ ╭ self._update(ctx, +294 │ │ balance0: token0.balanceOf(ctx.self_address()), +295 │ │ balance1: token1.balanceOf(ctx.self_address()), +296 │ │ reserve0: self.reserve0, +297 │ │ reserve1: self.reserve1) │ ╰─────────────────────────────────────────────^ () note: - ┌─ uniswap.fe:301:5 + ┌─ uniswap.fe:302:5 │ -301 │ fee_to: address +302 │ fee_to: address │ ^^^^^^^^^^^^^^^ address -302 │ fee_to_setter: address +303 │ fee_to_setter: address │ ^^^^^^^^^^^^^^^^^^^^^^ address -303 │ -304 │ pairs: Map> +304 │ +305 │ pairs: Map> │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Map> -305 │ -306 │ all_pairs: Array +306 │ +307 │ all_pairs: Array │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array -307 │ pair_counter: u256 +308 │ pair_counter: u256 │ ^^^^^^^^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:310:9 + ┌─ uniswap.fe:311:9 │ -310 │ idx token0: address +311 │ idx token0: address │ ^^^^^^^^^^^^^^^^^^^ address -311 │ idx token1: address +312 │ idx token1: address │ ^^^^^^^^^^^^^^^^^^^ address -312 │ pair: address +313 │ pair: address │ ^^^^^^^^^^^^^ address -313 │ index: u256 +314 │ index: u256 │ ^^^^^^^^^^^ u256 note: - ┌─ uniswap.fe:320:5 + ┌─ uniswap.fe:321:5 │ -320 │ ╭ pub fn fee_to(self) -> address { -321 │ │ return self.fee_to -322 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address +321 │ ╭ pub fn fee_to(self) -> address { +322 │ │ return self.fee_to +323 │ │ } + │ ╰─────^ params: [self] -> address note: - ┌─ uniswap.fe:321:16 + ┌─ uniswap.fe:322:16 │ -321 │ return self.fee_to +322 │ return self.fee_to │ ^^^^ UniswapV2Factory note: - ┌─ uniswap.fe:321:16 + ┌─ uniswap.fe:322:16 │ -321 │ return self.fee_to +322 │ return self.fee_to │ ^^^^^^^^^^^ SPtr
-> address note: - ┌─ uniswap.fe:324:5 + ┌─ uniswap.fe:325:5 │ -324 │ ╭ pub fn fee_to_setter(self) -> address { -325 │ │ return self.fee_to_setter -326 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> address +325 │ ╭ pub fn fee_to_setter(self) -> address { +326 │ │ return self.fee_to_setter +327 │ │ } + │ ╰─────^ params: [self] -> address note: - ┌─ uniswap.fe:325:16 + ┌─ uniswap.fe:326:16 │ -325 │ return self.fee_to_setter +326 │ return self.fee_to_setter │ ^^^^ UniswapV2Factory note: - ┌─ uniswap.fe:325:16 + ┌─ uniswap.fe:326:16 │ -325 │ return self.fee_to_setter +326 │ return self.fee_to_setter │ ^^^^^^^^^^^^^^^^^^ SPtr
-> address note: - ┌─ uniswap.fe:328:5 + ┌─ uniswap.fe:329:5 │ -328 │ ╭ pub fn all_pairs_length(self) -> u256 { -329 │ │ return self.pair_counter -330 │ │ } - │ ╰─────^ self: Some(Mutable), params: [] -> u256 +329 │ ╭ pub fn all_pairs_length(self) -> u256 { +330 │ │ return self.pair_counter +331 │ │ } + │ ╰─────^ params: [self] -> u256 note: - ┌─ uniswap.fe:329:16 + ┌─ uniswap.fe:330:16 │ -329 │ return self.pair_counter +330 │ return self.pair_counter │ ^^^^ UniswapV2Factory note: - ┌─ uniswap.fe:329:16 + ┌─ uniswap.fe:330:16 │ -329 │ return self.pair_counter +330 │ return self.pair_counter │ ^^^^^^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ uniswap.fe:332:5 + ┌─ uniswap.fe:333:5 │ -332 │ ╭ pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address { -333 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" -334 │ │ -335 │ │ let token0: address = token_a if token_a < token_b else token_b +333 │ ╭ pub fn create_pair(mut self, mut ctx: Context, _ token_a: address, _ token_b: address) -> address { +334 │ │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +335 │ │ +336 │ │ let token0: address = token_a if token_a < token_b else token_b · │ -350 │ │ return address(pair) -351 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: Some("_"), name: token_a, typ: address }, { label: Some("_"), name: token_b, typ: address }] -> address +351 │ │ return address(pair) +352 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: mut Context }, { label: Some("_"), name: token_a, typ: address }, { label: Some("_"), name: token_b, typ: address }] -> address note: - ┌─ uniswap.fe:335:13 + ┌─ uniswap.fe:336:13 │ -335 │ let token0: address = token_a if token_a < token_b else token_b +336 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^ address -336 │ let token1: address = token_a if token_a > token_b else token_b +337 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^ address · -340 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +341 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^ u256 -341 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +342 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:333:16 + ┌─ uniswap.fe:334:16 │ -333 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +334 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^ ^^^^^^^ address │ │ │ address note: - ┌─ uniswap.fe:333:16 + ┌─ uniswap.fe:334:16 │ -333 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" +334 │ assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String<30> │ │ │ bool -334 │ -335 │ let token0: address = token_a if token_a < token_b else token_b +335 │ +336 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^ address │ │ │ address note: - ┌─ uniswap.fe:335:31 + ┌─ uniswap.fe:336:31 │ -335 │ let token0: address = token_a if token_a < token_b else token_b +336 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ │ │ │ bool │ address note: - ┌─ uniswap.fe:335:31 + ┌─ uniswap.fe:336:31 │ -335 │ let token0: address = token_a if token_a < token_b else token_b +336 │ let token0: address = token_a if token_a < token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address -336 │ let token1: address = token_a if token_a > token_b else token_b +337 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^ address │ │ │ address note: - ┌─ uniswap.fe:336:31 + ┌─ uniswap.fe:337:31 │ -336 │ let token1: address = token_a if token_a > token_b else token_b +337 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^ address │ │ │ │ │ bool │ address note: - ┌─ uniswap.fe:336:31 + ┌─ uniswap.fe:337:31 │ -336 │ let token1: address = token_a if token_a > token_b else token_b +337 │ let token1: address = token_a if token_a > token_b else token_b │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ address -337 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +338 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^ ^ u256 │ │ │ address note: - ┌─ uniswap.fe:337:26 + ┌─ uniswap.fe:338:26 │ -337 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +338 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^ address note: - ┌─ uniswap.fe:337:16 + ┌─ uniswap.fe:338:16 │ -337 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" +338 │ assert token0 != address(0), "UniswapV2: ZERO_ADDRESS" │ ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ String<23> │ │ │ bool -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" - │ ^^^^ UniswapV2Factory +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:339:16 │ -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:339:16 │ -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:339:16 │ -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr
-> address + │ mut SPtr
-> address note: - ┌─ uniswap.fe:338:46 + ┌─ uniswap.fe:339:46 │ -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^ address note: - ┌─ uniswap.fe:338:16 + ┌─ uniswap.fe:339:16 │ -338 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" +339 │ assert self.pairs[token0][token1] == address(0), "UniswapV2: PAIR_EXISTS" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ String<22> │ │ │ bool -339 │ -340 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +340 │ +341 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^ ^^^^^^ address │ │ │ address note: - ┌─ uniswap.fe:340:36 + ┌─ uniswap.fe:341:36 │ -340 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +341 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^ (address, address) note: - ┌─ uniswap.fe:340:36 + ┌─ uniswap.fe:341:36 │ -340 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +341 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Array note: - ┌─ uniswap.fe:340:26 + ┌─ uniswap.fe:341:26 │ -340 │ let salt: u256 = keccak256((token0, token1).abi_encode()) +341 │ let salt: u256 = keccak256((token0, token1).abi_encode()) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ u256 -341 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +342 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^ ^ ^^^^ u256 │ │ │ │ │ u256 - │ Context + │ mut Context note: - ┌─ uniswap.fe:341:35 + ┌─ uniswap.fe:342:35 │ -341 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) +342 │ let pair: UniswapV2Pair = UniswapV2Pair.create2(ctx, 0, salt) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UniswapV2Pair -342 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) +343 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) │ ^^^^ ^^^ ^^^^^^ address │ │ │ - │ │ Context + │ │ mut Context -> Context │ UniswapV2Pair note: - ┌─ uniswap.fe:342:38 + ┌─ uniswap.fe:343:38 │ -342 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) +343 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) │ ^^^^^^^^^^^^^ ^^^^^^ address │ │ │ ERC20 note: - ┌─ uniswap.fe:342:61 + ┌─ uniswap.fe:343:61 │ -342 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) +343 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) │ ^^^^^^^^^^^^^ ERC20 note: - ┌─ uniswap.fe:342:9 + ┌─ uniswap.fe:343:9 │ -342 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) +343 │ pair.initialize(ctx, token0: ERC20(token0), token1: ERC20(token1)) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () -343 │ -344 │ self.pairs[token0][token1] = address(pair) - │ ^^^^ UniswapV2Factory +344 │ +345 │ self.pairs[token0][token1] = address(pair) + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:344:9 + ┌─ uniswap.fe:345:9 │ -344 │ self.pairs[token0][token1] = address(pair) +345 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: - ┌─ uniswap.fe:344:9 + ┌─ uniswap.fe:345:9 │ -344 │ self.pairs[token0][token1] = address(pair) +345 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ uniswap.fe:344:9 + ┌─ uniswap.fe:345:9 │ -344 │ self.pairs[token0][token1] = address(pair) +345 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair │ │ - │ SPtr
+ │ mut SPtr
note: - ┌─ uniswap.fe:344:38 + ┌─ uniswap.fe:345:38 │ -344 │ self.pairs[token0][token1] = address(pair) +345 │ self.pairs[token0][token1] = address(pair) │ ^^^^^^^^^^^^^ address -345 │ self.pairs[token1][token0] = address(pair) - │ ^^^^ UniswapV2Factory +346 │ self.pairs[token1][token0] = address(pair) + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:345:9 + ┌─ uniswap.fe:346:9 │ -345 │ self.pairs[token1][token0] = address(pair) +346 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr>> + │ mut SPtr>> note: - ┌─ uniswap.fe:345:9 + ┌─ uniswap.fe:346:9 │ -345 │ self.pairs[token1][token0] = address(pair) +346 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ uniswap.fe:345:9 + ┌─ uniswap.fe:346:9 │ -345 │ self.pairs[token1][token0] = address(pair) +346 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair │ │ - │ SPtr
+ │ mut SPtr
note: - ┌─ uniswap.fe:345:38 + ┌─ uniswap.fe:346:38 │ -345 │ self.pairs[token1][token0] = address(pair) +346 │ self.pairs[token1][token0] = address(pair) │ ^^^^^^^^^^^^^ address -346 │ self.all_pairs[self.pair_counter] = address(pair) - │ ^^^^ UniswapV2Factory +347 │ self.all_pairs[self.pair_counter] = address(pair) + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:346:9 + ┌─ uniswap.fe:347:9 │ -346 │ self.all_pairs[self.pair_counter] = address(pair) - │ ^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory +347 │ self.all_pairs[self.pair_counter] = address(pair) + │ ^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Factory │ │ - │ SPtr> + │ mut SPtr> note: - ┌─ uniswap.fe:346:24 + ┌─ uniswap.fe:347:24 │ -346 │ self.all_pairs[self.pair_counter] = address(pair) - │ ^^^^^^^^^^^^^^^^^ SPtr -> u256 +347 │ self.all_pairs[self.pair_counter] = address(pair) + │ ^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 note: - ┌─ uniswap.fe:346:9 + ┌─ uniswap.fe:347:9 │ -346 │ self.all_pairs[self.pair_counter] = address(pair) +347 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Pair │ │ - │ SPtr
+ │ mut SPtr
note: - ┌─ uniswap.fe:346:45 + ┌─ uniswap.fe:347:45 │ -346 │ self.all_pairs[self.pair_counter] = address(pair) +347 │ self.all_pairs[self.pair_counter] = address(pair) │ ^^^^^^^^^^^^^ address -347 │ self.pair_counter = self.pair_counter + 1 - │ ^^^^ UniswapV2Factory +348 │ self.pair_counter = self.pair_counter + 1 + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:347:9 + ┌─ uniswap.fe:348:9 │ -347 │ self.pair_counter = self.pair_counter + 1 - │ ^^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory +348 │ self.pair_counter = self.pair_counter + 1 + │ ^^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Factory │ │ - │ SPtr + │ mut SPtr note: - ┌─ uniswap.fe:347:29 + ┌─ uniswap.fe:348:29 │ -347 │ self.pair_counter = self.pair_counter + 1 +348 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^ ^ u256 │ │ - │ SPtr -> u256 + │ mut SPtr -> u256 note: - ┌─ uniswap.fe:347:29 + ┌─ uniswap.fe:348:29 │ -347 │ self.pair_counter = self.pair_counter + 1 +348 │ self.pair_counter = self.pair_counter + 1 │ ^^^^^^^^^^^^^^^^^^^^^ u256 -348 │ -349 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) +349 │ +350 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) │ ^^^ ^^^^^^ ^^^^^^ ^^^^ UniswapV2Pair │ │ │ │ │ │ │ address │ │ address - │ Context + │ mut Context -> Context note: - ┌─ uniswap.fe:349:53 + ┌─ uniswap.fe:350:53 │ -349 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) - │ ^^^^^^^^^^^^^ ^^^^ UniswapV2Factory +350 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) + │ ^^^^^^^^^^^^^ ^^^^ mut UniswapV2Factory │ │ │ address note: - ┌─ uniswap.fe:349:75 + ┌─ uniswap.fe:350:75 │ -349 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) - │ ^^^^^^^^^^^^^^^^^ SPtr -> u256 -350 │ return address(pair) +350 │ emit PairCreated(ctx, token0, token1, pair: address(pair), index: self.pair_counter) + │ ^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr -> u256 +351 │ return address(pair) │ ^^^^ UniswapV2Pair note: - ┌─ uniswap.fe:350:16 + ┌─ uniswap.fe:351:16 │ -350 │ return address(pair) +351 │ return address(pair) │ ^^^^^^^^^^^^^ address note: - ┌─ uniswap.fe:353:5 + ┌─ uniswap.fe:354:5 │ -353 │ ╭ pub fn set_fee_to(self, ctx: Context, fee_to: address) { -354 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" -355 │ │ self.fee_to = fee_to -356 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: fee_to, typ: address }] -> () +354 │ ╭ pub fn set_fee_to(mut self, ctx: Context, fee_to: address) { +355 │ │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +356 │ │ self.fee_to = fee_to +357 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }, { label: None, name: fee_to, typ: address }] -> () note: - ┌─ uniswap.fe:354:16 + ┌─ uniswap.fe:355:16 │ -354 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +355 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context note: - ┌─ uniswap.fe:354:16 + ┌─ uniswap.fe:355:16 │ -354 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" - │ ^^^^^^^^^^^^^^^^ ^^^^ UniswapV2Factory +355 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" + │ ^^^^^^^^^^^^^^^^ ^^^^ mut UniswapV2Factory │ │ │ address note: - ┌─ uniswap.fe:354:36 + ┌─ uniswap.fe:355:36 │ -354 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" - │ ^^^^^^^^^^^^^^^^^^ SPtr
-> address +355 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" + │ ^^^^^^^^^^^^^^^^^^ mut SPtr
-> address note: - ┌─ uniswap.fe:354:16 + ┌─ uniswap.fe:355:16 │ -354 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" +355 │ assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20> │ │ │ bool -355 │ self.fee_to = fee_to - │ ^^^^ UniswapV2Factory +356 │ self.fee_to = fee_to + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:355:9 + ┌─ uniswap.fe:356:9 │ -355 │ self.fee_to = fee_to +356 │ self.fee_to = fee_to │ ^^^^^^^^^^^ ^^^^^^ address │ │ - │ SPtr
+ │ mut SPtr
note: - ┌─ uniswap.fe:358:5 + ┌─ uniswap.fe:359:5 │ -358 │ ╭ pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address) { -359 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" -360 │ │ self.fee_to_setter = fee_to_setter -361 │ │ } - │ ╰─────^ self: Some(Mutable), params: [{ label: None, name: ctx, typ: Context }, { label: None, name: fee_to_setter, typ: address }] -> () +359 │ ╭ pub fn set_fee_to_setter(mut self, ctx: Context, fee_to_setter: address) { +360 │ │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +361 │ │ self.fee_to_setter = fee_to_setter +362 │ │ } + │ ╰─────^ params: [mut self, { label: None, name: ctx, typ: Context }, { label: None, name: fee_to_setter, typ: address }] -> () note: - ┌─ uniswap.fe:359:16 + ┌─ uniswap.fe:360:16 │ -359 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +360 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^ Context note: - ┌─ uniswap.fe:359:16 + ┌─ uniswap.fe:360:16 │ -359 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +360 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address │ │ │ address note: - ┌─ uniswap.fe:359:16 + ┌─ uniswap.fe:360:16 │ -359 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" +360 │ assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ String<20> │ │ │ bool -360 │ self.fee_to_setter = fee_to_setter - │ ^^^^ UniswapV2Factory +361 │ self.fee_to_setter = fee_to_setter + │ ^^^^ mut UniswapV2Factory note: - ┌─ uniswap.fe:360:9 + ┌─ uniswap.fe:361:9 │ -360 │ self.fee_to_setter = fee_to_setter +361 │ self.fee_to_setter = fee_to_setter │ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^ address │ │ - │ SPtr
+ │ mut SPtr
note: - ┌─ uniswap.fe:364:1 + ┌─ uniswap.fe:365:1 │ -364 │ ╭ fn sqrt(_ val: u256) -> u256 { -365 │ │ let z: u256 -366 │ │ if val > 3 { -367 │ │ z = val +365 │ ╭ fn sqrt(_ val: u256) -> u256 { +366 │ │ let mut z: u256 +367 │ │ if val > 3 { +368 │ │ z = val · │ -376 │ │ return z -377 │ │ } - │ ╰─^ self: None, params: [{ label: Some("_"), name: val, typ: u256 }] -> u256 +377 │ │ return z +378 │ │ } + │ ╰─^ params: [{ label: Some("_"), name: val, typ: u256 }] -> u256 note: - ┌─ uniswap.fe:365:9 + ┌─ uniswap.fe:366:13 │ -365 │ let z: u256 - │ ^ u256 +366 │ let mut z: u256 + │ ^ mut u256 · -368 │ let x: u256 = val / 2 + 1 - │ ^ u256 +369 │ let mut x: u256 = val / 2 + 1 + │ ^ mut u256 note: - ┌─ uniswap.fe:366:8 + ┌─ uniswap.fe:367:8 │ -366 │ if val > 3 { +367 │ if val > 3 { │ ^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:366:8 + ┌─ uniswap.fe:367:8 │ -366 │ if val > 3 { +367 │ if val > 3 { │ ^^^^^^^ bool -367 │ z = val +368 │ z = val │ ^ ^^^ u256 │ │ - │ u256 -368 │ let x: u256 = val / 2 + 1 - │ ^^^ ^ u256 - │ │ - │ u256 + │ mut u256 +369 │ let mut x: u256 = val / 2 + 1 + │ ^^^ ^ u256 + │ │ + │ u256 note: - ┌─ uniswap.fe:368:23 + ┌─ uniswap.fe:369:27 │ -368 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^ ^ u256 - │ │ - │ u256 +369 │ let mut x: u256 = val / 2 + 1 + │ ^^^^^^^ ^ u256 + │ │ + │ u256 note: - ┌─ uniswap.fe:368:23 + ┌─ uniswap.fe:369:27 │ -368 │ let x: u256 = val / 2 + 1 - │ ^^^^^^^^^^^ u256 -369 │ while x < z { - │ ^ ^ u256 +369 │ let mut x: u256 = val / 2 + 1 + │ ^^^^^^^^^^^ u256 +370 │ while x < z { + │ ^ ^ mut u256 │ │ - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:369:15 + ┌─ uniswap.fe:370:15 │ -369 │ while x < z { +370 │ while x < z { │ ^^^^^ bool -370 │ z = x - │ ^ ^ u256 +371 │ z = x + │ ^ ^ mut u256 -> u256 │ │ - │ u256 -371 │ x = (val / x + x) / 2 - │ ^ ^^^ ^ u256 + │ mut u256 +372 │ x = (val / x + x) / 2 + │ ^ ^^^ ^ mut u256 │ │ │ │ │ u256 - │ u256 + │ mut u256 note: - ┌─ uniswap.fe:371:18 + ┌─ uniswap.fe:372:18 │ -371 │ x = (val / x + x) / 2 - │ ^^^^^^^ ^ u256 +372 │ x = (val / x + x) / 2 + │ ^^^^^^^ ^ mut u256 │ │ │ u256 note: - ┌─ uniswap.fe:371:17 + ┌─ uniswap.fe:372:17 │ -371 │ x = (val / x + x) / 2 +372 │ x = (val / x + x) / 2 │ ^^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:371:17 + ┌─ uniswap.fe:372:17 │ -371 │ x = (val / x + x) / 2 +372 │ x = (val / x + x) / 2 │ ^^^^^^^^^^^^^^^^^ u256 -372 │ } -373 │ } else if val != 0 { +373 │ } +374 │ } else if val != 0 { │ ^^^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:373:15 + ┌─ uniswap.fe:374:15 │ -373 │ } else if val != 0 { +374 │ } else if val != 0 { │ ^^^^^^^^ bool -374 │ z = 1 +375 │ z = 1 │ ^ ^ u256 │ │ - │ u256 -375 │ } -376 │ return z - │ ^ u256 + │ mut u256 +376 │ } +377 │ return z + │ ^ mut u256 -> u256 note: - ┌─ uniswap.fe:379:1 + ┌─ uniswap.fe:380:1 │ -379 │ ╭ fn min(_ x: u256, _ y: u256) -> u256 { -380 │ │ return x if x < y else y -381 │ │ } - │ ╰─^ self: None, params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 +380 │ ╭ fn min(_ x: u256, _ y: u256) -> u256 { +381 │ │ return x if x < y else y +382 │ │ } + │ ╰─^ params: [{ label: Some("_"), name: x, typ: u256 }, { label: Some("_"), name: y, typ: u256 }] -> u256 note: - ┌─ uniswap.fe:380:17 + ┌─ uniswap.fe:381:17 │ -380 │ return x if x < y else y +381 │ return x if x < y else y │ ^ ^ u256 │ │ │ u256 note: - ┌─ uniswap.fe:380:12 + ┌─ uniswap.fe:381:12 │ -380 │ return x if x < y else y +381 │ return x if x < y else y │ ^ ^^^^^ ^ u256 │ │ │ │ │ bool │ u256 note: - ┌─ uniswap.fe:380:12 + ┌─ uniswap.fe:381:12 │ -380 │ return x if x < y else y +381 │ return x if x < y else y │ ^^^^^^^^^^^^^^^^^ u256 diff --git a/crates/analyzer/tests/snapshots/analysis__while_loop.snap b/crates/analyzer/tests/snapshots/analysis__while_loop.snap index 035890d518..7cfb4dcaa2 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop.snap @@ -7,29 +7,29 @@ note: ┌─ while_loop.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let val: u256 = 0 + 3 │ │ let mut val: u256 = 0 4 │ │ while val < 2 { 5 │ │ val = val + 1 · │ 10 │ │ return val 11 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ while_loop.fe:3:13 + ┌─ while_loop.fe:3:17 │ -3 │ let val: u256 = 0 - │ ^^^ u256 +3 │ let mut val: u256 = 0 + │ ^^^ mut u256 note: - ┌─ while_loop.fe:3:25 + ┌─ while_loop.fe:3:29 │ -3 │ let val: u256 = 0 - │ ^ u256 +3 │ let mut val: u256 = 0 + │ ^ u256 4 │ while val < 2 { │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop.fe:4:15 @@ -39,8 +39,8 @@ note: 5 │ val = val + 1 │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ while_loop.fe:5:19 @@ -50,7 +50,7 @@ note: 6 │ if val == 2 { │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop.fe:6:16 @@ -60,9 +60,9 @@ note: 7 │ val = 3 │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 · 10 │ return val - │ ^^^ u256 + │ ^^^ mut u256 -> u256 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 3cef3f7912..ec34df05bc 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop_with_break.snap @@ -7,29 +7,29 @@ note: ┌─ while_loop_with_break.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { -3 │ │ let val: u256 = 0 +3 │ │ let mut val: u256 = 0 4 │ │ while val < 2 { 5 │ │ val = val + 1 · │ 8 │ │ return val 9 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ while_loop_with_break.fe:3:13 + ┌─ while_loop_with_break.fe:3:17 │ -3 │ let val: u256 = 0 - │ ^^^ u256 +3 │ let mut val: u256 = 0 + │ ^^^ mut u256 note: - ┌─ while_loop_with_break.fe:3:25 + ┌─ while_loop_with_break.fe:3:29 │ -3 │ let val: u256 = 0 - │ ^ u256 +3 │ let mut val: u256 = 0 + │ ^ u256 4 │ while val < 2 { │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop_with_break.fe:4:15 @@ -39,8 +39,8 @@ note: 5 │ val = val + 1 │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ while_loop_with_break.fe:5:19 @@ -49,6 +49,6 @@ note: │ ^^^^^^^ u256 · 8 │ return val - │ ^^^ u256 + │ ^^^ mut u256 -> u256 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 205b8d8470..0fb65d6df0 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 @@ -7,29 +7,29 @@ note: ┌─ while_loop_with_break_2.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let val: u256 = 0 + 3 │ │ let mut val: u256 = 0 4 │ │ while val < 2 { 5 │ │ val = val + 1 · │ 10 │ │ return val 11 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ while_loop_with_break_2.fe:3:13 + ┌─ while_loop_with_break_2.fe:3:17 │ -3 │ let val: u256 = 0 - │ ^^^ u256 +3 │ let mut val: u256 = 0 + │ ^^^ mut u256 note: - ┌─ while_loop_with_break_2.fe:3:25 + ┌─ while_loop_with_break_2.fe:3:29 │ -3 │ let val: u256 = 0 - │ ^ u256 +3 │ let mut val: u256 = 0 + │ ^ u256 4 │ while val < 2 { │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop_with_break_2.fe:4:15 @@ -39,8 +39,8 @@ note: 5 │ val = val + 1 │ ^^^ ^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ while_loop_with_break_2.fe:5:19 @@ -50,7 +50,7 @@ note: 6 │ if val == 1 { │ ^^^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop_with_break_2.fe:6:16 @@ -59,6 +59,6 @@ note: │ ^^^^^^^^ bool · 10 │ return val - │ ^^^ u256 + │ ^^^ mut u256 -> u256 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 f2515968a5..b477770835 100644 --- a/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap +++ b/crates/analyzer/tests/snapshots/analysis__while_loop_with_continue.snap @@ -7,33 +7,33 @@ note: ┌─ while_loop_with_continue.fe:2:5 │ 2 │ ╭ pub fn bar() -> u256 { - 3 │ │ let i: u256 = 0 - 4 │ │ let counter: u256 = 0 + 3 │ │ let mut i: u256 = 0 + 4 │ │ let mut counter: u256 = 0 5 │ │ while i < 2 { · │ 12 │ │ return counter 13 │ │ } - │ ╰─────^ self: None, params: [] -> u256 + │ ╰─────^ params: [] -> u256 note: - ┌─ while_loop_with_continue.fe:3:13 + ┌─ while_loop_with_continue.fe:3:17 │ -3 │ let i: u256 = 0 - │ ^ u256 -4 │ let counter: u256 = 0 - │ ^^^^^^^ u256 +3 │ let mut i: u256 = 0 + │ ^ mut u256 +4 │ let mut counter: u256 = 0 + │ ^^^^^^^ mut u256 note: - ┌─ while_loop_with_continue.fe:3:23 + ┌─ while_loop_with_continue.fe:3:27 │ -3 │ let i: u256 = 0 - │ ^ u256 -4 │ let counter: u256 = 0 - │ ^ u256 +3 │ let mut i: u256 = 0 + │ ^ u256 +4 │ let mut counter: u256 = 0 + │ ^ u256 5 │ while i < 2 { │ ^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop_with_continue.fe:5:15 @@ -43,8 +43,8 @@ note: 6 │ i = i + 1 │ ^ ^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ while_loop_with_continue.fe:6:17 @@ -54,7 +54,7 @@ note: 7 │ if i == 1 { │ ^ ^ u256 │ │ - │ u256 + │ mut u256 note: ┌─ while_loop_with_continue.fe:7:16 @@ -65,8 +65,8 @@ note: 10 │ counter = counter + 1 │ ^^^^^^^ ^^^^^^^ ^ u256 │ │ │ - │ │ u256 - │ u256 + │ │ mut u256 + │ mut u256 note: ┌─ while_loop_with_continue.fe:10:23 @@ -75,6 +75,6 @@ note: │ ^^^^^^^^^^^ u256 11 │ } 12 │ return counter - │ ^^^^^^^ u256 + │ ^^^^^^^ mut u256 -> u256 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 58d23c3470..d760649f15 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 @@ -6,7 +6,7 @@ expression: "error_string(&path, test_files::fixture(path))" error: the function `do_private_thingz` on `type Foo` is private ┌─ compile_errors/call_non_pub_fn_on_external_contract.fe:11:25 │ - 4 │ fn do_private_thingz(self) { + 4 │ fn do_private_thingz(mut self) { │ ----------------- `do_private_thingz` is defined here · 11 │ Foo(address(0)).do_private_thingz() diff --git a/crates/analyzer/tests/snapshots/errors__clone_arg_count.snap b/crates/analyzer/tests/snapshots/errors__clone_arg_count.snap index a2ed4a710a..965a24ecda 100644 --- a/crates/analyzer/tests/snapshots/errors__clone_arg_count.snap +++ b/crates/analyzer/tests/snapshots/errors__clone_arg_count.snap @@ -3,12 +3,10 @@ source: crates/analyzer/tests/errors.rs expression: "error_string(\"[snippet]\", &src)" --- -error: `clone` expects 0 arguments, but 1 was provided +error: No function `clone` exists on type `Array` ┌─ [snippet]:4:29 │ 4 │ let y: Array = x.clone(y) - │ ^^^^^ - supplied 1 argument - │ │ - │ expects 0 arguments + │ ^^^^^ undefined function diff --git a/crates/analyzer/tests/snapshots/errors__const_assign.snap b/crates/analyzer/tests/snapshots/errors__const_assign.snap index bb7d1cf627..ab073362df 100644 --- a/crates/analyzer/tests/snapshots/errors__const_assign.snap +++ b/crates/analyzer/tests/snapshots/errors__const_assign.snap @@ -11,7 +11,7 @@ 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 +error: cannot assign to a constant value ┌─ compile_errors/const_assign.fe:10:9 │ 10 │ LOCAL = 1 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 9a1fcedb45..def912ca49 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 @@ -7,7 +7,7 @@ error: incorrect type for argument to `Barn.create` ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:11:46 │ 11 │ let created_barn: Barn = Barn.create(address(26), 0) - │ ^^^^^^^^^^^ this has type `address`; expected `Context` + │ ^^^^^^^^^^^ this has type `address`; expected `mut Context` error: missing argument label ┌─ compile_errors/ctx_builtins_param_incorrect_type.fe:12:27 diff --git a/crates/analyzer/tests/snapshots/errors__ctx_missing_create.snap b/crates/analyzer/tests/snapshots/errors__ctx_missing_create.snap index fdb8e06a8d..08e0e72eb4 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_missing_create.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_missing_create.snap @@ -15,6 +15,6 @@ error: incorrect type for argument to `Foo.create` ┌─ compile_errors/ctx_missing_create.fe:7:20 │ 7 │ Foo.create(0) - │ ^ this has type `u256`; expected `Context` + │ ^ this has type `u256`; expected `mut Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap index 33c929dd03..458b514494 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create.snap @@ -15,6 +15,6 @@ error: incorrect type for argument to `Bar.create` ┌─ compile_errors/ctx_undefined_create.fe:5:20 │ 5 │ Bar.create(0) - │ ^ this has type `u256`; expected `Context` + │ ^ this has type `u256`; expected `mut Context` diff --git a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap index 3f5cfa0812..b5f8851581 100644 --- a/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap +++ b/crates/analyzer/tests/snapshots/errors__ctx_undefined_create2.snap @@ -15,6 +15,6 @@ error: incorrect type for argument to `Bar.create2` ┌─ compile_errors/ctx_undefined_create2.fe:5:21 │ 5 │ Bar.create2(0, 0) - │ ^ this has type `u256`; expected `Context` + │ ^ this has type `u256`; expected `mut Context` 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 619eb50138..9f9e77a65c 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 @@ -4,12 +4,12 @@ expression: "error_string(&path, test_files::fixture(path))" --- error: duplicate definition of variable `sum` - ┌─ compile_errors/duplicate_var_in_child_scope.fe:4:13 + ┌─ compile_errors/duplicate_var_in_child_scope.fe:4:17 │ -4 │ let sum: u256 = 0 - │ ^^^ `sum` first defined here +4 │ let mut sum: u256 = 0 + │ ^^^ `sum` first defined here 5 │ for i in my_array { -6 │ let sum: u64 = 0 - │ --- `sum` redefined here +6 │ let mut sum: u64 = 0 + │ --- `sum` redefined here diff --git a/crates/analyzer/tests/snapshots/errors__missing_return.snap b/crates/analyzer/tests/snapshots/errors__missing_return.snap index 2870b741e5..fc685d65ea 100644 --- a/crates/analyzer/tests/snapshots/errors__missing_return.snap +++ b/crates/analyzer/tests/snapshots/errors__missing_return.snap @@ -6,9 +6,9 @@ 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 { - │ ^^^ ---- expected function to return `u256` - │ │ +4 │ pub fn bar(mut self) -> u256 { + │ ^^^ ---- expected function to return `u256` + │ │ │ all paths of this function must `return` or `revert` diff --git a/crates/mir/src/lower/function.rs b/crates/mir/src/lower/function.rs index 07848dbb58..d1bd745550 100644 --- a/crates/mir/src/lower/function.rs +++ b/crates/mir/src/lower/function.rs @@ -731,6 +731,10 @@ impl<'db, 'a> BodyLowerHelper<'db, 'a> { for into_ty in &self.analyzer_body.expressions[&expr.id].type_coercion_chain { let into_ty = self.lower_analyzer_type(*into_ty); + if expr_ty == into_ty { + // meaningless mut unwrap + continue; + } let tmp = self.map_to_tmp(inst, expr_ty); if expr_ty.is_ptr(self.db) && !into_ty.is_ptr(self.db) { @@ -907,7 +911,7 @@ impl<'db, 'a> BodyLowerHelper<'db, 'a> { AnalyzerCallType::BuiltinValueMethod { method, .. } => { let arg = self.lower_method_receiver(func); match method { - ValueMethod::ToMem | ValueMethod::Clone => self.builder.mem_copy(arg, source), + ValueMethod::ToMem => self.builder.mem_copy(arg, source), ValueMethod::AbiEncode => self.builder.abi_encode(arg, source), } } 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 7c5eabd1ca..dce8493e8b 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 @@ -25,7 +25,7 @@ contract Main { my_func() } - pub fn priv_contract(ctx: Context, addr: address) { + pub fn priv_contract(mut ctx: Context, addr: address) { let _: MyContract = MyContract(addr) MyContract.create(ctx, 1) } 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 853e8a23b6..1aeeae6744 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,7 +1,7 @@ contract Bar {} contract Foo { - pub fn foo(ctx: Context) { + pub fn foo(mut 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 d16bc53398..286470999d 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,7 +1,7 @@ contract Bar {} contract Foo { - pub fn foo(ctx: Context) { + pub fn foo(mut ctx: Context) { Bar.create(ctx, true) Bar.create(ctx) // agroce //447 } 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 de7b8a15e5..99b5e2f384 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 @@ -4,7 +4,7 @@ contract Foo { idx val_2: u8 } - pub fn foo(ctx: Context) { + pub fn foo(mut 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 8f223efe83..ad0161cf6d 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,7 +1,7 @@ contract Foo { val: u8 - fn do_private_thingz(self) { + fn do_private_thingz(mut self) { self.val = 100 } } 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 8aadde5815..723d7b91a1 100644 --- a/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe +++ b/crates/test-files/fixtures/compile_errors/circular_dependency_create.fe @@ -1,5 +1,5 @@ contract Foo { - pub fn bar(ctx: Context) -> address { + pub fn bar(mut ctx: Context) -> address { let foo: Foo = Foo.create(ctx, 0) 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 9fa121d1b0..9c2cab821a 100644 --- a/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe +++ b/crates/test-files/fixtures/compile_errors/circular_dependency_create2.fe @@ -1,5 +1,5 @@ contract Foo { - pub fn bar(ctx: Context) -> address { + pub fn bar(mut ctx: Context) -> address { let foo: Foo = Foo.create2(ctx, 2, 0) return address(foo) } 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 2a0c5b54af..8ac65d1506 100644 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe +++ b/crates/test-files/fixtures/compile_errors/ctx_missing_create.fe @@ -6,4 +6,7 @@ contract Bar { pub fn create_foo(ctx: Context) { Foo.create(0) } + pub fn create_foo2(mut ctx: Context) { + Foo.create(ctx, 0) + } } 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 e729112a1f..724595729a 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 @@ -5,7 +5,7 @@ contract Foo { return ctx.block_number() } - pub fn baz(self, ctx: Context) { + pub fn baz(mut 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 deleted file mode 100644 index 16f7edbdea..0000000000 --- a/crates/test-files/fixtures/compile_errors/ctx_missing_load.fe +++ /dev/null @@ -1,9 +0,0 @@ -contract Foo { - pub fn bar() {} -} - -contract Bar { - pub fn create_foo(ctx: Context) { - Foo(0) - } -} 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 1cb4c016be..2287c6ec68 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,9 +1,9 @@ contract Foo { pub fn bar() { let my_array: Array = [u64(0); 3] - let sum: u256 = 0 + let mut sum: u256 = 0 for i in my_array { - let sum: u64 = 0 + let mut sum: u64 = 0 sum += i } } 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 773f2b8c09..156cac6f67 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 @@ -2,7 +2,7 @@ contract C { fn f() { let x: u256 = 10 let xs: Array = [1, 2, 3, 4] - let sum: u8 = 0 + let mut sum: u8 = 0 for x in xs { sum += x } diff --git a/crates/test-files/fixtures/compile_errors/missing_return.fe b/crates/test-files/fixtures/compile_errors/missing_return.fe index 6d802629f3..882f8bb1cb 100644 --- a/crates/test-files/fixtures/compile_errors/missing_return.fe +++ b/crates/test-files/fixtures/compile_errors/missing_return.fe @@ -1,7 +1,7 @@ contract Foo { baz: Map - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.baz[0] = 1 } } 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 73249cc30f..b749a5f2fd 100644 --- a/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe +++ b/crates/test-files/fixtures/compile_errors/needs_mem_copy.fe @@ -1,7 +1,7 @@ contract Foo { my_sto_array: Array - pub fn bar(self, my_array: Array) { + pub fn bar(self, mut my_array: Array) { my_array = self.my_sto_array let x: Array = self.my_sto_array } 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 db4d77afa4..dd53c85230 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,6 +1,6 @@ contract Foo { pub fn bar() -> u256 { - let i: u256 = 0 + let mut i: u256 = 0 while i < 1 { i = 1 let y: u256 = 1 diff --git a/crates/test-files/fixtures/compile_errors/self_misuse.fe b/crates/test-files/fixtures/compile_errors/self_misuse.fe index 816281fd83..6ef54f5215 100644 --- a/crates/test-files/fixtures/compile_errors/self_misuse.fe +++ b/crates/test-files/fixtures/compile_errors/self_misuse.fe @@ -3,7 +3,7 @@ fn foo() { self = 5 } -fn change_x(_ s: S) { +fn change_x(mut _ s: S) { s.x = 100 } @@ -16,11 +16,11 @@ struct S { self() } - fn g(self) { + fn g(mut self) { self = S(x: 10) } - fn h(self) { + fn h(mut self) { change_x(self) } } diff --git a/crates/test-files/fixtures/demos/erc20_token.fe b/crates/test-files/fixtures/demos/erc20_token.fe index 77edcb1a3d..56587d0958 100644 --- a/crates/test-files/fixtures/demos/erc20_token.fe +++ b/crates/test-files/fixtures/demos/erc20_token.fe @@ -18,7 +18,7 @@ contract ERC20 { value: u256 } - pub fn __init__(self, ctx: Context, name: String<100>, symbol: String<100>) { + pub fn __init__(mut self, mut ctx: Context, name: String<100>, symbol: String<100>) { self._name = name self._symbol = symbol self._decimals = u8(18) @@ -45,7 +45,7 @@ contract ERC20 { return self._balances[account] } - pub fn transfer(self, ctx: Context, recipient: address, value: u256) -> bool { + pub fn transfer(mut self, mut ctx: Context, recipient: address, value: u256) -> bool { self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) return true } @@ -54,29 +54,29 @@ contract ERC20 { return self._allowances[owner][spender] } - pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { + pub fn approve(mut self, mut 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 { + pub fn transferFrom(mut self, mut 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 { + pub fn increaseAllowance(mut self, mut 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 { + pub fn decreaseAllowance(mut self, mut 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) { + fn _transfer(mut self, mut ctx: Context, sender: address, recipient: address, value: u256) { assert sender != address(0) assert recipient != address(0) _before_token_transfer(from: sender, to: recipient, value) @@ -85,7 +85,7 @@ contract ERC20 { emit Transfer(ctx, from: sender, to: recipient, value) } - fn _mint(self, ctx: Context, account: address, value: u256) { + fn _mint(mut self, mut 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 @@ -93,7 +93,7 @@ contract ERC20 { emit Transfer(ctx, from: address(0), to: account, value) } - fn _burn(self, ctx: Context, account: address, value: u256) { + fn _burn(mut self, mut 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 @@ -101,14 +101,14 @@ contract ERC20 { emit Transfer(ctx, from: account, to: address(0), value) } - fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { + fn _approve(mut self, mut 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) { + fn _setup_decimals(mut self, _ decimals_: u8) { self._decimals = decimals_ } diff --git a/crates/test-files/fixtures/demos/guest_book.fe b/crates/test-files/fixtures/demos/guest_book.fe index 99161de0f3..736959a508 100644 --- a/crates/test-files/fixtures/demos/guest_book.fe +++ b/crates/test-files/fixtures/demos/guest_book.fe @@ -11,7 +11,7 @@ contract GuestBook { // Context is a struct provided by the standard library // that gives access to various features of the EVM - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { // All storage access is explicit using `self.` self.messages[ctx.msg_sender()] = book_msg diff --git a/crates/test-files/fixtures/demos/simple_open_auction.fe b/crates/test-files/fixtures/demos/simple_open_auction.fe index 643f695f0d..d6011a69c1 100644 --- a/crates/test-files/fixtures/demos/simple_open_auction.fe +++ b/crates/test-files/fixtures/demos/simple_open_auction.fe @@ -31,13 +31,13 @@ contract SimpleOpenAuction { } // constructor - pub fn __init__(self, ctx: Context, bidding_time: u256, beneficiary_addr: address) { + pub fn __init__(mut 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) { + pub fn bid(mut self, mut ctx: Context) { if ctx.block_timestamp() > self.auction_end_time { revert AuctionAlreadyEnded() } @@ -53,7 +53,7 @@ contract SimpleOpenAuction { emit HighestBidIncreased(ctx, bidder: ctx.msg_sender(), amount: ctx.msg_value()) } - pub fn withdraw(self, ctx: Context) -> bool { + pub fn withdraw(mut self, ctx: Context) -> bool { let amount: u256 = self.pending_returns[ctx.msg_sender()] if amount > 0 { @@ -63,7 +63,7 @@ contract SimpleOpenAuction { return true } - pub fn action_end(self, ctx: Context) { + pub fn action_end(mut self, mut ctx: Context) { if ctx.block_timestamp() <= self.auction_end_time { revert AuctionNotYetEnded() } diff --git a/crates/test-files/fixtures/demos/uniswap.fe b/crates/test-files/fixtures/demos/uniswap.fe index 4519c9b0b4..52afaeb3db 100644 --- a/crates/test-files/fixtures/demos/uniswap.fe +++ b/crates/test-files/fixtures/demos/uniswap.fe @@ -69,7 +69,7 @@ contract UniswapV2Pair { reserve1: u256 } - pub fn __init__(self, ctx: Context) { + pub fn __init__(mut self, ctx: Context) { self.factory = ctx.msg_sender() } @@ -85,40 +85,40 @@ contract UniswapV2Pair { return address(self.token1) } - fn _mint(self, ctx: Context, to: address, value: u256) { + fn _mint(mut self, mut ctx: Context, to: address, value: u256) { self.total_supply = self.total_supply + value self.balances[to] = self.balances[to] + value emit Transfer(ctx, from: address(0), to, value) } - fn _burn(self, ctx: Context, from: address, value: u256) { + fn _burn(mut self, mut ctx: Context, from: address, value: u256) { self.balances[from] = self.balances[from] - value self.total_supply = self.total_supply - value emit Transfer(ctx, from, to: address(0), value) } - fn _approve(self, ctx: Context, owner: address, spender: address, value: u256) { + fn _approve(mut self, mut 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) { + fn _transfer(mut self, mut ctx: Context, from: address, to: address, value: u256) { self.balances[from] = self.balances[from] - value self.balances[to] = self.balances[to] + value emit Transfer(ctx, from, to, value) } - pub fn approve(self, ctx: Context, spender: address, value: u256) -> bool { + pub fn approve(mut self, mut ctx: Context, spender: address, value: u256) -> bool { self._approve(ctx, owner: ctx.msg_sender(), spender, value) return true } - pub fn transfer(self, ctx: Context, to: address, value: u256) -> bool { + pub fn transfer(mut self, mut ctx: Context, to: address, value: u256) -> bool { self._transfer(ctx, from: ctx.msg_sender(), to, value) return true } - pub fn transferFrom(self, ctx: Context, from: address, to: address, value: u256) -> bool { + pub fn transferFrom(mut self, mut ctx: Context, from: address, to: address, value: u256) -> bool { assert self.allowances[from][ctx.msg_sender()] >= value self.allowances[from][ctx.msg_sender()] = self.allowances[from][ctx.msg_sender()] - value self._transfer(ctx, from, to, value) @@ -134,14 +134,14 @@ contract UniswapV2Pair { } // called once by the factory at time of deployment - pub fn initialize(self, ctx: Context, token0: ERC20, token1: ERC20) { + pub fn initialize(mut self, ctx: Context, token0: ERC20, token1: ERC20) { assert ctx.msg_sender() == self.factory, "UniswapV2: FORBIDDEN" self.token0 = token0 self.token1 = token1 } // update reserves and, on the first call per block, price accumulators - fn _update(self, ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { + fn _update(mut self, mut ctx: Context, balance0: u256, balance1: u256, reserve0: u256, reserve1: u256) { // changed from u32s // TODO: reproduce desired overflow (https://github.com/ethereum/fe/issues/286) let block_timestamp: u256 = ctx.block_timestamp() % 2 ** 32 @@ -156,7 +156,8 @@ contract UniswapV2Pair { emit Sync(ctx, reserve0: self.reserve0, reserve1: self.reserve1) } - fn _mint_fee(self, ctx: Context, reserve0: u256, reserve1: u256) -> bool { + // XXX expect `mut` error for ctx here + fn _mint_fee(mut self, mut ctx: Context, reserve0: u256, reserve1: u256) -> bool { let fee_to: address = UniswapV2Factory(self.factory).fee_to() let fee_on: bool = fee_to != address(0) let k_last: u256 = self.k_last @@ -180,7 +181,7 @@ contract UniswapV2Pair { } // this low-level function should be called from a contract which performs important safety checks - pub fn mint(self, ctx: Context, to: address) -> u256 { + pub fn mint(mut self, mut ctx: Context, to: address) -> u256 { let MINIMUM_LIQUIDITY: u256 = 1000 let reserve0: u256 = self.reserve0 let reserve1: u256 = self.reserve1 @@ -190,7 +191,7 @@ contract UniswapV2Pair { 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 + let mut liquidity: u256 = 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 @@ -208,13 +209,13 @@ contract UniswapV2Pair { } // this low-level function should be called from a contract which performs important safety checks - pub fn burn(self, ctx: Context, to: address) -> (u256, u256) { + pub fn burn(mut self, mut ctx: Context, to: address) -> (u256, u256) { let reserve0: u256 = self.reserve0 let reserve1: u256 = self.reserve1 let token0: ERC20 = self.token0 let token1: ERC20 = self.token1 - let balance0: u256 = token0.balanceOf(ctx.self_address()) - let balance1: u256 = token1.balanceOf(ctx.self_address()) + let mut balance0: u256 = token0.balanceOf(ctx.self_address()) + let mut balance1: u256 = token1.balanceOf(ctx.self_address()) let liquidity: u256 = self.balances[ctx.self_address()] let fee_on: bool = self._mint_fee(ctx, reserve0, reserve1) @@ -238,7 +239,7 @@ contract UniswapV2Pair { // this low-level function should be called from a contract which performs important safety checks // TODO: add support for the bytes type (https://github.com/ethereum/fe/issues/280) // pub fn swap(amount0_out: u256, amount1_out: u256, to: address, data: bytes): - pub fn swap(self, ctx: Context, amount0_out: u256, amount1_out: u256, to: address) { + pub fn swap(mut self, mut ctx: Context, amount0_out: u256, amount1_out: u256, to: address) { assert amount0_out > 0 or amount1_out > 0, "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" let reserve0: u256 = self.reserve0 let reserve1: u256 = self.reserve1 @@ -286,7 +287,7 @@ contract UniswapV2Pair { } // force reserves to match balances - pub fn sync(self, ctx: Context) { + pub fn sync(self, mut ctx: Context) { let token0: ERC20 = self.token0 let token1: ERC20 = self.token1 self._update(ctx, @@ -313,7 +314,7 @@ contract UniswapV2Factory { index: u256 } - pub fn __init__(self, _ fee_to_setter: address) { + pub fn __init__(mut self, _ fee_to_setter: address) { self.fee_to_setter = fee_to_setter } @@ -329,7 +330,7 @@ contract UniswapV2Factory { return self.pair_counter } - pub fn create_pair(self, ctx: Context, _ token_a: address, _ token_b: address) -> address { + pub fn create_pair(mut self, mut ctx: Context, _ token_a: address, _ token_b: address) -> address { assert token_a != token_b, "UniswapV2: IDENTICAL_ADDRESSES" let token0: address = token_a if token_a < token_b else token_b @@ -350,22 +351,22 @@ contract UniswapV2Factory { return address(pair) } - pub fn set_fee_to(self, ctx: Context, fee_to: address) { + pub fn set_fee_to(mut self, ctx: Context, fee_to: address) { assert ctx.msg_sender() == self.fee_to_setter, "UniswapV2: FORBIDDEN" self.fee_to = fee_to } - pub fn set_fee_to_setter(self, ctx: Context, fee_to_setter: address) { + pub fn set_fee_to_setter(mut self, ctx: Context, fee_to_setter: address) { assert ctx.msg_sender() == fee_to_setter, "UniswapV2: FORBIDDEN" self.fee_to_setter = fee_to_setter } } fn sqrt(_ val: u256) -> u256 { - let z: u256 + let mut z: u256 if val > 3 { z = val - let x: u256 = val / 2 + 1 + let mut x: u256 = val / 2 + 1 while x < z { z = x x = (val / x + x) / 2 diff --git a/crates/test-files/fixtures/features/address_bytes10_map.fe b/crates/test-files/fixtures/features/address_bytes10_map.fe index 6f85dd3f1a..b008731a5c 100644 --- a/crates/test-files/fixtures/features/address_bytes10_map.fe +++ b/crates/test-files/fixtures/features/address_bytes10_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key].to_mem() } - pub fn write_bar(self, key: address, value: Array) { + pub fn write_bar(mut self, key: address, value: Array) { self.bar[key] = value } } diff --git a/crates/test-files/fixtures/features/array_repeat.fe b/crates/test-files/fixtures/features/array_repeat.fe index f7c45d7559..0ff87ec8dd 100644 --- a/crates/test-files/fixtures/features/array_repeat.fe +++ b/crates/test-files/fixtures/features/array_repeat.fe @@ -1,12 +1,12 @@ contract Foo { pub fn foo() -> Array { - let my_array: Array = [8; 4] + let mut my_array: Array = [8; 4] my_array[1] = 42 return my_array } pub fn bar() { - let my_array: Array<(u256, u256), 2> = [(1, 0); 2] + let mut my_array: Array<(u256, u256), 2> = [(1, 0); 2] my_array[0].item0 = 4 assert my_array[0].item0 == 4 assert my_array[1].item0 == 1 diff --git a/crates/test-files/fixtures/features/assert.fe b/crates/test-files/fixtures/features/assert.fe index 96d2413f44..ff83d1a223 100644 --- a/crates/test-files/fixtures/features/assert.fe +++ b/crates/test-files/fixtures/features/assert.fe @@ -14,12 +14,12 @@ contract Foo { assert baz > 5, reason } - pub fn assert_sto_bool(self) { + pub fn assert_sto_bool(mut self) { self.my_bool = false assert self.my_bool } - pub fn assert_sto_string_msg(self) { + pub fn assert_sto_string_msg(mut 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 d708b684ff..6218813343 100644 --- a/crates/test-files/fixtures/features/associated_fns.fe +++ b/crates/test-files/fixtures/features/associated_fns.fe @@ -15,7 +15,7 @@ struct MyStruct { contract Foo { my_struct: MyStruct - pub fn bar(self, val: u256) -> u256 { + pub fn bar(mut 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 e0b728d672..4189346140 100644 --- a/crates/test-files/fixtures/features/aug_assign.fe +++ b/crates/test-files/fixtures/features/aug_assign.fe @@ -1,69 +1,69 @@ contract Foo { my_num: u256 - pub fn add(a: u256, b: u256) -> u256 { + pub fn add(mut a: u256, b: u256) -> u256 { a += b return a } - pub fn sub(a: u256, b: u256) -> u256 { + pub fn sub(mut a: u256, b: u256) -> u256 { a -= b return a } - pub fn mul(a: u256, b: u256) -> u256 { + pub fn mul(mut a: u256, b: u256) -> u256 { a *= b return a } - pub fn div(a: u256, b: u256) -> u256 { + pub fn div(mut a: u256, b: u256) -> u256 { a /= b return a } - pub fn mod(a: u256, b: u256) -> u256 { + pub fn mod(mut a: u256, b: u256) -> u256 { a %= b return a } - pub fn pow(a: u256, b: u256) -> u256 { + pub fn pow(mut a: u256, b: u256) -> u256 { a **= b return a } - pub fn lshift(a: u8, b: u8) -> u8 { + pub fn lshift(mut a: u8, b: u8) -> u8 { a <<= b return a } - pub fn rshift(a: u8, b: u8) -> u8 { + pub fn rshift(mut a: u8, b: u8) -> u8 { a >>= b return a } - pub fn bit_or(a: u8, b: u8) -> u8 { + pub fn bit_or(mut a: u8, b: u8) -> u8 { a |= b return a } - pub fn bit_xor(a: u8, b: u8) -> u8 { + pub fn bit_xor(mut a: u8, b: u8) -> u8 { a ^= b return a } - pub fn bit_and(a: u8, b: u8) -> u8 { + pub fn bit_and(mut 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(mut 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 { - let my_array: Array = [0; 10] + let mut my_array: Array = [0; 10] my_array[7] = a my_array[7] += b return my_array[7] 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 5312046273..42f490e2b2 100644 --- a/crates/test-files/fixtures/features/call_statement_with_args.fe +++ b/crates/test-files/fixtures/features/call_statement_with_args.fe @@ -1,11 +1,11 @@ contract Foo { baz: Map - fn assign(self, _ val: u256) { + fn assign(mut self, _ val: u256) { self.baz[0] = val } - pub fn bar(self) -> u256 { + pub fn bar(mut 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 fb7facc533..b56ab73b68 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,12 +1,12 @@ contract Foo { baz: Map - fn assign(self, _ val: u256) -> u256 { + fn assign(mut self, _ val: u256) -> u256 { self.baz[0] = val return val } - pub fn bar(self) -> u256 { + pub fn bar(mut 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 eade30b6e8..9e4a6b1e27 100644 --- a/crates/test-files/fixtures/features/call_statement_without_args.fe +++ b/crates/test-files/fixtures/features/call_statement_without_args.fe @@ -1,11 +1,11 @@ contract Foo { baz: Map - fn assign(self) { + fn assign(mut self) { self.baz[0] = 100 } - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.assign() return self.baz[0] } diff --git a/crates/test-files/fixtures/features/constructor.fe b/crates/test-files/fixtures/features/constructor.fe index 03a7af61d5..9986f2ef4a 100644 --- a/crates/test-files/fixtures/features/constructor.fe +++ b/crates/test-files/fixtures/features/constructor.fe @@ -1,7 +1,7 @@ contract Foo { bar: Map - pub fn __init__(self, baz: u256, bing: u256) { + pub fn __init__(mut self, baz: u256, bing: u256) { self.bar[42] = baz + bing } diff --git a/crates/test-files/fixtures/features/create2_contract.fe b/crates/test-files/fixtures/features/create2_contract.fe index 0cc816e6db..54227afee2 100644 --- a/crates/test-files/fixtures/features/create2_contract.fe +++ b/crates/test-files/fixtures/features/create2_contract.fe @@ -5,7 +5,7 @@ contract Foo { } contract FooFactory { - pub fn create2_foo(ctx: Context) -> address { + pub fn create2_foo(mut 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 accd66cf66..743d88765b 100644 --- a/crates/test-files/fixtures/features/create_contract.fe +++ b/crates/test-files/fixtures/features/create_contract.fe @@ -5,7 +5,7 @@ contract Foo { } contract FooFactory { - pub fn create_foo(ctx: Context) -> address { + pub fn create_foo(mut 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 557395da89..8a8cf4352d 100644 --- a/crates/test-files/fixtures/features/create_contract_from_init.fe +++ b/crates/test-files/fixtures/features/create_contract_from_init.fe @@ -7,7 +7,7 @@ contract Foo { contract FooFactory { foo_addr: address - pub fn __init__(self, ctx: Context) { + pub fn __init__(mut self, mut ctx: Context) { self.foo_addr = address(Foo.create(ctx, 0)) } 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 e6e263b2d9..8bf8f49c2a 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 @@ -5,7 +5,7 @@ contract Foo { return ctx.block_number() } - pub fn bing(self, _ new_num: u256) -> u256 { + pub fn bing(mut self, _ new_num: u256) -> u256 { self.my_num = new_num return self.my_num } @@ -17,7 +17,7 @@ contract Bar { return foo.baz(ctx) } - pub fn call_bing(ctx: Context) -> u256 { + pub fn call_bing(mut 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 d56272a8ed..9ac339066f 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,7 +1,7 @@ contract Foo { is_true: bool - pub fn bar(self, ctx: Context) -> u256 { + pub fn bar(mut self, ctx: Context) -> u256 { self.is_true = false return baz(ctx) } diff --git a/crates/test-files/fixtures/features/events.fe b/crates/test-files/fixtures/features/events.fe index 3fc4a325e7..408b2631fe 100644 --- a/crates/test-files/fixtures/features/events.fe +++ b/crates/test-files/fixtures/features/events.fe @@ -33,7 +33,7 @@ contract Foo { } pub fn emit_addresses(ctx: Context, addr1: address, addr2: address) { - let addrs: Array = [address(0); 2] + let mut addrs: Array = [address(0); 2] addrs[0] = addr1 addrs[1] = addr2 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 c160d3802e..db98d70dcb 100644 --- a/crates/test-files/fixtures/features/external_contract.fe +++ b/crates/test-files/fixtures/features/external_contract.fe @@ -10,7 +10,7 @@ contract Foo { } pub fn build_array(self, a: u256, b: u256) -> Array { - let my_array: Array = [0; 3] + let mut my_array: Array = [0; 3] my_array[0] = a my_array[1] = a * b my_array[2] = 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 8e8079b7dc..06345f6618 100644 --- a/crates/test-files/fixtures/features/for_loop_with_break.fe +++ b/crates/test-files/fixtures/features/for_loop_with_break.fe @@ -1,10 +1,10 @@ contract Foo { pub fn bar() -> u256 { - let my_array: Array = [0; 3] + let mut my_array: Array = [0; 3] my_array[0] = 5 my_array[1] = 10 my_array[2] = 15 - let sum: u256 = 0 + let mut sum: u256 = 0 for i in my_array { sum = sum + i if sum == 15 { diff --git a/crates/test-files/fixtures/features/for_loop_with_complex_elem_array.fe b/crates/test-files/fixtures/features/for_loop_with_complex_elem_array.fe index 9879239cd9..7ff65ddeae 100644 --- a/crates/test-files/fixtures/features/for_loop_with_complex_elem_array.fe +++ b/crates/test-files/fixtures/features/for_loop_with_complex_elem_array.fe @@ -2,7 +2,7 @@ contract Foo { pub fn bar() -> i256 { let my_array: Array = [Pair::new(-1, 1), Pair::new(10, -10), Pair::new(-100, 100)] - let sum: i256 = 0 + let mut sum: i256 = 0 for pair in my_array { sum += pair.l1_norm() } @@ -14,11 +14,11 @@ contract Foo { struct Pair { pub x: i256 pub y: i256 - + pub fn new(_ x: i256, _ y: i256) -> Pair { return Pair(x, y) } - + pub fn l1_norm(self) -> i256 { return abs(self.x) + abs(self.y) } 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 d2ce17e87d..05702b6ae2 100644 --- a/crates/test-files/fixtures/features/for_loop_with_continue.fe +++ b/crates/test-files/fixtures/features/for_loop_with_continue.fe @@ -1,12 +1,12 @@ contract Foo { pub fn bar() -> u256 { - let my_array: Array = [0; 5] + let mut my_array: Array = [0; 5] my_array[0] = 2 my_array[1] = 3 my_array[2] = 5 my_array[3] = 6 my_array[4] = 9 - let sum: u256 = 0 + let mut sum: u256 = 0 for i in my_array { if i % 2 == 0 { continue 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 6ff378cd83..75f9dcb87d 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,10 +1,10 @@ contract Foo { pub fn bar() -> u256 { - let my_array: Array = [0; 3] + let mut my_array: Array = [0; 3] my_array[0] = 5 my_array[1] = 10 my_array[2] = 15 - let sum: u256 = 0 + let mut sum: u256 = 0 for i in my_array { sum = sum + i } 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 901a5fd0bc..b9212bfffa 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,9 +1,9 @@ contract Foo { my_array: Array - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.my_array = [1, 2, 3] - let sum: u256 = 0 + let mut sum: u256 = 0 for i in self.my_array.to_mem() { sum = sum + i } 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 6bda2ec697..a7738c86dc 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 @@ -3,7 +3,7 @@ contract Foo { my_bool2: bool my_bool3: bool - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.my_bool1 = false self.my_bool2 = false self.my_bool3 = true diff --git a/crates/test-files/fixtures/features/int_literal_coercion.fe b/crates/test-files/fixtures/features/int_literal_coercion.fe index c837a08ae0..359d7aa55e 100644 --- a/crates/test-files/fixtures/features/int_literal_coercion.fe +++ b/crates/test-files/fixtures/features/int_literal_coercion.fe @@ -1,6 +1,6 @@ contract Foo { pub fn bar() -> u32 { - let c: u32 = 30 + let mut c: u32 = 30 c = 300 let d: (u128, u64, u32) = (100, 200, c) return d.item2 diff --git a/crates/test-files/fixtures/features/map_tuple.fe b/crates/test-files/fixtures/features/map_tuple.fe index 62341dd14c..bb1e0bca56 100644 --- a/crates/test-files/fixtures/features/map_tuple.fe +++ b/crates/test-files/fixtures/features/map_tuple.fe @@ -1,7 +1,7 @@ contract Foo { tuples: Map - pub fn bar(self, x: u256) -> u256 { + pub fn bar(mut 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 a6499b5238..58fed070fc 100644 --- a/crates/test-files/fixtures/features/math.fe +++ b/crates/test-files/fixtures/features/math.fe @@ -1,9 +1,9 @@ contract Math { pub fn sqrt(val: u256) -> u256 { - let z: u256 + let mut z: u256 if val > 3 { z = val - let x: u256 = val / 2 + 1 + let mut x: u256 = val / 2 + 1 while x < z { z = x x = (val / x + x) / 2 diff --git a/crates/test-files/fixtures/features/multi_param.fe b/crates/test-files/fixtures/features/multi_param.fe index 5579ebf859..5af033d897 100644 --- a/crates/test-files/fixtures/features/multi_param.fe +++ b/crates/test-files/fixtures/features/multi_param.fe @@ -1,6 +1,6 @@ contract Foo { pub fn bar(x: u256, y: u256, z: u256) -> Array { - let my_array: Array = [0; 3] + let mut my_array: Array = [0; 3] my_array[0] = x my_array[1] = y my_array[2] = z diff --git a/crates/test-files/fixtures/features/nested_map.fe b/crates/test-files/fixtures/features/nested_map.fe index 1271b748a2..e7db5f32cd 100644 --- a/crates/test-files/fixtures/features/nested_map.fe +++ b/crates/test-files/fixtures/features/nested_map.fe @@ -6,7 +6,7 @@ contract Foo { return self.bar[a][b] } - pub fn write_bar(self, a: address, b: address, value: u256) { + pub fn write_bar(mut self, a: address, b: address, value: u256) { self.bar[a][b] = value } @@ -14,7 +14,7 @@ contract Foo { return self.baz[a][b] } - pub fn write_baz(self, a: address, b: u256, value: bool) { + pub fn write_baz(mut self, a: address, b: u256, value: bool) { self.baz[a][b] = value } } diff --git a/crates/test-files/fixtures/features/ownable.fe b/crates/test-files/fixtures/features/ownable.fe index dda3b365a5..3b6000f236 100644 --- a/crates/test-files/fixtures/features/ownable.fe +++ b/crates/test-files/fixtures/features/ownable.fe @@ -6,7 +6,7 @@ contract Ownable { idx newOwner: address } - pub fn __init__(self, ctx: Context) { + pub fn __init__(mut self, ctx: Context) { self._owner = ctx.msg_sender() } @@ -14,13 +14,13 @@ contract Ownable { return self._owner } - pub fn renounceOwnership(self, ctx: Context) { + pub fn renounceOwnership(mut self, mut 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) { + pub fn transferOwnership(mut self, mut ctx: Context, newOwner: address) { assert ctx.msg_sender() == self._owner assert newOwner != address(0) self._owner = newOwner diff --git a/crates/test-files/fixtures/features/pure_fn_standalone.fe b/crates/test-files/fixtures/features/pure_fn_standalone.fe index 2b4f939a3f..9fd2a64f43 100644 --- a/crates/test-files/fixtures/features/pure_fn_standalone.fe +++ b/crates/test-files/fixtures/features/pure_fn_standalone.fe @@ -6,7 +6,7 @@ contract Foo { cool_users: Map points: Map - fn add_points(self, _ user: address, _ val: u256) { + fn add_points(mut self, _ user: address, _ val: u256) { if self.cool_users[user] { self.points[user] += add_bonus(val) } else { @@ -14,7 +14,7 @@ contract Foo { } } - pub fn bar(self, _ x: u256) -> u256 { + pub fn bar(mut self, _ x: u256) -> u256 { let a: address = address(x) self.add_points(a, 100) self.cool_users[a] = true diff --git a/crates/test-files/fixtures/features/return_array.fe b/crates/test-files/fixtures/features/return_array.fe index 1e9f684424..fc9cc8fa9f 100644 --- a/crates/test-files/fixtures/features/return_array.fe +++ b/crates/test-files/fixtures/features/return_array.fe @@ -1,6 +1,6 @@ contract Foo { pub fn bar(x: u256) -> Array { - let my_array: Array = [0; 5] + let mut my_array: Array = [0; 5] my_array[3] = x return my_array } 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 e78d92c114..f30eaf6433 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,7 +1,7 @@ contract Foo { some_thing: Array - pub fn bar(self, val: i8) -> Array { + pub fn bar(mut self, val: i8) -> Array { self.some_thing[0] = val 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 cda7de9670..882256d443 100644 --- a/crates/test-files/fixtures/features/return_from_storage_i8.fe +++ b/crates/test-files/fixtures/features/return_from_storage_i8.fe @@ -2,7 +2,7 @@ contract Foo { some_thing: i8 some_other: i8 - pub fn bar(self, val: i8) -> i8 { + pub fn bar(mut self, val: i8) -> i8 { self.some_thing = val self.some_other = val let x: i8 = self.some_thing + self.some_other 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 f13a272c50..23a0f44d81 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,10 @@ contract Foo { num_two: u256 - pub fn bar(self) -> u256 { + pub fn bar(mut 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 + let mut sum: u256 = 0 for i in my_array { sum = sum + i } 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 edddc6a955..618832ef13 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 @@ -4,7 +4,7 @@ contract Foo { } fn count(_ values: Array) -> u256 { - let sum: u256 = 0 + let mut sum: u256 = 0 for i in values { sum = sum + i } 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 fb945e4d12..68b3c105cd 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 @@ -9,7 +9,7 @@ contract Foo { return 100 } - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.baz[0] = 43 return foo(5, 2, cem(), 25 + 25, self.baz[0]) } diff --git a/crates/test-files/fixtures/features/revert.fe b/crates/test-files/fixtures/features/revert.fe index 10d8cec92b..accdef85d9 100644 --- a/crates/test-files/fixtures/features/revert.fe +++ b/crates/test-files/fixtures/features/revert.fe @@ -10,7 +10,7 @@ contract Foo { revert } - pub fn revert_custom_error(ctx: Context) { + pub fn revert_custom_error(mut ctx: Context) { ctx.send_value(to: address(0), wei: 100) } @@ -18,7 +18,7 @@ contract Foo { revert OtherError(msg: 1, val: true) } - pub fn revert_other_error_from_sto(self) { + pub fn revert_other_error_from_sto(mut 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/send_value.fe b/crates/test-files/fixtures/features/send_value.fe index fa79ea15da..027c37c623 100644 --- a/crates/test-files/fixtures/features/send_value.fe +++ b/crates/test-files/fixtures/features/send_value.fe @@ -1,5 +1,5 @@ contract Foo { - pub fn send_them_wei(ctx: Context, to: address, wei: u256) { + pub fn send_them_wei(mut ctx: Context, to: address, wei: u256) { ctx.send_value(to, wei) } } diff --git a/crates/test-files/fixtures/features/simple_traits.fe b/crates/test-files/fixtures/features/simple_traits.fe index 325fcf74d3..e939ad834c 100644 --- a/crates/test-files/fixtures/features/simple_traits.fe +++ b/crates/test-files/fixtures/features/simple_traits.fe @@ -31,7 +31,7 @@ impl Double for Array { contract Example { my_array: Array - pub fn __init__(self) { + pub fn __init__(mut self) { self.my_array = [1, 0] } 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 bddded7613..06656a3760 100644 --- a/crates/test-files/fixtures/features/sized_vals_in_sto.fe +++ b/crates/test-files/fixtures/features/sized_vals_in_sto.fe @@ -9,7 +9,7 @@ contract Foo { str: String<26> } - pub fn write_num(self, x: u256) { + pub fn write_num(mut self, x: u256) { self.num = x } @@ -17,7 +17,7 @@ contract Foo { return self.num } - pub fn write_nums(self, x: Array) { + pub fn write_nums(mut self, x: Array) { self.nums = x } @@ -25,7 +25,7 @@ contract Foo { return self.nums.to_mem() } - pub fn write_str(self, x: String<26>) { + pub fn write_str(mut self, x: String<26>) { self.str = x } @@ -33,7 +33,7 @@ contract Foo { return self.str.to_mem() } - pub fn emit_event(self, ctx: Context) { + pub fn emit_event(self, mut 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 5a2da2354a..bdf24d55fa 100644 --- a/crates/test-files/fixtures/features/strings.fe +++ b/crates/test-files/fixtures/features/strings.fe @@ -9,7 +9,7 @@ contract Foo { s5: String<100> } - pub fn __init__(ctx: Context, s1: String<42>, a: address, s2: String<26>, u: u256, s3: String<100>) { + pub fn __init__(mut 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")) } diff --git a/crates/test-files/fixtures/features/struct_fns.fe b/crates/test-files/fixtures/features/struct_fns.fe index e388232e3d..a9649b38dc 100644 --- a/crates/test-files/fixtures/features/struct_fns.fe +++ b/crates/test-files/fixtures/features/struct_fns.fe @@ -18,20 +18,20 @@ struct Point { return self.x } - pub fn set_x(self, _ x: u64) -> u64 { + pub fn set_x(mut self, _ x: u64) -> u64 { let old: u64 = self.x self.x = x return old } - pub fn reflect(self) { + pub fn reflect(mut 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) { + pub fn translate(mut self, x: u64, y: u64) { self.x += x self.y += y } @@ -44,7 +44,7 @@ struct Point { } pub fn do_pointy_things() { - let p1: Point = Point::origin() + let mut p1: Point = Point::origin() p1.translate(x: 5, y: 10) let p2: Point = Point(x: 1, y: 2) let p3: Point = p1.add(p2) @@ -54,7 +54,7 @@ pub fn do_pointy_things() { contract Foo { pub fn bar(x: u64, y: u64) -> u64 { do_pointy_things() - let p: Point = Point::new(x, y) + let mut p: Point = Point::new(x, y) assert p.x == x and p.y == y p.set_x(100) p.reflect() diff --git a/crates/test-files/fixtures/features/structs.fe b/crates/test-files/fixtures/features/structs.fe index 20658f748c..6dabddba62 100644 --- a/crates/test-files/fixtures/features/structs.fe +++ b/crates/test-files/fixtures/features/structs.fe @@ -37,7 +37,7 @@ struct House { return self.price / self.size } - pub fn expand(self) { + pub fn expand(mut self) { self.rooms += 1 self.size += 100 } @@ -47,7 +47,7 @@ contract Foo { my_house: House my_bar: Bar - pub fn complex_struct_in_storage(self) -> String<3> { + pub fn complex_struct_in_storage(mut 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 @@ -79,8 +79,8 @@ contract Foo { 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)) + pub fn complex_struct_in_memory() -> String<3> { + let mut 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 @@ -116,7 +116,7 @@ contract Foo { return mixed.foo } - pub fn set_house(self, data: House) { + pub fn set_house(mut self, data: House) { self.my_house = data } @@ -124,7 +124,7 @@ contract Foo { return self.my_house.to_mem() } - pub fn create_house(self) { + pub fn create_house(mut 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 @@ -153,7 +153,7 @@ contract Foo { } pub fn bar() -> u256 { - let building: House = House(price: 300, size: 500, rooms: u8(20), vacant: true) + let mut 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) diff --git a/crates/test-files/fixtures/features/two_contracts.fe b/crates/test-files/fixtures/features/two_contracts.fe index 6a720c663f..0ed18424c7 100644 --- a/crates/test-files/fixtures/features/two_contracts.fe +++ b/crates/test-files/fixtures/features/two_contracts.fe @@ -1,11 +1,11 @@ contract Foo { other: Bar - pub fn __init__(self, ctx: Context) { + pub fn __init__(mut self, mut ctx: Context) { self.other = Bar.create(ctx, 0) } - pub fn foo(self, ctx: Context) -> u256 { + pub fn foo(mut self, ctx: Context) -> u256 { self.other.set_foo_addr(ctx.self_address()) return self.other.answer() } @@ -18,7 +18,7 @@ contract Foo { contract Bar { other: Foo - pub fn set_foo_addr(self, _ addr: address) { + pub fn set_foo_addr(mut self, _ addr: address) { self.other = Foo(addr) } diff --git a/crates/test-files/fixtures/features/type_aliases.fe b/crates/test-files/fixtures/features/type_aliases.fe index c4a1f3ad04..c20295f9a1 100644 --- a/crates/test-files/fixtures/features/type_aliases.fe +++ b/crates/test-files/fixtures/features/type_aliases.fe @@ -1,15 +1,9 @@ type Posts = Map - type Scoreboard = Map - type AuthorPosts = Map - type Author = address - type Score = u64 - type PostId = u256 - type PostBody = String<32> contract Forum { @@ -17,14 +11,14 @@ contract Forum { authors: AuthorPosts scoreboard: Scoreboard - pub fn post(self, ctx: Context, body: PostBody) { + pub fn post(mut 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(mut self, id: PostId) -> Score { let score: Score = self.scoreboard[id] + 1 self.scoreboard[id] = score return score diff --git a/crates/test-files/fixtures/features/u128_u128_map.fe b/crates/test-files/fixtures/features/u128_u128_map.fe index d6d70b67e3..3d2f6cb45e 100644 --- a/crates/test-files/fixtures/features/u128_u128_map.fe +++ b/crates/test-files/fixtures/features/u128_u128_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u128, value: u128) { + pub fn write_bar(mut 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 6d98a40cde..f14cf3c1bd 100644 --- a/crates/test-files/fixtures/features/u16_u16_map.fe +++ b/crates/test-files/fixtures/features/u16_u16_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u16, value: u16) { + pub fn write_bar(mut 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 ceedbf4e3a..aad55b3171 100644 --- a/crates/test-files/fixtures/features/u256_u256_map.fe +++ b/crates/test-files/fixtures/features/u256_u256_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u256, value: u256) { + pub fn write_bar(mut 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 37730309fc..f6e1860f40 100644 --- a/crates/test-files/fixtures/features/u32_u32_map.fe +++ b/crates/test-files/fixtures/features/u32_u32_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u32, value: u32) { + pub fn write_bar(mut 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 523b0201fc..a1918af839 100644 --- a/crates/test-files/fixtures/features/u64_u64_map.fe +++ b/crates/test-files/fixtures/features/u64_u64_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u64, value: u64) { + pub fn write_bar(mut 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 d9cdd74259..db0d54530f 100644 --- a/crates/test-files/fixtures/features/u8_u8_map.fe +++ b/crates/test-files/fixtures/features/u8_u8_map.fe @@ -5,7 +5,7 @@ contract Foo { return self.bar[key] } - pub fn write_bar(self, key: u8, value: u8) { + pub fn write_bar(mut 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 1eac9e0284..ec22e3a5fe 100644 --- a/crates/test-files/fixtures/features/while_loop.fe +++ b/crates/test-files/fixtures/features/while_loop.fe @@ -1,6 +1,6 @@ contract Foo { pub fn bar() -> u256 { - let val: u256 = 0 + let mut val: u256 = 0 while val < 2 { val = val + 1 if val == 2 { 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 865acdef86..b2f4f61672 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,7 +1,7 @@ contract Foo { my_bool: bool - pub fn bar(self) -> u256 { + pub fn bar(mut self) -> u256 { self.my_bool = false while self.my_bool { 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 38f9fd64be..9824808165 100644 --- a/crates/test-files/fixtures/features/while_loop_with_break.fe +++ b/crates/test-files/fixtures/features/while_loop_with_break.fe @@ -1,6 +1,6 @@ contract Foo { pub fn bar() -> u256 { - let val: u256 = 0 + let mut val: u256 = 0 while val < 2 { val = val + 1 break 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 e27f106540..ec6d1a54ef 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,6 +1,6 @@ contract Foo { pub fn bar() -> u256 { - let val: u256 = 0 + let mut val: u256 = 0 while val < 2 { val = val + 1 if val == 1 { 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 8823bbf924..a3c68fce48 100644 --- a/crates/test-files/fixtures/features/while_loop_with_continue.fe +++ b/crates/test-files/fixtures/features/while_loop_with_continue.fe @@ -1,7 +1,7 @@ contract Foo { pub fn bar() -> u256 { - let i: u256 = 0 - let counter: u256 = 0 + let mut i: u256 = 0 + let mut counter: u256 = 0 while i < 2 { i = i + 1 if i == 1 { 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 4496120263..efb1fe7dbb 100644 --- a/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe +++ b/crates/test-files/fixtures/ingots/basic_ingot/src/main.fe @@ -32,7 +32,7 @@ contract Foo { 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(mut ctx: Context) -> u256 { let bing_contract: BingContract = BingContract.create(ctx, 0) return bing_contract.add(40, 50) } 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 6a99ee1386..d6c8672d2d 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 @@ -5,7 +5,7 @@ contract FooBarBing { return Bar(my_u256: 24) } - pub fn create_foobar_contract(ctx: Context) -> u256 { + pub fn create_foobar_contract(mut ctx: Context) -> u256 { let foo_bar: FooBar = FooBar.create(ctx, 0) return FooBar::add(40, 50) } diff --git a/crates/test-files/fixtures/stress/abi_encoding_stress.fe b/crates/test-files/fixtures/stress/abi_encoding_stress.fe index 7085c109ae..8407bd82a2 100644 --- a/crates/test-files/fixtures/stress/abi_encoding_stress.fe +++ b/crates/test-files/fixtures/stress/abi_encoding_stress.fe @@ -22,7 +22,7 @@ contract Foo { my_bytes: Array } - pub fn set_my_addrs(self, my_addrs: Array) { + pub fn set_my_addrs(mut self, my_addrs: Array) { self.my_addrs = my_addrs } @@ -30,7 +30,7 @@ contract Foo { return self.my_addrs.to_mem() } - pub fn set_my_u128(self, my_u128: u128) { + pub fn set_my_u128(mut self, my_u128: u128) { self.my_u128 = my_u128 } @@ -38,7 +38,7 @@ contract Foo { return self.my_u128 } - pub fn set_my_string(self, my_string: String<10>) { + pub fn set_my_string(mut self, my_string: String<10>) { self.my_string = my_string } @@ -46,7 +46,7 @@ contract Foo { return self.my_string.to_mem() } - pub fn set_my_u16s(self, my_u16s: Array) { + pub fn set_my_u16s(mut self, my_u16s: Array) { self.my_u16s = my_u16s } @@ -54,7 +54,7 @@ contract Foo { return self.my_u16s.to_mem() } - pub fn set_my_bool(self, my_bool: bool) { + pub fn set_my_bool(mut self, my_bool: bool) { self.my_bool = my_bool } @@ -62,7 +62,7 @@ contract Foo { return self.my_bool } - pub fn set_my_bytes(self, my_bytes: Array) { + pub fn set_my_bytes(mut self, my_bytes: Array) { self.my_bytes = my_bytes } @@ -74,7 +74,7 @@ contract Foo { 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(mut my_struct: MyStruct) -> MyStruct { my_struct.my_num = 12341234 my_struct.my_num2 = u8(42) my_struct.my_bool = false @@ -82,7 +82,7 @@ contract Foo { return my_struct } - pub fn emit_my_event(self, ctx: Context) { + pub fn emit_my_event(self, mut 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 f0c4a82a59..aaf296e61a 100644 --- a/crates/test-files/fixtures/stress/data_copying_stress.fe +++ b/crates/test-files/fixtures/stress/data_copying_stress.fe @@ -11,21 +11,22 @@ contract Foo { 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(mut 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(mut self) { self.my_string = self.my_other_string self.my_u256 = self.my_other_u256 } - pub fn multiple_references_shared_memory(my_array: Array) { + // XXX change this + pub fn multiple_references_shared_memory(mut my_array: Array) { let my_2nd_array: Array = my_array - let my_3rd_array: Array = my_2nd_array + let mut my_3rd_array: Array = my_2nd_array assert my_array[3] != 5 my_array[3] = 5 assert my_array[3] == 5 @@ -37,22 +38,24 @@ contract Foo { assert my_3rd_array[3] == 50 } - pub fn mutate_and_return(my_array: Array) -> Array { + pub fn mutate_and_return(mut my_array: Array) -> Array { my_array[3] = 5 return my_array } pub fn clone_and_return(my_array: Array) -> Array { - return my_array.clone() + let a: Array = my_array + return a } pub fn clone_mutate_and_return(my_array: Array) -> Array { - my_array.clone()[3] = 5 + let mut a: Array = my_array + a[3] = 5 return my_array } - pub fn assign_my_nums_and_return(self) -> Array { - let my_nums_mem: Array = [0; 5] + pub fn assign_my_nums_and_return(mut self) -> Array { + let mut my_nums_mem: Array = [0; 5] self.my_nums[0] = 42 self.my_nums[1] = 26 self.my_nums[2] = 0 @@ -62,15 +65,15 @@ contract Foo { return my_nums_mem } - pub fn emit_my_event(self, ctx: Context) { + pub fn emit_my_event(self, mut ctx: Context) { emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) } - fn emit_my_event_internal(ctx: Context, _ my_string: String<42>, _ my_u256: u256) { + fn emit_my_event_internal(mut 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(mut self, my_addrs: Array) { self.my_addrs = my_addrs } diff --git a/crates/test-files/fixtures/stress/external_calls.fe b/crates/test-files/fixtures/stress/external_calls.fe index dab6b1a2d7..42cd19baad 100644 --- a/crates/test-files/fixtures/stress/external_calls.fe +++ b/crates/test-files/fixtures/stress/external_calls.fe @@ -10,7 +10,7 @@ contract Foo { return self.my_string.to_mem() } - pub fn set_my_string(self, some_string: String<100>) { + pub fn set_my_string(mut self, some_string: String<100>) { self.my_string = some_string } @@ -18,11 +18,11 @@ contract Foo { return self.my_tuple.to_mem() } - pub fn set_my_tuple(self, some_tuple: (u256, address)) { + pub fn set_my_tuple(mut 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(mut self, some_string: String<100>, some_tuple: (u256, address)) { self.my_string = some_string self.my_tuple = some_tuple } @@ -59,7 +59,7 @@ contract Foo { contract FooProxy { foo: Foo - pub fn __init__(self, foo_addr: address) { + pub fn __init__(mut self, foo_addr: address) { self.foo = Foo(foo_addr) } diff --git a/crates/test-files/fixtures/stress/tuple_stress.fe b/crates/test-files/fixtures/stress/tuple_stress.fe index 89a3aaaa12..8ef814a5d0 100644 --- a/crates/test-files/fixtures/stress/tuple_stress.fe +++ b/crates/test-files/fixtures/stress/tuple_stress.fe @@ -25,11 +25,11 @@ contract Foo { return my_tuple.item10 } - pub fn emit_my_event(ctx: Context, my_tuple: (u256, bool, address)) { + pub fn emit_my_event(mut 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(mut 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) } @@ -38,7 +38,7 @@ contract Foo { return self.my_sto_tuple.to_mem() } - pub fn build_tuple_and_emit(self, ctx: Context) { + pub fn build_tuple_and_emit(self, mut 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)) emit_my_event(ctx, my_tuple) diff --git a/docs/src/quickstart/deploy_contract.md b/docs/src/quickstart/deploy_contract.md index 9c785493a6..33cc6824c3 100644 --- a/docs/src/quickstart/deploy_contract.md +++ b/docs/src/quickstart/deploy_contract.md @@ -38,7 +38,7 @@ Let's recall that we finished our guest book in the previous chapter with the fo contract GuestBook { messages: Map> - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { self.messages[ctx.msg_sender()] = book_msg } diff --git a/docs/src/quickstart/first_contract.md b/docs/src/quickstart/first_contract.md index e6f04e7714..0cb1981401 100644 --- a/docs/src/quickstart/first_contract.md +++ b/docs/src/quickstart/first_contract.md @@ -56,7 +56,7 @@ Let's focus on the functionality of our world changing application and add a met contract GuestBook { messages: Map> - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { self.messages[ctx.msg_sender()] = book_msg } } @@ -102,7 +102,7 @@ To make the guest book more useful we will also add a method `get_msg` to read e contract GuestBook { messages: Map> - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { self.messages[ctx.msg_sender()] = book_msg } @@ -136,7 +136,7 @@ The code should compile fine when we change it accordingly. contract GuestBook { messages: Map> - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { self.messages[ctx.msg_sender()] = book_msg } diff --git a/docs/src/spec/data_layout/memory/clone_function.md b/docs/src/spec/data_layout/memory/clone_function.md index 7f6d9b097e..45e4e2c868 100644 --- a/docs/src/spec/data_layout/memory/clone_function.md +++ b/docs/src/spec/data_layout/memory/clone_function.md @@ -6,14 +6,16 @@ Example: ```fe fn f() { + // with clone let bar: Array = [1, 2, 3, 4] - let foo: Array = bar.clone() // `foo` points to a new segment of memory + let mut foo: Array = bar.clone() // `foo` points to a new segment of memory assert foo[1] == bar[1] foo[1] = 42 assert foo[1] != bar[1] // modifying `foo` does not modify bar } +// XXX change or remove this fn g() { // without clone let bar: Array = [1, 2, 3, 4] diff --git a/docs/src/spec/expressions/indexing.md b/docs/src/spec/expressions/indexing.md index 84c6ee267d..cdde13f3cd 100644 --- a/docs/src/spec/expressions/indexing.md +++ b/docs/src/spec/expressions/indexing.md @@ -14,7 +14,8 @@ contract Foo { balances: Map - pub fn baz(self, values: Array) { + + pub fn baz(mut self, mut values: Array) { // Assign value at slot 5 values[5] = 1000 // Read value at slot 5 diff --git a/docs/src/spec/items/contracts.md b/docs/src/spec/items/contracts.md index 1ead2cace4..e8562c8ae4 100644 --- a/docs/src/spec/items/contracts.md +++ b/docs/src/spec/items/contracts.md @@ -35,7 +35,7 @@ contract GuestBook { book_msg: String<100> } - pub fn sign(self, ctx: Context, book_msg: String<100>) { + pub fn sign(mut self, mut ctx: Context, book_msg: String<100>) { self.messages[ctx.msg_sender()] = book_msg emit Signed(ctx, book_msg: book_msg) } diff --git a/docs/src/spec/items/events.md b/docs/src/spec/items/events.md index da67659b03..fba754ea47 100644 --- a/docs/src/spec/items/events.md +++ b/docs/src/spec/items/events.md @@ -24,7 +24,8 @@ contract Foo { value: u256 } - fn transfer(ctx: Context, to: address, value: u256) { + + fn transfer(mut ctx: Context, to: address, value: u256) { // Heavy logic here // All done, log the event for listeners emit Transfer(ctx, sender: ctx.msg_sender(), receiver: to, value) diff --git a/docs/src/spec/items/functions.md b/docs/src/spec/items/functions.md index 5a4861d85a..7e8ff7ba5e 100644 --- a/docs/src/spec/items/functions.md +++ b/docs/src/spec/items/functions.md @@ -74,7 +74,7 @@ fn add(_ x: u256, _ y: u256) -> u256 { contract CoolCoin { balance: Map - fn transfer(self, from sender: address, to recipient: address, value: u256) -> bool { + fn transfer(mut self, from sender: address, to recipient: address, value: u256) -> bool { if self.balance[sender] < value { return false } @@ -82,7 +82,7 @@ contract CoolCoin { self.balance[recipient] += value return true } - pub fn demo(self) { + pub fn demo(mut self) { let ann: address = address(0xaa) let bob: address = address(0xbb) self.balance[ann] = 100 diff --git a/docs/src/spec/statements/assign.md b/docs/src/spec/statements/assign.md index d714634cca..53c58467c0 100644 --- a/docs/src/spec/statements/assign.md +++ b/docs/src/spec/statements/assign.md @@ -13,12 +13,13 @@ Example: contract Foo { some_array: Array + pub fn bar(self) { - let val1: u256 = 10 + let mut val1: u256 = 10 // Assignment of stack variable val1 = 10 - let values: (u256, u256) = (1, 2) + let mut values: (u256, u256) = (1, 2) // Assignment of tuple item values.item0 = 3 diff --git a/docs/src/spec/statements/augassign.md b/docs/src/spec/statements/augassign.md index 812783b5b8..0eaac76643 100644 --- a/docs/src/spec/statements/augassign.md +++ b/docs/src/spec/statements/augassign.md @@ -24,57 +24,57 @@ Example: ```fe contract Foo { - pub fn add(a: u256, b: u256) -> u256 { + pub fn add(mut a: u256, b: u256) -> u256 { a += b return a } - pub fn sub(a: u256, b: u256) -> u256 { + pub fn sub(mut a: u256, b: u256) -> u256 { a -= b return a } - pub fn mul(a: u256, b: u256) -> u256 { + pub fn mul(mut a: u256, b: u256) -> u256 { a *= b return a } - pub fn div(a: u256, b: u256) -> u256 { + pub fn div(mut a: u256, b: u256) -> u256 { a /= b return a } - pub fn mod(a: u256, b: u256) -> u256 { + pub fn mod(mut a: u256, b: u256) -> u256 { a %= b return a } - pub fn pow(a: u256, b: u256) -> u256 { + pub fn pow(mut a: u256, b: u256) -> u256 { a **= b return a } - pub fn lshift(a: u8, b: u8) -> u8 { + pub fn lshift(mut a: u8, b: u8) -> u8 { a <<= b return a } - pub fn rshift(a: u8, b: u8) -> u8 { + pub fn rshift(mut a: u8, b: u8) -> u8 { a >>= b return a } - pub fn bit_or(a: u8, b: u8) -> u8 { + pub fn bit_or(mut a: u8, b: u8) -> u8 { a |= b return a } - pub fn bit_xor(a: u8, b: u8) -> u8 { + pub fn bit_xor(mut a: u8, b: u8) -> u8 { a ^= b return a } - pub fn bit_and(a: u8, b: u8) -> u8 { + pub fn bit_and(mut a: u8, b: u8) -> u8 { a &= b return a } diff --git a/docs/src/spec/statements/break.md b/docs/src/spec/statements/break.md index ba505e1238..dbcfef6cf6 100644 --- a/docs/src/spec/statements/break.md +++ b/docs/src/spec/statements/break.md @@ -15,7 +15,7 @@ An example of a `break` statement used within a [`while`] loop. contract Foo { pub fn bar() -> u256 { - let sum: u256 + let mut sum: u256 = 0 while sum < 10 { sum += 1 @@ -39,7 +39,7 @@ An example of a `break` statement used within a [`for`] loop. contract Foo { pub fn bar(values: Array) -> u256 { - let sum: u256 + let mut sum: u256 = 0 for i in values { sum = sum + i diff --git a/docs/src/spec/statements/continue.md b/docs/src/spec/statements/continue.md index a3f8bc5f34..90acaf5590 100644 --- a/docs/src/spec/statements/continue.md +++ b/docs/src/spec/statements/continue.md @@ -15,7 +15,7 @@ An example of a `continue` statement used within a [`while`] loop. contract Foo { pub fn bar() -> u256 { - let sum: u256 + let mut sum: u256 = 0 while sum < 10 { sum += 1 @@ -40,7 +40,7 @@ An example of a `continue` statement used within a [`for`] loop. contract Foo { pub fn bar(values: Array) -> u256 { - let sum: u256 + let mut sum: u256 = 0 for i in values { sum = sum + i diff --git a/docs/src/spec/statements/emit.md b/docs/src/spec/statements/emit.md index 4984f419d5..cc412f44f0 100644 --- a/docs/src/spec/statements/emit.md +++ b/docs/src/spec/statements/emit.md @@ -30,7 +30,7 @@ contract Foo { num2: u256 my_bytes: Array } - pub fn emit_mix(ctx: Context, addr: address, my_bytes: Array) { + pub fn emit_mix(mut ctx: Context, addr: address, my_bytes: Array) { emit Mix(ctx, num1: 26, addr, num2: 42, my_bytes) } } diff --git a/docs/src/spec/statements/for.md b/docs/src/spec/statements/for.md index af696c2c8c..0dc83deef1 100644 --- a/docs/src/spec/statements/for.md +++ b/docs/src/spec/statements/for.md @@ -17,7 +17,7 @@ Example: contract Foo { pub fn bar(values: Array) -> u256 { - let sum: u256 + let mut sum: u256 = 0 for i in values { sum = sum + i } diff --git a/docs/src/spec/statements/while.md b/docs/src/spec/statements/while.md index c34e99d62e..ae58a18484 100644 --- a/docs/src/spec/statements/while.md +++ b/docs/src/spec/statements/while.md @@ -15,7 +15,7 @@ Example: contract Foo { pub fn bar() -> u256 { - let sum: u256 + let mut sum: u256 = 0 while sum < 10 { sum += 1 } diff --git a/docs/src/spec/type_system/types/contract.md b/docs/src/spec/type_system/types/contract.md index c230cae9f2..424d21aa2b 100644 --- a/docs/src/spec/type_system/types/contract.md +++ b/docs/src/spec/type_system/types/contract.md @@ -17,7 +17,7 @@ contract Foo { } contract FooFactory { - pub fn create2_foo(ctx: Context) -> address { + pub fn create2_foo(mut ctx: Context) -> address { // `0` is the value being sent and `52` is the address salt let foo: Foo = Foo.create2(ctx, 0, 52) return address(foo) diff --git a/docs/src/spec/type_system/types/map.md b/docs/src/spec/type_system/types/map.md index 22a6ec5dfb..ebbc3fe77f 100644 --- a/docs/src/spec/type_system/types/map.md +++ b/docs/src/spec/type_system/types/map.md @@ -22,7 +22,7 @@ contract Foo { return self.bar[a][b] } - pub fn write_bar(self, a: address, b: address, value: u256) { + pub fn write_bar(mut self, a: address, b: address, value: u256) { self.bar[a][b] = value } @@ -30,7 +30,7 @@ contract Foo { return self.baz[a][b] } - pub fn write_baz(self, a: address, b: u256, value: bool) { + pub fn write_baz(mut self, a: address, b: u256, value: bool) { self.baz[a][b] = value } }