diff --git a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap index cacb5c85fb..6158c69bc0 100644 --- a/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap +++ b/crates/analyzer/tests/snapshots/analysis__data_copying_stress.snap @@ -128,32 +128,33 @@ note: │ ^^^^^^^^^^^^^^^^^^ mut SPtr -> SPtr note: - ┌─ data_copying_stress.fe:27:5 + ┌─ data_copying_stress.fe:26: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 +26 │ ╭ pub fn multiple_references_shared_memory(mut my_array: Array) { +27 │ │ let my_2nd_array: Array = my_array +28 │ │ let mut my_3rd_array: Array = my_2nd_array +29 │ │ · │ 38 │ │ assert my_3rd_array[3] == 50 39 │ │ } │ ╰─────^ params: [{ label: None, name: my_array, typ: mut Array }] -> () note: - ┌─ data_copying_stress.fe:28:13 + ┌─ data_copying_stress.fe:27:13 │ -28 │ let my_2nd_array: Array = my_array +27 │ let my_2nd_array: Array = my_array │ ^^^^^^^^^^^^ Array -29 │ let mut my_3rd_array: Array = my_2nd_array +28 │ let mut my_3rd_array: Array = my_2nd_array │ ^^^^^^^^^^^^ mut Array note: - ┌─ data_copying_stress.fe:28:45 + ┌─ data_copying_stress.fe:27:45 │ -28 │ let my_2nd_array: Array = my_array +27 │ let my_2nd_array: Array = my_array │ ^^^^^^^^ mut Array -> Array -29 │ let mut my_3rd_array: Array = my_2nd_array +28 │ let mut my_3rd_array: Array = my_2nd_array │ ^^^^^^^^^^^^ Array +29 │ 30 │ assert my_array[3] != 5 │ ^^^^^^^^ ^ u256 │ │ @@ -202,7 +203,7 @@ note: │ 32 │ assert my_array[3] == 5 │ ^^^^^^^^^^^^^^^^ bool -33 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] != 5 │ ^^^^^^^^^^^^ ^ u256 │ │ │ Array @@ -210,7 +211,7 @@ note: note: ┌─ data_copying_stress.fe:33:16 │ -33 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] != 5 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ u256 @@ -218,9 +219,9 @@ note: note: ┌─ data_copying_stress.fe:33:16 │ -33 │ assert my_2nd_array[3] == 5 +33 │ assert my_2nd_array[3] != 5 │ ^^^^^^^^^^^^^^^^^^^^ bool -34 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] != 5 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut Array @@ -228,7 +229,7 @@ note: note: ┌─ data_copying_stress.fe:34:16 │ -34 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] != 5 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ mut u256 @@ -236,7 +237,7 @@ note: note: ┌─ data_copying_stress.fe:34:16 │ -34 │ assert my_3rd_array[3] == 5 +34 │ assert my_3rd_array[3] != 5 │ ^^^^^^^^^^^^^^^^^^^^ bool 35 │ my_3rd_array[3] = 50 │ ^^^^^^^^^^^^ ^ u256 @@ -250,7 +251,7 @@ note: │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ │ mut u256 -36 │ assert my_array[3] == 50 +36 │ assert my_array[3] == 5 │ ^^^^^^^^ ^ u256 │ │ │ mut Array @@ -258,17 +259,17 @@ note: note: ┌─ data_copying_stress.fe:36:16 │ -36 │ assert my_array[3] == 50 - │ ^^^^^^^^^^^ ^^ u256 +36 │ assert my_array[3] == 5 + │ ^^^^^^^^^^^ ^ u256 │ │ │ mut u256 note: ┌─ data_copying_stress.fe:36:16 │ -36 │ assert my_array[3] == 50 - │ ^^^^^^^^^^^^^^^^^ bool -37 │ assert my_2nd_array[3] == 50 +36 │ assert my_array[3] == 5 + │ ^^^^^^^^^^^^^^^^ bool +37 │ assert my_2nd_array[3] == 5 │ ^^^^^^^^^^^^ ^ u256 │ │ │ Array @@ -276,16 +277,16 @@ note: note: ┌─ data_copying_stress.fe:37:16 │ -37 │ assert my_2nd_array[3] == 50 - │ ^^^^^^^^^^^^^^^ ^^ u256 +37 │ assert my_2nd_array[3] == 5 + │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ u256 note: ┌─ data_copying_stress.fe:37:16 │ -37 │ assert my_2nd_array[3] == 50 - │ ^^^^^^^^^^^^^^^^^^^^^ bool +37 │ assert my_2nd_array[3] == 5 + │ ^^^^^^^^^^^^^^^^^^^^ bool 38 │ assert my_3rd_array[3] == 50 │ ^^^^^^^^^^^^ ^ u256 │ │ @@ -361,8 +362,9 @@ note: 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 │ │ } +54 │ │ assert my_array[3] != 5 +55 │ │ return my_array +56 │ │ } │ ╰─────^ params: [{ label: None, name: my_array, typ: Array }] -> Array note: @@ -388,256 +390,274 @@ note: │ ^^^^ ^ u256 │ │ │ mut u256 -54 │ return my_array +54 │ assert my_array[3] != 5 + │ ^^^^^^^^ ^ u256 + │ │ + │ Array + +note: + ┌─ data_copying_stress.fe:54:16 + │ +54 │ assert my_array[3] != 5 + │ ^^^^^^^^^^^ ^ u256 + │ │ + │ u256 + +note: + ┌─ data_copying_stress.fe:54:16 + │ +54 │ assert my_array[3] != 5 + │ ^^^^^^^^^^^^^^^^ bool +55 │ return my_array │ ^^^^^^^^ Array note: - ┌─ data_copying_stress.fe:57:5 + ┌─ data_copying_stress.fe:58:5 │ -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 +58 │ ╭ pub fn assign_my_nums_and_return(mut self) -> Array { +59 │ │ let mut my_nums_mem: Array = [0; 5] +60 │ │ self.my_nums[0] = 42 +61 │ │ self.my_nums[1] = 26 · │ -65 │ │ return my_nums_mem -66 │ │ } +66 │ │ return my_nums_mem +67 │ │ } │ ╰─────^ params: [mut self] -> Array note: - ┌─ data_copying_stress.fe:58:17 + ┌─ data_copying_stress.fe:59:17 │ -58 │ let mut my_nums_mem: Array = [0; 5] +59 │ let mut my_nums_mem: Array = [0; 5] │ ^^^^^^^^^^^ mut Array note: - ┌─ data_copying_stress.fe:58:48 + ┌─ data_copying_stress.fe:59:48 │ -58 │ let mut my_nums_mem: Array = [0; 5] +59 │ let mut my_nums_mem: Array = [0; 5] │ ^ ^ u256 │ │ │ u256 note: - ┌─ data_copying_stress.fe:58:47 + ┌─ data_copying_stress.fe:59:47 │ -58 │ let mut my_nums_mem: Array = [0; 5] +59 │ let mut my_nums_mem: Array = [0; 5] │ ^^^^^^ Array -59 │ self.my_nums[0] = 42 +60 │ self.my_nums[0] = 42 │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:59:9 + ┌─ data_copying_stress.fe:60:9 │ -59 │ self.my_nums[0] = 42 +60 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:59:9 + ┌─ data_copying_stress.fe:60:9 │ -59 │ self.my_nums[0] = 42 +60 │ self.my_nums[0] = 42 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ │ mut SPtr -60 │ self.my_nums[1] = 26 +61 │ self.my_nums[1] = 26 │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:60:9 + ┌─ data_copying_stress.fe:61:9 │ -60 │ self.my_nums[1] = 26 +61 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:60:9 + ┌─ data_copying_stress.fe:61:9 │ -60 │ self.my_nums[1] = 26 +61 │ self.my_nums[1] = 26 │ ^^^^^^^^^^^^^^^ ^^ u256 │ │ │ mut SPtr -61 │ self.my_nums[2] = 0 +62 │ self.my_nums[2] = 0 │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:61:9 + ┌─ data_copying_stress.fe:62:9 │ -61 │ self.my_nums[2] = 0 +62 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:61:9 + ┌─ data_copying_stress.fe:62:9 │ -61 │ self.my_nums[2] = 0 +62 │ self.my_nums[2] = 0 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr -62 │ self.my_nums[3] = 1 +63 │ self.my_nums[3] = 1 │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:62:9 + ┌─ data_copying_stress.fe:63:9 │ -62 │ self.my_nums[3] = 1 +63 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:62:9 + ┌─ data_copying_stress.fe:63:9 │ -62 │ self.my_nums[3] = 1 +63 │ self.my_nums[3] = 1 │ ^^^^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr -63 │ self.my_nums[4] = 255 +64 │ self.my_nums[4] = 255 │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:63:9 + ┌─ data_copying_stress.fe:64:9 │ -63 │ self.my_nums[4] = 255 +64 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^ ^ u256 │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:63:9 + ┌─ data_copying_stress.fe:64:9 │ -63 │ self.my_nums[4] = 255 +64 │ self.my_nums[4] = 255 │ ^^^^^^^^^^^^^^^ ^^^ u256 │ │ │ mut SPtr -64 │ my_nums_mem = self.my_nums.to_mem() +65 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^ ^^^^ mut Foo │ │ │ mut Array note: - ┌─ data_copying_stress.fe:64:23 + ┌─ data_copying_stress.fe:65:23 │ -64 │ my_nums_mem = self.my_nums.to_mem() +65 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^^ mut SPtr> note: - ┌─ data_copying_stress.fe:64:23 + ┌─ data_copying_stress.fe:65:23 │ -64 │ my_nums_mem = self.my_nums.to_mem() +65 │ my_nums_mem = self.my_nums.to_mem() │ ^^^^^^^^^^^^^^^^^^^^^ Array -65 │ return my_nums_mem +66 │ return my_nums_mem │ ^^^^^^^^^^^ mut Array -> Array note: - ┌─ data_copying_stress.fe:68:5 + ┌─ data_copying_stress.fe:69:5 │ -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 │ │ } +69 │ ╭ pub fn emit_my_event(self, mut ctx: Context) { +70 │ │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +71 │ │ } │ ╰─────^ params: [self, { label: None, name: ctx, typ: mut Context }] -> () note: - ┌─ data_copying_stress.fe:69:32 + ┌─ data_copying_stress.fe:70:32 │ -69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^ ^^^^ Foo │ │ │ mut Context note: - ┌─ data_copying_stress.fe:69:37 + ┌─ data_copying_stress.fe:70:37 │ -69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^ SPtr> note: - ┌─ data_copying_stress.fe:69:37 + ┌─ data_copying_stress.fe:70:37 │ -69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ Foo │ │ │ String<42> note: - ┌─ data_copying_stress.fe:69:62 + ┌─ data_copying_stress.fe:70:62 │ -69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^ SPtr -> u256 note: - ┌─ data_copying_stress.fe:69:9 + ┌─ data_copying_stress.fe:70:9 │ -69 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) +70 │ emit_my_event_internal(ctx, self.my_string.to_mem(), self.my_u256) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ () note: - ┌─ data_copying_stress.fe:72:5 + ┌─ data_copying_stress.fe:73:5 │ -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 │ │ } +73 │ ╭ fn emit_my_event_internal(mut ctx: Context, _ my_string: String<42>, _ my_u256: u256) { +74 │ │ emit MyEvent(ctx, my_string, my_u256) +75 │ │ } │ ╰─────^ 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:73:22 + ┌─ data_copying_stress.fe:74:22 │ -73 │ emit MyEvent(ctx, my_string, my_u256) +74 │ emit MyEvent(ctx, my_string, my_u256) │ ^^^ ^^^^^^^^^ ^^^^^^^ u256 │ │ │ │ │ String<42> │ mut Context -> Context note: - ┌─ data_copying_stress.fe:76:5 + ┌─ data_copying_stress.fe:77:5 │ -76 │ ╭ pub fn set_my_addrs(mut self, my_addrs: Array) { -77 │ │ self.my_addrs = my_addrs -78 │ │ } +77 │ ╭ pub fn set_my_addrs(mut self, my_addrs: Array) { +78 │ │ self.my_addrs = my_addrs +79 │ │ } │ ╰─────^ params: [mut self, { label: None, name: my_addrs, typ: Array }] -> () note: - ┌─ data_copying_stress.fe:77:9 + ┌─ data_copying_stress.fe:78:9 │ -77 │ self.my_addrs = my_addrs +78 │ self.my_addrs = my_addrs │ ^^^^ mut Foo note: - ┌─ data_copying_stress.fe:77:9 + ┌─ data_copying_stress.fe:78:9 │ -77 │ self.my_addrs = my_addrs +78 │ self.my_addrs = my_addrs │ ^^^^^^^^^^^^^ ^^^^^^^^ Array │ │ │ mut SPtr> note: - ┌─ data_copying_stress.fe:80:5 + ┌─ data_copying_stress.fe:81:5 │ -80 │ ╭ pub fn get_my_second_addr(self) -> address { -81 │ │ return self.my_addrs[1] -82 │ │ } +81 │ ╭ pub fn get_my_second_addr(self) -> address { +82 │ │ return self.my_addrs[1] +83 │ │ } │ ╰─────^ params: [self] -> address note: - ┌─ data_copying_stress.fe:81:16 + ┌─ data_copying_stress.fe:82:16 │ -81 │ return self.my_addrs[1] +82 │ return self.my_addrs[1] │ ^^^^ Foo note: - ┌─ data_copying_stress.fe:81:16 + ┌─ data_copying_stress.fe:82:16 │ -81 │ return self.my_addrs[1] +82 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^ ^ u256 │ │ │ SPtr> note: - ┌─ data_copying_stress.fe:81:16 + ┌─ data_copying_stress.fe:82:16 │ -81 │ return self.my_addrs[1] +82 │ return self.my_addrs[1] │ ^^^^^^^^^^^^^^^^ SPtr
-> address diff --git a/crates/codegen/src/db/queries/abi.rs b/crates/codegen/src/db/queries/abi.rs index 99660e2b69..d4a827097b 100644 --- a/crates/codegen/src/db/queries/abi.rs +++ b/crates/codegen/src/db/queries/abi.rs @@ -196,11 +196,11 @@ pub fn abi_type(db: &dyn CodegenDb, ty: TypeId) -> AbiType { AbiType::Tuple(fields) } + ir::TypeKind::MPtr(inner) => db.codegen_abi_type(*inner), ir::TypeKind::Event(_) | ir::TypeKind::Contract(_) | ir::TypeKind::Map(_) - | ir::TypeKind::MPtr(_) | ir::TypeKind::SPtr(_) => unreachable!(), } } diff --git a/crates/codegen/src/yul/legalize/body.rs b/crates/codegen/src/yul/legalize/body.rs index 3c4c234be9..2049343f4e 100644 --- a/crates/codegen/src/yul/legalize/body.rs +++ b/crates/codegen/src/yul/legalize/body.rs @@ -187,7 +187,10 @@ fn make_zst_ptr(db: &dyn CodegenDb, ty: TypeId) -> Value { /// Returns `true` if a value has a zero sized type. fn is_value_zst(db: &dyn CodegenDb, body: &FunctionBody, value: ValueId) -> bool { - body.store.value_ty(value).is_zero_sized(db.upcast()) + body.store + .value_ty(value) + .deref(db.upcast()) + .is_zero_sized(db.upcast()) // XXX deref? } fn is_value_contract(db: &dyn CodegenDb, body: &FunctionBody, value: ValueId) -> bool { @@ -198,5 +201,6 @@ fn is_value_contract(db: &dyn CodegenDb, body: &FunctionBody, value: ValueId) -> fn is_lvalue_zst(db: &dyn CodegenDb, body: &FunctionBody, lvalue: &AssignableValue) -> bool { lvalue .ty(db.upcast(), &body.store) + .deref(db.upcast()) .is_zero_sized(db.upcast()) } diff --git a/crates/codegen/src/yul/legalize/signature.rs b/crates/codegen/src/yul/legalize/signature.rs index 94a5118308..134bc10ae6 100644 --- a/crates/codegen/src/yul/legalize/signature.rs +++ b/crates/codegen/src/yul/legalize/signature.rs @@ -1,12 +1,14 @@ -use fe_mir::ir::FunctionSignature; +use fe_mir::ir::{FunctionSignature, TypeKind}; use crate::db::CodegenDb; pub fn legalize_func_signature(db: &dyn CodegenDb, sig: &mut FunctionSignature) { // Remove param if the type is contract or zero-sized. let params = &mut sig.params; - params - .retain(|param| !param.ty.is_contract(db.upcast()) && !param.ty.is_zero_sized(db.upcast())); + params.retain(|param| match param.ty.data(db.upcast()).kind { + TypeKind::Contract(_) => false, + _ => !param.ty.deref(db.upcast()).is_zero_sized(db.upcast()), + }); // Legalize param types. for param in params.iter_mut() { @@ -15,7 +17,7 @@ pub fn legalize_func_signature(db: &dyn CodegenDb, sig: &mut FunctionSignature) if let Some(ret_ty) = sig.return_type { // Remove return type if the type is contract or zero-sized. - if ret_ty.is_contract(db.upcast()) || ret_ty.is_zero_sized(db.upcast()) { + if ret_ty.is_contract(db.upcast()) || ret_ty.deref(db.upcast()).is_zero_sized(db.upcast()) { sig.return_type = None; } else { // Legalize param types. diff --git a/crates/mir/src/db/queries/types.rs b/crates/mir/src/db/queries/types.rs index 5ade074e98..b15ef023de 100644 --- a/crates/mir/src/db/queries/types.rs +++ b/crates/mir/src/db/queries/types.rs @@ -57,9 +57,9 @@ impl TypeId { } pub fn deref(self, db: &dyn MirDb) -> TypeId { - match &self.data(db).kind { - TypeKind::SPtr(inner) => *inner, - TypeKind::MPtr(inner) => *inner, + match self.data(db).kind { + TypeKind::SPtr(inner) => inner, + TypeKind::MPtr(inner) => inner.deref(db), _ => self, } } diff --git a/crates/mir/src/lower/function.rs b/crates/mir/src/lower/function.rs index d1bd745550..59c5837954 100644 --- a/crates/mir/src/lower/function.rs +++ b/crates/mir/src/lower/function.rs @@ -731,18 +731,31 @@ 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 + + // XXX typeid equality is broken by differing analyzer types + if expr_ty.data(self.db).kind == into_ty.data(self.db).kind { + // `Mut` type unwrapping that was already handled in `lower_type` continue; } + eprintln!( + "{}: {} -> {}", + expr.kind, + expr_ty.as_string(self.db), + into_ty.as_string(self.db) + ); + + // XXX blah let tmp = self.map_to_tmp(inst, expr_ty); if expr_ty.is_ptr(self.db) && !into_ty.is_ptr(self.db) { - inst = self.builder.load(tmp, expr.into()); - } else if expr_ty.is_string(self.db) { + if into_ty.is_primitive(self.db) { + inst = self.builder.load(tmp, expr.into()); + } else { + inst = self.builder.mem_copy(tmp, expr.into()); + } + } else if expr_ty.deref(self.db).is_string(self.db) { // XXX handle string size difference } else { - dbg!(expr_ty.as_string(self.db), into_ty.as_string(self.db)); inst = self.builder.cast(tmp, into_ty, expr.into()); } expr_ty = into_ty; diff --git a/crates/mir/src/lower/types.rs b/crates/mir/src/lower/types.rs index 4f2071bdf8..f79e1c7934 100644 --- a/crates/mir/src/lower/types.rs +++ b/crates/mir/src/lower/types.rs @@ -11,10 +11,14 @@ use fe_analyzer::namespace::{items as analyzer_items, types as analyzer_types}; pub fn lower_type(db: &dyn MirDb, analyzer_ty: analyzer_types::TypeId) -> TypeId { let ty_kind = match analyzer_ty.typ(db.upcast()) { analyzer_types::Type::SPtr(inner) => TypeKind::SPtr(lower_type(db, inner)), - analyzer_types::Type::Mut(inner) => { - // XXX lower to MPtr - return lower_type(db, inner); - } + // XXX this results in unexpected MIR TypeId inequalities + // (when different analyzer types map to the same MIR type) + analyzer_types::Type::Mut(inner) => match inner.typ(db.upcast()) { + analyzer_types::Type::SPtr(t) => TypeKind::SPtr(lower_type(db, t)), + analyzer_types::Type::Base(t) => lower_base(t), + analyzer_types::Type::Contract(_) => TypeKind::Address, + _ => TypeKind::MPtr(lower_type(db, inner)), + }, analyzer_types::Type::Base(base) => lower_base(base), analyzer_types::Type::Array(arr) => lower_array(db, &arr), analyzer_types::Type::Map(map) => lower_map(db, &map), diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap.new b/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap.new new file mode 100644 index 0000000000..f1a8f7a698 --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__erc20.snap.new @@ -0,0 +1,122 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"demos/erc20_token.fe\", src)" + +--- +contract ERC20 { + _balances: Map + _allowances: Map> + _total_supply: u256 + _name: String<100> + _symbol: String<100> + _decimals: u8 + + event Approval { + idx owner: address + idx spender: address + value: u256 + } + + event Transfer { + idx from: address + idx to: address + value: u256 + } + + pub fn __init__(mut self, mut ctx: Context, name: String<100>, symbol: String<100>) { + self._name = name + self._symbol = symbol + self._decimals = u8(18) + self._mint(ctx, account: ctx.msg_sender(), value: 1000_000_000_000_000_000_000_000) + } + + pub fn name(self) -> String<100> { + return self._name.to_mem() + } + + pub fn symbol(self) -> String<100> { + return self._symbol.to_mem() + } + + pub fn decimals(self) -> u8 { + return self._decimals + } + + pub fn totalSupply(self) -> u256 { + return self._total_supply + } + + pub fn balanceOf(self, _ account: address) -> u256 { + return self._balances[account] + } + + pub fn transfer(mut self, mut ctx: Context, recipient: address, value: u256) -> bool { + self._transfer(ctx, sender: ctx.msg_sender(), recipient, value) + return true + } + + pub fn allowance(self, owner: address, spender: address) -> u256 { + return self._allowances[owner][spender] + } + + pub fn approve(mut self, mut ctx: Context, spender: address, value: u256) -> bool { + self._approve(ctx, owner: ctx.msg_sender(), spender, value) + return true + } + + 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(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(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(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) + self._balances[sender] = self._balances[sender] - value + self._balances[recipient] = self._balances[recipient] + value + emit Transfer(ctx, from: sender, to: recipient, value) + } + + 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 + self._balances[account] = self._balances[account] + value + emit Transfer(ctx, from: address(0), to: account, value) + } + + 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 + self._total_supply = self._total_supply - value + emit Transfer(ctx, from: account, to: address(0), value) + } + + 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(mut self, _ decimals_: u8) { + self._decimals = decimals_ + } + + fn _before_token_transfer(from: address, to: address, _ value: u256) {} +} + diff --git a/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap.new b/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap.new new file mode 100644 index 0000000000..f42d6ad366 --- /dev/null +++ b/crates/parser/tests/cases/snapshots/cases__print_ast__guest_book.snap.new @@ -0,0 +1,22 @@ +--- +source: crates/parser/tests/cases/print_ast.rs +expression: "parse_and_print(\"demos/guest_book.fe\", src)" + +--- +contract GuestBook { + messages: Map> + + event Signed { + book_msg: String<100> + } + + pub fn sign(mut self, ctx: Context, book_msg: String<100>) { + self.messages[ctx.msg_sender()] = book_msg + emit Signed(ctx, book_msg) + } + + pub fn get_msg(self, addr: address) -> String<100> { + return self.messages[addr].to_mem() + } +} + diff --git a/crates/test-files/fixtures/stress/data_copying_stress.fe b/crates/test-files/fixtures/stress/data_copying_stress.fe index aaf296e61a..803f2a029f 100644 --- a/crates/test-files/fixtures/stress/data_copying_stress.fe +++ b/crates/test-files/fixtures/stress/data_copying_stress.fe @@ -23,18 +23,18 @@ contract Foo { self.my_u256 = self.my_other_u256 } - // XXX change this pub fn multiple_references_shared_memory(mut my_array: Array) { let my_2nd_array: Array = my_array let mut my_3rd_array: Array = my_2nd_array + assert my_array[3] != 5 my_array[3] = 5 assert my_array[3] == 5 - assert my_2nd_array[3] == 5 - assert my_3rd_array[3] == 5 + assert my_2nd_array[3] != 5 + assert my_3rd_array[3] != 5 my_3rd_array[3] = 50 - assert my_array[3] == 50 - assert my_2nd_array[3] == 50 + assert my_array[3] == 5 + assert my_2nd_array[3] == 5 assert my_3rd_array[3] == 50 } @@ -51,6 +51,7 @@ contract Foo { pub fn clone_mutate_and_return(my_array: Array) -> Array { let mut a: Array = my_array a[3] = 5 + assert my_array[3] != 5 return my_array } diff --git a/crates/tests/src/features.rs b/crates/tests/src/features.rs index a07a3a546c..9a195eb5b2 100644 --- a/crates/tests/src/features.rs +++ b/crates/tests/src/features.rs @@ -265,189 +265,193 @@ fn test_arrays() { }) } -#[rstest(fixture_file, input, expected, - case("const_local.fe", &[], uint_token(42)), - case("for_loop_with_static_array.fe", &[], uint_token(30)), - case("for_loop_with_static_array_from_sto.fe", &[], uint_token(6)), - case("for_loop_with_break.fe", &[], uint_token(15)), - case("for_loop_with_continue.fe", &[], uint_token(17)), - case("while_loop_with_continue.fe", &[], uint_token(1)), - case("while_loop.fe", &[], uint_token(3)), - case("while_loop_test_from_sto.fe", &[], uint_token(42)), - case("while_loop_with_break.fe", &[], uint_token(1)), - case("while_loop_with_break_2.fe", &[], uint_token(1)), - case("if_statement.fe", &[uint_token(6)], uint_token(1)), - case("if_statement.fe", &[uint_token(4)], uint_token(0)), - case("if_statement_test_from_sto.fe", &[], uint_token(42)), - case("if_statement_2.fe", &[uint_token(6)], uint_token(1)), - case("if_statement_with_block_declaration.fe", &[], uint_token(1)), - case("ternary_expression.fe", &[uint_token(6)], uint_token(1)), - case("ternary_expression.fe", &[uint_token(4)], uint_token(0)), - case("call_statement_without_args.fe", &[], uint_token(100)), - case("call_statement_with_args.fe", &[], uint_token(100)), - case("call_statement_with_args_2.fe", &[], uint_token(100)), - case("return_bool_true.fe", &[], bool_token(true)), - case("return_bool_false.fe", &[], bool_token(false)), - case("return_bool_inverted.fe", &[bool_token(true)], bool_token(false)), - case("return_bool_inverted.fe", &[bool_token(false)], bool_token(true)), - case("return_u256_from_called_fn_with_args.fe", &[], uint_token(200)), - case("return_u256_from_called_fn.fe", &[], uint_token(42)), - case("return_u256.fe", &[], uint_token(42)), - case("return_i256.fe", &[], int_token(-3)), - case("return_from_storage_i8.fe", &[int_token(-3)], int_token(-6)), - case("return_from_storage_array_i8.fe", &[int_token(-10)], int_array_token(&[-10])), - case("return_from_memory_i8.fe", &[int_token(-3)], int_token(-6)), - case("return_identity_u256.fe", &[uint_token(42)], uint_token(42)), - case("return_identity_u128.fe", &[uint_token(42)], uint_token(42)), - case("return_identity_u64.fe", &[uint_token(42)], uint_token(42)), - case("return_identity_u32.fe", &[uint_token(42)], uint_token(42)), - case("return_identity_u16.fe", &[uint_token(42)], uint_token(42)), - case("return_identity_u8.fe", &[uint_token(42)], uint_token(42)), - case("return_u128_cast.fe", &[], uint_token(42)), - case("return_i128_cast.fe", &[], int_token(-3)), - case("return_cast_u8_to_signed.fe", &[uint_token(253)], int_token(-3)), - case("return_cast_u8_to_signed.fe", &[uint_token(127)], int_token(127)), - case("return_cast_u8_to_signed.fe", &[uint_token(128)], int_token(-128)), - case("return_cast_u8_to_signed.fe", &[uint_token(129)], int_token(-127)), - case("return_cast_u8_to_signed.fe", &[uint_token(0)], int_token(0)), - case("return_cast_u8_to_signed.fe", &[uint_token(1)], int_token(1)), - case("return_cast_i8_to_unsigned.fe", &[int_token(-3)], uint_token(253)), - case("return_cast_i8_to_unsigned.fe", &[int_token(-128)], uint_token(128)), - case("return_cast_i8_to_unsigned.fe", &[int_token(-127)], uint_token(129)), - case("return_cast_i8_to_unsigned.fe", &[int_token(127)], uint_token(127)), - case("return_cast_i8_to_unsigned.fe", &[int_token(0)], uint_token(0)), - case("return_cast_i8_to_unsigned.fe", &[int_token(1)], uint_token(1)), - case("return_msg_sig.fe", &[], uint_token(4273672062)), - case("return_sum_list_expression_1.fe", &[], uint_token(210)), - case("return_sum_list_expression_2.fe", &[], uint_token(210)), - case("pure_fn.fe", &[uint_token(42), uint_token(26)], uint_token(68)), - case("pure_fn_internal_call.fe", &[uint_token(42), uint_token(26)], uint_token(68)), - case("pure_fn_standalone.fe", &[uint_token(5)], uint_token(210)), - // unary invert - case("return_invert_i256.fe", &[int_token(1)], int_token(-2)), - case("return_invert_i128.fe", &[int_token(1)], int_token(-2)), - case("return_invert_i64.fe", &[int_token(4000000000)], int_token(-4000000001)), - case("return_invert_i32.fe", &[int_token(30000)], int_token(-30001)), - case("return_invert_i16.fe", &[int_token(2000)], int_token(-2001)), - case("return_invert_i8.fe", &[int_token(1)], int_token(-2)), - case("return_invert_u256.fe", &[uint_token(1)], uint_token_from_dec_str("115792089237316195423570985008687907853269984665640564039457584007913129639934")), - case("return_invert_u128.fe", &[uint_token(1)], uint_token_from_dec_str("340282366920938463463374607431768211454")), - case("return_invert_u64.fe", &[uint_token(1)], uint_token_from_dec_str("18446744073709551614")), - case("return_invert_u32.fe", &[uint_token(1)], uint_token(4294967294)), - case("return_invert_u16.fe", &[uint_token(1)], uint_token(65534)), - case("return_invert_u8.fe", &[uint_token(1)], uint_token(254)), - // binary operators - case("return_addition_u256.fe", &[uint_token(42), uint_token(42)], uint_token(84)), - case("return_addition_i256.fe", &[int_token(-42), int_token(-42)], int_token(-84)), - case("return_addition_i256.fe", &[int_token(-42), int_token(42)], int_token(0)), - case("return_addition_u128.fe", &[uint_token(42), uint_token(42)], uint_token(84)), - case("return_subtraction_u256.fe", &[uint_token(42), uint_token(42)], uint_token(0)), - case("return_subtraction_i256.fe", &[int_token(-42), int_token(-42)], int_token(0)), - case("return_subtraction_i256.fe", &[int_token(-42), int_token(42)], int_token(-84)), - case("return_multiplication_u256.fe", &[uint_token(42), uint_token(42)], uint_token(1764)), - case("return_multiplication_i256.fe", &[int_token(-42), int_token(-42)], int_token(1764)), - case("return_multiplication_i256.fe", &[int_token(-42), int_token(42)], int_token(-1764)), - case("return_division_u256.fe", &[uint_token(42), uint_token(42)], uint_token(1)), - case("return_division_i256.fe", &[int_token(-42), int_token(-42)], int_token(1)), - case("return_division_i256.fe", &[int_token(-1), int_token(1)], int_token(-1)), - case("return_division_i256.fe", &[int_token(-42), int_token(42)], int_token(-1)), - case("return_pow_u256.fe", &[uint_token(2), uint_token(0)], uint_token(1)), - case("return_pow_u256.fe", &[uint_token(2), uint_token(4)], uint_token(16)), - case("return_pow_i256.fe", &[int_token(-2), uint_token(3)], int_token(-8)), - case("return_mod_u256.fe", &[uint_token(5), uint_token(2)], uint_token(1)), - case("return_mod_u256.fe", &[uint_token(5), uint_token(3)], uint_token(2)), - case("return_mod_u256.fe", &[uint_token(5), uint_token(5)], uint_token(0)), - case("return_mod_i256.fe", &[int_token(5), int_token(2)], int_token(1)), - case("return_mod_i256.fe", &[int_token(5), int_token(3)], int_token(2)), - case("return_mod_i256.fe", &[int_token(5), int_token(5)], int_token(0)), - case("return_bitwiseand_u256.fe", &[uint_token(12), uint_token(25)], uint_token(8)), - case("return_bitwiseand_u128.fe", &[uint_token(12), uint_token(25)], uint_token(8)), - case("return_bitwiseor_u256.fe", &[uint_token(12), uint_token(25)], uint_token(29)), - case("return_bitwisexor_u256.fe", &[uint_token(12), uint_token(25)], uint_token(21)), - case("return_bitwiseshl_u8.fe", &[uint_token(1), uint_token(8)], uint_token(0)), - case("return_bitwiseshl_i8.fe", &[int_token(-1), uint_token(1)], int_token(-2)), - case("return_bitwiseshl_u256.fe", &[uint_token(212), uint_token(0)], uint_token(212)), - case("return_bitwiseshl_u256.fe", &[uint_token(212), uint_token(1)], uint_token(424)), - case("return_bitwiseshr_u256.fe", &[uint_token(212), uint_token(0)], uint_token(212)), - case("return_bitwiseshr_u256.fe", &[uint_token(212), uint_token(1)], uint_token(106)), - case("return_bitwiseshr_i256.fe", &[int_token(212), uint_token(0)], int_token(212)), - case("return_bitwiseshr_i256.fe", &[int_token(212), uint_token(1)], int_token(106)), - case("return_bitwiseshl_i64_coerced.fe", &[], int_token(-1)), - // comparison operators - case("return_eq_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true)), - case("return_eq_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false)), - case("return_noteq_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false)), - case("return_noteq_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true)), - case("return_lt_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true)), - case("return_lt_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false)), - case("return_lt_u256.fe", &[uint_token(2), uint_token(1)], bool_token(false)), - case("return_lt_u128.fe", &[uint_token(1), uint_token(2)], bool_token(true)), - // lt_i256 with positive and negative numbers - case("return_lt_i256.fe", &[int_token(1), int_token(2)], bool_token(true)), - case("return_lt_i256.fe", &[int_token(1), int_token(1)], bool_token(false)), - case("return_lt_i256.fe", &[int_token(2), int_token(1)], bool_token(false)), - case("return_lt_i256.fe", &[int_token(-2), int_token(-1)], bool_token(true)), - case("return_lt_i256.fe", &[int_token(-1), int_token(-1)], bool_token(false)), - case("return_lt_i256.fe", &[int_token(-1), int_token(-2)], bool_token(false)), - case("return_lte_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true)), - case("return_lte_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true)), - // lte_i256 with positive and negative numbers - case("return_lte_u256.fe", &[uint_token(2), uint_token(1)], bool_token(false)), - case("return_lte_i256.fe", &[int_token(1), int_token(2)], bool_token(true)), - case("return_lte_i256.fe", &[int_token(1), int_token(1)], bool_token(true)), - case("return_lte_i256.fe", &[int_token(2), int_token(1)], bool_token(false)), - case("return_lte_i256.fe", &[int_token(-2), int_token(-1)], bool_token(true)), - case("return_lte_i256.fe", &[int_token(-1), int_token(-1)], bool_token(true)), - case("return_lte_i256.fe", &[int_token(-1), int_token(-2)], bool_token(false)), - case("return_gt_u256.fe", &[uint_token(2), uint_token(1)], bool_token(true)), - case("return_gt_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false)), - case("return_gt_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false)), - // gt_i256 with positive and negative numbers - case("return_gt_i256.fe", &[int_token(2), int_token(1)], bool_token(true)), - case("return_gt_i256.fe", &[int_token(1), int_token(1)], bool_token(false)), - case("return_gt_i256.fe", &[int_token(1), int_token(2)], bool_token(false)), - case("return_gt_i256.fe", &[int_token(-1), int_token(-2)], bool_token(true)), - case("return_gt_i256.fe", &[int_token(-1), int_token(-1)], bool_token(false)), - case("return_gt_i256.fe", &[int_token(-2), int_token(-1)], bool_token(false)), - case("return_gte_u256.fe", &[uint_token(2), uint_token(1)], bool_token(true)), - case("return_gte_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true)), - case("return_gte_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false)), - // gte_i256 with positive and negative numbers - case("return_gte_i256.fe", &[int_token(2), int_token(1)], bool_token(true)), - case("return_gte_i256.fe", &[int_token(1), int_token(1)], bool_token(true)), - case("return_gte_i256.fe", &[int_token(1), int_token(2)], bool_token(false)), - case("return_gte_i256.fe", &[int_token(-1), int_token(-2)], bool_token(true)), - case("return_gte_i256.fe", &[int_token(-1), int_token(-1)], bool_token(true)), - case("return_gte_i256.fe", &[int_token(-2), int_token(-1)], bool_token(false)), - // `and` bool operation - case("return_bool_op_and.fe", &[bool_token(true), bool_token(true)], bool_token(true)), - case("return_bool_op_and.fe", &[bool_token(true), bool_token(false)], bool_token(false)), - case("return_bool_op_and.fe", &[bool_token(false), bool_token(true)], bool_token(false)), - case("return_bool_op_and.fe", &[bool_token(false), bool_token(false)], bool_token(false)), - // `or` bool operation - case("return_bool_op_or.fe", &[bool_token(true), bool_token(true)], bool_token(true)), - case("return_bool_op_or.fe", &[bool_token(true), bool_token(false)], bool_token(true)), - case("return_bool_op_or.fe", &[bool_token(false), bool_token(true)], bool_token(true)), - case("return_bool_op_or.fe", &[bool_token(false), bool_token(false)], bool_token(false)), - // radix - case("radix_hex.fe", &[], uint_token(0xfe)), - case("radix_octal.fe", &[], uint_token(0o70)), - case("radix_binary.fe", &[], uint_token(0b10)), - case::map_tuple("map_tuple.fe", &[uint_token(1234)], uint_token(1234)), - case::int_literal_coercion("int_literal_coercion.fe", &[], uint_token(300)), - case::associated_fns("associated_fns.fe", &[uint_token(12)], uint_token(144)), - case::struct_fns("struct_fns.fe", &[uint_token(10), uint_token(20)], uint_token(100)), - case::cast_address_to_u256("cast_address_to_u256.fe", &[address_token(SOME_ADDRESS)], address_token(SOME_ADDRESS)), - case("for_loop_with_complex_elem_array.fe", &[], int_token(222)), -)] -fn test_method_return(fixture_file: &str, input: &[ethabi::Token], expected: ethabi::Token) { - with_executor(&|mut executor| { - let harness = deploy_contract(&mut executor, fixture_file, "Foo", &[]); - harness.test_function(&mut executor, "bar", input, Some(&expected)); - assert_harness_gas_report!(harness); - }) +macro_rules! test_method_return { + ($name:ident, $path:expr, $input:expr, $expected:expr) => { + #[test] + fn $name() { + with_executor(&|mut executor| { + let harness = deploy_contract(&mut executor, $path, "Foo", &[]); + harness.test_function(&mut executor, "bar", $input, Some(&$expected)); + assert_harness_gas_report!(harness); + }) + } + }; } +test_method_return! { const_local, "const_local.fe", &[], uint_token(42) } +test_method_return! { for_loop_with_static_array, "for_loop_with_static_array.fe", &[], uint_token(30) } +test_method_return! { for_loop_with_static_array_from_sto, "for_loop_with_static_array_from_sto.fe", &[], uint_token(6) } +test_method_return! { for_loop_with_break, "for_loop_with_break.fe", &[], uint_token(15) } +test_method_return! { for_loop_with_continue, "for_loop_with_continue.fe", &[], uint_token(17) } +test_method_return! { while_loop_with_continue, "while_loop_with_continue.fe", &[], uint_token(1) } +test_method_return! { while_loop, "while_loop.fe", &[], uint_token(3) } +test_method_return! { while_loop_test_from_sto, "while_loop_test_from_sto.fe", &[], uint_token(42) } +test_method_return! { while_loop_with_break, "while_loop_with_break.fe", &[], uint_token(1) } +test_method_return! { while_loop_with_break_2, "while_loop_with_break_2.fe", &[], uint_token(1) } +test_method_return! { if_statement_a, "if_statement.fe", &[uint_token(6)], uint_token(1) } +test_method_return! { if_statement_b, "if_statement.fe", &[uint_token(4)], uint_token(0) } +test_method_return! { if_statement_test_from_sto, "if_statement_test_from_sto.fe", &[], uint_token(42) } +test_method_return! { if_statement_2, "if_statement_2.fe", &[uint_token(6)], uint_token(1) } +test_method_return! { if_statement_with_block_declaration, "if_statement_with_block_declaration.fe", &[], uint_token(1) } +test_method_return! { ternary_expression_a, "ternary_expression.fe", &[uint_token(6)], uint_token(1) } +test_method_return! { ternary_expression_b, "ternary_expression.fe", &[uint_token(4)], uint_token(0) } +test_method_return! { call_statement_without_args, "call_statement_without_args.fe", &[], uint_token(100) } +test_method_return! { call_statement_with_args, "call_statement_with_args.fe", &[], uint_token(100) } +test_method_return! { call_statement_with_args_2, "call_statement_with_args_2.fe", &[], uint_token(100) } +test_method_return! { return_bool_true, "return_bool_true.fe", &[], bool_token(true) } +test_method_return! { return_bool_false, "return_bool_false.fe", &[], bool_token(false) } +test_method_return! { return_bool_inverted_a, "return_bool_inverted.fe", &[bool_token(true)], bool_token(false) } +test_method_return! { return_bool_inverted_b, "return_bool_inverted.fe", &[bool_token(false)], bool_token(true) } +test_method_return! { return_u256_from_called_fn_with_args, "return_u256_from_called_fn_with_args.fe", &[], uint_token(200) } +test_method_return! { return_u256_from_called_fn, "return_u256_from_called_fn.fe", &[], uint_token(42) } +test_method_return! { return_u256, "return_u256.fe", &[], uint_token(42) } +test_method_return! { return_i256, "return_i256.fe", &[], int_token(-3) } +test_method_return! { return_from_storage_i8, "return_from_storage_i8.fe", &[int_token(-3)], int_token(-6) } +test_method_return! { return_from_storage_array_i8, "return_from_storage_array_i8.fe", &[int_token(-10)], int_array_token(&[-10]) } +test_method_return! { return_from_memory_i8, "return_from_memory_i8.fe", &[int_token(-3)], int_token(-6) } +test_method_return! { return_identity_u256, "return_identity_u256.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_identity_u128, "return_identity_u128.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_identity_u64, "return_identity_u64.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_identity_u32, "return_identity_u32.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_identity_u16, "return_identity_u16.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_identity_u8, "return_identity_u8.fe", &[uint_token(42)], uint_token(42) } +test_method_return! { return_u128_cast, "return_u128_cast.fe", &[], uint_token(42) } +test_method_return! { return_i128_cast, "return_i128_cast.fe", &[], int_token(-3) } +test_method_return! { return_cast_u8_to_signed_a, "return_cast_u8_to_signed.fe", &[uint_token(253)], int_token(-3) } +test_method_return! { return_cast_u8_to_signed_b, "return_cast_u8_to_signed.fe", &[uint_token(127)], int_token(127) } +test_method_return! { return_cast_u8_to_signed_c, "return_cast_u8_to_signed.fe", &[uint_token(128)], int_token(-128) } +test_method_return! { return_cast_u8_to_signed_d, "return_cast_u8_to_signed.fe", &[uint_token(129)], int_token(-127) } +test_method_return! { return_cast_u8_to_signed_e, "return_cast_u8_to_signed.fe", &[uint_token(0)], int_token(0) } +test_method_return! { return_cast_u8_to_signed_f, "return_cast_u8_to_signed.fe", &[uint_token(1)], int_token(1) } +test_method_return! { return_cast_i8_to_unsigned_a, "return_cast_i8_to_unsigned.fe", &[int_token(-3)], uint_token(253) } +test_method_return! { return_cast_i8_to_unsigned_b, "return_cast_i8_to_unsigned.fe", &[int_token(-128)], uint_token(128) } +test_method_return! { return_cast_i8_to_unsigned_c, "return_cast_i8_to_unsigned.fe", &[int_token(-127)], uint_token(129) } +test_method_return! { return_cast_i8_to_unsigned_d, "return_cast_i8_to_unsigned.fe", &[int_token(127)], uint_token(127) } +test_method_return! { return_cast_i8_to_unsigned_e, "return_cast_i8_to_unsigned.fe", &[int_token(0)], uint_token(0) } +test_method_return! { return_cast_i8_to_unsigned_f, "return_cast_i8_to_unsigned.fe", &[int_token(1)], uint_token(1) } +test_method_return! { return_msg_sig, "return_msg_sig.fe", &[], uint_token(4273672062) } +test_method_return! { return_sum_list_expression_1, "return_sum_list_expression_1.fe", &[], uint_token(210) } +test_method_return! { return_sum_list_expression_2, "return_sum_list_expression_2.fe", &[], uint_token(210) } +test_method_return! { pure_fn, "pure_fn.fe", &[uint_token(42), uint_token(26)], uint_token(68) } +test_method_return! { pure_fn_internal_call, "pure_fn_internal_call.fe", &[uint_token(42), uint_token(26)], uint_token(68) } +test_method_return! { pure_fn_standalone, "pure_fn_standalone.fe", &[uint_token(5)], uint_token(210) } +// unary invert +test_method_return! { return_invert_i256, "return_invert_i256.fe", &[int_token(1)], int_token(-2) } +test_method_return! { return_invert_i128, "return_invert_i128.fe", &[int_token(1)], int_token(-2) } +test_method_return! { return_invert_i64, "return_invert_i64.fe", &[int_token(4000000000)], int_token(-4000000001) } +test_method_return! { return_invert_i32, "return_invert_i32.fe", &[int_token(30000)], int_token(-30001) } +test_method_return! { return_invert_i16, "return_invert_i16.fe", &[int_token(2000)], int_token(-2001) } +test_method_return! { return_invert_i8, "return_invert_i8.fe", &[int_token(1)], int_token(-2) } +test_method_return! { return_invert_u256, "return_invert_u256.fe", &[uint_token(1)], uint_token_from_dec_str("115792089237316195423570985008687907853269984665640564039457584007913129639934") } +test_method_return! { return_invert_u128, "return_invert_u128.fe", &[uint_token(1)], uint_token_from_dec_str("340282366920938463463374607431768211454") } +test_method_return! { return_invert_u64, "return_invert_u64.fe", &[uint_token(1)], uint_token_from_dec_str("18446744073709551614") } +test_method_return! { return_invert_u32, "return_invert_u32.fe", &[uint_token(1)], uint_token(4294967294) } +test_method_return! { return_invert_u16, "return_invert_u16.fe", &[uint_token(1)], uint_token(65534) } +test_method_return! { return_invert_u8, "return_invert_u8.fe", &[uint_token(1)], uint_token(254) } +// binary operators +test_method_return! { return_addition_u256, "return_addition_u256.fe", &[uint_token(42), uint_token(42)], uint_token(84) } +test_method_return! { return_addition_i256_a, "return_addition_i256.fe", &[int_token(-42), int_token(-42)], int_token(-84) } +test_method_return! { return_addition_i256_b, "return_addition_i256.fe", &[int_token(-42), int_token(42)], int_token(0) } +test_method_return! { return_addition_u128, "return_addition_u128.fe", &[uint_token(42), uint_token(42)], uint_token(84) } +test_method_return! { return_subtraction_u256, "return_subtraction_u256.fe", &[uint_token(42), uint_token(42)], uint_token(0) } +test_method_return! { return_subtraction_i256_a, "return_subtraction_i256.fe", &[int_token(-42), int_token(-42)], int_token(0) } +test_method_return! { return_subtraction_i256_b, "return_subtraction_i256.fe", &[int_token(-42), int_token(42)], int_token(-84) } +test_method_return! { return_multiplication_u256, "return_multiplication_u256.fe", &[uint_token(42), uint_token(42)], uint_token(1764) } +test_method_return! { return_multiplication_i256_a, "return_multiplication_i256.fe", &[int_token(-42), int_token(-42)], int_token(1764) } +test_method_return! { return_multiplication_i256_b, "return_multiplication_i256.fe", &[int_token(-42), int_token(42)], int_token(-1764) } +test_method_return! { return_division_u256, "return_division_u256.fe", &[uint_token(42), uint_token(42)], uint_token(1) } +test_method_return! { return_division_i256_a, "return_division_i256.fe", &[int_token(-42), int_token(-42)], int_token(1) } +test_method_return! { return_division_i256_b, "return_division_i256.fe", &[int_token(-1), int_token(1)], int_token(-1) } +test_method_return! { return_division_i256_c, "return_division_i256.fe", &[int_token(-42), int_token(42)], int_token(-1) } +test_method_return! { return_pow_u256_a, "return_pow_u256.fe", &[uint_token(2), uint_token(0)], uint_token(1) } +test_method_return! { return_pow_u256_b, "return_pow_u256.fe", &[uint_token(2), uint_token(4)], uint_token(16) } +test_method_return! { return_pow_i256, "return_pow_i256.fe", &[int_token(-2), uint_token(3)], int_token(-8) } +test_method_return! { return_mod_u256_a, "return_mod_u256.fe", &[uint_token(5), uint_token(2)], uint_token(1) } +test_method_return! { return_mod_u256_b, "return_mod_u256.fe", &[uint_token(5), uint_token(3)], uint_token(2) } +test_method_return! { return_mod_u256_c, "return_mod_u256.fe", &[uint_token(5), uint_token(5)], uint_token(0) } +test_method_return! { return_mod_i256_a, "return_mod_i256.fe", &[int_token(5), int_token(2)], int_token(1) } +test_method_return! { return_mod_i256_b, "return_mod_i256.fe", &[int_token(5), int_token(3)], int_token(2) } +test_method_return! { return_mod_i256_c, "return_mod_i256.fe", &[int_token(5), int_token(5)], int_token(0) } +test_method_return! { return_bitwiseand_u256, "return_bitwiseand_u256.fe", &[uint_token(12), uint_token(25)], uint_token(8) } +test_method_return! { return_bitwiseand_u128, "return_bitwiseand_u128.fe", &[uint_token(12), uint_token(25)], uint_token(8) } +test_method_return! { return_bitwiseor_u256, "return_bitwiseor_u256.fe", &[uint_token(12), uint_token(25)], uint_token(29) } +test_method_return! { return_bitwisexor_u256, "return_bitwisexor_u256.fe", &[uint_token(12), uint_token(25)], uint_token(21) } +test_method_return! { return_bitwiseshl_u8, "return_bitwiseshl_u8.fe", &[uint_token(1), uint_token(8)], uint_token(0) } +test_method_return! { return_bitwiseshl_i8, "return_bitwiseshl_i8.fe", &[int_token(-1), uint_token(1)], int_token(-2) } +test_method_return! { return_bitwiseshl_u256_a, "return_bitwiseshl_u256.fe", &[uint_token(212), uint_token(0)], uint_token(212) } +test_method_return! { return_bitwiseshl_u256_b, "return_bitwiseshl_u256.fe", &[uint_token(212), uint_token(1)], uint_token(424) } +test_method_return! { return_bitwiseshr_u256_c, "return_bitwiseshr_u256.fe", &[uint_token(212), uint_token(0)], uint_token(212) } +test_method_return! { return_bitwiseshr_u256_d, "return_bitwiseshr_u256.fe", &[uint_token(212), uint_token(1)], uint_token(106) } +test_method_return! { return_bitwiseshr_i256_a, "return_bitwiseshr_i256.fe", &[int_token(212), uint_token(0)], int_token(212) } +test_method_return! { return_bitwiseshr_i256_b, "return_bitwiseshr_i256.fe", &[int_token(212), uint_token(1)], int_token(106) } +test_method_return! { return_bitwiseshl_i64_coerced, "return_bitwiseshl_i64_coerced.fe", &[], int_token(-1) } +// comparison operators +test_method_return! { return_eq_u256_a, "return_eq_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true) } +test_method_return! { return_eq_u256_b, "return_eq_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false) } +test_method_return! { return_noteq_u256a, "return_noteq_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false) } +test_method_return! { return_noteq_u256b, "return_noteq_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true) } +test_method_return! { return_lt_u256_a, "return_lt_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true) } +test_method_return! { return_lt_u256_b, "return_lt_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false) } +test_method_return! { return_lt_u256_c, "return_lt_u256.fe", &[uint_token(2), uint_token(1)], bool_token(false) } +test_method_return! { return_lt_u128, "return_lt_u128.fe", &[uint_token(1), uint_token(2)], bool_token(true) } +// lt_i256 with positive and negative numbers +test_method_return! { return_lt_i256_a, "return_lt_i256.fe", &[int_token(1), int_token(2)], bool_token(true) } +test_method_return! { return_lt_i256_b, "return_lt_i256.fe", &[int_token(1), int_token(1)], bool_token(false) } +test_method_return! { return_lt_i256_c, "return_lt_i256.fe", &[int_token(2), int_token(1)], bool_token(false) } +test_method_return! { return_lt_i256_d, "return_lt_i256.fe", &[int_token(-2), int_token(-1)], bool_token(true) } +test_method_return! { return_lt_i256_e, "return_lt_i256.fe", &[int_token(-1), int_token(-1)], bool_token(false) } +test_method_return! { return_lt_i256_f, "return_lt_i256.fe", &[int_token(-1), int_token(-2)], bool_token(false) } +test_method_return! { return_lte_u256_a, "return_lte_u256.fe", &[uint_token(1), uint_token(2)], bool_token(true) } +test_method_return! { return_lte_u256_b, "return_lte_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true) } +// lte_i256 with positive and negative numbers +test_method_return! { return_lte_u256, "return_lte_u256.fe", &[uint_token(2), uint_token(1)], bool_token(false) } +test_method_return! { return_lte_i256_a, "return_lte_i256.fe", &[int_token(1), int_token(2)], bool_token(true) } +test_method_return! { return_lte_i256_b, "return_lte_i256.fe", &[int_token(1), int_token(1)], bool_token(true) } +test_method_return! { return_lte_i256_c, "return_lte_i256.fe", &[int_token(2), int_token(1)], bool_token(false) } +test_method_return! { return_lte_i256_d, "return_lte_i256.fe", &[int_token(-2), int_token(-1)], bool_token(true) } +test_method_return! { return_lte_i256_e, "return_lte_i256.fe", &[int_token(-1), int_token(-1)], bool_token(true) } +test_method_return! { return_lte_i256_f, "return_lte_i256.fe", &[int_token(-1), int_token(-2)], bool_token(false) } +test_method_return! { return_gt_u256_a, "return_gt_u256.fe", &[uint_token(2), uint_token(1)], bool_token(true) } +test_method_return! { return_gt_u256_b, "return_gt_u256.fe", &[uint_token(1), uint_token(1)], bool_token(false) } +test_method_return! { return_gt_u256_c, "return_gt_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false) } +// gt_i256 with positive and negative numbers +test_method_return! { return_gt_i256_a, "return_gt_i256.fe", &[int_token(2), int_token(1)], bool_token(true) } +test_method_return! { return_gt_i256_b, "return_gt_i256.fe", &[int_token(1), int_token(1)], bool_token(false) } +test_method_return! { return_gt_i256_c, "return_gt_i256.fe", &[int_token(1), int_token(2)], bool_token(false) } +test_method_return! { return_gt_i256_d, "return_gt_i256.fe", &[int_token(-1), int_token(-2)], bool_token(true) } +test_method_return! { return_gt_i256_e, "return_gt_i256.fe", &[int_token(-1), int_token(-1)], bool_token(false) } +test_method_return! { return_gt_i256_f, "return_gt_i256.fe", &[int_token(-2), int_token(-1)], bool_token(false) } +test_method_return! { return_gte_u256_a, "return_gte_u256.fe", &[uint_token(2), uint_token(1)], bool_token(true) } +test_method_return! { return_gte_u256_b, "return_gte_u256.fe", &[uint_token(1), uint_token(1)], bool_token(true) } +test_method_return! { return_gte_u256_c, "return_gte_u256.fe", &[uint_token(1), uint_token(2)], bool_token(false) } +// gte_i256 with positive and negative numbers +test_method_return! { return_gte_i256_a, "return_gte_i256.fe", &[int_token(2), int_token(1)], bool_token(true) } +test_method_return! { return_gte_i256_b, "return_gte_i256.fe", &[int_token(1), int_token(1)], bool_token(true) } +test_method_return! { return_gte_i256_c, "return_gte_i256.fe", &[int_token(1), int_token(2)], bool_token(false) } +test_method_return! { return_gte_i256_d, "return_gte_i256.fe", &[int_token(-1), int_token(-2)], bool_token(true) } +test_method_return! { return_gte_i256_e, "return_gte_i256.fe", &[int_token(-1), int_token(-1)], bool_token(true) } +test_method_return! { return_gte_i256_f, "return_gte_i256.fe", &[int_token(-2), int_token(-1)], bool_token(false) } +// `and` bool operation +test_method_return! { return_bool_op_and_a, "return_bool_op_and.fe", &[bool_token(true), bool_token(true)], bool_token(true) } +test_method_return! { return_bool_op_and_b, "return_bool_op_and.fe", &[bool_token(true), bool_token(false)], bool_token(false) } +test_method_return! { return_bool_op_and_c, "return_bool_op_and.fe", &[bool_token(false), bool_token(true)], bool_token(false) } +test_method_return! { return_bool_op_and_d, "return_bool_op_and.fe", &[bool_token(false), bool_token(false)], bool_token(false) } +// `or` bool operation +test_method_return! { return_bool_op_or_a, "return_bool_op_or.fe", &[bool_token(true), bool_token(true)], bool_token(true) } +test_method_return! { return_bool_op_or_b, "return_bool_op_or.fe", &[bool_token(true), bool_token(false)], bool_token(true) } +test_method_return! { return_bool_op_or_c, "return_bool_op_or.fe", &[bool_token(false), bool_token(true)], bool_token(true) } +test_method_return! { return_bool_op_or_d, "return_bool_op_or.fe", &[bool_token(false), bool_token(false)], bool_token(false) } +// radix +test_method_return! { radix_hex, "radix_hex.fe", &[], uint_token(0xfe) } +test_method_return! { radix_octal, "radix_octal.fe", &[], uint_token(0o70) } +test_method_return! { radix_binary, "radix_binary.fe", &[], uint_token(0b10) } +test_method_return! { map_tuple, "map_tuple.fe", &[uint_token(1234)], uint_token(1234) } +test_method_return! { int_literal_coercion, "int_literal_coercion.fe", &[], uint_token(300) } +test_method_return! { associated_fns, "associated_fns.fe", &[uint_token(12)], uint_token(144) } +test_method_return! { struct_fns, "struct_fns.fe", &[uint_token(10), uint_token(20)], uint_token(100) } +test_method_return! { cast_address_to_u256, "cast_address_to_u256.fe", &[address_token(SOME_ADDRESS)], address_token(SOME_ADDRESS) } +test_method_return! { for_loop_with_complex_elem_array, "for_loop_with_complex_elem_array.fe", &[], int_token(222) } + #[test] fn return_array() { with_executor(&|mut executor| { diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__associated_fns.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__associated_fns.snap.new new file mode 100644 index 0000000000..eaf7fdb7c5 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__associated_fns.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(12)]) used 22698 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args.snap.new new file mode 100644 index 0000000000..9c60b847ca --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 22235 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args_2.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args_2.snap.new new file mode 100644 index 0000000000..9c60b847ca --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_with_args_2.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 22235 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_without_args.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_without_args.snap.new new file mode 100644 index 0000000000..9c60b847ca --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__call_statement_without_args.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 22235 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__cast_address_to_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__cast_address_to_u256.snap new file mode 100644 index 0000000000..e91aa41d83 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__cast_address_to_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Address(0x2012301230123012301230123012301230123002)]) used 192 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__const_local.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__const_local.snap new file mode 100644 index 0000000000..eedfa52178 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__const_local.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 2323 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__events.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__events.snap index 2cef5445e4..56fc17c5d6 100644 --- a/crates/tests/src/snapshots/fe_compiler_tests__features__events.snap +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__events.snap @@ -6,5 +6,5 @@ expression: "format!(\"{}\", harness.gas_reporter)" emit_nums([]) used 1600 gas emit_bases([Address(0x1234000000000000000000000000000000005678)]) used 1673 gas emit_mix([Address(0x1234000000000000000000000000000000005678), Bytes([116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46, 116, 101, 110, 32, 98, 121, 116, 101, 115, 46])]) used 4836 gas -emit_addresses([Address(0x1234000000000000000000000000000000005678), Address(0x9123000000000000000000000000000000004567)]) used 2315 gas +emit_addresses([Address(0x1234000000000000000000000000000000005678), Address(0x9123000000000000000000000000000000004567)]) used 2672 gas diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__external_contract.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__external_contract.snap index 9e643f647f..99075cb9cd 100644 --- a/crates/tests/src/snapshots/fe_compiler_tests__features__external_contract.snap +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__external_contract.snap @@ -4,6 +4,6 @@ expression: "format!(\"{}\", proxy_harness.gas_reporter)" --- call_emit_event([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), FixedArray([Address(0x0000000000000000000000000000000000000000), Address(0x0000000000000000000000000000000000000001), Address(0x0000000000000000000000000000000000000042), Address(0x0000000000000000000000000000000000000003), Address(0x0000000000000000000000000000000000000004)]), String("hello world")]) used 8249 gas -call_build_array([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), Uint(42)]) used 1963 gas +call_build_array([Address(0x5dddfce53ee040d9eb21afbc0ae1bb4dbb0ba643), Uint(26), Uint(42)]) used 2359 gas add([Uint(26), Uint(42)]) used 313 gas diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_2.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_2.snap new file mode 100644 index 0000000000..bb1c9742fe --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_2.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(6)]) used 225 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_a.snap new file mode 100644 index 0000000000..bb1c9742fe --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(6)]) used 225 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_b.snap new file mode 100644 index 0000000000..ad8cc426b7 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(4)]) used 239 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_test_from_sto.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_test_from_sto.snap.new new file mode 100644 index 0000000000..1941cb3e88 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_test_from_sto.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 22418 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_with_block_declaration.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_with_block_declaration.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__if_statement_with_block_declaration.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__map_tuple.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__map_tuple.snap.new new file mode 100644 index 0000000000..cc13957724 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__map_tuple.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1234)]) used 44425 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__multi_param.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__multi_param.snap index eb102b4776..6d8f811d38 100644 --- a/crates/tests/src/snapshots/fe_compiler_tests__features__multi_param.snap +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__multi_param.snap @@ -3,5 +3,5 @@ source: crates/tests/src/features.rs expression: "format!(\"{}\", harness.gas_reporter)" --- -bar([Uint(4), Uint(42), Uint(420)]) used 570 gas +bar([Uint(4), Uint(42), Uint(420)]) used 976 gas diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn.snap new file mode 100644 index 0000000000..37b6559a96 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(26)]) used 202 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_internal_call.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_internal_call.snap new file mode 100644 index 0000000000..37b6559a96 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_internal_call.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(26)]) used 202 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_standalone.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_standalone.snap.new new file mode 100644 index 0000000000..9682b55588 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__pure_fn_standalone.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(5)]) used 46594 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__radix_binary.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_binary.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_binary.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__radix_hex.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_hex.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_hex.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__radix_octal.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_octal.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__radix_octal.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_a.snap new file mode 100644 index 0000000000..2b0a44670a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(115792089237316195423570985008687907853269984665640564039457584007913129639894)]) used 277 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_b.snap new file mode 100644 index 0000000000..a38b03207c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(42)]) used 277 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u128.snap new file mode 100644 index 0000000000..9e84eda39a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(42)]) used 314 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u256.snap new file mode 100644 index 0000000000..9d74add1b8 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_addition_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(42)]) used 202 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_array.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_array.snap index 14a4f082f8..23ed776d11 100644 --- a/crates/tests/src/snapshots/fe_compiler_tests__features__return_array.snap +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_array.snap @@ -3,5 +3,5 @@ source: crates/tests/src/features.rs expression: "format!(\"{}\", harness.gas_reporter)" --- -bar([Uint(42)]) used 778 gas +bar([Uint(42)]) used 1356 gas diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u128.snap new file mode 100644 index 0000000000..06801b037d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(12), Uint(25)]) used 224 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u256.snap new file mode 100644 index 0000000000..9602984579 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseand_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(12), Uint(25)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseor_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseor_u256.snap new file mode 100644 index 0000000000..9602984579 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseor_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(12), Uint(25)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i64_coerced.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i64_coerced.snap new file mode 100644 index 0000000000..7cc6f39a22 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i64_coerced.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 105 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i8.snap new file mode 100644 index 0000000000..d3a81c198a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_i8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Uint(1)]) used 238 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_a.snap new file mode 100644 index 0000000000..f56ac8f4ae --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(212), Uint(0)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_b.snap new file mode 100644 index 0000000000..dadca765c6 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(212), Uint(1)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u8.snap new file mode 100644 index 0000000000..ff3999ff4e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshl_u8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(8)]) used 212 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_a.snap new file mode 100644 index 0000000000..ea223619ce --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(212), Uint(0)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_b.snap new file mode 100644 index 0000000000..ed5ae87851 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(212), Uint(1)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_c.snap new file mode 100644 index 0000000000..f56ac8f4ae --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(212), Uint(0)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_d.snap new file mode 100644 index 0000000000..dadca765c6 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwiseshr_u256_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(212), Uint(1)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwisexor_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwisexor_u256.snap new file mode 100644 index 0000000000..9602984579 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bitwisexor_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(12), Uint(25)]) used 153 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_false.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_false.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_false.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_a.snap new file mode 100644 index 0000000000..e0d39bbac4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(true)]) used 180 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_b.snap new file mode 100644 index 0000000000..cf9dbc3996 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_inverted_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(false)]) used 180 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_a.snap new file mode 100644 index 0000000000..8a91dcfe5b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(true), Bool(true)]) used 269 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_b.snap new file mode 100644 index 0000000000..3a10b8ff39 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(true), Bool(false)]) used 269 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_c.snap new file mode 100644 index 0000000000..d5a37a4f75 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(false), Bool(true)]) used 276 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_d.snap new file mode 100644 index 0000000000..9bda29865d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_and_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(false), Bool(false)]) used 276 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_a.snap new file mode 100644 index 0000000000..c24eafe9c9 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(true), Bool(true)]) used 266 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_b.snap new file mode 100644 index 0000000000..8c01b11dc9 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(true), Bool(false)]) used 266 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_c.snap new file mode 100644 index 0000000000..dfd8cb514d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(false), Bool(true)]) used 287 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_d.snap new file mode 100644 index 0000000000..8f9893f961 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_op_or_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Bool(false), Bool(false)]) used 287 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_true.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_true.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_bool_true.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_a.snap new file mode 100644 index 0000000000..875de88848 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639933)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_b.snap new file mode 100644 index 0000000000..875308d075 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639808)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_c.snap new file mode 100644 index 0000000000..c1b6b6e1a2 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639809)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_d.snap new file mode 100644 index 0000000000..82d1dc761c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(127)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_e.snap new file mode 100644 index 0000000000..b422085fb1 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(0)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_f.snap new file mode 100644 index 0000000000..b0c9df6203 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_i8_to_unsigned_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_a.snap new file mode 100644 index 0000000000..512fb93c31 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(253)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_b.snap new file mode 100644 index 0000000000..a63a272b2c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(127)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_c.snap new file mode 100644 index 0000000000..158e828b2e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(128)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_d.snap new file mode 100644 index 0000000000..e560e64da9 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(129)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_e.snap new file mode 100644 index 0000000000..3840d635ac --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(0)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_f.snap new file mode 100644 index 0000000000..8c59f64bf4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_cast_u8_to_signed_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 185 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_a.snap new file mode 100644 index 0000000000..97e349bac8 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(115792089237316195423570985008687907853269984665640564039457584007913129639894)]) used 240 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_b.snap new file mode 100644 index 0000000000..1c15aa4261 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(1)]) used 240 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_c.snap new file mode 100644 index 0000000000..26d5769afb --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(42)]) used 240 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_u256.snap new file mode 100644 index 0000000000..450cdedeb8 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_division_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(42)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_a.snap new file mode 100644 index 0000000000..f5bd05192e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_b.snap new file mode 100644 index 0000000000..ad9f0c3835 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_eq_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_memory_i8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_memory_i8.snap new file mode 100644 index 0000000000..2a63ee8413 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_memory_i8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639933)]) used 486 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_array_i8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_array_i8.snap new file mode 100644 index 0000000000..c09b2d3639 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_array_i8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639926)]) used 22635 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_i8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_i8.snap new file mode 100644 index 0000000000..6925fab91c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_from_storage_i8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639933)]) used 22648 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_a.snap new file mode 100644 index 0000000000..9f4238c5b5 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(2), Int(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_b.snap new file mode 100644 index 0000000000..003b4f3bf0 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_c.snap new file mode 100644 index 0000000000..6d4809cbf4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(2)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_d.snap new file mode 100644 index 0000000000..59d0ae645a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639934)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_e.snap new file mode 100644 index 0000000000..6358676e01 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_f.snap new file mode 100644 index 0000000000..eef6e8fdee --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_i256_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639934), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_a.snap new file mode 100644 index 0000000000..34d0886984 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_b.snap new file mode 100644 index 0000000000..f5bd05192e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_c.snap new file mode 100644 index 0000000000..ad9f0c3835 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gt_u256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_a.snap new file mode 100644 index 0000000000..de5be278eb --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(2), Int(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_b.snap new file mode 100644 index 0000000000..3f9a02838b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_c.snap new file mode 100644 index 0000000000..72aeb7ac6a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(2)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_d.snap new file mode 100644 index 0000000000..b7404c95d4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639934)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_e.snap new file mode 100644 index 0000000000..f017373183 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_f.snap new file mode 100644 index 0000000000..2f9cd4658d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_i256_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639934), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_a.snap new file mode 100644 index 0000000000..287805cf5a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_b.snap new file mode 100644 index 0000000000..3d2ab29400 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_c.snap new file mode 100644 index 0000000000..c1d530678c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_gte_u256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_i128_cast.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_i128_cast.snap new file mode 100644 index 0000000000..7cc6f39a22 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_i128_cast.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 105 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_i256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_i256.snap new file mode 100644 index 0000000000..7cc6f39a22 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_i256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 105 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u128.snap new file mode 100644 index 0000000000..de19b322ae --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 192 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u16.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u16.snap new file mode 100644 index 0000000000..857fd2c7ed --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u16.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 177 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u256.snap new file mode 100644 index 0000000000..db2f444418 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 144 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u32.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u32.snap new file mode 100644 index 0000000000..857fd2c7ed --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u32.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 177 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u64.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u64.snap new file mode 100644 index 0000000000..de19b322ae --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u64.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 192 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u8.snap new file mode 100644 index 0000000000..857fd2c7ed --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_identity_u8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42)]) used 177 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i128.snap new file mode 100644 index 0000000000..f257b2fa5b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i16.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i16.snap new file mode 100644 index 0000000000..2473202c3c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i16.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(2000)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i256.snap new file mode 100644 index 0000000000..8b4d121034 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1)]) used 147 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i32.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i32.snap new file mode 100644 index 0000000000..fae711703d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i32.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(30000)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i64.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i64.snap new file mode 100644 index 0000000000..55b8b77925 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i64.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(4000000000)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i8.snap new file mode 100644 index 0000000000..f257b2fa5b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_i8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u128.snap new file mode 100644 index 0000000000..4702b7dabe --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 192 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u16.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u16.snap new file mode 100644 index 0000000000..9446c9e366 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u16.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 180 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u256.snap new file mode 100644 index 0000000000..a7abea0a1b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 147 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u32.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u32.snap new file mode 100644 index 0000000000..9446c9e366 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u32.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 180 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u64.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u64.snap new file mode 100644 index 0000000000..4702b7dabe --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u64.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 192 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u8.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u8.snap new file mode 100644 index 0000000000..9446c9e366 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_invert_u8.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1)]) used 180 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_a.snap new file mode 100644 index 0000000000..6d4809cbf4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(2)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_b.snap new file mode 100644 index 0000000000..003b4f3bf0 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_c.snap new file mode 100644 index 0000000000..9f4238c5b5 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(2), Int(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_d.snap new file mode 100644 index 0000000000..eef6e8fdee --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639934), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_e.snap new file mode 100644 index 0000000000..6358676e01 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_f.snap new file mode 100644 index 0000000000..59d0ae645a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_i256_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639934)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u128.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u128.snap new file mode 100644 index 0000000000..2f2acaae0c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u128.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 209 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_a.snap new file mode 100644 index 0000000000..ad9f0c3835 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_b.snap new file mode 100644 index 0000000000..f5bd05192e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_c.snap new file mode 100644 index 0000000000..34d0886984 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lt_u256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(1)]) used 159 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_a.snap new file mode 100644 index 0000000000..72aeb7ac6a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(2)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_b.snap new file mode 100644 index 0000000000..3f9a02838b --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(1), Int(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_c.snap new file mode 100644 index 0000000000..de5be278eb --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(2), Int(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_d.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_d.snap new file mode 100644 index 0000000000..2f9cd4658d --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_d.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639934), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_e.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_e.snap new file mode 100644 index 0000000000..f017373183 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_e.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639935)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_f.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_f.snap new file mode 100644 index 0000000000..b7404c95d4 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_i256_f.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639935), Int(115792089237316195423570985008687907853269984665640564039457584007913129639934)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256.snap new file mode 100644 index 0000000000..287805cf5a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_a.snap new file mode 100644 index 0000000000..c1d530678c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_b.snap new file mode 100644 index 0000000000..3d2ab29400 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_lte_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_a.snap new file mode 100644 index 0000000000..7c755c4d15 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(5), Int(2)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_b.snap new file mode 100644 index 0000000000..92b5fb24db --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(5), Int(3)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_c.snap new file mode 100644 index 0000000000..5eca984912 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_i256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(5), Int(5)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_a.snap new file mode 100644 index 0000000000..2a4d5286cb --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(5), Uint(2)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_b.snap new file mode 100644 index 0000000000..095ef49d17 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(5), Uint(3)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_c.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_c.snap new file mode 100644 index 0000000000..737a1b9d94 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_mod_u256_c.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(5), Uint(5)]) used 201 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_msg_sig.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_msg_sig.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_msg_sig.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_a.snap new file mode 100644 index 0000000000..2494d7cb66 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(115792089237316195423570985008687907853269984665640564039457584007913129639894)]) used 420 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_b.snap new file mode 100644 index 0000000000..964934b307 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(42)]) used 420 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_u256.snap new file mode 100644 index 0000000000..956259ec52 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_multiplication_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(42)]) used 224 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256a.snap new file mode 100644 index 0000000000..3d2ab29400 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(1)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256b.snap new file mode 100644 index 0000000000..c1d530678c --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_noteq_u256b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(1), Uint(2)]) used 162 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_i256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_i256.snap new file mode 100644 index 0000000000..4d1172543e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_i256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639934), Uint(3)]) used 653 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_a.snap new file mode 100644 index 0000000000..6ce7c46219 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(0)]) used 218 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_b.snap new file mode 100644 index 0000000000..10a4e392fd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_pow_u256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(2), Uint(4)]) used 307 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_a.snap new file mode 100644 index 0000000000..bacb6dd2bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(115792089237316195423570985008687907853269984665640564039457584007913129639894)]) used 271 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_b.snap new file mode 100644 index 0000000000..2c84c0dc5a --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_i256_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Int(115792089237316195423570985008687907853269984665640564039457584007913129639894), Int(42)]) used 271 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_u256.snap new file mode 100644 index 0000000000..bdebc273ac --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_subtraction_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(42), Uint(42)]) used 199 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_u128_cast.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u128_cast.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u128_cast.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256.snap new file mode 100644 index 0000000000..963565f5bd --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 102 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn.snap new file mode 100644 index 0000000000..664bb8c16e --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 120 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn_with_args.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn_with_args.snap.new new file mode 100644 index 0000000000..6706f0f9e1 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__return_u256_from_called_fn_with_args.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 22307 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__struct_fns.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__struct_fns.snap new file mode 100644 index 0000000000..9b6a53c067 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__struct_fns.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(10), Uint(20)]) used 2082 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__structs.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__structs.snap.new new file mode 100644 index 0000000000..0cd06e3ecf --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__structs.snap.new @@ -0,0 +1,15 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +create_house([]) used 69429 gas +bar([]) used 1271 gas +set_house([Tuple([Uint(1000000), Uint(250), Uint(6), Bool(true)])]) used 1175 gas +get_house([]) used 1078 gas +encode_house([]) used 1263 gas +hashed_house([]) used 846 gas +create_mixed([]) used 350 gas +complex_struct_in_memory([]) used 3919 gas +complex_struct_in_storage([]) used 183605 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_a.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_a.snap new file mode 100644 index 0000000000..d13acaa896 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_a.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(6)]) used 210 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_b.snap b/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_b.snap new file mode 100644 index 0000000000..08a2ba5cc0 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__ternary_expression_b.snap @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([Uint(4)]) used 221 gas + diff --git a/crates/tests/src/snapshots/fe_compiler_tests__features__while_loop_test_from_sto.snap.new b/crates/tests/src/snapshots/fe_compiler_tests__features__while_loop_test_from_sto.snap.new new file mode 100644 index 0000000000..6bc84f9235 --- /dev/null +++ b/crates/tests/src/snapshots/fe_compiler_tests__features__while_loop_test_from_sto.snap.new @@ -0,0 +1,7 @@ +--- +source: crates/tests/src/features.rs +expression: "format!(\"{}\", harness.gas_reporter)" + +--- +bar([]) used 2329 gas +