From d39bbbf435edca7a4712c68f65e89b39d598c91c Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:28:19 -0700 Subject: [PATCH 01/20] MVP lambda support in parser and expression builder --- Cargo.lock | 1 + .../move/evm/move-to-yul/src/context.rs | 2 +- .../move/evm/move-to-yul/src/solidity_ty.rs | 2 +- .../move-to-yul/tests/AccountStateMachine.exp | 1138 +++++++++++++++++ .../evm/move-to-yul/tests/ConstructorTest.exp | 8 +- .../evm/move-to-yul/tests/GlobalVectors.exp | 366 +++--- .../move/evm/move-to-yul/tests/Resources.exp | 80 +- .../tests/Resources.exp.capture-source-info | 80 +- .../move/evm/move-to-yul/tests/Structs.exp | 90 +- .../move/evm/move-to-yul/tests/Tables.exp | 168 +-- .../evm/move-to-yul/tests/TestABIStructs.exp | 68 +- .../move-to-yul/tests/TestExternalResult.exp | 126 +- .../move-to-yul/tests/TestStringLiteral.exp | 16 +- .../move/evm/move-to-yul/tests/Vectors.exp | 132 +- .../DispatcherArrayDecoding.exp | 22 +- .../DispatcherBasicStorage.exp | 12 +- .../DispatcherEncodingStorage.exp | 26 +- .../tests/test-dispatcher/ExternalCall.exp | 90 +- .../tests/test-events/CallEmit.exp | 36 +- .../move-binary-format/src/file_format.rs | 5 +- .../src/bytecode_generator.rs | 22 +- .../src/env_pipeline/ast_simplifier.rs | 20 +- .../env_pipeline/flow_insensitive_checkers.rs | 2 +- .../src/env_pipeline/function_checker.rs | 17 +- .../src/env_pipeline/inliner.rs | 4 +- .../src/env_pipeline/lambda_lifter.rs | 421 +++++- .../src/env_pipeline/rewrite_target.rs | 6 +- .../src/env_pipeline/spec_rewriter.rs | 9 +- .../src/env_pipeline/unused_params_checker.rs | 2 +- .../file_format_generator/module_generator.rs | 4 +- .../borrowed_from_one_path.exp | 36 +- .../ability-transform/copy_ability_tuple.exp | 60 +- .../tests/ability-transform/mutate_vector.exp | 96 +- .../tests/abort-analysis/drop_on_abort.exp | 12 +- .../tests/abort-analysis/loop_abort.exp | 24 +- .../tests/bytecode-generator/assign.exp | 22 +- .../tests/bytecode-generator/borrow.exp | 8 +- .../borrow_deref_optimize.exp | 16 +- .../bug_14300_update_variant_select.exp | 48 +- .../bug_14300_variant_select_autoref.exp | 8 +- .../bug_14471_receiver_inference.exp | 24 +- .../bytecode-generator/conditional_borrow.exp | 68 +- .../bytecode-generator/escape_autoref.exp | 34 +- .../tests/bytecode-generator/fields.exp | 108 +- .../bytecode-generator/freeze_mut_ref.exp | 46 +- .../tests/bytecode-generator/globals.exp | 20 +- .../matching_ability_err.exp | 46 +- .../tests/bytecode-generator/matching_ok.exp | 222 ++-- .../matching_refutable_err.exp | 4 +- .../tests/bytecode-generator/pack_order.exp | 36 +- .../tests/bytecode-generator/pack_unpack.exp | 18 +- .../bytecode-generator/spec_construct.exp | 12 +- .../tests/bytecode-generator/wildcard3.exp | 10 +- .../tests/bytecode-generator/wildcard5.exp | 6 +- .../tests/checking/specs/conditions_ok.exp | 2 +- .../checking/specs/inline_fun_in_spec.exp | 6 +- .../specs/inline_fun_in_spec_typed.exp | 6 +- .../tests/checking/specs/invariants_ok.exp | 4 +- .../specs/move_function_in_spec_ok.exp | 8 +- .../tests/checking/specs/quantifiers_ok.exp | 4 +- .../tests/checking/specs/structs_ok.exp | 8 +- .../tests/checking/specs/update_field_ok.exp | 4 +- .../checking/typing/nested_post_process.exp | 6 +- .../tests/checking/unused/unused_enum.exp | 8 +- .../jump-label.on.exp | 18 +- .../tests/copy-propagation/mut_refs_2.exp | 14 +- .../sequential_assign_struct.exp | 28 +- .../eager-pushes/framework_reduced_02.exp | 16 +- .../eager-pushes/framework_reduced_03.exp | 28 +- .../eager-pushes/framework_reduced_04.exp | 24 +- .../eager-pushes/framework_reduced_05.exp | 20 +- .../eager-pushes/framework_reduced_06.exp | 36 +- .../eager-pushes/framework_reduced_07.exp | 16 +- .../eager-pushes/framework_reduced_08.exp | 16 +- .../eager-pushes/framework_reduced_09.exp | 20 +- .../eager-pushes/framework_reduced_10.exp | 16 +- .../tests/folding/empty_tvectors.exp | 8 +- .../tests/folding/nonempty_tvectors.exp | 8 +- .../tests/lambda-lifting/basic.lambda.exp | 99 +- .../tests/lambda-lifting/modify.lambda.exp | 58 +- .../tests/lambda-lifting/nested.lambda.exp | 76 +- .../tests/lambda-lifting/pattern.lambda.exp | 77 +- .../break_continue_in_lambda.lambda.exp | 348 +---- .../lambda/inline-parity/bug_10991.lambda.exp | 100 +- .../bug_10991_noparam.lambda.exp | 118 +- .../bug_10991_noparam2.lambda.exp | 100 +- .../inline-parity/bug_10991a.lambda.exp | 134 +- .../inline-parity/bug_10991b.lambda.exp | 74 +- .../inline-parity/bug_10991c.lambda.exp | 83 +- .../inline-parity/dotdot_valid.lambda.exp | 933 +------------- .../lambda/inline-parity/eq_inline.lambda.exp | 52 +- .../eval_ignored_param.lambda.exp | 154 +-- .../inline-parity/generic_calls.lambda.exp | 143 +-- .../lambda/inline-parity/generics.lambda.exp | 6 +- .../inline_fun_in_spec.lambda.exp | 193 +-- .../lambda/inline-parity/inlining1.lambda.exp | 83 +- .../lambda/inline-parity/lambda.lambda.exp | 51 +- .../inline-parity/lambda_cast.lambda.exp | 18 +- .../inline-parity/lambda_no_param.lambda.exp | 91 +- .../inline-parity/lambda_param.lambda.exp | 215 +--- .../inline-parity/lambda_return.lambda.exp | 74 +- .../inline-parity/lambda_typed.lambda.exp | 326 +---- .../lambda/inline-parity/masking.lambda.exp | 85 +- .../inline-parity/multi_param.lambda.exp | 18 +- .../inline-parity/nested_lambda.lambda.exp | 61 +- .../nested_lambda_module.lambda.exp | 70 +- .../op_with_side_effect_49.lambda.exp | 12 +- .../lambda/inline-parity/options.lambda.exp | 161 +-- .../inline-parity/return_in_lambda.lambda.exp | 59 +- .../inline-parity/same_names.lambda.exp | 116 +- .../lambda/inline-parity/shadowing.lambda.exp | 12 +- .../shadowing_renamed.lambda.exp | 12 +- .../shadowing_renamed_param.lambda.exp | 48 +- .../inline-parity/shadowing_unused.lambda.exp | 30 +- .../shadowing_unused_nodecl.lambda.exp | 30 +- .../inline-parity/simple_map_keys.lambda.exp | 16 +- .../inline-parity/spec_inlining.lambda.exp | 145 +-- .../inline-parity/subtype_args.lambda.exp | 4 +- ...erical_extreme_comparisons_warn.lambda.exp | 398 +----- .../unpack_generic_struct.lambda.exp | 172 +-- .../unused_lambda_param.lambda.exp | 110 +- .../tests/lambda/lambda3.lambda.exp | 44 +- .../tests/lambda/storable/doable_func.exp | 20 + .../lambda/storable/doable_func.lambda.exp | 20 + .../tests/lambda/storable/doable_func.move | 91 ++ .../tests/lambda/storable/registry.move | 18 +- .../tests/lambda/storable/return_func.exp | 159 ++- .../lambda/storable/return_func.lambda.exp | 159 ++- .../tests/lambda/storable/return_func.move | 55 +- .../tests/live-var/mut_ref.exp | 120 +- .../invalid_call_lhs_complex_expression.exp | 15 +- .../invalid_call_lhs_complex_expression2.exp | 15 +- .../invalid_call_lhs_parens_around_name.exp | 9 +- .../invalid_call_lhs_parens_around_name2.exp | 9 +- .../parser/invalid_call_lhs_return.exp | 9 +- .../parser/invalid_call_lhs_return2.exp | 9 +- .../more-v1/parser/invalid_call_lhs_value.exp | 15 +- .../parser/invalid_call_lhs_value2.exp | 15 +- ...oken_after_ability_function_constraint.exp | 7 +- .../tests/op-equal/valid0.exp | 228 ++-- .../tests/op-equal/valid1.exp | 120 +- .../tests/op-equal/valid2.exp | 36 +- .../struct_use_before_assign.exp | 32 +- .../uninit-use-checker/unused_reference.exp | 8 +- .../v1-locals/use_before_assign_simple.exp | 24 +- .../tests/variable-coalescing/consume_1.exp | 50 +- .../variable-coalescing/consume_1.opt.exp | 50 +- .../tests/variable-coalescing/consume_2.exp | 30 +- .../variable-coalescing/consume_2.opt.exp | 30 +- .../tests/variable-coalescing/consume_3.exp | 30 +- .../variable-coalescing/consume_3.opt.exp | 30 +- .../tests/variable-coalescing/consume_4.exp | 40 +- .../variable-coalescing/consume_4.opt.exp | 40 +- .../tests/variable-coalescing/consume_5.exp | 30 +- .../variable-coalescing/consume_5.opt.exp | 30 +- .../tests/variable-coalescing/mut_refs_2.exp | 70 +- .../variable-coalescing/mut_refs_2.opt.exp | 70 +- .../sequential_assign_struct.exp | 70 +- .../sequential_assign_struct.opt.exp | 70 +- .../move/move-compiler/src/expansion/ast.rs | 50 +- .../src/expansion/dependency_ordering.rs | 8 +- .../move-compiler/src/expansion/translate.rs | 21 +- .../move-compiler/src/naming/translate.rs | 21 +- .../move/move-compiler/src/parser/ast.rs | 56 +- .../move/move-compiler/src/parser/keywords.rs | 2 + .../move/move-compiler/src/parser/syntax.rs | 121 +- .../move-compiler/src/shared/ast_debug.rs | 21 +- .../invalid_call_lhs_complex_expression.exp | 21 +- .../invalid_call_lhs_complex_expression2.exp | 15 +- .../invalid_call_lhs_parens_around_name.exp | 15 +- .../invalid_call_lhs_parens_around_name2.exp | 9 +- .../parser/invalid_call_lhs_return.exp | 15 +- .../parser/invalid_call_lhs_return2.exp | 9 +- .../parser/invalid_call_lhs_value.exp | 21 +- .../parser/invalid_call_lhs_value2.exp | 15 +- ...oken_after_ability_function_constraint.exp | 7 +- third_party/move/move-model/Cargo.toml | 1 + .../bytecode/src/function_target_pipeline.rs | 2 +- .../bytecode/tests/borrow/basic_test.exp | 176 +-- .../bytecode/tests/borrow/function_call.exp | 86 +- .../bytecode/tests/borrow/hyper_edge.exp | 70 +- .../tests/borrow_strong/basic_test.exp | 230 ++-- .../bytecode/tests/borrow_strong/mut_ref.exp | 430 +++---- .../regression_generic_and_native_type.exp | 54 +- .../bytecode/tests/from_move/smoke_test.exp | 166 +-- .../bytecode/tests/livevar/basic_test.exp | 82 +- .../tests/reaching_def/basic_test.exp | 12 +- .../bytecode/tests/usage_analysis/test.exp | 48 +- third_party/move/move-model/src/ast.rs | 298 ++++- .../move-model/src/builder/exp_builder.rs | 719 +++++++++-- .../move-model/src/builder/model_builder.rs | 14 +- .../move-model/src/builder/module_builder.rs | 159 ++- .../move/move-model/src/exp_rewriter.rs | 61 +- third_party/move/move-model/src/model.rs | 183 ++- third_party/move/move-model/src/sourcifier.rs | 53 +- third_party/move/move-model/src/ty.rs | 99 +- .../boogie-backend/src/boogie_wrapper.rs | 2 +- .../boogie-backend/src/bytecode_translator.rs | 20 +- .../boogie-backend/src/spec_translator.rs | 15 +- .../src/memory_instrumentation.rs | 2 +- .../data_invariant_instrumentation/borrow.exp | 120 +- .../data_invariant_instrumentation/pack.exp | 22 +- .../data_invariant_instrumentation/params.exp | 12 +- .../data_invariant_instrumentation/vector.exp | 6 +- .../tests/eliminate_imm_refs/basic_test.exp | 100 +- .../disable_in_body.exp | 14 +- .../global_invariant_analysis/mutual_inst.exp | 62 +- .../uninst_type_param_in_inv.exp | 44 +- .../borrow.exp | 30 +- .../global_invariant_instrumentation/move.exp | 32 +- .../update.exp | 28 +- .../tests/memory_instr/basic_test.exp | 176 +-- .../tests/memory_instr/mut_ref.exp | 262 ++-- .../tests/mono_analysis/test.exp | 32 +- .../mut_ref_instrumentation/basic_test.exp | 208 +-- .../tests/spec_instrumentation/fun_spec.exp | 138 +- .../tests/spec_instrumentation/generics.exp | 52 +- .../tests/spec_instrumentation/modifies.exp | 210 +-- .../spec_instrumentation/opaque_call.exp | 108 +- .../verification_analysis/inv_relevance.exp | 12 +- .../verification_analysis/inv_suspension.exp | 12 +- .../move-prover/move-abigen/src/abigen.rs | 2 +- .../move-prover/move-docgen/src/docgen.rs | 4 +- 223 files changed, 7494 insertions(+), 8926 deletions(-) create mode 100644 third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp create mode 100644 third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.exp create mode 100644 third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.lambda.exp create mode 100644 third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.move diff --git a/Cargo.lock b/Cargo.lock index dbe8b1c7df442..59c962d5ccc1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11452,6 +11452,7 @@ dependencies = [ "codespan", "codespan-reporting", "datatest-stable", + "either", "internment", "itertools 0.13.0", "log", diff --git a/third_party/move/evm/move-to-yul/src/context.rs b/third_party/move/evm/move-to-yul/src/context.rs index ef8e251ee89e8..a8e9b29deef17 100644 --- a/third_party/move/evm/move-to-yul/src/context.rs +++ b/third_party/move/evm/move-to-yul/src/context.rs @@ -784,7 +784,7 @@ impl<'a> Context<'a> { Tuple(_) | TypeParameter(_) | Reference(_, _) - | Fun(_, _) + | Fun(..) | TypeDomain(_) | ResourceDomain(_, _, _) | Error diff --git a/third_party/move/evm/move-to-yul/src/solidity_ty.rs b/third_party/move/evm/move-to-yul/src/solidity_ty.rs index b47d59e5dfa48..7f44b34c35e4e 100644 --- a/third_party/move/evm/move-to-yul/src/solidity_ty.rs +++ b/third_party/move/evm/move-to-yul/src/solidity_ty.rs @@ -368,7 +368,7 @@ impl SolidityType { }, TypeParameter(_) | Reference(_, _) - | Fun(_, _) + | Fun(..) | TypeDomain(_) | ResourceDomain(_, _, _) | Error diff --git a/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp b/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp new file mode 100644 index 0000000000000..08f39e05a23f3 --- /dev/null +++ b/third_party/move/evm/move-to-yul/tests/AccountStateMachine.exp @@ -0,0 +1,1138 @@ +/* ======================================= + * Generated by Move-To-Yul compiler v0.0 + * ======================================= */ + + +object "A3_AccountStateMachine" { + code { + mstore(0, memoryguard(160)) + let $new_value := A3_AccountStateMachine_init() + { + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if $AlignedStorageLoad($base_offset) { + $AbortBuiltin() + } + $AlignedStorageStore($base_offset, true) + { + let $dst := add($base_offset, 32) + let $src := $new_value + { + let $linked_src_37500119 := mload(add($src, 0)) + let $linked_dst_37500119 := $NewLinkedStorageBase(0x23c34d7) + let $size_37500119 := $MemoryLoadU64($linked_src_37500119) + let $data_size_37500119 := mul($size_37500119, 32) + $AlignedStorageStore($linked_dst_37500119, mload($linked_src_37500119)) + let $data_src_37500119 := add($linked_src_37500119, 32) + let $data_dst_37500119 := add($linked_dst_37500119, 32) + for { let $offs_37500119 := 0 } lt($offs_37500119, $data_size_37500119) { $offs_37500119 := add($offs_37500119, 32)} { + { + let $linked_src_1341933877 := mload(add($offs_37500119, $data_src_37500119)) + let $linked_dst_1341933877 := $NewLinkedStorageBase(0x4ffc4935) + $AlignedStorageStore(add($linked_dst_1341933877, 0), mload(add($linked_src_1341933877, 0))) + $Free($linked_src_1341933877, 32) + $AlignedStorageStore(add($data_dst_37500119, $offs_37500119), $linked_dst_1341933877) + } + $Free($linked_src_37500119, add($data_size_37500119, 32)) + } + $AlignedStorageStore(add($dst, 0), $linked_dst_37500119) + } + $AlignedStorageStore(add($dst, 32), mload(add($src, 32))) + $Free($src, 48) + } + } + codecopy(0, dataoffset("A3_AccountStateMachine_deployed"), datasize("A3_AccountStateMachine_deployed")) + return(0, datasize("A3_AccountStateMachine_deployed")) + function A3_AccountStateMachine_init() -> $result { + let $t0, $t1, $t2, $t3 + // $t0 := 0 + $t0 := 0 + // $t1 := 0 + $t1 := 0 + // $t2 := vector::empty() + $t2 := A1_vector_empty$A3_AccountStateMachine_PendingTransfer$() + // $t3 := pack AccountStateMachine::Account($t0, $t1, $t2) + { + let $mem := $Malloc(48) + $MemoryStoreU64(add($mem, 32), $t0) + $MemoryStoreU64(add($mem, 40), $t1) + $MemoryStoreU256(add($mem, 0), $t2) + $t3 := $mem + } + // return $t3 + $result := $t3 + } + + function A1_vector_empty$A3_AccountStateMachine_PendingTransfer$() -> vector { + vector := $Malloc(96) + $MemoryStoreU64(add(vector, 8), 2) + } + function $Abort(code) { + mstore(0, code) + revert(24, 8) // TODO: store code as a string? + } + function $AbortBuiltin() { + $Abort(sub(0, 1)) + } + function $Malloc(size) -> offs { + offs := mload(0) + // pad to word size + mstore(0, add(offs, shl(5, shr(5, add(size, 31))))) + } + function $Free(offs, size) { + } + function $MaskForSize(size) -> mask { + mask := sub(shl(shl(3, size), 1), 1) + } + function $MemoryLoadBytes(offs, size) -> val { + // Lower bit where the value in the higher bytes ends + let bit_end := shl(3, sub(32, size)) + val := shr(bit_end, mload(offs)) + } + function $MemoryStoreBytes(offs, size, val) { + let bit_end := shl(3, sub(32, size)) + let mask := shl(bit_end, $MaskForSize(size)) + mstore(offs, or(and(mload(offs), not(mask)), shl(bit_end, val))) + } + function $StorageKey(group, word) -> key { + mstore(32, word) + mstore(64, shl(224, group)) + key := keccak256(32, 36) + } + function $MakeTypeStorageBase(category, type_hash, id) -> offs { + offs := or(shl(252, category), or(shl(220, type_hash), shl(60, id))) + } + function $NewLinkedStorageBase(type_hash) -> offs { + let key := $StorageKey(1, 1) + let handle := sload(key) + sstore(key, add(handle, 1)) + offs := $MakeTypeStorageBase(1, type_hash, handle) + } + function $MemoryLoadU64(offs) -> val { + val := $MemoryLoadBytes(offs, 8) + } + function $MemoryStoreU64(offs, val) { + $MemoryStoreBytes(offs, 8, val) + } + function $MemoryStoreU256(offs, val) { + $MemoryStoreBytes(offs, 32, val) + } + function $AlignedStorageLoad(offs) -> val { + let word_offs := shr(5, offs) + val := sload($StorageKey(0, word_offs)) + } + function $AlignedStorageStore(offs, val) { + let word_offs := shr(5, offs) + sstore($StorageKey(0, word_offs), val) + } + } + object "A3_AccountStateMachine_deployed" { + code { + mstore(0, memoryguard(160)) + if iszero(lt(calldatasize(), 4)) + { + let selector := $Shr(calldataload(0), 224) + switch selector + case 0x3cecd719 + { + // cleanup() + if callvalue() + { + $Abort(99) + } + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_cleanup($MakePtr(true, add($base_offset, 32))) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + case 0x13765838 + { + // deposit(uint64) + if callvalue() + { + $Abort(99) + } + let param_0 := abi_decode_tuple_$uint64$_$u64$(4, calldatasize()) + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_deposit($MakePtr(true, add($base_offset, 32)), param_0) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + case 0x750f0acc + { + // withdraw(uint64) + if callvalue() + { + $Abort(99) + } + let param_0 := abi_decode_tuple_$uint64$_$u64$(4, calldatasize()) + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_withdraw($MakePtr(true, add($base_offset, 32)), param_0) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + case 0x2bcc3f98 + { + // xfer(address,uint64) + if callvalue() + { + $Abort(99) + } + let param_0, param_1 := abi_decode_tuple_$address_uint64$_$address_u64$(4, calldatasize()) + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_xfer($MakePtr(true, add($base_offset, 32)), param_0, param_1) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + case 0x02852d52 + { + // xfer_deposit(uint64,address,uint64) + if callvalue() + { + $Abort(99) + } + let param_0, param_1, param_2 := abi_decode_tuple_$uint64_address_uint64$_$u64_address_u64$(4, calldatasize()) + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_xfer_deposit($MakePtr(true, add($base_offset, 32)), param_0, param_1, param_2) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + case 0x8c38542c + { + // xfer_finish(uint64) + if callvalue() + { + $Abort(99) + } + let param_0 := abi_decode_tuple_$uint64$_$u64$(4, calldatasize()) + let $base_offset := $MakeTypeStorageBase(0, 0x330750a9, address()) + if iszero($AlignedStorageLoad($base_offset)) { + $AbortBuiltin() + } + A3_AccountStateMachine_xfer_finish($MakePtr(true, add($base_offset, 32)), param_0) + let memPos := mload(0) + let memEnd := abi_encode_tuple__(memPos) + return(memPos, sub(memEnd, memPos)) + } + default {} + } + $Abort(97) + function A3_AccountStateMachine_cleanup(this) { + let tmp_$1, i, p, pending, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12, $t13, $t14, $t15, $t16, $t17, $t18, $t19 + let $block := 3 + for {} true {} { + switch $block + case 2 { + // label L6 + // $t7 := freeze_ref($t5) + $t7 := $t5 + // $t8 := vector::length($t7) + $t8 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t7) + // $t9 := <($t2, $t8) + $t9 := $Lt(i, $t8) + // if ($t9) goto L1 else goto L0 + switch $t9 + case 0 { $block := 5 } + default { $block := 4 } + } + case 3 { + // $t5 := borrow_field.pending($t0) + $t5 := this + // $t6 := 0 + $t6 := 0 + // $t2 := $t6 + i := $t6 + // goto L6 + $block := 2 + } + case 4 { + // label L1 + // goto L2 + $block := 6 + } + case 5 { + // label L0 + // drop($t5) + // return () + leave + } + case 6 { + // label L2 + // $t10 := freeze_ref($t5) + $t10 := $t5 + // $t11 := vector::borrow($t10, $t2) + $t11 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t10, i) + // $t12 := Actor::virtual_time() + $t12 := A1_Actor_virtual_time() + // $t13 := borrow_field.initiated_at($t11) + $t13 := $t11 + // $t14 := read_ref($t13) + $t14 := $LoadU128($t13) + // $t15 := -($t12, $t14) + $t15 := $Sub($t12, $t14) + // $t16 := 100000000 + $t16 := 100000000 + // $t17 := >=($t15, $t16) + $t17 := $GtEq($t15, $t16) + // if ($t17) goto L4 else goto L3 + switch $t17 + case 0 { $block := 8 } + default { $block := 7 } + } + case 7 { + // label L4 + // $t18 := vector::remove($t5, $t2) + $t18 := A1_vector_remove$A3_AccountStateMachine_PendingTransfer$($t5, i) + // drop($t18) + $Free($t18, 32) + // goto L5 + $block := 9 + } + case 8 { + // label L3 + // $t19 := 1 + $t19 := 1 + // $t2 := +($t2, $t19) + i := $AddU64(i, $t19) + // goto L5 + $block := 9 + } + case 9 { + // label L5 + // goto L6 + $block := 2 + } + } + } + + function A3_AccountStateMachine_deposit(this, v) { + let $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11 + let $block := 4 + for {} true {} { + switch $block + case 2 { + // label L1 + // goto L2 + $block := 5 + } + case 3 { + // label L0 + // drop($t0) + // $t7 := 1 + $t7 := 1 + // abort($t7) + $Abort($t7) + } + case 4 { + // $t2 := 43 + $t2 := 43 + // $t3 := borrow_field.value($t0) + $t3 := $IndexPtr(this, 32) + // $t4 := read_ref($t3) + $t4 := $LoadU64($t3) + // $t5 := -($t2, $t4) + $t5 := $Sub($t2, $t4) + // $t6 := >=($t5, $t1) + $t6 := $GtEq($t5, v) + // if ($t6) goto L1 else goto L0 + switch $t6 + case 0 { $block := 3 } + default { $block := 2 } + } + case 5 { + // label L2 + // $t8 := borrow_field.value($t0) + $t8 := $IndexPtr(this, 32) + // $t9 := read_ref($t8) + $t9 := $LoadU64($t8) + // $t10 := +($t9, $t1) + $t10 := $AddU64($t9, v) + // $t11 := borrow_field.value($t0) + $t11 := $IndexPtr(this, 32) + // write_ref($t11, $t10) + $StoreU64($t11, $t10) + // return () + leave + } + } + } + + function A3_AccountStateMachine_withdraw(this, v) { + let $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9 + let $block := 4 + for {} true {} { + switch $block + case 2 { + // label L1 + // goto L2 + $block := 5 + } + case 3 { + // label L0 + // drop($t0) + // $t5 := 2 + $t5 := 2 + // abort($t5) + $Abort($t5) + } + case 4 { + // $t2 := borrow_field.value($t0) + $t2 := $IndexPtr(this, 32) + // $t3 := read_ref($t2) + $t3 := $LoadU64($t2) + // $t4 := >=($t3, $t1) + $t4 := $GtEq($t3, v) + // if ($t4) goto L1 else goto L0 + switch $t4 + case 0 { $block := 3 } + default { $block := 2 } + } + case 5 { + // label L2 + // $t6 := borrow_field.value($t0) + $t6 := $IndexPtr(this, 32) + // $t7 := read_ref($t6) + $t7 := $LoadU64($t6) + // $t8 := -($t7, $t1) + $t8 := $Sub($t7, v) + // $t9 := borrow_field.value($t0) + $t9 := $IndexPtr(this, 32) + // write_ref($t9, $t8) + $StoreU64($t9, $t8) + // return () + leave + } + } + } + + function A3_AccountStateMachine_xfer(this, dest, v) { + let xfer_id, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12 + let $block := 4 + for {} true {} { + switch $block + case 2 { + // label L1 + // goto L2 + $block := 5 + } + case 3 { + // label L0 + // drop($t0) + // $t7 := 1 + $t7 := 1 + // abort($t7) + $Abort($t7) + } + case 4 { + // $t4 := borrow_field.value($t0) + $t4 := $IndexPtr(this, 32) + // $t5 := read_ref($t4) + $t5 := $LoadU64($t4) + // $t6 := >=($t5, $t2) + $t6 := $GtEq($t5, v) + // if ($t6) goto L1 else goto L0 + switch $t6 + case 0 { $block := 3 } + default { $block := 2 } + } + case 5 { + // label L2 + // $t8 := AccountStateMachine::new_xfer_id($t0) + $t8 := A3_AccountStateMachine_new_xfer_id(this) + // $t9 := borrow_field.pending($t0) + $t9 := this + // $t10 := Actor::virtual_time() + $t10 := A1_Actor_virtual_time() + // $t11 := pack AccountStateMachine::PendingTransfer($t8, $t2, $t10) + { + let $mem := $Malloc(32) + $MemoryStoreU64(add($mem, 16), $t8) + $MemoryStoreU64(add($mem, 24), v) + $MemoryStoreU128(add($mem, 0), $t10) + $t11 := $mem + } + // vector::push_back($t9, $t11) + A1_vector_push_back$A3_AccountStateMachine_PendingTransfer$($t9, $t11) + // $t12 := Actor::self() + $t12 := A1_Actor_self() + // AccountStateMachine::send_xfer_deposit($t1, $t2, $t12, $t8) + A3_AccountStateMachine_send_xfer_deposit(dest, v, $t12, $t8) + // return () + leave + } + } + } + + function A3_AccountStateMachine_xfer_deposit(this, v, caller_, xfer_id) { + // AccountStateMachine::deposit($t0, $t1) + A3_AccountStateMachine_deposit(this, v) + // AccountStateMachine::send_xfer_finish($t2, $t3) + A3_AccountStateMachine_send_xfer_finish(caller_, xfer_id) + // return () + } + + function A3_AccountStateMachine_xfer_finish(this, xfer_id) { + let tmp_$2, amount, i, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12 + // $t5 := freeze_ref($t0) + $t5 := this + // $t6 := AccountStateMachine::find_xfer($t5, $t1) + $t6 := A3_AccountStateMachine_find_xfer($t5, xfer_id) + // $t7 := borrow_field.pending($t0) + $t7 := this + // $t8 := vector::borrow($t7, $t6) + $t8 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t7, $t6) + // $t9 := borrow_field.amount($t8) + $t9 := $IndexPtr($t8, 24) + // $t10 := read_ref($t9) + $t10 := $LoadU64($t9) + // $t11 := borrow_field.pending($t0) + $t11 := this + // $t12 := vector::remove($t11, $t6) + $t12 := A1_vector_remove$A3_AccountStateMachine_PendingTransfer$($t11, $t6) + // drop($t12) + $Free($t12, 32) + // AccountStateMachine::withdraw($t0, $t10) + A3_AccountStateMachine_withdraw(this, $t10) + // return () + } + + function A1_vector_remove$A3_AccountStateMachine_PendingTransfer$(v, i) -> $result { + let tmp_$2, tmp_$3, len, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12, $t13, $t14, $t15 + let $block := 4 + for {} true {} { + switch $block + case 2 { + // label L1 + // drop($t0) + // $t8 := 131072 + $t8 := 131072 + // abort($t8) + $Abort($t8) + } + case 3 { + // label L0 + // $t9 := 1 + $t9 := 1 + // $t10 := -($t6, $t9) + $t10 := $Sub($t6, $t9) + // goto L5 + $block := 5 + } + case 4 { + // $t5 := freeze_ref($t0) + $t5 := v + // $t6 := vector::length<#0>($t5) + $t6 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t5) + // $t7 := >=($t1, $t6) + $t7 := $GtEq(i, $t6) + // if ($t7) goto L1 else goto L0 + switch $t7 + case 0 { $block := 3 } + default { $block := 2 } + } + case 5 { + // label L5 + // $t11 := <($t1, $t10) + $t11 := $Lt(i, $t10) + // if ($t11) goto L3 else goto L2 + switch $t11 + case 0 { $block := 7 } + default { $block := 6 } + } + case 6 { + // label L3 + // goto L4 + $block := 8 + } + case 7 { + // label L2 + // $t15 := vector::pop_back<#0>($t0) + $t15 := A1_vector_pop_back$A3_AccountStateMachine_PendingTransfer$(v) + // return $t15 + $result := $t15 + leave + } + case 8 { + // label L4 + // $t12 := copy($t1) + $t12 := i + // $t13 := 1 + $t13 := 1 + // $t14 := +($t1, $t13) + $t14 := $AddU64(i, $t13) + // $t1 := $t14 + i := $t14 + // vector::swap<#0>($t0, $t12, $t14) + A1_vector_swap$A3_AccountStateMachine_PendingTransfer$(v, $t12, $t14) + // goto L5 + $block := 5 + } + } + } + + function A1_vector_swap$A3_AccountStateMachine_PendingTransfer$(v_ref, i, j) { + let v_offs := $LoadU256(v_ref) + let v_ptr := $MakePtr($IsStoragePtr(v_ref), v_offs) + let size := $LoadU64(v_ptr) + if or($GtEq(i, size), $GtEq(j, size)) { $AbortBuiltin() } + let i_ptr := $IndexPtr(v_ptr, add(32, mul(i, 32))) + let j_ptr := $IndexPtr(v_ptr, add(32, mul(j, 32))) + let i_val := $LoadU256(i_ptr) + let j_val := $LoadU256(j_ptr) + $StoreU256(i_ptr, j_val) + $StoreU256(j_ptr, i_val) + } + function A1_vector_pop_back$A3_AccountStateMachine_PendingTransfer$(v_ref) -> e { + let v_offs := $LoadU256(v_ref) + let v_ptr := $MakePtr($IsStoragePtr(v_ref), v_offs) + let size := $LoadU64(v_ptr) + if iszero(size) { $AbortBuiltin() } + let e_ptr := $IndexPtr(v_ptr, add(32, mul(sub(size, 1), 32))) + e := $LoadU256(e_ptr) + if $IsStoragePtr(e_ptr) { + let e_offs := $OffsetPtr(e_ptr) + let linked_src := $AlignedStorageLoad(e_offs) + e := $Malloc(32) + mstore(add(e, 0), $AlignedStorageLoad(add(linked_src, 0))) + $AlignedStorageStore(add(linked_src, 0), 0) + $AlignedStorageStore(e_offs, 0) + } + $StoreU64(v_ptr, sub(size, 1)) + } + function A1_vector_length$A3_AccountStateMachine_PendingTransfer$(v_ref) -> len { + let v_offs := $LoadU256(v_ref) + let v_ptr := $MakePtr($IsStoragePtr(v_ref), v_offs) + len := $LoadU64(v_ptr) + } + function A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$(v_ref, i) -> e_ptr { + let v_offs := $LoadU256(v_ref) + let v_ptr := $MakePtr($IsStoragePtr(v_ref), v_offs) + let size := $LoadU64(v_ptr) + if $GtEq(i, size) { $AbortBuiltin() } + e_ptr := $IndexPtr(v_ptr, add(32, mul(i, 32))) + let e := $LoadU256(e_ptr) + e_ptr := $MakePtr($IsStoragePtr(v_ref), e) + } + function A3_AccountStateMachine_find_xfer(this, xfer_id) -> $result { + let tmp_$2, i, pending, $t5, $t6, $t7, $t8, $t9, $t10, $t11, $t12, $t13, $t14, $t15, $t16 + let $block := 3 + for {} true {} { + switch $block + case 2 { + // label L6 + // $t7 := vector::length($t5) + $t7 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t5) + // $t8 := <($t3, $t7) + $t8 := $Lt(i, $t7) + // if ($t8) goto L1 else goto L0 + switch $t8 + case 0 { $block := 5 } + default { $block := 4 } + } + case 3 { + // $t5 := borrow_field.pending($t0) + $t5 := this + // $t6 := 0 + $t6 := 0 + // $t3 := $t6 + i := $t6 + // goto L6 + $block := 2 + } + case 4 { + // label L1 + // goto L2 + $block := 6 + } + case 5 { + // label L0 + // $t12 := false + $t12 := false + // $t2 := $t12 + tmp_$2 := $t12 + // goto L3 + $block := 7 + } + case 6 { + // label L2 + // $t9 := vector::borrow($t5, $t3) + $t9 := A1_vector_borrow$A3_AccountStateMachine_PendingTransfer$($t5, i) + // $t10 := borrow_field.xfer_id($t9) + $t10 := $IndexPtr($t9, 16) + // $t11 := read_ref($t10) + $t11 := $LoadU64($t10) + // $t2 := !=($t11, $t1) + tmp_$2 := $Neq($t11, xfer_id) + // goto L3 + $block := 7 + } + case 7 { + // label L3 + // if ($t2) goto L5 else goto L4 + switch tmp_$2 + case 0 { $block := 9 } + default { $block := 8 } + } + case 8 { + // label L5 + // $t13 := 1 + $t13 := 1 + // $t3 := +($t3, $t13) + i := $AddU64(i, $t13) + // goto L6 + $block := 2 + } + case 9 { + // label L4 + // $t14 := vector::length($t5) + $t14 := A1_vector_length$A3_AccountStateMachine_PendingTransfer$($t5) + // $t15 := <($t3, $t14) + $t15 := $Lt(i, $t14) + // if ($t15) goto L8 else goto L7 + switch $t15 + case 0 { $block := 11 } + default { $block := 10 } + } + case 10 { + // label L8 + // goto L9 + $block := 12 + } + case 11 { + // label L7 + // $t16 := 3 + $t16 := 3 + // abort($t16) + $Abort($t16) + } + case 12 { + // label L9 + // return $t3 + $result := i + leave + } + } + } + + function A3_AccountStateMachine_send_xfer_finish(actor,xfer_id) { + let $t2 := 0x6a51b363524e1e502dbe8698bec5f165b6cf490a68c4ee9063f2c2f0653ff0dd + let $t3 := 0x09d2fda8 + { + let $t4 := mload(0) + let $t5 := abi_encode_tuple_$address_uint64_uint64$_$address_u64_u64$($t4, actor,$t3,xfer_id) + log1($t4, sub($t5, $t4), $t2) + mstore(0, $t5) + } + } + function A3_AccountStateMachine_send_xfer_deposit(actor,v,caller_,xfer_id) { + let $t4 := 0x5163aa8ed9d57dbb55d2433f534c881e8fec62da43488c756dbd1ac604ce9c1b + let $t5 := 0x8eeea8a2 + { + let $t6 := mload(0) + let $t7 := abi_encode_tuple_$address_uint64_uint64_address_uint64$_$address_u64_u64_address_u64$($t6, actor,$t5,v,caller_,xfer_id) + log1($t6, sub($t7, $t6), $t4) + mstore(0, $t7) + } + } + function A1_Actor_self() -> addr { + addr := address() + } + function A1_vector_push_back$A3_AccountStateMachine_PendingTransfer$(v_ref, e) { + let v_offs := $LoadU256(v_ref) + let v_ptr := $MakePtr($IsStoragePtr(v_ref), v_offs) + let size := $LoadU64(v_ptr) + let e_ptr := $IndexPtr(v_ptr, add(32, mul(size, 32))) + $StoreU256(e_ptr, e) + if $IsStoragePtr(e_ptr) { + let e_offs := $OffsetPtr(e_ptr) + let $linked_dst_1341933877 := $NewLinkedStorageBase(0x4ffc4935) + $AlignedStorageStore(add($linked_dst_1341933877, 0), mload(add(e, 0))) + $Free(e, 32) + $AlignedStorageStore(e_offs, $linked_dst_1341933877) + } + size := add(size, 1) + $StoreU64(v_ptr, size) + let capacity := $LoadU64($IndexPtr(v_ptr, 8)) + if and(iszero($IsStoragePtr(v_ptr)), eq(size, capacity)) { + let new_v_offs := $ResizeVector(v_offs, capacity, 32) + $StoreU256(v_ref, new_v_offs) + } + } + function A1_Actor_virtual_time() -> virtual_time { + virtual_time := timestamp() + } + function A3_AccountStateMachine_new_xfer_id(this) -> $result { + let counter, xfer_id, $t3, $t4, $t5, $t6, $t7 + // $t3 := borrow_field.xfer_id_counter($t0) + $t3 := $IndexPtr(this, 40) + // $t4 := read_ref($t3) + $t4 := $LoadU64($t3) + // $t5 := read_ref($t3) + $t5 := $LoadU64($t3) + // $t6 := 1 + $t6 := 1 + // $t7 := +($t5, $t6) + $t7 := $AddU64($t5, $t6) + // write_ref($t3, $t7) + $StoreU64($t3, $t7) + // return $t4 + $result := $t4 + } + + function abi_encode_tuple_$address_uint64_uint64_address_uint64$_$address_u64_u64_address_u64$(headStart ,value_0, value_1, value_2, value_3, value_4) -> tail { + tail := add(headStart, 160) + abi_encode_address(value_0, add(headStart, 0)) + abi_encode_uint64(value_1, add(headStart, 32)) + abi_encode_uint64(value_2, add(headStart, 64)) + abi_encode_address(value_3, add(headStart, 96)) + abi_encode_uint64(value_4, add(headStart, 128)) + } + function abi_encode_uint64(value, pos) { + mstore(pos, cleanup_uint64(value)) + } + function cleanup_uint64(value) -> cleaned { + cleaned := and(value, 0xffffffffffffffff) + } + function abi_encode_address(value, pos) { + mstore(pos, cleanup_address(value)) + } + function cleanup_address(value) -> cleaned { + cleaned := and(value, 0xffffffffffffffffffffffffffffffffffffffff) + } + function abi_encode_tuple_$address_uint64_uint64$_$address_u64_u64$(headStart ,value_0, value_1, value_2) -> tail { + tail := add(headStart, 96) + abi_encode_address(value_0, add(headStart, 0)) + abi_encode_uint64(value_1, add(headStart, 32)) + abi_encode_uint64(value_2, add(headStart, 64)) + } + function abi_encode_tuple__(headStart ) -> tail { + tail := add(headStart, 0) + } + function abi_decode_tuple_$uint64$_$u64$(headStart, dataEnd) -> value_0 { + if slt(sub(dataEnd, headStart), 32) { $Abort(96) } + { + let offset := 0 + value_0 := abi_decode_uint64(add(headStart, offset), dataEnd) + } + } + function abi_decode_uint64(offset, end) -> value { + value := calldataload(offset) + validator_uint64(value) + } + function validator_uint64(value) { + if iszero(eq(value, cleanup_uint64(value))) { $Abort(95) } + } + function abi_decode_tuple_$uint64_address_uint64$_$u64_address_u64$(headStart, dataEnd) -> value_0, value_1, value_2 { + if slt(sub(dataEnd, headStart), 96) { $Abort(96) } + { + let offset := 0 + value_0 := abi_decode_uint64(add(headStart, offset), dataEnd) + } + { + let offset := 32 + value_1 := abi_decode_address(add(headStart, offset), dataEnd) + } + { + let offset := 64 + value_2 := abi_decode_uint64(add(headStart, offset), dataEnd) + } + } + function abi_decode_address(offset, end) -> value { + value := calldataload(offset) + validator_address(value) + } + function validator_address(value) { + if iszero(eq(value, cleanup_address(value))) { $Abort(95) } + } + function abi_decode_tuple_$address_uint64$_$address_u64$(headStart, dataEnd) -> value_0, value_1 { + if slt(sub(dataEnd, headStart), 64) { $Abort(96) } + { + let offset := 0 + value_0 := abi_decode_address(add(headStart, offset), dataEnd) + } + { + let offset := 32 + value_1 := abi_decode_uint64(add(headStart, offset), dataEnd) + } + } + function $Abort(code) { + mstore(0, code) + revert(24, 8) // TODO: store code as a string? + } + function $AbortBuiltin() { + $Abort(sub(0, 1)) + } + function $Malloc(size) -> offs { + offs := mload(0) + // pad to word size + mstore(0, add(offs, shl(5, shr(5, add(size, 31))))) + } + function $Free(offs, size) { + } + function $MakePtr(is_storage, offs) -> ptr { + ptr := or(is_storage, shl(1, offs)) + } + function $IsStoragePtr(ptr) -> b { + b := and(ptr, 0x1) + } + function $OffsetPtr(ptr) -> offs { + offs := shr(1, ptr) + } + function $MaskForSize(size) -> mask { + mask := sub(shl(shl(3, size), 1), 1) + } + function $ExtractBytes(word, start, size) -> bytes { + switch size + case 1 { + // use the faster byte primitive + bytes := byte(start, word) + } + default { + // As we have big endian, we need to right shift the value from + // where the highest byte starts in the word (32 - start), minus + // the size. + let shift_bits := shl(3, sub(sub(32, start), size)) + bytes := and(shr(shift_bits, word), $MaskForSize(size)) + } + } + function $InjectBytes(word, start, size, bytes) -> new_word { + let shift_bits := shl(3, sub(sub(32, start), size)) + // Blend out the bits which we inject + let neg_mask := not(shl(shift_bits, $MaskForSize(size))) + word := and(word, neg_mask) + // Overlay the bits we inject + new_word := or(word, shl(shift_bits, bytes)) + } + function $ToWordOffs(offs) -> word_offs, byte_offset { + word_offs := shr(5, offs) + byte_offset := and(offs, 0x1F) + } + function $OverflowBytes(byte_offset, size) -> overflow_bytes { + let available_bytes := sub(32, byte_offset) + switch gt(size, available_bytes) + case 0 { + overflow_bytes := 0 + } + default { + overflow_bytes := sub(size, available_bytes) + } + } + function $MemoryLoadBytes(offs, size) -> val { + // Lower bit where the value in the higher bytes ends + let bit_end := shl(3, sub(32, size)) + val := shr(bit_end, mload(offs)) + } + function $MemoryStoreBytes(offs, size, val) { + let bit_end := shl(3, sub(32, size)) + let mask := shl(bit_end, $MaskForSize(size)) + mstore(offs, or(and(mload(offs), not(mask)), shl(bit_end, val))) + } + function $StorageLoadBytes(offs, size) -> val { + let word_offs, byte_offs := $ToWordOffs(offs) + let key := $StorageKey(0, word_offs) + val := $ExtractBytes(sload(key), byte_offs, size) + let overflow_bytes := $OverflowBytes(byte_offs, size) + if $LogicalNot(iszero(overflow_bytes)) { + key := $StorageKey(0, add(word_offs, 1)) + let extra_bytes := $ExtractBytes(sload(key), 0, overflow_bytes) + val := or(shl(shl(3, overflow_bytes), val), extra_bytes) + } + } + function $StorageStoreBytes(offs, size, bytes) { + let word_offs, byte_offs := $ToWordOffs(offs) + let key := $StorageKey(0, word_offs) + let overflow_bytes := $OverflowBytes(byte_offs, size) + switch overflow_bytes + case 0 { + sstore(key, $InjectBytes(sload(key), byte_offs, size, bytes)) + } + default { + // Shift the higher bytes to the right + let used_bytes := sub(size, overflow_bytes) + let higher_bytes := shr(used_bytes, bytes) + let lower_bytes := and(bytes, $MaskForSize(overflow_bytes)) + sstore(key, $InjectBytes(sload(key), byte_offs, used_bytes, higher_bytes)) + key := $StorageKey(0, add(word_offs, 1)) + sstore(key, $InjectBytes(sload(key), 0, overflow_bytes, lower_bytes)) + } + } + function $StorageKey(group, word) -> key { + mstore(32, word) + mstore(64, shl(224, group)) + key := keccak256(32, 36) + } + function $MakeTypeStorageBase(category, type_hash, id) -> offs { + offs := or(shl(252, category), or(shl(220, type_hash), shl(60, id))) + } + function $NewLinkedStorageBase(type_hash) -> offs { + let key := $StorageKey(1, 1) + let handle := sload(key) + sstore(key, add(handle, 1)) + offs := $MakeTypeStorageBase(1, type_hash, handle) + } + function $IndexPtr(ptr, offs) -> new_ptr { + new_ptr := $MakePtr($IsStoragePtr(ptr), add($OffsetPtr(ptr), offs)) + } + function $LoadU64(ptr) -> val { + let offs := $OffsetPtr(ptr) + switch $IsStoragePtr(ptr) + case 0 { + val := $MemoryLoadU64(offs) + } + default { + val := $StorageLoadU64(offs) + } + } + function $MemoryLoadU64(offs) -> val { + val := $MemoryLoadBytes(offs, 8) + } + function $StorageLoadU64(offs) -> val { + val := $StorageLoadBytes(offs, 8) + } + function $StoreU64(ptr, val) { + let offs := $OffsetPtr(ptr) + switch $IsStoragePtr(ptr) + case 0 { + $MemoryStoreU64(offs, val) + } + default { + $StorageStoreU64(offs, val) + } + } + function $MemoryStoreU64(offs, val) { + $MemoryStoreBytes(offs, 8, val) + } + function $StorageStoreU64(offs, val) { + $StorageStoreBytes(offs, 8, val) + } + function $LoadU128(ptr) -> val { + let offs := $OffsetPtr(ptr) + switch $IsStoragePtr(ptr) + case 0 { + val := $MemoryLoadU128(offs) + } + default { + val := $StorageLoadU128(offs) + } + } + function $MemoryLoadU128(offs) -> val { + val := $MemoryLoadBytes(offs, 16) + } + function $StorageLoadU128(offs) -> val { + val := $StorageLoadBytes(offs, 16) + } + function $MemoryStoreU128(offs, val) { + $MemoryStoreBytes(offs, 16, val) + } + function $LoadU256(ptr) -> val { + let offs := $OffsetPtr(ptr) + switch $IsStoragePtr(ptr) + case 0 { + val := $MemoryLoadU256(offs) + } + default { + val := $StorageLoadU256(offs) + } + } + function $MemoryLoadU256(offs) -> val { + val := $MemoryLoadBytes(offs, 32) + } + function $StorageLoadU256(offs) -> val { + val := $StorageLoadBytes(offs, 32) + } + function $StoreU256(ptr, val) { + let offs := $OffsetPtr(ptr) + switch $IsStoragePtr(ptr) + case 0 { + $MemoryStoreU256(offs, val) + } + default { + $StorageStoreU256(offs, val) + } + } + function $MemoryStoreU256(offs, val) { + $MemoryStoreBytes(offs, 32, val) + } + function $StorageStoreU256(offs, val) { + $StorageStoreBytes(offs, 32, val) + } + function $AlignedStorageLoad(offs) -> val { + let word_offs := shr(5, offs) + val := sload($StorageKey(0, word_offs)) + } + function $AlignedStorageStore(offs, val) { + let word_offs := shr(5, offs) + sstore($StorageKey(0, word_offs), val) + } + function $CopyMemory(src, dst, size) { + let num_words, overflow_bytes := $ToWordOffs(size) + let i := 0 + for { } lt(i, mul(num_words, 32)) { i := add(i, 32) } { + mstore(add(dst, i), mload(add(src, i))) + } + if overflow_bytes { + let mask := $MaskForSize(sub(32, overflow_bytes)) + let overflow_offs := mul(num_words, 32) + let dst_word := and(mload(add(dst, overflow_offs)), mask) + let src_word := and(mload(add(src, overflow_offs)), not(mask)) + mstore(add(dst, overflow_offs), or(dst_word, src_word)) + } + } + function $ResizeVector(v_offs, capacity, type_size) -> new_v_offs { + let new_capacity := mul(capacity, 2) + let data_size := add(32, mul(capacity, type_size)) + let new_data_size := add(32, mul(new_capacity, type_size)) + new_v_offs := $Malloc(new_data_size) + $CopyMemory(v_offs, new_v_offs, data_size) + // update capacity at new location + $MemoryStoreU64(add(new_v_offs, 8), new_capacity) + $Free(v_offs, data_size) + } + function $AddU64(x, y) -> r { + if lt(sub(0xffffffffffffffff, x), y) { $AbortBuiltin() } + r := add(x, y) + } + function $Sub(x, y) -> r { + if lt(x, y) { $AbortBuiltin() } + r := sub(x, y) + } + function $Shr(x, y) -> r { + r := shr(y, x) + } + function $Lt(x, y) -> r { + r := lt(x, y) + } + function $GtEq(x, y) -> r { + r := or(gt(x, y), eq(x, y)) + } + function $Neq(x, y) -> r { + r := $LogicalNot(eq(x, y)) + } + function $LogicalNot(x) -> r { + r := iszero(x) + } + } + } +} + + +!! Succeeded compiling Yul diff --git a/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp b/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp index 4666b284b3fcd..b51e33ba8fde2 100644 --- a/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp +++ b/third_party/move/evm/move-to-yul/tests/ConstructorTest.exp @@ -23,14 +23,14 @@ object "A2_ConstructorTest" { mstore($locals, A2_Evm_sign($t3)) // $t4 := borrow_local($t2) $t4 := $MakePtr(false, $locals) - // $t5 := pack 0x2::ConstructorTest::Balance($t0, $t1) + // $t5 := pack ConstructorTest::Balance($t0, $t1) { let $mem := $Malloc(16) $MemoryStoreU64(add($mem, 0), value) $MemoryStoreU64(add($mem, 8), value2) $t5 := $mem } - // move_to<0x2::ConstructorTest::Balance>($t5, $t4) + // move_to($t5, $t4) { let $base_offset := $MakeTypeStorageBase(0, 0x91d9463a, $LoadU256($t4)) if $AlignedStorageLoad($base_offset) { @@ -212,7 +212,7 @@ object "A2_ConstructorTest" { let $t0, $t1, $t2, $t3 // $t0 := 0x42 $t0 := 0x42 - // $t1 := borrow_global<0x2::ConstructorTest::Balance>($t0) + // $t1 := borrow_global($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x91d9463a, $t0) if iszero($AlignedStorageLoad($base_offset)) { @@ -220,7 +220,7 @@ object "A2_ConstructorTest" { } $t1 := $MakePtr(true, add($base_offset, 32)) } - // $t2 := borrow_field<0x2::ConstructorTest::Balance>.value($t1) + // $t2 := borrow_field.value($t1) $t2 := $t1 // $t3 := read_ref($t2) $t3 := $LoadU64($t2) diff --git a/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp b/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp index 12db22c42d0a0..fcee1e13c2424 100644 --- a/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp +++ b/third_party/move/evm/move-to-yul/tests/GlobalVectors.exp @@ -93,13 +93,13 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { $t10 := $MakePtr(false, add($locals, 32)) // $t11 := move($t2) $t11 := mload($locals) - // $t12 := pack 0x2::GlobalVectors::T($t11) + // $t12 := pack GlobalVectors::T($t11) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t11) $t12 := $mem } - // move_to<0x2::GlobalVectors::T>($t12, $t10) + // move_to>($t12, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -128,7 +128,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } // $t13 := 0x42 $t13 := 0x42 - // $t14 := borrow_global<0x2::GlobalVectors::T>($t13) + // $t14 := borrow_global>($t13) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t13) if iszero($AlignedStorageLoad($base_offset)) { @@ -136,7 +136,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } $t14 := $MakePtr(true, add($base_offset, 32)) } - // $t15 := borrow_field<0x2::GlobalVectors::T>.v($t14) + // $t15 := borrow_field>.v($t14) $t15 := $t14 // $t16 := 0 $t16 := 0 @@ -148,7 +148,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { $StoreU64($t17, $t18) // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) + // $t20 := borrow_global>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -156,7 +156,7 @@ object "test_A2_GlobalVectors_test_borrow_mut_global" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) + // $t21 := borrow_field>.v($t20) $t21 := $t20 // $t22 := 0 $t22 := 0 @@ -502,13 +502,13 @@ object "test_A2_GlobalVectors_test_move_from" { $t10 := $MakePtr(false, add($locals, 32)) // $t11 := move($t1) $t11 := mload($locals) - // $t12 := pack 0x2::GlobalVectors::T($t11) + // $t12 := pack GlobalVectors::T($t11) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t11) $t12 := $mem } - // move_to<0x2::GlobalVectors::T>($t12, $t10) + // move_to>($t12, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -537,7 +537,7 @@ object "test_A2_GlobalVectors_test_move_from" { } // $t13 := 0x42 $t13 := 0x42 - // $t14 := move_from<0x2::GlobalVectors::T>($t13) + // $t14 := move_from>($t13) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t13) if iszero($AlignedStorageLoad($base_offset)) { @@ -569,7 +569,7 @@ object "test_A2_GlobalVectors_test_move_from" { $t14 := $dst } } - // $t2 := unpack 0x2::GlobalVectors::T($t14) + // $t2 := unpack GlobalVectors::T($t14) mstore(add($locals, 64), $MemoryLoadU256(add($t14, 0))) $Free($t14, 32) // $t15 := borrow_local($t2) @@ -1060,7 +1060,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $Abort($t25) } case 4 { - // $t2 := vector::empty<0x2::GlobalVectors::S>() + // $t2 := vector::empty() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t3 := borrow_local($t2) $t3 := $MakePtr(false, $locals) @@ -1068,14 +1068,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t4 := 10 // $t5 := 40 $t5 := 40 - // $t6 := pack 0x2::GlobalVectors::S($t4, $t5) + // $t6 := pack GlobalVectors::S($t4, $t5) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t4) $MemoryStoreU64(add($mem, 16), $t5) $t6 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t3, $t6) + // vector::push_back($t3, $t6) A1_vector_push_back$A2_GlobalVectors_S$($t3, $t6) // $t7 := borrow_local($t2) $t7 := $MakePtr(false, $locals) @@ -1083,14 +1083,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t8 := 11 // $t9 := 41 $t9 := 41 - // $t10 := pack 0x2::GlobalVectors::S($t8, $t9) + // $t10 := pack GlobalVectors::S($t8, $t9) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t8) $MemoryStoreU64(add($mem, 16), $t9) $t10 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t7, $t10) + // vector::push_back($t7, $t10) A1_vector_push_back$A2_GlobalVectors_S$($t7, $t10) // $t11 := borrow_local($t2) $t11 := $MakePtr(false, $locals) @@ -1098,14 +1098,14 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t12 := 12 // $t13 := 42 $t13 := 42 - // $t14 := pack 0x2::GlobalVectors::S($t12, $t13) + // $t14 := pack GlobalVectors::S($t12, $t13) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t12) $MemoryStoreU64(add($mem, 16), $t13) $t14 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t11, $t14) + // vector::push_back($t11, $t14) A1_vector_push_back$A2_GlobalVectors_S$($t11, $t14) // $t15 := 0x42 $t15 := 0x42 @@ -1115,13 +1115,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { $t16 := $MakePtr(false, add($locals, 32)) // $t17 := move($t2) $t17 := mload($locals) - // $t18 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t17) + // $t18 := pack GlobalVectors::T($t17) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t17) $t18 := $mem } - // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18, $t16) + // move_to>($t18, $t16) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t16)) if $AlignedStorageLoad($base_offset) { @@ -1156,7 +1156,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { } // $t19 := 0x42 $t19 := 0x42 - // $t1 := move_from<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t19) + // $t1 := move_from>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -1197,9 +1197,9 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { } // $t20 := borrow_local($t1) $t20 := $MakePtr(false, local_t) - // $t21 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t20) + // $t21 := borrow_field>.v($t20) $t21 := $t20 - // $t22 := vector::length<0x2::GlobalVectors::S>($t21) + // $t22 := vector::length($t21) $t22 := A1_vector_length$A2_GlobalVectors_S$($t21) // $t23 := 3 $t23 := 3 @@ -1214,13 +1214,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L2 // $t26 := borrow_local($t1) $t26 := $MakePtr(false, local_t) - // $t27 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t26) + // $t27 := borrow_field>.v($t26) $t27 := $t26 // $t28 := 0 $t28 := 0 - // $t29 := vector::borrow<0x2::GlobalVectors::S>($t27, $t28) + // $t29 := vector::borrow($t27, $t28) $t29 := A1_vector_borrow$A2_GlobalVectors_S$($t27, $t28) - // $t30 := borrow_field<0x2::GlobalVectors::S>.x($t29) + // $t30 := borrow_field.x($t29) $t30 := $t29 // $t31 := read_ref($t30) $t31 := $LoadU128($t30) @@ -1249,13 +1249,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L5 // $t35 := borrow_local($t1) $t35 := $MakePtr(false, local_t) - // $t36 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t35) + // $t36 := borrow_field>.v($t35) $t36 := $t35 // $t37 := 1 $t37 := 1 - // $t38 := vector::borrow<0x2::GlobalVectors::S>($t36, $t37) + // $t38 := vector::borrow($t36, $t37) $t38 := A1_vector_borrow$A2_GlobalVectors_S$($t36, $t37) - // $t39 := borrow_field<0x2::GlobalVectors::S>.x($t38) + // $t39 := borrow_field.x($t38) $t39 := $t38 // $t40 := read_ref($t39) $t40 := $LoadU128($t39) @@ -1284,13 +1284,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_struct" { // label L8 // $t44 := borrow_local($t1) $t44 := $MakePtr(false, local_t) - // $t45 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t44) + // $t45 := borrow_field>.v($t44) $t45 := $t44 // $t46 := 2 $t46 := 2 - // $t47 := vector::borrow<0x2::GlobalVectors::S>($t45, $t46) + // $t47 := vector::borrow($t45, $t46) $t47 := A1_vector_borrow$A2_GlobalVectors_S$($t45, $t46) - // $t48 := borrow_field<0x2::GlobalVectors::S>.x($t47) + // $t48 := borrow_field.x($t47) $t48 := $t47 // $t49 := read_ref($t48) $t49 := $LoadU128($t48) @@ -1685,13 +1685,13 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { $t13 := $MakePtr(false, add($locals, 32)) // $t14 := move($t2) $t14 := mload($locals) - // $t15 := pack 0x2::GlobalVectors::T>($t14) + // $t15 := pack GlobalVectors::T>($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // move_to<0x2::GlobalVectors::T>>($t15, $t13) + // move_to>>($t15, $t13) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $LoadU256($t13)) if $AlignedStorageLoad($base_offset) { @@ -1733,7 +1733,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { } // $t16 := 0x42 $t16 := 0x42 - // $t1 := move_from<0x2::GlobalVectors::T>>($t16) + // $t1 := move_from>>($t16) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t16) if iszero($AlignedStorageLoad($base_offset)) { @@ -1783,7 +1783,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { } // $t17 := borrow_local($t1) $t17 := $MakePtr(false, local_t) - // $t18 := borrow_field<0x2::GlobalVectors::T>>.v($t17) + // $t18 := borrow_field>>.v($t17) $t18 := $t17 // $t19 := vector::length>($t18) $t19 := A1_vector_length$vec$u64$$($t18) @@ -1800,7 +1800,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L2 // $t23 := borrow_local($t1) $t23 := $MakePtr(false, local_t) - // $t24 := borrow_field<0x2::GlobalVectors::T>>.v($t23) + // $t24 := borrow_field>>.v($t23) $t24 := $t23 // $t25 := 0 $t25 := 0 @@ -1837,7 +1837,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L5 // $t33 := borrow_local($t1) $t33 := $MakePtr(false, local_t) - // $t34 := borrow_field<0x2::GlobalVectors::T>>.v($t33) + // $t34 := borrow_field>>.v($t33) $t34 := $t33 // $t35 := 1 $t35 := 1 @@ -1874,7 +1874,7 @@ object "test_A2_GlobalVectors_test_move_from_vector_of_vector" { // label L8 // $t43 := borrow_local($t1) $t43 := $MakePtr(false, local_t) - // $t44 := borrow_field<0x2::GlobalVectors::T>>.v($t43) + // $t44 := borrow_field>>.v($t43) $t44 := $t43 // $t45 := 2 $t45 := 2 @@ -2298,13 +2298,13 @@ object "test_A2_GlobalVectors_test_move_to" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack 0x2::GlobalVectors::T($t10) + // $t11 := pack GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to<0x2::GlobalVectors::T>($t11, $t9) + // move_to>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -2333,7 +2333,7 @@ object "test_A2_GlobalVectors_test_move_to" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) + // $t13 := borrow_global>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -2341,7 +2341,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) + // $t14 := borrow_field>.v($t13) $t14 := $t13 // $t15 := vector::length($t14) $t15 := A1_vector_length$u64$($t14) @@ -2358,7 +2358,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L2 // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) + // $t20 := borrow_global>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -2366,7 +2366,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) + // $t21 := borrow_field>.v($t20) $t21 := $t20 // $t22 := 0 $t22 := 0 @@ -2399,7 +2399,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L5 // $t28 := 0x42 $t28 := 0x42 - // $t29 := borrow_global<0x2::GlobalVectors::T>($t28) + // $t29 := borrow_global>($t28) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t28) if iszero($AlignedStorageLoad($base_offset)) { @@ -2407,7 +2407,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t29 := $MakePtr(true, add($base_offset, 32)) } - // $t30 := borrow_field<0x2::GlobalVectors::T>.v($t29) + // $t30 := borrow_field>.v($t29) $t30 := $t29 // $t31 := 1 $t31 := 1 @@ -2440,7 +2440,7 @@ object "test_A2_GlobalVectors_test_move_to" { // label L8 // $t37 := 0x42 $t37 := 0x42 - // $t38 := borrow_global<0x2::GlobalVectors::T>($t37) + // $t38 := borrow_global>($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -2448,7 +2448,7 @@ object "test_A2_GlobalVectors_test_move_to" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field<0x2::GlobalVectors::T>.v($t38) + // $t39 := borrow_field>.v($t38) $t39 := $t38 // $t40 := 2 $t40 := 2 @@ -2776,7 +2776,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $Abort($t24) } case 4 { - // $t1 := vector::empty<0x2::GlobalVectors::S>() + // $t1 := vector::empty() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, $locals) @@ -2784,14 +2784,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t3 := 10 // $t4 := 40 $t4 := 40 - // $t5 := pack 0x2::GlobalVectors::S($t3, $t4) + // $t5 := pack GlobalVectors::S($t3, $t4) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t3) $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t2, $t5) + // vector::push_back($t2, $t5) A1_vector_push_back$A2_GlobalVectors_S$($t2, $t5) // $t6 := borrow_local($t1) $t6 := $MakePtr(false, $locals) @@ -2799,14 +2799,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t7 := 11 // $t8 := 41 $t8 := 41 - // $t9 := pack 0x2::GlobalVectors::S($t7, $t8) + // $t9 := pack GlobalVectors::S($t7, $t8) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t7) $MemoryStoreU64(add($mem, 16), $t8) $t9 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t6, $t9) + // vector::push_back($t6, $t9) A1_vector_push_back$A2_GlobalVectors_S$($t6, $t9) // $t10 := borrow_local($t1) $t10 := $MakePtr(false, $locals) @@ -2814,14 +2814,14 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t11 := 12 // $t12 := 42 $t12 := 42 - // $t13 := pack 0x2::GlobalVectors::S($t11, $t12) + // $t13 := pack GlobalVectors::S($t11, $t12) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t11) $MemoryStoreU64(add($mem, 16), $t12) $t13 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t10, $t13) + // vector::push_back($t10, $t13) A1_vector_push_back$A2_GlobalVectors_S$($t10, $t13) // $t14 := 0x42 $t14 := 0x42 @@ -2831,13 +2831,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { $t15 := $MakePtr(false, add($locals, 32)) // $t16 := move($t1) $t16 := mload($locals) - // $t17 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t16) + // $t17 := pack GlobalVectors::T($t16) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t16) $t17 := $mem } - // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t17, $t15) + // move_to>($t17, $t15) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t15)) if $AlignedStorageLoad($base_offset) { @@ -2872,7 +2872,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18) + // $t19 := borrow_global>($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -2880,9 +2880,9 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t19) + // $t20 := borrow_field>.v($t19) $t20 := $t19 - // $t21 := vector::length<0x2::GlobalVectors::S>($t20) + // $t21 := vector::length($t20) $t21 := A1_vector_length$A2_GlobalVectors_S$($t20) // $t22 := 3 $t22 := 3 @@ -2897,7 +2897,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L2 // $t25 := 0x42 $t25 := 0x42 - // $t26 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t25) + // $t26 := borrow_global>($t25) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t25) if iszero($AlignedStorageLoad($base_offset)) { @@ -2905,13 +2905,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t26 := $MakePtr(true, add($base_offset, 32)) } - // $t27 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t26) + // $t27 := borrow_field>.v($t26) $t27 := $t26 // $t28 := 0 $t28 := 0 - // $t29 := vector::borrow<0x2::GlobalVectors::S>($t27, $t28) + // $t29 := vector::borrow($t27, $t28) $t29 := A1_vector_borrow$A2_GlobalVectors_S$($t27, $t28) - // $t30 := borrow_field<0x2::GlobalVectors::S>.x($t29) + // $t30 := borrow_field.x($t29) $t30 := $t29 // $t31 := read_ref($t30) $t31 := $LoadU128($t30) @@ -2940,7 +2940,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L5 // $t35 := 0x42 $t35 := 0x42 - // $t36 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t35) + // $t36 := borrow_global>($t35) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t35) if iszero($AlignedStorageLoad($base_offset)) { @@ -2948,13 +2948,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t36 := $MakePtr(true, add($base_offset, 32)) } - // $t37 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t36) + // $t37 := borrow_field>.v($t36) $t37 := $t36 // $t38 := 1 $t38 := 1 - // $t39 := vector::borrow<0x2::GlobalVectors::S>($t37, $t38) + // $t39 := vector::borrow($t37, $t38) $t39 := A1_vector_borrow$A2_GlobalVectors_S$($t37, $t38) - // $t40 := borrow_field<0x2::GlobalVectors::S>.x($t39) + // $t40 := borrow_field.x($t39) $t40 := $t39 // $t41 := read_ref($t40) $t41 := $LoadU128($t40) @@ -2983,7 +2983,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { // label L8 // $t45 := 0x42 $t45 := 0x42 - // $t46 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t45) + // $t46 := borrow_global>($t45) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t45) if iszero($AlignedStorageLoad($base_offset)) { @@ -2991,13 +2991,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_struct" { } $t46 := $MakePtr(true, add($base_offset, 32)) } - // $t47 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t46) + // $t47 := borrow_field>.v($t46) $t47 := $t46 // $t48 := 2 $t48 := 2 - // $t49 := vector::borrow<0x2::GlobalVectors::S>($t47, $t48) + // $t49 := vector::borrow($t47, $t48) $t49 := A1_vector_borrow$A2_GlobalVectors_S$($t47, $t48) - // $t50 := borrow_field<0x2::GlobalVectors::S>.x($t49) + // $t50 := borrow_field.x($t49) $t50 := $t49 // $t51 := read_ref($t50) $t51 := $LoadU128($t50) @@ -3383,13 +3383,13 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { $t12 := $MakePtr(false, add($locals, 32)) // $t13 := move($t1) $t13 := mload($locals) - // $t14 := pack 0x2::GlobalVectors::T>($t13) + // $t14 := pack GlobalVectors::T>($t13) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t13) $t14 := $mem } - // move_to<0x2::GlobalVectors::T>>($t14, $t12) + // move_to>>($t14, $t12) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $LoadU256($t12)) if $AlignedStorageLoad($base_offset) { @@ -3431,7 +3431,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } // $t15 := 0x42 $t15 := 0x42 - // $t16 := borrow_global<0x2::GlobalVectors::T>>($t15) + // $t16 := borrow_global>>($t15) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t15) if iszero($AlignedStorageLoad($base_offset)) { @@ -3439,7 +3439,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field<0x2::GlobalVectors::T>>.v($t16) + // $t17 := borrow_field>>.v($t16) $t17 := $t16 // $t18 := vector::length>($t17) $t18 := A1_vector_length$vec$u64$$($t17) @@ -3456,7 +3456,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L2 // $t22 := 0x42 $t22 := 0x42 - // $t23 := borrow_global<0x2::GlobalVectors::T>>($t22) + // $t23 := borrow_global>>($t22) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t22) if iszero($AlignedStorageLoad($base_offset)) { @@ -3464,7 +3464,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t23 := $MakePtr(true, add($base_offset, 32)) } - // $t24 := borrow_field<0x2::GlobalVectors::T>>.v($t23) + // $t24 := borrow_field>>.v($t23) $t24 := $t23 // $t25 := 0 $t25 := 0 @@ -3501,7 +3501,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L5 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global<0x2::GlobalVectors::T>>($t33) + // $t34 := borrow_global>>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -3509,7 +3509,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field<0x2::GlobalVectors::T>>.v($t34) + // $t35 := borrow_field>>.v($t34) $t35 := $t34 // $t36 := 1 $t36 := 1 @@ -3546,7 +3546,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { // label L8 // $t44 := 0x42 $t44 := 0x42 - // $t45 := borrow_global<0x2::GlobalVectors::T>>($t44) + // $t45 := borrow_global>>($t44) { let $base_offset := $MakeTypeStorageBase(0, 0x9947b477, $t44) if iszero($AlignedStorageLoad($base_offset)) { @@ -3554,7 +3554,7 @@ object "test_A2_GlobalVectors_test_move_to_vector_of_vector" { } $t45 := $MakePtr(true, add($base_offset, 32)) } - // $t46 := borrow_field<0x2::GlobalVectors::T>>.v($t45) + // $t46 := borrow_field>>.v($t45) $t46 := $t45 // $t47 := 2 $t47 := 2 @@ -3969,13 +3969,13 @@ object "test_A2_GlobalVectors_test_pop_back_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack 0x2::GlobalVectors::T($t10) + // $t11 := pack GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to<0x2::GlobalVectors::T>($t11, $t9) + // move_to>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -4004,7 +4004,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) + // $t13 := borrow_global>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -4012,7 +4012,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) + // $t14 := borrow_field>.v($t13) $t14 := $t13 // $t15 := vector::pop_back($t14) $t15 := A1_vector_pop_back$u64$($t14) @@ -4029,7 +4029,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L2 // $t19 := 0x42 $t19 := 0x42 - // $t20 := borrow_global<0x2::GlobalVectors::T>($t19) + // $t20 := borrow_global>($t19) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t19) if iszero($AlignedStorageLoad($base_offset)) { @@ -4037,7 +4037,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t20 := $MakePtr(true, add($base_offset, 32)) } - // $t21 := borrow_field<0x2::GlobalVectors::T>.v($t20) + // $t21 := borrow_field>.v($t20) $t21 := $t20 // $t22 := vector::length($t21) $t22 := A1_vector_length$u64$($t21) @@ -4066,7 +4066,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L5 // $t26 := 0x42 $t26 := 0x42 - // $t27 := borrow_global<0x2::GlobalVectors::T>($t26) + // $t27 := borrow_global>($t26) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t26) if iszero($AlignedStorageLoad($base_offset)) { @@ -4074,7 +4074,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t27 := $MakePtr(true, add($base_offset, 32)) } - // $t28 := borrow_field<0x2::GlobalVectors::T>.v($t27) + // $t28 := borrow_field>.v($t27) $t28 := $t27 // $t29 := vector::pop_back($t28) $t29 := A1_vector_pop_back$u64$($t28) @@ -4103,7 +4103,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { // label L8 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global<0x2::GlobalVectors::T>($t33) + // $t34 := borrow_global>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -4111,7 +4111,7 @@ object "test_A2_GlobalVectors_test_pop_back_global" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field<0x2::GlobalVectors::T>.v($t34) + // $t35 := borrow_field>.v($t34) $t35 := $t34 // $t36 := vector::length($t35) $t36 := A1_vector_length$u64$($t35) @@ -4425,7 +4425,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L1 // $t29 := borrow_local($t3) $t29 := $MakePtr(false, e) - // $t30 := borrow_field<0x2::GlobalVectors::S>.y($t29) + // $t30 := borrow_field.y($t29) $t30 := $IndexPtr($t29, 16) // $t31 := read_ref($t30) $t31 := $LoadU64($t30) @@ -4446,7 +4446,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $block := 5 } case 4 { - // $t4 := vector::empty<0x2::GlobalVectors::S>() + // $t4 := vector::empty() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t5 := borrow_local($t4) $t5 := $MakePtr(false, $locals) @@ -4454,14 +4454,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t6 := 10 // $t7 := 40 $t7 := 40 - // $t8 := pack 0x2::GlobalVectors::S($t6, $t7) + // $t8 := pack GlobalVectors::S($t6, $t7) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t6) $MemoryStoreU64(add($mem, 16), $t7) $t8 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t5, $t8) + // vector::push_back($t5, $t8) A1_vector_push_back$A2_GlobalVectors_S$($t5, $t8) // $t9 := borrow_local($t4) $t9 := $MakePtr(false, $locals) @@ -4469,14 +4469,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t10 := 11 // $t11 := 41 $t11 := 41 - // $t12 := pack 0x2::GlobalVectors::S($t10, $t11) + // $t12 := pack GlobalVectors::S($t10, $t11) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t10) $MemoryStoreU64(add($mem, 16), $t11) $t12 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t9, $t12) + // vector::push_back($t9, $t12) A1_vector_push_back$A2_GlobalVectors_S$($t9, $t12) // $t13 := borrow_local($t4) $t13 := $MakePtr(false, $locals) @@ -4484,14 +4484,14 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t14 := 12 // $t15 := 42 $t15 := 42 - // $t16 := pack 0x2::GlobalVectors::S($t14, $t15) + // $t16 := pack GlobalVectors::S($t14, $t15) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t14) $MemoryStoreU64(add($mem, 16), $t15) $t16 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t13, $t16) + // vector::push_back($t13, $t16) A1_vector_push_back$A2_GlobalVectors_S$($t13, $t16) // $t17 := 0x42 $t17 := 0x42 @@ -4501,13 +4501,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { $t18 := $MakePtr(false, add($locals, 32)) // $t19 := move($t4) $t19 := mload($locals) - // $t20 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t19) + // $t20 := pack GlobalVectors::T($t19) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t19) $t20 := $mem } - // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t20, $t18) + // move_to>($t20, $t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t18)) if $AlignedStorageLoad($base_offset) { @@ -4542,7 +4542,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } // $t21 := 0x42 $t21 := 0x42 - // $t22 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t21) + // $t22 := borrow_global>($t21) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t21) if iszero($AlignedStorageLoad($base_offset)) { @@ -4550,13 +4550,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t22) + // $t23 := borrow_field>.v($t22) $t23 := $t22 - // $t3 := vector::pop_back<0x2::GlobalVectors::S>($t23) + // $t3 := vector::pop_back($t23) e := A1_vector_pop_back$A2_GlobalVectors_S$($t23) // $t24 := borrow_local($t3) $t24 := $MakePtr(false, e) - // $t25 := borrow_field<0x2::GlobalVectors::S>.x($t24) + // $t25 := borrow_field.x($t24) $t25 := $t24 // $t26 := read_ref($t25) $t26 := $LoadU128($t25) @@ -4592,7 +4592,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L5 // $t35 := 0x42 $t35 := 0x42 - // $t36 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t35) + // $t36 := borrow_global>($t35) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t35) if iszero($AlignedStorageLoad($base_offset)) { @@ -4600,9 +4600,9 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t36 := $MakePtr(true, add($base_offset, 32)) } - // $t37 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t36) + // $t37 := borrow_field>.v($t36) $t37 := $t36 - // $t38 := vector::length<0x2::GlobalVectors::S>($t37) + // $t38 := vector::length($t37) $t38 := A1_vector_length$A2_GlobalVectors_S$($t37) // $t39 := 2 $t39 := 2 @@ -4629,7 +4629,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L8 // $t42 := 0x42 $t42 := 0x42 - // $t43 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t42) + // $t43 := borrow_global>($t42) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t42) if iszero($AlignedStorageLoad($base_offset)) { @@ -4637,13 +4637,13 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t43 := $MakePtr(true, add($base_offset, 32)) } - // $t44 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t43) + // $t44 := borrow_field>.v($t43) $t44 := $t43 - // $t3 := vector::pop_back<0x2::GlobalVectors::S>($t44) + // $t3 := vector::pop_back($t44) e := A1_vector_pop_back$A2_GlobalVectors_S$($t44) // $t45 := borrow_local($t3) $t45 := $MakePtr(false, e) - // $t46 := borrow_field<0x2::GlobalVectors::S>.x($t45) + // $t46 := borrow_field.x($t45) $t46 := $t45 // $t47 := read_ref($t46) $t47 := $LoadU128($t46) @@ -4660,7 +4660,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L10 // $t50 := borrow_local($t3) $t50 := $MakePtr(false, e) - // $t51 := borrow_field<0x2::GlobalVectors::S>.y($t50) + // $t51 := borrow_field.y($t50) $t51 := $IndexPtr($t50, 16) // $t52 := read_ref($t51) $t52 := $LoadU64($t51) @@ -4703,7 +4703,7 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { // label L14 // $t56 := 0x42 $t56 := 0x42 - // $t57 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t56) + // $t57 := borrow_global>($t56) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t56) if iszero($AlignedStorageLoad($base_offset)) { @@ -4711,9 +4711,9 @@ object "test_A2_GlobalVectors_test_pop_back_struct_global" { } $t57 := $MakePtr(true, add($base_offset, 32)) } - // $t58 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t57) + // $t58 := borrow_field>.v($t57) $t58 := $t57 - // $t59 := vector::length<0x2::GlobalVectors::S>($t58) + // $t59 := vector::length($t58) $t59 := A1_vector_length$A2_GlobalVectors_S$($t58) // $t60 := 1 $t60 := 1 @@ -5096,13 +5096,13 @@ object "test_A2_GlobalVectors_test_push_back_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := copy($t1) $t10 := mload($locals) - // $t11 := pack 0x2::GlobalVectors::T($t10) + // $t11 := pack GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to<0x2::GlobalVectors::T>($t11, $t9) + // move_to>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -5131,7 +5131,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) + // $t13 := borrow_global>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -5139,7 +5139,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) + // $t14 := borrow_field>.v($t13) $t14 := $t13 // $t15 := 13 $t15 := 13 @@ -5147,7 +5147,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { A1_vector_push_back$u64$($t14, $t15) // $t16 := 0x42 $t16 := 0x42 - // $t17 := borrow_global<0x2::GlobalVectors::T>($t16) + // $t17 := borrow_global>($t16) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t16) if iszero($AlignedStorageLoad($base_offset)) { @@ -5155,7 +5155,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t17 := $MakePtr(true, add($base_offset, 32)) } - // $t18 := borrow_field<0x2::GlobalVectors::T>.v($t17) + // $t18 := borrow_field>.v($t17) $t18 := $t17 // $t19 := 14 $t19 := 14 @@ -5163,7 +5163,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { A1_vector_push_back$u64$($t18, $t19) // $t20 := 0x42 $t20 := 0x42 - // $t21 := borrow_global<0x2::GlobalVectors::T>($t20) + // $t21 := borrow_global>($t20) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t20) if iszero($AlignedStorageLoad($base_offset)) { @@ -5171,7 +5171,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t21 := $MakePtr(true, add($base_offset, 32)) } - // $t22 := borrow_field<0x2::GlobalVectors::T>.v($t21) + // $t22 := borrow_field>.v($t21) $t22 := $t21 // $t23 := vector::length($t22) $t23 := A1_vector_length$u64$($t22) @@ -5188,7 +5188,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L2 // $t27 := 0x42 $t27 := 0x42 - // $t28 := borrow_global<0x2::GlobalVectors::T>($t27) + // $t28 := borrow_global>($t27) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t27) if iszero($AlignedStorageLoad($base_offset)) { @@ -5196,7 +5196,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t28 := $MakePtr(true, add($base_offset, 32)) } - // $t29 := borrow_field<0x2::GlobalVectors::T>.v($t28) + // $t29 := borrow_field>.v($t28) $t29 := $t28 // $t30 := 0 $t30 := 0 @@ -5229,7 +5229,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L5 // $t36 := 0x42 $t36 := 0x42 - // $t37 := borrow_global<0x2::GlobalVectors::T>($t36) + // $t37 := borrow_global>($t36) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t36) if iszero($AlignedStorageLoad($base_offset)) { @@ -5237,7 +5237,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t37 := $MakePtr(true, add($base_offset, 32)) } - // $t38 := borrow_field<0x2::GlobalVectors::T>.v($t37) + // $t38 := borrow_field>.v($t37) $t38 := $t37 // $t39 := 1 $t39 := 1 @@ -5270,7 +5270,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L8 // $t45 := 0x42 $t45 := 0x42 - // $t46 := borrow_global<0x2::GlobalVectors::T>($t45) + // $t46 := borrow_global>($t45) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t45) if iszero($AlignedStorageLoad($base_offset)) { @@ -5278,7 +5278,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t46 := $MakePtr(true, add($base_offset, 32)) } - // $t47 := borrow_field<0x2::GlobalVectors::T>.v($t46) + // $t47 := borrow_field>.v($t46) $t47 := $t46 // $t48 := 2 $t48 := 2 @@ -5311,7 +5311,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L11 // $t54 := 0x42 $t54 := 0x42 - // $t55 := borrow_global<0x2::GlobalVectors::T>($t54) + // $t55 := borrow_global>($t54) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t54) if iszero($AlignedStorageLoad($base_offset)) { @@ -5319,7 +5319,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t55 := $MakePtr(true, add($base_offset, 32)) } - // $t56 := borrow_field<0x2::GlobalVectors::T>.v($t55) + // $t56 := borrow_field>.v($t55) $t56 := $t55 // $t57 := 3 $t57 := 3 @@ -5352,7 +5352,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { // label L14 // $t63 := 0x42 $t63 := 0x42 - // $t64 := borrow_global<0x2::GlobalVectors::T>($t63) + // $t64 := borrow_global>($t63) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t63) if iszero($AlignedStorageLoad($base_offset)) { @@ -5360,7 +5360,7 @@ object "test_A2_GlobalVectors_test_push_back_global" { } $t64 := $MakePtr(true, add($base_offset, 32)) } - // $t65 := borrow_field<0x2::GlobalVectors::T>.v($t64) + // $t65 := borrow_field>.v($t64) $t65 := $t64 // $t66 := 4 $t66 := 4 @@ -5688,7 +5688,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $Abort($t36) } case 4 { - // $t1 := vector::empty<0x2::GlobalVectors::S>() + // $t1 := vector::empty() mstore($locals, A1_vector_empty$A2_GlobalVectors_S$()) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, $locals) @@ -5696,14 +5696,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t3 := 10 // $t4 := 40 $t4 := 40 - // $t5 := pack 0x2::GlobalVectors::S($t3, $t4) + // $t5 := pack GlobalVectors::S($t3, $t4) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t3) $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t2, $t5) + // vector::push_back($t2, $t5) A1_vector_push_back$A2_GlobalVectors_S$($t2, $t5) // $t6 := borrow_local($t1) $t6 := $MakePtr(false, $locals) @@ -5711,14 +5711,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t7 := 11 // $t8 := 41 $t8 := 41 - // $t9 := pack 0x2::GlobalVectors::S($t7, $t8) + // $t9 := pack GlobalVectors::S($t7, $t8) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t7) $MemoryStoreU64(add($mem, 16), $t8) $t9 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t6, $t9) + // vector::push_back($t6, $t9) A1_vector_push_back$A2_GlobalVectors_S$($t6, $t9) // $t10 := borrow_local($t1) $t10 := $MakePtr(false, $locals) @@ -5726,14 +5726,14 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t11 := 12 // $t12 := 42 $t12 := 42 - // $t13 := pack 0x2::GlobalVectors::S($t11, $t12) + // $t13 := pack GlobalVectors::S($t11, $t12) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t11) $MemoryStoreU64(add($mem, 16), $t12) $t13 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t10, $t13) + // vector::push_back($t10, $t13) A1_vector_push_back$A2_GlobalVectors_S$($t10, $t13) // $t14 := 0x42 $t14 := 0x42 @@ -5743,13 +5743,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { $t15 := $MakePtr(false, add($locals, 32)) // $t16 := move($t1) $t16 := mload($locals) - // $t17 := pack 0x2::GlobalVectors::T<0x2::GlobalVectors::S>($t16) + // $t17 := pack GlobalVectors::T($t16) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t16) $t17 := $mem } - // move_to<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t17, $t15) + // move_to>($t17, $t15) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $LoadU256($t15)) if $AlignedStorageLoad($base_offset) { @@ -5784,7 +5784,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t18) + // $t19 := borrow_global>($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -5792,24 +5792,24 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t19) + // $t20 := borrow_field>.v($t19) $t20 := $t19 // $t21 := 13 $t21 := 13 // $t22 := 43 $t22 := 43 - // $t23 := pack 0x2::GlobalVectors::S($t21, $t22) + // $t23 := pack GlobalVectors::S($t21, $t22) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t21) $MemoryStoreU64(add($mem, 16), $t22) $t23 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t20, $t23) + // vector::push_back($t20, $t23) A1_vector_push_back$A2_GlobalVectors_S$($t20, $t23) // $t24 := 0x42 $t24 := 0x42 - // $t25 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t24) + // $t25 := borrow_global>($t24) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t24) if iszero($AlignedStorageLoad($base_offset)) { @@ -5817,24 +5817,24 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t25 := $MakePtr(true, add($base_offset, 32)) } - // $t26 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t25) + // $t26 := borrow_field>.v($t25) $t26 := $t25 // $t27 := 14 $t27 := 14 // $t28 := 44 $t28 := 44 - // $t29 := pack 0x2::GlobalVectors::S($t27, $t28) + // $t29 := pack GlobalVectors::S($t27, $t28) { let $mem := $Malloc(24) $MemoryStoreU128(add($mem, 0), $t27) $MemoryStoreU64(add($mem, 16), $t28) $t29 := $mem } - // vector::push_back<0x2::GlobalVectors::S>($t26, $t29) + // vector::push_back($t26, $t29) A1_vector_push_back$A2_GlobalVectors_S$($t26, $t29) // $t30 := 0x42 $t30 := 0x42 - // $t31 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t30) + // $t31 := borrow_global>($t30) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t30) if iszero($AlignedStorageLoad($base_offset)) { @@ -5842,9 +5842,9 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t31 := $MakePtr(true, add($base_offset, 32)) } - // $t32 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t31) + // $t32 := borrow_field>.v($t31) $t32 := $t31 - // $t33 := vector::length<0x2::GlobalVectors::S>($t32) + // $t33 := vector::length($t32) $t33 := A1_vector_length$A2_GlobalVectors_S$($t32) // $t34 := 5 $t34 := 5 @@ -5859,7 +5859,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L2 // $t37 := 0x42 $t37 := 0x42 - // $t38 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t37) + // $t38 := borrow_global>($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -5867,13 +5867,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t38) + // $t39 := borrow_field>.v($t38) $t39 := $t38 // $t40 := 0 $t40 := 0 - // $t41 := vector::borrow<0x2::GlobalVectors::S>($t39, $t40) + // $t41 := vector::borrow($t39, $t40) $t41 := A1_vector_borrow$A2_GlobalVectors_S$($t39, $t40) - // $t42 := borrow_field<0x2::GlobalVectors::S>.x($t41) + // $t42 := borrow_field.x($t41) $t42 := $t41 // $t43 := read_ref($t42) $t43 := $LoadU128($t42) @@ -5902,7 +5902,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L5 // $t47 := 0x42 $t47 := 0x42 - // $t48 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t47) + // $t48 := borrow_global>($t47) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t47) if iszero($AlignedStorageLoad($base_offset)) { @@ -5910,13 +5910,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t48 := $MakePtr(true, add($base_offset, 32)) } - // $t49 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t48) + // $t49 := borrow_field>.v($t48) $t49 := $t48 // $t50 := 1 $t50 := 1 - // $t51 := vector::borrow<0x2::GlobalVectors::S>($t49, $t50) + // $t51 := vector::borrow($t49, $t50) $t51 := A1_vector_borrow$A2_GlobalVectors_S$($t49, $t50) - // $t52 := borrow_field<0x2::GlobalVectors::S>.x($t51) + // $t52 := borrow_field.x($t51) $t52 := $t51 // $t53 := read_ref($t52) $t53 := $LoadU128($t52) @@ -5945,7 +5945,7 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { // label L8 // $t57 := 0x42 $t57 := 0x42 - // $t58 := borrow_global<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>($t57) + // $t58 := borrow_global>($t57) { let $base_offset := $MakeTypeStorageBase(0, 0x27c9b6b7, $t57) if iszero($AlignedStorageLoad($base_offset)) { @@ -5953,13 +5953,13 @@ object "test_A2_GlobalVectors_test_push_back_struct_global" { } $t58 := $MakePtr(true, add($base_offset, 32)) } - // $t59 := borrow_field<0x2::GlobalVectors::T<0x2::GlobalVectors::S>>.v($t58) + // $t59 := borrow_field>.v($t58) $t59 := $t58 // $t60 := 2 $t60 := 2 - // $t61 := vector::borrow<0x2::GlobalVectors::S>($t59, $t60) + // $t61 := vector::borrow($t59, $t60) $t61 := A1_vector_borrow$A2_GlobalVectors_S$($t59, $t60) - // $t62 := borrow_field<0x2::GlobalVectors::S>.x($t61) + // $t62 := borrow_field.x($t61) $t62 := $t61 // $t63 := read_ref($t62) $t63 := $LoadU128($t62) @@ -6327,13 +6327,13 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { $t6 := $MakePtr(false, add($locals, 32)) // $t7 := move($t1) $t7 := mload($locals) - // $t8 := pack 0x2::GlobalVectors::T($t7) + // $t8 := pack GlobalVectors::T($t7) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t7) $t8 := $mem } - // move_to<0x2::GlobalVectors::T>($t8, $t6) + // move_to>($t8, $t6) { let $base_offset := $MakeTypeStorageBase(0, 0x10b7746c, $LoadU256($t6)) if $AlignedStorageLoad($base_offset) { @@ -6362,7 +6362,7 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { } // $t9 := 0x42 $t9 := 0x42 - // $t10 := borrow_global<0x2::GlobalVectors::T>($t9) + // $t10 := borrow_global>($t9) { let $base_offset := $MakeTypeStorageBase(0, 0x10b7746c, $t9) if iszero($AlignedStorageLoad($base_offset)) { @@ -6370,7 +6370,7 @@ object "test_A2_GlobalVectors_test_read_ref_copy" { } $t10 := $MakePtr(true, add($base_offset, 32)) } - // $t11 := borrow_field<0x2::GlobalVectors::T>.v($t10) + // $t11 := borrow_field>.v($t10) $t11 := $t10 // $t2 := read_ref($t11) mstore(add($locals, 64), $LoadU256($t11)) @@ -6802,13 +6802,13 @@ object "test_A2_GlobalVectors_test_swap_global" { $t9 := $MakePtr(false, add($locals, 32)) // $t10 := move($t1) $t10 := mload($locals) - // $t11 := pack 0x2::GlobalVectors::T($t10) + // $t11 := pack GlobalVectors::T($t10) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t10) $t11 := $mem } - // move_to<0x2::GlobalVectors::T>($t11, $t9) + // move_to>($t11, $t9) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $LoadU256($t9)) if $AlignedStorageLoad($base_offset) { @@ -6837,7 +6837,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } // $t12 := 0x42 $t12 := 0x42 - // $t13 := borrow_global<0x2::GlobalVectors::T>($t12) + // $t13 := borrow_global>($t12) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t12) if iszero($AlignedStorageLoad($base_offset)) { @@ -6845,7 +6845,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t13 := $MakePtr(true, add($base_offset, 32)) } - // $t14 := borrow_field<0x2::GlobalVectors::T>.v($t13) + // $t14 := borrow_field>.v($t13) $t14 := $t13 // $t15 := 0 $t15 := 0 @@ -6855,7 +6855,7 @@ object "test_A2_GlobalVectors_test_swap_global" { A1_vector_swap$u64$($t14, $t15, $t16) // $t17 := 0x42 $t17 := 0x42 - // $t18 := borrow_global<0x2::GlobalVectors::T>($t17) + // $t18 := borrow_global>($t17) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t17) if iszero($AlignedStorageLoad($base_offset)) { @@ -6863,7 +6863,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t18 := $MakePtr(true, add($base_offset, 32)) } - // $t19 := borrow_field<0x2::GlobalVectors::T>.v($t18) + // $t19 := borrow_field>.v($t18) $t19 := $t18 // $t20 := vector::length($t19) $t20 := A1_vector_length$u64$($t19) @@ -6880,7 +6880,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L2 // $t24 := 0x42 $t24 := 0x42 - // $t25 := borrow_global<0x2::GlobalVectors::T>($t24) + // $t25 := borrow_global>($t24) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t24) if iszero($AlignedStorageLoad($base_offset)) { @@ -6888,7 +6888,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t25 := $MakePtr(true, add($base_offset, 32)) } - // $t26 := borrow_field<0x2::GlobalVectors::T>.v($t25) + // $t26 := borrow_field>.v($t25) $t26 := $t25 // $t27 := 0 $t27 := 0 @@ -6921,7 +6921,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L5 // $t33 := 0x42 $t33 := 0x42 - // $t34 := borrow_global<0x2::GlobalVectors::T>($t33) + // $t34 := borrow_global>($t33) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t33) if iszero($AlignedStorageLoad($base_offset)) { @@ -6929,7 +6929,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t34 := $MakePtr(true, add($base_offset, 32)) } - // $t35 := borrow_field<0x2::GlobalVectors::T>.v($t34) + // $t35 := borrow_field>.v($t34) $t35 := $t34 // $t36 := 1 $t36 := 1 @@ -6962,7 +6962,7 @@ object "test_A2_GlobalVectors_test_swap_global" { // label L8 // $t42 := 0x42 $t42 := 0x42 - // $t43 := borrow_global<0x2::GlobalVectors::T>($t42) + // $t43 := borrow_global>($t42) { let $base_offset := $MakeTypeStorageBase(0, 0x7da2a540, $t42) if iszero($AlignedStorageLoad($base_offset)) { @@ -6970,7 +6970,7 @@ object "test_A2_GlobalVectors_test_swap_global" { } $t43 := $MakePtr(true, add($base_offset, 32)) } - // $t44 := borrow_field<0x2::GlobalVectors::T>.v($t43) + // $t44 := borrow_field>.v($t43) $t44 := $t43 // $t45 := 2 $t45 := 2 diff --git a/third_party/move/evm/move-to-yul/tests/Resources.exp b/third_party/move/evm/move-to-yul/tests/Resources.exp index d28737892fc66..e75268ee3b854 100644 --- a/third_party/move/evm/move-to-yul/tests/Resources.exp +++ b/third_party/move/evm/move-to-yul/tests/Resources.exp @@ -81,7 +81,7 @@ object "test_A2_M_test_increment_a" { A2_M_increment_a($t4) // $t5 := 0x3 $t5 := 0x3 - // $t6 := borrow_global<0x2::M::S>($t5) + // $t6 := borrow_global($t5) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t5) if iszero($AlignedStorageLoad($base_offset)) { @@ -89,7 +89,7 @@ object "test_A2_M_test_increment_a" { } $t6 := $MakePtr(true, add($base_offset, 32)) } - // $t7 := borrow_field<0x2::M::S>.a($t6) + // $t7 := borrow_field.a($t6) $t7 := $IndexPtr($t6, 32) // $t8 := read_ref($t7) $t8 := $LoadU64($t7) @@ -113,7 +113,7 @@ object "test_A2_M_test_increment_a" { function A2_M_increment_a(addr) { let r, $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_global<0x2::M::S>($t0) + // $t2 := borrow_global($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, addr) if iszero($AlignedStorageLoad($base_offset)) { @@ -121,7 +121,7 @@ object "test_A2_M_test_increment_a" { } $t2 := $MakePtr(true, add($base_offset, 32)) } - // $t3 := borrow_field<0x2::M::S>.a($t2) + // $t3 := borrow_field.a($t2) $t3 := $IndexPtr($t2, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) @@ -129,7 +129,7 @@ object "test_A2_M_test_increment_a" { $t5 := 1 // $t6 := +($t4, $t5) $t6 := $AddU64($t4, $t5) - // $t7 := borrow_field<0x2::M::S>.a($t2) + // $t7 := borrow_field.a($t2) $t7 := $IndexPtr($t2, 32) // write_ref($t7, $t6) $StoreU64($t7, $t6) @@ -148,13 +148,13 @@ object "test_A2_M_test_increment_a" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -162,7 +162,7 @@ object "test_A2_M_test_increment_a" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -441,7 +441,7 @@ object "test_A2_M_test_publish" { A2_M_publish($t2, $t3) // $t4 := 0x3 $t4 := 0x3 - // $t5 := exists<0x2::M::S>($t4) + // $t5 := exists($t4) $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x698265eb, $t4)) // if ($t5) goto L1 else goto L0 switch $t5 @@ -452,7 +452,7 @@ object "test_A2_M_test_publish" { // label L2 // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global<0x2::M::S>($t7) + // $t8 := borrow_global($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -460,7 +460,7 @@ object "test_A2_M_test_publish" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field<0x2::M::S>.a($t8) + // $t9 := borrow_field.a($t8) $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) $t10 := $LoadU64($t9) @@ -489,7 +489,7 @@ object "test_A2_M_test_publish" { // label L5 // $t14 := 0x3 $t14 := 0x3 - // $t15 := borrow_global<0x2::M::S>($t14) + // $t15 := borrow_global($t14) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t14) if iszero($AlignedStorageLoad($base_offset)) { @@ -497,7 +497,7 @@ object "test_A2_M_test_publish" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field<0x2::M::S>.b($t15) + // $t16 := borrow_field.b($t15) $t16 := $IndexPtr($t15, 40) // $t17 := read_ref($t16) $t17 := $LoadU8($t16) @@ -526,7 +526,7 @@ object "test_A2_M_test_publish" { // label L8 // $t21 := 0x3 $t21 := 0x3 - // $t22 := borrow_global<0x2::M::S>($t21) + // $t22 := borrow_global($t21) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t21) if iszero($AlignedStorageLoad($base_offset)) { @@ -534,11 +534,11 @@ object "test_A2_M_test_publish" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field<0x2::M::S>.c($t22) + // $t23 := borrow_field.c($t22) { $t23 := $MakePtr($IsStoragePtr($t22), $LoadU256($t22)) } - // $t24 := borrow_field<0x2::M::S2>.x($t23) + // $t24 := borrow_field.x($t23) $t24 := $t23 // $t25 := read_ref($t24) $t25 := $LoadU128($t24) @@ -584,13 +584,13 @@ object "test_A2_M_test_publish" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -598,7 +598,7 @@ object "test_A2_M_test_publish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -870,7 +870,7 @@ object "test_A2_M_test_publish_t" { A2_M_publish_t($t2, $t3) // $t4 := 0x3 $t4 := 0x3 - // $t5 := exists<0x2::M::T>($t4) + // $t5 := exists($t4) $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x3948ca0a, $t4)) // if ($t5) goto L1 else goto L0 switch $t5 @@ -881,7 +881,7 @@ object "test_A2_M_test_publish_t" { // label L2 // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global<0x2::M::T>($t7) + // $t8 := borrow_global($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -889,11 +889,11 @@ object "test_A2_M_test_publish_t" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field<0x2::M::T>.s($t8) + // $t9 := borrow_field.s($t8) { $t9 := $MakePtr($IsStoragePtr($t8), $LoadU256($t8)) } - // $t10 := borrow_field<0x2::M::S>.a($t9) + // $t10 := borrow_field.a($t9) $t10 := $IndexPtr($t9, 32) // $t11 := read_ref($t10) $t11 := $LoadU64($t10) @@ -922,7 +922,7 @@ object "test_A2_M_test_publish_t" { // label L5 // $t15 := 0x3 $t15 := 0x3 - // $t16 := borrow_global<0x2::M::T>($t15) + // $t16 := borrow_global($t15) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t15) if iszero($AlignedStorageLoad($base_offset)) { @@ -930,11 +930,11 @@ object "test_A2_M_test_publish_t" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field<0x2::M::T>.s($t16) + // $t17 := borrow_field.s($t16) { $t17 := $MakePtr($IsStoragePtr($t16), $LoadU256($t16)) } - // $t18 := borrow_field<0x2::M::S>.b($t17) + // $t18 := borrow_field.b($t17) $t18 := $IndexPtr($t17, 40) // $t19 := read_ref($t18) $t19 := $LoadU8($t18) @@ -963,7 +963,7 @@ object "test_A2_M_test_publish_t" { // label L8 // $t23 := 0x3 $t23 := 0x3 - // $t24 := borrow_global<0x2::M::T>($t23) + // $t24 := borrow_global($t23) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t23) if iszero($AlignedStorageLoad($base_offset)) { @@ -971,15 +971,15 @@ object "test_A2_M_test_publish_t" { } $t24 := $MakePtr(true, add($base_offset, 32)) } - // $t25 := borrow_field<0x2::M::T>.s($t24) + // $t25 := borrow_field.s($t24) { $t25 := $MakePtr($IsStoragePtr($t24), $LoadU256($t24)) } - // $t26 := borrow_field<0x2::M::S>.c($t25) + // $t26 := borrow_field.c($t25) { $t26 := $MakePtr($IsStoragePtr($t25), $LoadU256($t25)) } - // $t27 := borrow_field<0x2::M::S2>.x($t26) + // $t27 := borrow_field.x($t26) $t27 := $t26 // $t28 := read_ref($t27) $t28 := $LoadU128($t27) @@ -1025,13 +1025,13 @@ object "test_A2_M_test_publish_t" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1039,13 +1039,13 @@ object "test_A2_M_test_publish_t" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // $t10 := pack 0x2::M::T($t9) + // $t10 := pack M::T($t9) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t9) $t10 := $mem } - // move_to<0x2::M::T>($t10, $t0) + // move_to($t10, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { @@ -1325,12 +1325,12 @@ object "test_A2_M_test_unpublish" { $t6 := 0x3 // $t7 := M::unpublish($t6) $t7 := A2_M_unpublish($t6) - // ($t8, $t9, $t10) := unpack 0x2::M::S($t7) + // ($t8, $t9, $t10) := unpack M::S($t7) $t8 := $MemoryLoadU64(add($t7, 32)) $t9 := $MemoryLoadU8(add($t7, 40)) $t10 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 41) - // $t11 := unpack 0x2::M::S2($t10) + // $t11 := unpack M::S2($t10) $t11 := $MemoryLoadU128(add($t10, 0)) $Free($t10, 16) // $t12 := 33 @@ -1399,7 +1399,7 @@ object "test_A2_M_test_unpublish" { function A2_M_unpublish(a) -> $result { let $t1 - // $t1 := move_from<0x2::M::S>($t0) + // $t1 := move_from($t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, a) if iszero($AlignedStorageLoad($base_offset)) { @@ -1440,13 +1440,13 @@ object "test_A2_M_test_unpublish" { $t6 := $AddU64(a, a) // $t7 := (u128)($t6) $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1454,7 +1454,7 @@ object "test_A2_M_test_unpublish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) if $AlignedStorageLoad($base_offset) { diff --git a/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info b/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info index 9832954c64548..c04def6d750e5 100644 --- a/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info +++ b/third_party/move/evm/move-to-yul/tests/Resources.exp.capture-source-info @@ -96,7 +96,7 @@ object "test_A2_M_test_increment_a" { // $t5 := 0x3 /// @src 1:1309:1311 $t5 := 0x3 - // $t6 := borrow_global<0x2::M::S>($t5) + // $t6 := borrow_global($t5) /// @src 1:1292:1305 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t5) @@ -105,7 +105,7 @@ object "test_A2_M_test_increment_a" { } $t6 := $MakePtr(true, add($base_offset, 32)) } - // $t7 := borrow_field<0x2::M::S>.a($t6) + // $t7 := borrow_field.a($t6) /// @src 1:1292:1314 $t7 := $IndexPtr($t6, 32) // $t8 := read_ref($t7) @@ -135,7 +135,7 @@ object "test_A2_M_test_increment_a" { function A2_M_increment_a(addr) { let r, $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_global<0x2::M::S>($t0) + // $t2 := borrow_global($t0) /// @src 1:1106:1123 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, addr) @@ -144,7 +144,7 @@ object "test_A2_M_test_increment_a" { } $t2 := $MakePtr(true, add($base_offset, 32)) } - // $t3 := borrow_field<0x2::M::S>.a($t2) + // $t3 := borrow_field.a($t2) /// @src 1:1148:1151 $t3 := $IndexPtr($t2, 32) // $t4 := read_ref($t3) @@ -156,7 +156,7 @@ object "test_A2_M_test_increment_a" { // $t6 := +($t4, $t5) /// @src 1:1152:1153 $t6 := $AddU64($t4, $t5) - // $t7 := borrow_field<0x2::M::S>.a($t2) + // $t7 := borrow_field.a($t2) /// @src 1:1142:1145 $t7 := $IndexPtr($t2, 32) // write_ref($t7, $t6) @@ -183,14 +183,14 @@ object "test_A2_M_test_increment_a" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -199,7 +199,7 @@ object "test_A2_M_test_increment_a" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) @@ -492,7 +492,7 @@ object "test_A2_M_test_publish" { // $t4 := 0x3 /// @src 1:566:568 $t4 := 0x3 - // $t5 := exists<0x2::M::S>($t4) + // $t5 := exists($t4) /// @src 1:556:562 $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x698265eb, $t4)) // if ($t5) goto L1 else goto L0 @@ -506,7 +506,7 @@ object "test_A2_M_test_publish" { // $t7 := 0x3 /// @src 1:609:611 $t7 := 0x3 - // $t8 := borrow_global<0x2::M::S>($t7) + // $t8 := borrow_global($t7) /// @src 1:592:605 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t7) @@ -515,7 +515,7 @@ object "test_A2_M_test_publish" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field<0x2::M::S>.a($t8) + // $t9 := borrow_field.a($t8) /// @src 1:592:614 $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) @@ -553,7 +553,7 @@ object "test_A2_M_test_publish" { // $t14 := 0x3 /// @src 1:660:662 $t14 := 0x3 - // $t15 := borrow_global<0x2::M::S>($t14) + // $t15 := borrow_global($t14) /// @src 1:643:656 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t14) @@ -562,7 +562,7 @@ object "test_A2_M_test_publish" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field<0x2::M::S>.b($t15) + // $t16 := borrow_field.b($t15) /// @src 1:643:665 $t16 := $IndexPtr($t15, 40) // $t17 := read_ref($t16) @@ -600,7 +600,7 @@ object "test_A2_M_test_publish" { // $t21 := 0x3 /// @src 1:711:713 $t21 := 0x3 - // $t22 := borrow_global<0x2::M::S>($t21) + // $t22 := borrow_global($t21) /// @src 1:694:707 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $t21) @@ -609,12 +609,12 @@ object "test_A2_M_test_publish" { } $t22 := $MakePtr(true, add($base_offset, 32)) } - // $t23 := borrow_field<0x2::M::S>.c($t22) + // $t23 := borrow_field.c($t22) /// @src 1:694:716 { $t23 := $MakePtr($IsStoragePtr($t22), $LoadU256($t22)) } - // $t24 := borrow_field<0x2::M::S2>.x($t23) + // $t24 := borrow_field.x($t23) /// @src 1:694:718 $t24 := $t23 // $t25 := read_ref($t24) @@ -674,14 +674,14 @@ object "test_A2_M_test_publish" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -690,7 +690,7 @@ object "test_A2_M_test_publish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) @@ -976,7 +976,7 @@ object "test_A2_M_test_publish_t" { // $t4 := 0x3 /// @src 1:1602:1604 $t4 := 0x3 - // $t5 := exists<0x2::M::T>($t4) + // $t5 := exists($t4) /// @src 1:1592:1598 $t5 := $AlignedStorageLoad($MakeTypeStorageBase(0, 0x3948ca0a, $t4)) // if ($t5) goto L1 else goto L0 @@ -990,7 +990,7 @@ object "test_A2_M_test_publish_t" { // $t7 := 0x3 /// @src 1:1646:1648 $t7 := 0x3 - // $t8 := borrow_global<0x2::M::T>($t7) + // $t8 := borrow_global($t7) /// @src 1:1629:1642 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) @@ -999,12 +999,12 @@ object "test_A2_M_test_publish_t" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field<0x2::M::T>.s($t8) + // $t9 := borrow_field.s($t8) /// @src 1:1629:1651 { $t9 := $MakePtr($IsStoragePtr($t8), $LoadU256($t8)) } - // $t10 := borrow_field<0x2::M::S>.a($t9) + // $t10 := borrow_field.a($t9) /// @src 1:1629:1653 $t10 := $IndexPtr($t9, 32) // $t11 := read_ref($t10) @@ -1042,7 +1042,7 @@ object "test_A2_M_test_publish_t" { // $t15 := 0x3 /// @src 1:1700:1702 $t15 := 0x3 - // $t16 := borrow_global<0x2::M::T>($t15) + // $t16 := borrow_global($t15) /// @src 1:1683:1696 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t15) @@ -1051,12 +1051,12 @@ object "test_A2_M_test_publish_t" { } $t16 := $MakePtr(true, add($base_offset, 32)) } - // $t17 := borrow_field<0x2::M::T>.s($t16) + // $t17 := borrow_field.s($t16) /// @src 1:1683:1705 { $t17 := $MakePtr($IsStoragePtr($t16), $LoadU256($t16)) } - // $t18 := borrow_field<0x2::M::S>.b($t17) + // $t18 := borrow_field.b($t17) /// @src 1:1683:1707 $t18 := $IndexPtr($t17, 40) // $t19 := read_ref($t18) @@ -1094,7 +1094,7 @@ object "test_A2_M_test_publish_t" { // $t23 := 0x3 /// @src 1:1754:1756 $t23 := 0x3 - // $t24 := borrow_global<0x2::M::T>($t23) + // $t24 := borrow_global($t23) /// @src 1:1737:1750 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t23) @@ -1103,17 +1103,17 @@ object "test_A2_M_test_publish_t" { } $t24 := $MakePtr(true, add($base_offset, 32)) } - // $t25 := borrow_field<0x2::M::T>.s($t24) + // $t25 := borrow_field.s($t24) /// @src 1:1737:1759 { $t25 := $MakePtr($IsStoragePtr($t24), $LoadU256($t24)) } - // $t26 := borrow_field<0x2::M::S>.c($t25) + // $t26 := borrow_field.c($t25) /// @src 1:1737:1761 { $t26 := $MakePtr($IsStoragePtr($t25), $LoadU256($t25)) } - // $t27 := borrow_field<0x2::M::S2>.x($t26) + // $t27 := borrow_field.x($t26) /// @src 1:1737:1763 $t27 := $t26 // $t28 := read_ref($t27) @@ -1173,14 +1173,14 @@ object "test_A2_M_test_publish_t" { // $t7 := (u128)($t6) /// @src 1:1434:1451 $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) /// @src 1:1428:1452 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) /// @src 1:1400:1453 { let $mem := $Malloc(41) @@ -1189,14 +1189,14 @@ object "test_A2_M_test_publish_t" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // $t10 := pack 0x2::M::T($t9) + // $t10 := pack M::T($t9) /// @src 1:1393:1454 { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t9) $t10 := $mem } - // move_to<0x2::M::T>($t10, $t0) + // move_to($t10, $t0) /// @src 1:1464:1471 { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256(sg)) @@ -1491,13 +1491,13 @@ object "test_A2_M_test_unpublish" { // $t7 := M::unpublish($t6) /// @src 1:931:944 $t7 := A2_M_unpublish($t6) - // ($t8, $t9, $t10) := unpack 0x2::M::S($t7) + // ($t8, $t9, $t10) := unpack M::S($t7) /// @src 1:911:928 $t8 := $MemoryLoadU64(add($t7, 32)) $t9 := $MemoryLoadU8(add($t7, 40)) $t10 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 41) - // $t11 := unpack 0x2::M::S2($t10) + // $t11 := unpack M::S2($t10) /// @src 1:922:927 $t11 := $MemoryLoadU128(add($t10, 0)) $Free($t10, 16) @@ -1583,7 +1583,7 @@ object "test_A2_M_test_unpublish" { function A2_M_unpublish(a) -> $result { let $t1 - // $t1 := move_from<0x2::M::S>($t0) + // $t1 := move_from($t0) /// @src 1:793:802 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, a) @@ -1631,14 +1631,14 @@ object "test_A2_M_test_unpublish" { // $t7 := (u128)($t6) /// @src 1:405:422 $t7 := $CastU128($t6) - // $t8 := pack 0x2::M::S2($t7) + // $t8 := pack M::S2($t7) /// @src 1:399:423 { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), $t7) $t8 := $mem } - // $t9 := pack 0x2::M::S($t1, $t5, $t8) + // $t9 := pack M::S($t1, $t5, $t8) /// @src 1:371:424 { let $mem := $Malloc(41) @@ -1647,7 +1647,7 @@ object "test_A2_M_test_unpublish" { $MemoryStoreU256(add($mem, 0), $t8) $t9 := $mem } - // move_to<0x2::M::S>($t9, $t0) + // move_to($t9, $t0) /// @src 1:434:441 { let $base_offset := $MakeTypeStorageBase(0, 0x698265eb, $LoadU256(sg)) diff --git a/third_party/move/evm/move-to-yul/tests/Structs.exp b/third_party/move/evm/move-to-yul/tests/Structs.exp index 078aae2d530ec..d79871424ed16 100644 --- a/third_party/move/evm/move-to-yul/tests/Structs.exp +++ b/third_party/move/evm/move-to-yul/tests/Structs.exp @@ -54,7 +54,7 @@ object "test_A2_M_test_drop" { $t1 := false // $t2 := M::pack_S($t0, $t1) $t2 := A2_M_pack_S($t0, $t1) - // $t3 := pack 0x2::M::S3($t2) + // $t3 := pack M::S3($t2) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t2) @@ -79,7 +79,7 @@ object "test_A2_M_test_drop" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -93,7 +93,7 @@ object "test_A2_M_test_drop" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -330,7 +330,7 @@ object "test_A2_M_test_equality" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -344,7 +344,7 @@ object "test_A2_M_test_equality" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -460,7 +460,7 @@ object "test_A2_M_test_pack_S" { s := A2_M_pack_S($t1, $t2) // $t3 := borrow_local($t0) $t3 := $MakePtr(false, s) - // $t4 := borrow_field<0x2::M::S>.a($t3) + // $t4 := borrow_field.a($t3) $t4 := $IndexPtr($t3, 32) // $t5 := read_ref($t4) $t5 := $LoadU64($t4) @@ -477,7 +477,7 @@ object "test_A2_M_test_pack_S" { // label L2 // $t9 := borrow_local($t0) $t9 := $MakePtr(false, s) - // $t10 := borrow_field<0x2::M::S>.b($t9) + // $t10 := borrow_field.b($t9) $t10 := $IndexPtr($t9, 40) // $t11 := read_ref($t10) $t11 := $LoadU8($t10) @@ -506,11 +506,11 @@ object "test_A2_M_test_pack_S" { // label L5 // $t15 := borrow_local($t0) $t15 := $MakePtr(false, s) - // $t16 := borrow_field<0x2::M::S>.c($t15) + // $t16 := borrow_field.c($t15) { $t16 := $MakePtr($IsStoragePtr($t15), $LoadU256($t15)) } - // $t17 := borrow_field<0x2::M::S2>.x($t16) + // $t17 := borrow_field.x($t16) $t17 := $t16 // $t18 := read_ref($t17) $t18 := $LoadU128($t17) @@ -549,7 +549,7 @@ object "test_A2_M_test_pack_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -563,7 +563,7 @@ object "test_A2_M_test_pack_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -780,7 +780,7 @@ object "test_A2_M_test_pack_S2" { s := A2_M_pack_S2($t1) // $t2 := borrow_local($t0) $t2 := $MakePtr(false, s) - // $t3 := borrow_field<0x2::M::S2>.x($t2) + // $t3 := borrow_field.x($t2) $t3 := $t2 // $t4 := read_ref($t3) $t4 := $LoadU128($t3) @@ -803,7 +803,7 @@ object "test_A2_M_test_pack_S2" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -952,7 +952,7 @@ object "test_A2_M_test_pack_S2_fail" { s := A2_M_pack_S2($t1) // $t2 := borrow_local($t0) $t2 := $MakePtr(false, s) - // $t3 := borrow_field<0x2::M::S2>.x($t2) + // $t3 := borrow_field.x($t2) $t3 := $t2 // $t4 := read_ref($t3) $t4 := $LoadU128($t3) @@ -975,7 +975,7 @@ object "test_A2_M_test_pack_S2_fail" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1147,15 +1147,15 @@ object "test_A2_M_test_read_S" { function A2_M_read_S(s) -> $result { let $t1, $t2, $t3, $t4, $t5, $t6, $t7 - // $t1 := borrow_field<0x2::M::S>.a($t0) + // $t1 := borrow_field.a($t0) $t1 := $IndexPtr(s, 32) // $t2 := read_ref($t1) $t2 := $LoadU64($t1) - // $t3 := borrow_field<0x2::M::S>.c($t0) + // $t3 := borrow_field.c($t0) { $t3 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t4 := borrow_field<0x2::M::S2>.x($t3) + // $t4 := borrow_field.x($t3) $t4 := $t3 // $t5 := read_ref($t4) $t5 := $LoadU128($t4) @@ -1173,7 +1173,7 @@ object "test_A2_M_test_read_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1187,7 +1187,7 @@ object "test_A2_M_test_read_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1394,7 +1394,7 @@ object "test_A2_M_test_read_and_write_S" { s := A2_M_read_and_write_S() // $t1 := borrow_local($t0) $t1 := $MakePtr(false, s) - // $t2 := borrow_field<0x2::M::S>.a($t1) + // $t2 := borrow_field.a($t1) $t2 := $IndexPtr($t1, 32) // $t3 := read_ref($t2) $t3 := $LoadU64($t2) @@ -1411,11 +1411,11 @@ object "test_A2_M_test_read_and_write_S" { // label L2 // $t7 := borrow_local($t0) $t7 := $MakePtr(false, s) - // $t8 := borrow_field<0x2::M::S>.c($t7) + // $t8 := borrow_field.c($t7) { $t8 := $MakePtr($IsStoragePtr($t7), $LoadU256($t7)) } - // $t9 := borrow_field<0x2::M::S2>.x($t8) + // $t9 := borrow_field.x($t8) $t9 := $t8 // $t10 := read_ref($t9) $t10 := $LoadU128($t9) @@ -1472,21 +1472,21 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_write_S(s, v) { let $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_field<0x2::M::S>.a($t0) + // $t2 := borrow_field.a($t0) $t2 := $IndexPtr(s, 32) // write_ref($t2, $t1) $StoreU64($t2, v) - // $t3 := borrow_field<0x2::M::S>.a($t0) + // $t3 := borrow_field.a($t0) $t3 := $IndexPtr(s, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) // $t5 := (u128)($t4) $t5 := $CastU128($t4) - // $t6 := borrow_field<0x2::M::S>.c($t0) + // $t6 := borrow_field.c($t0) { $t6 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t7 := borrow_field<0x2::M::S2>.x($t6) + // $t7 := borrow_field.x($t6) $t7 := $t6 // write_ref($t7, $t5) $StoreU128($t7, $t5) @@ -1495,15 +1495,15 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_read_S(s) -> $result { let $t1, $t2, $t3, $t4, $t5, $t6, $t7 - // $t1 := borrow_field<0x2::M::S>.a($t0) + // $t1 := borrow_field.a($t0) $t1 := $IndexPtr(s, 32) // $t2 := read_ref($t1) $t2 := $LoadU64($t1) - // $t3 := borrow_field<0x2::M::S>.c($t0) + // $t3 := borrow_field.c($t0) { $t3 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t4 := borrow_field<0x2::M::S2>.x($t3) + // $t4 := borrow_field.x($t3) $t4 := $t3 // $t5 := read_ref($t4) $t5 := $LoadU128($t4) @@ -1521,7 +1521,7 @@ object "test_A2_M_test_read_and_write_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1535,7 +1535,7 @@ object "test_A2_M_test_read_and_write_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -1800,7 +1800,7 @@ object "test_A2_M_test_unpack" { s1 := A2_M_unpack($t3) // $t4 := borrow_local($t0) $t4 := $MakePtr(false, s1) - // $t5 := borrow_field<0x2::M::S2>.x($t4) + // $t5 := borrow_field.x($t4) $t5 := $t4 // $t6 := read_ref($t5) $t6 := $LoadU128($t5) @@ -1823,7 +1823,7 @@ object "test_A2_M_test_unpack" { function A2_M_unpack(s) -> $result { let c, $t2, $t3, $t4 - // ($t2, $t3, $t4) := unpack 0x2::M::S($t0) + // ($t2, $t3, $t4) := unpack M::S($t0) $t2 := $MemoryLoadU64(add(s, 32)) $t3 := $MemoryLoadU8(add(s, 40)) $t4 := $MemoryLoadU256(add(s, 0)) @@ -1840,7 +1840,7 @@ object "test_A2_M_test_unpack" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1854,7 +1854,7 @@ object "test_A2_M_test_unpack" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) @@ -2039,7 +2039,7 @@ object "test_A2_M_test_write_S" { A2_M_write_S($t3, $t4) // $t5 := borrow_local($t0) $t5 := $MakePtr(false, s) - // $t6 := borrow_field<0x2::M::S>.a($t5) + // $t6 := borrow_field.a($t5) $t6 := $IndexPtr($t5, 32) // $t7 := read_ref($t6) $t7 := $LoadU64($t6) @@ -2056,11 +2056,11 @@ object "test_A2_M_test_write_S" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, s) - // $t12 := borrow_field<0x2::M::S>.c($t11) + // $t12 := borrow_field.c($t11) { $t12 := $MakePtr($IsStoragePtr($t11), $LoadU256($t11)) } - // $t13 := borrow_field<0x2::M::S2>.x($t12) + // $t13 := borrow_field.x($t12) $t13 := $t12 // $t14 := read_ref($t13) $t14 := $LoadU128($t13) @@ -2095,21 +2095,21 @@ object "test_A2_M_test_write_S" { function A2_M_write_S(s, v) { let $t2, $t3, $t4, $t5, $t6, $t7 - // $t2 := borrow_field<0x2::M::S>.a($t0) + // $t2 := borrow_field.a($t0) $t2 := $IndexPtr(s, 32) // write_ref($t2, $t1) $StoreU64($t2, v) - // $t3 := borrow_field<0x2::M::S>.a($t0) + // $t3 := borrow_field.a($t0) $t3 := $IndexPtr(s, 32) // $t4 := read_ref($t3) $t4 := $LoadU64($t3) // $t5 := (u128)($t4) $t5 := $CastU128($t4) - // $t6 := borrow_field<0x2::M::S>.c($t0) + // $t6 := borrow_field.c($t0) { $t6 := $MakePtr($IsStoragePtr(s), $LoadU256(s)) } - // $t7 := borrow_field<0x2::M::S2>.x($t6) + // $t7 := borrow_field.x($t6) $t7 := $t6 // write_ref($t7, $t5) $StoreU128($t7, $t5) @@ -2122,7 +2122,7 @@ object "test_A2_M_test_write_S" { $t2 := $CastU128(a) // $t3 := M::pack_S2($t2) $t3 := A2_M_pack_S2($t2) - // $t4 := pack 0x2::M::S($t0, $t1, $t3) + // $t4 := pack M::S($t0, $t1, $t3) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -2136,7 +2136,7 @@ object "test_A2_M_test_write_S" { function A2_M_pack_S2(x) -> $result { let $t1 - // $t1 := pack 0x2::M::S2($t0) + // $t1 := pack M::S2($t0) { let $mem := $Malloc(16) $MemoryStoreU128(add($mem, 0), x) diff --git a/third_party/move/evm/move-to-yul/tests/Tables.exp b/third_party/move/evm/move-to-yul/tests/Tables.exp index 04a2ed965d8c1..f6ce37ffea2a9 100644 --- a/third_party/move/evm/move-to-yul/tests/Tables.exp +++ b/third_party/move/evm/move-to-yul/tests/Tables.exp @@ -108,13 +108,13 @@ object "test_A2_Tables_test_borrow_fail" { $t19 := $MakePtr(false, add($locals, 96)) // $t20 := move($t6) $t20 := mload($locals) - // $t21 := pack 0x2::Tables::S($t20) + // $t21 := pack Tables::S($t20) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t20) $t21 := $mem } - // move_to<0x2::Tables::S>($t21, $t19) + // move_to>($t21, $t19) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t19)) if $AlignedStorageLoad($base_offset) { @@ -456,13 +456,13 @@ object "test_A2_Tables_test_insert_fail" { $t30 := $MakePtr(false, add($locals, 160)) // $t31 := move($t9) $t31 := mload($locals) - // $t32 := pack 0x2::Tables::S($t31) + // $t32 := pack Tables::S($t31) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t31) $t32 := $mem } - // move_to<0x2::Tables::S>($t32, $t30) + // move_to>($t32, $t30) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t30)) if $AlignedStorageLoad($base_offset) { @@ -1022,13 +1022,13 @@ object "test_A2_Tables_test_primitive" { $t98 := $MakePtr(false, add($locals, 384)) // $t99 := move($t31) $t99 := mload($locals) - // $t100 := pack 0x2::Tables::S($t99) + // $t100 := pack Tables::S($t99) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t99) $t100 := $mem } - // move_to<0x2::Tables::S>($t100, $t98) + // move_to>($t100, $t98) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t98)) if $AlignedStorageLoad($base_offset) { @@ -1044,7 +1044,7 @@ object "test_A2_Tables_test_primitive" { } // $t101 := 0x42 $t101 := 0x42 - // $t102 := borrow_global<0x2::Tables::S>($t101) + // $t102 := borrow_global>($t101) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $t101) if iszero($AlignedStorageLoad($base_offset)) { @@ -1052,7 +1052,7 @@ object "test_A2_Tables_test_primitive" { } $t102 := $MakePtr(true, add($base_offset, 32)) } - // $t103 := borrow_field<0x2::Tables::S>.t($t102) + // $t103 := borrow_field>.t($t102) $t103 := $t102 // $t104 := 42 $t104 := 42 @@ -1119,7 +1119,7 @@ object "test_A2_Tables_test_primitive" { // label L32 // $t116 := 0x42 $t116 := 0x42 - // $t117 := move_from<0x2::Tables::S>($t116) + // $t117 := move_from>($t116) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $t116) if iszero($AlignedStorageLoad($base_offset)) { @@ -1135,7 +1135,7 @@ object "test_A2_Tables_test_primitive" { $t117 := $dst } } - // $t30 := unpack 0x2::Tables::S($t117) + // $t30 := unpack Tables::S($t117) mstore(add($locals, 480), $MemoryLoadU256(add($t117, 0))) $Free($t117, 32) // $t118 := borrow_local($t30) @@ -1181,13 +1181,13 @@ object "test_A2_Tables_test_primitive" { $t127 := $MakePtr(false, add($locals, 544)) // $t128 := move($t30) $t128 := mload(add($locals, 480)) - // $t129 := pack 0x2::Tables::S($t128) + // $t129 := pack Tables::S($t128) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t128) $t129 := $mem } - // move_to<0x2::Tables::S>($t129, $t127) + // move_to>($t129, $t127) { let $base_offset := $MakeTypeStorageBase(0, 0x8a475b1c, $LoadU256($t127)) if $AlignedStorageLoad($base_offset) { @@ -1483,7 +1483,7 @@ object "test_A2_Tables_test_remove_fail" { $Abort($t11) } case 4 { - // $t3 := Table::empty() + // $t3 := Table::empty() mstore($locals, A2_Table_empty$u64_A2_Tables_Balance$()) // $t4 := borrow_local($t3) $t4 := $MakePtr(false, $locals) @@ -1493,9 +1493,9 @@ object "test_A2_Tables_test_remove_fail" { mstore(add($locals, 32), $t5) // $t6 := borrow_local($t0) $t6 := $MakePtr(false, add($locals, 56)) - // $t7 := Table::remove($t4, $t6) + // $t7 := Table::remove($t4, $t6) $t7 := A2_Table_remove$u64_A2_Tables_Balance$($t4, $t6) - // $t8 := unpack 0x2::Tables::Balance($t7) + // $t8 := unpack Tables::Balance($t7) $t8 := $MemoryLoadU256(add($t7, 0)) $Free($t7, 32) // $t9 := U256::zero() @@ -1517,13 +1517,13 @@ object "test_A2_Tables_test_remove_fail" { $t13 := $MakePtr(false, add($locals, 64)) // $t14 := move($t3) $t14 := mload($locals) - // $t15 := pack 0x2::Tables::S($t14) + // $t15 := pack Tables::S($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // move_to<0x2::Tables::S>($t15, $t13) + // move_to>($t15, $t13) { let $base_offset := $MakeTypeStorageBase(0, 0x6f98bffd, $LoadU256($t13)) if $AlignedStorageLoad($base_offset) { @@ -1749,7 +1749,7 @@ object "test_A2_Tables_test_struct" { $Abort($t40) } case 4 { - // $t27 := Table::empty() + // $t27 := Table::empty() mstore($locals, A2_Table_empty$address_A2_Tables_Balance$()) // $t30 := 3743106036130323098097120681749450326028 $t30 := 3743106036130323098097120681749450326028 @@ -1763,13 +1763,13 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 32), $t33) // $t34 := borrow_local($t0) $t34 := $MakePtr(false, add($locals, 32)) - // $t35 := pack 0x2::Tables::Balance($t30) + // $t35 := pack Tables::Balance($t30) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t30) $t35 := $mem } - // Table::insert($t32, $t34, $t35) + // Table::insert($t32, $t34, $t35) A2_Table_insert$address_A2_Tables_Balance$($t32, $t34, $t35) // $t36 := borrow_local($t27) $t36 := $MakePtr(false, $locals) @@ -1779,7 +1779,7 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 64), $t37) // $t38 := borrow_local($t18) $t38 := $MakePtr(false, add($locals, 64)) - // $t39 := Table::contains($t36, $t38) + // $t39 := Table::contains($t36, $t38) $t39 := A2_Table_contains$address_A2_Tables_Balance$($t36, $t38) // if ($t39) goto L1 else goto L0 switch $t39 @@ -1796,9 +1796,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 96), $t42) // $t43 := borrow_local($t20) $t43 := $MakePtr(false, add($locals, 96)) - // $t44 := Table::borrow($t41, $t43) + // $t44 := Table::borrow($t41, $t43) $t44 := A2_Table_borrow$address_A2_Tables_Balance$($t41, $t43) - // $t45 := borrow_field<0x2::Tables::Balance>.value($t44) + // $t45 := borrow_field.value($t44) $t45 := $t44 // $t46 := read_ref($t45) $t46 := $LoadU256($t45) @@ -1831,13 +1831,13 @@ object "test_A2_Tables_test_struct" { $t50 := $MakePtr(false, add($locals, 128)) // $t51 := move($t27) $t51 := mload($locals) - // $t52 := pack 0x2::Tables::S($t51) + // $t52 := pack Tables::S($t51) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t51) $t52 := $mem } - // move_to<0x2::Tables::S>($t52, $t50) + // move_to>($t52, $t50) { let $base_offset := $MakeTypeStorageBase(0, 0x7dd56ec3, $LoadU256($t50)) if $AlignedStorageLoad($base_offset) { @@ -1853,7 +1853,7 @@ object "test_A2_Tables_test_struct" { } // $t53 := 0x42 $t53 := 0x42 - // $t54 := borrow_global<0x2::Tables::S>($t53) + // $t54 := borrow_global>($t53) { let $base_offset := $MakeTypeStorageBase(0, 0x7dd56ec3, $t53) if iszero($AlignedStorageLoad($base_offset)) { @@ -1861,7 +1861,7 @@ object "test_A2_Tables_test_struct" { } $t54 := $MakePtr(true, add($base_offset, 32)) } - // $t55 := borrow_field<0x2::Tables::S>.t($t54) + // $t55 := borrow_field>.t($t54) $t55 := $t54 // $t56 := 0xcd $t56 := 0xcd @@ -1869,13 +1869,13 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 160), $t56) // $t57 := borrow_local($t23) $t57 := $MakePtr(false, add($locals, 160)) - // $t58 := pack 0x2::Tables::Balance($t31) + // $t58 := pack Tables::Balance($t31) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t31) $t58 := $mem } - // Table::insert($t55, $t57, $t58) + // Table::insert($t55, $t57, $t58) A2_Table_insert$address_A2_Tables_Balance$($t55, $t57, $t58) // $t59 := 0xab $t59 := 0xab @@ -1885,9 +1885,9 @@ object "test_A2_Tables_test_struct" { $t60 := $MakePtr(false, add($locals, 192)) // $t61 := freeze_ref($t55) $t61 := $t55 - // $t62 := Table::borrow($t61, $t60) + // $t62 := Table::borrow($t61, $t60) $t62 := A2_Table_borrow$address_A2_Tables_Balance$($t61, $t60) - // $t63 := borrow_field<0x2::Tables::Balance>.value($t62) + // $t63 := borrow_field.value($t62) $t63 := $t62 // $t64 := read_ref($t63) $t64 := $LoadU256($t63) @@ -1921,9 +1921,9 @@ object "test_A2_Tables_test_struct" { $t68 := $MakePtr(false, add($locals, 224)) // $t69 := freeze_ref($t55) $t69 := $t55 - // $t70 := Table::borrow($t69, $t68) + // $t70 := Table::borrow($t69, $t68) $t70 := A2_Table_borrow$address_A2_Tables_Balance$($t69, $t68) - // $t71 := borrow_field<0x2::Tables::Balance>.value($t70) + // $t71 := borrow_field.value($t70) $t71 := $t70 // $t72 := read_ref($t71) $t72 := $LoadU256($t71) @@ -1955,9 +1955,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 256), $t75) // $t76 := borrow_local($t7) $t76 := $MakePtr(false, add($locals, 256)) - // $t77 := Table::borrow_mut($t55, $t76) + // $t77 := Table::borrow_mut($t55, $t76) $t77 := A2_Table_borrow_mut$address_A2_Tables_Balance$($t55, $t76) - // $t78 := borrow_field<0x2::Tables::Balance>.value($t77) + // $t78 := borrow_field.value($t77) $t78 := $t77 // $t79 := read_ref($t78) $t79 := $LoadU256($t78) @@ -1965,7 +1965,7 @@ object "test_A2_Tables_test_struct" { $t80 := A2_U256_one() // $t81 := -($t79, $t80) $t81 := $Sub($t79, $t80) - // $t82 := borrow_field<0x2::Tables::Balance>.value($t77) + // $t82 := borrow_field.value($t77) $t82 := $t77 // write_ref($t82, $t81) $StoreU256($t82, $t81) @@ -1977,9 +1977,9 @@ object "test_A2_Tables_test_struct" { $t84 := $MakePtr(false, add($locals, 288)) // $t85 := freeze_ref($t55) $t85 := $t55 - // $t86 := Table::borrow($t85, $t84) + // $t86 := Table::borrow($t85, $t84) $t86 := A2_Table_borrow$address_A2_Tables_Balance$($t85, $t84) - // $t87 := borrow_field<0x2::Tables::Balance>.value($t86) + // $t87 := borrow_field.value($t86) $t87 := $t86 // $t88 := read_ref($t87) $t88 := $LoadU256($t87) @@ -2013,9 +2013,9 @@ object "test_A2_Tables_test_struct" { mstore(add($locals, 320), $t92) // $t93 := borrow_local($t13) $t93 := $MakePtr(false, add($locals, 320)) - // $t94 := Table::remove($t55, $t93) + // $t94 := Table::remove($t55, $t93) $t94 := A2_Table_remove$address_A2_Tables_Balance$($t55, $t93) - // $t95 := unpack 0x2::Tables::Balance($t94) + // $t95 := unpack Tables::Balance($t94) $t95 := $MemoryLoadU256(add($t94, 0)) $Free($t94, 32) // $t96 := ==($t95, $t30) @@ -2048,7 +2048,7 @@ object "test_A2_Tables_test_struct" { $t99 := $MakePtr(false, add($locals, 352)) // $t100 := freeze_ref($t55) $t100 := $t55 - // $t101 := Table::contains($t100, $t99) + // $t101 := Table::contains($t100, $t99) $t101 := A2_Table_contains$address_A2_Tables_Balance$($t100, $t99) // $t102 := !($t101) $t102 := $LogicalNot($t101) @@ -2356,7 +2356,7 @@ object "test_A2_Tables_test_table_of_tables" { $Abort($t75) } case 4 { - // $t45 := Table::empty>() + // $t45 := Table::empty>() mstore(add($locals, 128), A2_Table_empty$address_A2_Table_Table$address_A2_U256_U256$$()) // $t51 := 3743106036130323098097120681749450326028 $t51 := 3743106036130323098097120681749450326028 @@ -2364,7 +2364,7 @@ object "test_A2_Tables_test_table_of_tables" { $t52 := 15312706511442230855851857334429569515566 // $t53 := 26542024619833200150143219379677920493647 $t53 := 26542024619833200150143219379677920493647 - // $t46 := Table::empty() + // $t46 := Table::empty() mstore($locals, A2_Table_empty$address_A2_U256_U256$()) // $t54 := borrow_local($t46) $t54 := $MakePtr(false, $locals) @@ -2374,9 +2374,9 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 32), $t55) // $t56 := borrow_local($t0) $t56 := $MakePtr(false, add($locals, 32)) - // Table::insert($t54, $t56, $t51) + // Table::insert($t54, $t56, $t51) A2_Table_insert$address_A2_U256_U256$($t54, $t56, $t51) - // $t47 := Table::empty() + // $t47 := Table::empty() mstore(add($locals, 64), A2_Table_empty$address_A2_U256_U256$()) // $t57 := borrow_local($t47) $t57 := $MakePtr(false, add($locals, 64)) @@ -2386,7 +2386,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 96), $t58) // $t59 := borrow_local($t22) $t59 := $MakePtr(false, add($locals, 96)) - // Table::insert($t57, $t59, $t52) + // Table::insert($t57, $t59, $t52) A2_Table_insert$address_A2_U256_U256$($t57, $t59, $t52) // $t60 := borrow_local($t45) $t60 := $MakePtr(false, add($locals, 128)) @@ -2398,7 +2398,7 @@ object "test_A2_Tables_test_table_of_tables" { $t62 := $MakePtr(false, add($locals, 160)) // $t63 := move($t46) $t63 := mload($locals) - // Table::insert>($t60, $t62, $t63) + // Table::insert>($t60, $t62, $t63) A2_Table_insert$address_A2_Table_Table$address_A2_U256_U256$$($t60, $t62, $t63) // $t64 := borrow_local($t45) $t64 := $MakePtr(false, add($locals, 128)) @@ -2410,7 +2410,7 @@ object "test_A2_Tables_test_table_of_tables" { $t66 := $MakePtr(false, add($locals, 192)) // $t67 := move($t47) $t67 := mload(add($locals, 64)) - // Table::insert>($t64, $t66, $t67) + // Table::insert>($t64, $t66, $t67) A2_Table_insert$address_A2_Table_Table$address_A2_U256_U256$$($t64, $t66, $t67) // $t68 := borrow_local($t45) $t68 := $MakePtr(false, add($locals, 128)) @@ -2420,7 +2420,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 224), $t69) // $t70 := borrow_local($t1) $t70 := $MakePtr(false, add($locals, 224)) - // $t71 := Table::borrow>($t68, $t70) + // $t71 := Table::borrow>($t68, $t70) $t71 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t68, $t70) // $t72 := 0xab $t72 := 0xab @@ -2428,7 +2428,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 256), $t72) // $t73 := borrow_local($t44) $t73 := $MakePtr(false, add($locals, 256)) - // $t74 := Table::contains($t71, $t73) + // $t74 := Table::contains($t71, $t73) $t74 := A2_Table_contains$address_A2_U256_U256$($t71, $t73) // if ($t74) goto L1 else goto L0 switch $t74 @@ -2445,7 +2445,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 288), $t77) // $t78 := borrow_local($t5) $t78 := $MakePtr(false, add($locals, 288)) - // $t79 := Table::borrow>($t76, $t78) + // $t79 := Table::borrow>($t76, $t78) $t79 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t76, $t78) // $t80 := 0xcd $t80 := 0xcd @@ -2453,7 +2453,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 320), $t80) // $t81 := borrow_local($t4) $t81 := $MakePtr(false, add($locals, 320)) - // $t82 := Table::contains($t79, $t81) + // $t82 := Table::contains($t79, $t81) $t82 := A2_Table_contains$address_A2_U256_U256$($t79, $t81) // if ($t82) goto L4 else goto L3 switch $t82 @@ -2482,7 +2482,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 352), $t85) // $t86 := borrow_local($t9) $t86 := $MakePtr(false, add($locals, 352)) - // $t87 := Table::borrow>($t84, $t86) + // $t87 := Table::borrow>($t84, $t86) $t87 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t84, $t86) // $t88 := 0xab $t88 := 0xab @@ -2490,7 +2490,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 384), $t88) // $t89 := borrow_local($t8) $t89 := $MakePtr(false, add($locals, 384)) - // $t90 := Table::borrow($t87, $t89) + // $t90 := Table::borrow($t87, $t89) $t90 := A2_Table_borrow$address_A2_U256_U256$($t87, $t89) // $t91 := read_ref($t90) $t91 := $LoadU256($t90) @@ -2523,7 +2523,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 416), $t95) // $t96 := borrow_local($t14) $t96 := $MakePtr(false, add($locals, 416)) - // $t97 := Table::borrow>($t94, $t96) + // $t97 := Table::borrow>($t94, $t96) $t97 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t94, $t96) // $t98 := 0xcd $t98 := 0xcd @@ -2531,7 +2531,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 448), $t98) // $t99 := borrow_local($t13) $t99 := $MakePtr(false, add($locals, 448)) - // $t100 := Table::borrow($t97, $t99) + // $t100 := Table::borrow($t97, $t99) $t100 := A2_Table_borrow$address_A2_U256_U256$($t97, $t99) // $t101 := read_ref($t100) $t101 := $LoadU256($t100) @@ -2564,7 +2564,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 480), $t105) // $t106 := borrow_local($t18) $t106 := $MakePtr(false, add($locals, 480)) - // $t107 := Table::borrow_mut>($t104, $t106) + // $t107 := Table::borrow_mut>($t104, $t106) $t107 := A2_Table_borrow_mut$address_A2_Table_Table$address_A2_U256_U256$$($t104, $t106) // $t108 := 0xef $t108 := 0xef @@ -2572,7 +2572,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 512), $t108) // $t109 := borrow_local($t17) $t109 := $MakePtr(false, add($locals, 512)) - // Table::insert($t107, $t109, $t53) + // Table::insert($t107, $t109, $t53) A2_Table_insert$address_A2_U256_U256$($t107, $t109, $t53) // $t110 := borrow_local($t45) $t110 := $MakePtr(false, add($locals, 128)) @@ -2582,7 +2582,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 544), $t111) // $t112 := borrow_local($t23) $t112 := $MakePtr(false, add($locals, 544)) - // $t113 := Table::borrow>($t110, $t112) + // $t113 := Table::borrow>($t110, $t112) $t113 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t110, $t112) // $t114 := 0xef $t114 := 0xef @@ -2590,7 +2590,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 576), $t114) // $t115 := borrow_local($t21) $t115 := $MakePtr(false, add($locals, 576)) - // $t116 := Table::borrow($t113, $t115) + // $t116 := Table::borrow($t113, $t115) $t116 := A2_Table_borrow$address_A2_U256_U256$($t113, $t115) // $t117 := read_ref($t116) $t117 := $LoadU256($t116) @@ -2623,7 +2623,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 608), $t121) // $t122 := borrow_local($t27) $t122 := $MakePtr(false, add($locals, 608)) - // $t123 := Table::borrow>($t120, $t122) + // $t123 := Table::borrow>($t120, $t122) $t123 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t120, $t122) // $t124 := 0xab $t124 := 0xab @@ -2631,7 +2631,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 640), $t124) // $t125 := borrow_local($t26) $t125 := $MakePtr(false, add($locals, 640)) - // $t126 := Table::borrow($t123, $t125) + // $t126 := Table::borrow($t123, $t125) $t126 := A2_Table_borrow$address_A2_U256_U256$($t123, $t125) // $t127 := read_ref($t126) $t127 := $LoadU256($t126) @@ -2664,7 +2664,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 672), $t131) // $t132 := borrow_local($t31) $t132 := $MakePtr(false, add($locals, 672)) - // $t133 := Table::borrow_mut>($t130, $t132) + // $t133 := Table::borrow_mut>($t130, $t132) $t133 := A2_Table_borrow_mut$address_A2_Table_Table$address_A2_U256_U256$$($t130, $t132) // $t134 := 0xcd $t134 := 0xcd @@ -2672,7 +2672,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 704), $t134) // $t135 := borrow_local($t30) $t135 := $MakePtr(false, add($locals, 704)) - // $t136 := Table::remove($t133, $t135) + // $t136 := Table::remove($t133, $t135) $t136 := A2_Table_remove$address_A2_U256_U256$($t133, $t135) // $t137 := ==($t136, $t52) $t137 := $Eq($t136, $t52) @@ -2703,7 +2703,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 736), $t140) // $t141 := borrow_local($t36) $t141 := $MakePtr(false, add($locals, 736)) - // $t142 := Table::borrow>($t139, $t141) + // $t142 := Table::borrow>($t139, $t141) $t142 := A2_Table_borrow$address_A2_Table_Table$address_A2_U256_U256$$($t139, $t141) // $t143 := 0xcd $t143 := 0xcd @@ -2711,7 +2711,7 @@ object "test_A2_Tables_test_table_of_tables" { mstore(add($locals, 768), $t143) // $t144 := borrow_local($t35) $t144 := $MakePtr(false, add($locals, 768)) - // $t145 := Table::contains($t142, $t144) + // $t145 := Table::contains($t142, $t144) $t145 := A2_Table_contains$address_A2_U256_U256$($t142, $t144) // $t146 := !($t145) $t146 := $LogicalNot($t145) @@ -2742,13 +2742,13 @@ object "test_A2_Tables_test_table_of_tables" { $t149 := $MakePtr(false, add($locals, 800)) // $t150 := move($t45) $t150 := mload(add($locals, 128)) - // $t151 := pack 0x2::Tables::S>($t150) + // $t151 := pack Tables::S>($t150) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t150) $t151 := $mem } - // move_to<0x2::Tables::S>>($t151, $t149) + // move_to>>($t151, $t149) { let $base_offset := $MakeTypeStorageBase(0, 0xc5110c9a, $LoadU256($t149)) if $AlignedStorageLoad($base_offset) { @@ -3047,7 +3047,7 @@ object "test_A2_Tables_test_u256" { $Abort($t14) } case 4 { - // $t3 := Table::empty<0x2::U256::U256, 0x2::U256::U256>() + // $t3 := Table::empty() mstore($locals, A2_Table_empty$A2_U256_U256_A2_U256_U256$()) // $t6 := 26542024619833200150143219379677920493647 $t6 := 26542024619833200150143219379677920493647 @@ -3061,13 +3061,13 @@ object "test_A2_Tables_test_u256" { $t9 := $MakePtr(false, $locals) // $t10 := borrow_local($t2) $t10 := $MakePtr(false, add($locals, 32)) - // Table::insert<0x2::U256::U256, 0x2::U256::U256>($t9, $t10, $t7) + // Table::insert($t9, $t10, $t7) A2_Table_insert$A2_U256_U256_A2_U256_U256$($t9, $t10, $t7) // $t11 := borrow_local($t3) $t11 := $MakePtr(false, $locals) // $t12 := borrow_local($t2) $t12 := $MakePtr(false, add($locals, 32)) - // $t13 := Table::contains<0x2::U256::U256, 0x2::U256::U256>($t11, $t12) + // $t13 := Table::contains($t11, $t12) $t13 := A2_Table_contains$A2_U256_U256_A2_U256_U256$($t11, $t12) // if ($t13) goto L1 else goto L0 switch $t13 @@ -3080,7 +3080,7 @@ object "test_A2_Tables_test_u256" { $t15 := $MakePtr(false, $locals) // $t16 := borrow_local($t2) $t16 := $MakePtr(false, add($locals, 32)) - // $t17 := Table::borrow<0x2::U256::U256, 0x2::U256::U256>($t15, $t16) + // $t17 := Table::borrow($t15, $t16) $t17 := A2_Table_borrow$A2_U256_U256_A2_U256_U256$($t15, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) @@ -3111,7 +3111,7 @@ object "test_A2_Tables_test_u256" { $t22 := $MakePtr(false, $locals) // $t23 := borrow_local($t2) $t23 := $MakePtr(false, add($locals, 32)) - // $t24 := Table::borrow_mut<0x2::U256::U256, 0x2::U256::U256>($t22, $t23) + // $t24 := Table::borrow_mut($t22, $t23) $t24 := A2_Table_borrow_mut$A2_U256_U256_A2_U256_U256$($t22, $t23) // write_ref($t24, $t8) $StoreU256($t24, $t8) @@ -3119,7 +3119,7 @@ object "test_A2_Tables_test_u256" { $t25 := $MakePtr(false, $locals) // $t26 := borrow_local($t2) $t26 := $MakePtr(false, add($locals, 32)) - // $t27 := Table::borrow<0x2::U256::U256, 0x2::U256::U256>($t25, $t26) + // $t27 := Table::borrow($t25, $t26) $t27 := A2_Table_borrow$A2_U256_U256_A2_U256_U256$($t25, $t26) // $t28 := read_ref($t27) $t28 := $LoadU256($t27) @@ -3152,13 +3152,13 @@ object "test_A2_Tables_test_u256" { $t32 := $MakePtr(false, add($locals, 64)) // $t33 := move($t3) $t33 := mload($locals) - // $t34 := pack 0x2::Tables::S<0x2::U256::U256, 0x2::U256::U256>($t33) + // $t34 := pack Tables::S($t33) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t33) $t34 := $mem } - // move_to<0x2::Tables::S<0x2::U256::U256, 0x2::U256::U256>>($t34, $t32) + // move_to>($t34, $t32) { let $base_offset := $MakeTypeStorageBase(0, 0xa20c17a3, $LoadU256($t32)) if $AlignedStorageLoad($base_offset) { @@ -3576,13 +3576,13 @@ object "test_A2_Tables_test_vector" { $t59 := $MakePtr(false, add($locals, 192)) // $t60 := move($t22) $t60 := mload($locals) - // $t61 := pack 0x2::Tables::S>($t60) + // $t61 := pack Tables::S>($t60) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t60) $t61 := $mem } - // move_to<0x2::Tables::S>>($t61, $t59) + // move_to>>($t61, $t59) { let $base_offset := $MakeTypeStorageBase(0, 0xa0362133, $LoadU256($t59)) if $AlignedStorageLoad($base_offset) { @@ -3598,7 +3598,7 @@ object "test_A2_Tables_test_vector" { } // $t62 := 0x42 $t62 := 0x42 - // $t63 := borrow_global<0x2::Tables::S>>($t62) + // $t63 := borrow_global>>($t62) { let $base_offset := $MakeTypeStorageBase(0, 0xa0362133, $t62) if iszero($AlignedStorageLoad($base_offset)) { @@ -3606,7 +3606,7 @@ object "test_A2_Tables_test_vector" { } $t63 := $MakePtr(true, add($base_offset, 32)) } - // $t64 := borrow_field<0x2::Tables::S>>.t($t63) + // $t64 := borrow_field>>.t($t63) $t64 := $t63 // $t65 := 42 $t65 := 42 @@ -3620,7 +3620,7 @@ object "test_A2_Tables_test_vector" { $t68 := 0x1013 // vector::push_back
($t67, $t68) A1_vector_push_back$address$($t67, $t68) - // $t69 := borrow_field<0x2::Tables::S>>.t($t63) + // $t69 := borrow_field>>.t($t63) $t69 := $t63 // $t70 := 42 $t70 := 42 @@ -3656,7 +3656,7 @@ object "test_A2_Tables_test_vector" { } case 17 { // label L14 - // $t77 := borrow_field<0x2::Tables::S>>.t($t63) + // $t77 := borrow_field>>.t($t63) $t77 := $t63 // $t78 := 42 $t78 := 42 @@ -3696,7 +3696,7 @@ object "test_A2_Tables_test_vector" { } case 20 { // label L17 - // $t87 := borrow_field<0x2::Tables::S>>.t($t63) + // $t87 := borrow_field>>.t($t63) $t87 := $t63 // $t88 := 42 $t88 := 42 @@ -3798,7 +3798,7 @@ object "test_A2_Tables_test_vector" { } case 29 { // label L26 - // $t109 := borrow_field<0x2::Tables::S>>.t($t63) + // $t109 := borrow_field>>.t($t63) $t109 := $t63 // $t110 := 42 $t110 := 42 diff --git a/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp b/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp index 06d766ee22495..49a3eb0ea4782 100644 --- a/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp +++ b/third_party/move/evm/move-to-yul/tests/TestABIStructs.exp @@ -101,13 +101,13 @@ object "A2_M" { $t1 := true // $t2 := M::pack_S($t0, $t1) $t2 := A2_M_pack_S($t0, $t1) - // $t3 := pack 0x2::M::Event_S($t2) + // $t3 := pack M::Event_S($t2) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t2) $t3 := $mem } - // Evm::emit<0x2::M::Event_S>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Event_S$($t3) // return () } @@ -130,7 +130,7 @@ object "A2_M" { $t1 := $MakePtr(false, $locals) // $t2 := 0 $t2 := 0 - // $t3 := vector::borrow>($t1, $t2) + // $t3 := vector::borrow>($t1, $t2) $t3 := A1_vector_borrow$vec$A2_M_S$$($t1, $t2) // $t4 := read_ref($t3) $t4 := $LoadU256($t3) @@ -244,7 +244,7 @@ object "A2_M" { function A2_M_pack_S(a, b) -> $result { let s2, $t4, $t5, $t6, $t7, $t8 let $locals := $Malloc(32) - // $t3 := vector::empty<0x2::M::S2>() + // $t3 := vector::empty() mstore($locals, A1_vector_empty$A2_M_S2$()) // $t4 := (u128)($t0) $t4 := $CastU128(a) @@ -252,11 +252,11 @@ object "A2_M" { $t5 := A2_M_pack_S2($t4) // $t6 := borrow_local($t3) $t6 := $MakePtr(false, $locals) - // vector::push_back<0x2::M::S2>($t6, $t5) + // vector::push_back($t6, $t5) A1_vector_push_back$A2_M_S2$($t6, $t5) // $t7 := move($t3) $t7 := mload($locals) - // $t8 := pack 0x2::M::S($t0, $t1, $t7) + // $t8 := pack M::S($t0, $t1, $t7) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -314,7 +314,7 @@ object "A2_M" { A1_vector_push_back$u128$($t2, x) // $t3 := move($t1) $t3 := mload($locals) - // $t4 := pack 0x2::M::S2($t3) + // $t4 := pack M::S2($t3) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t3) @@ -1068,13 +1068,13 @@ object "test_A2_M_test_abi_S" { _s := A2_M_decode_S($t7) // $t8 := borrow_local($t2) $t8 := $MakePtr(false, s) - // $t9 := borrow_field<0x2::M::S>.a($t8) + // $t9 := borrow_field.a($t8) $t9 := $IndexPtr($t8, 32) // $t10 := read_ref($t9) $t10 := $LoadU64($t9) // $t11 := borrow_local($t0) $t11 := $MakePtr(false, _s) - // $t12 := borrow_field<0x2::M::S>.a($t11) + // $t12 := borrow_field.a($t11) $t12 := $IndexPtr($t11, 32) // $t13 := read_ref($t12) $t13 := $LoadU64($t12) @@ -1089,7 +1089,7 @@ object "test_A2_M_test_abi_S" { // label L2 // $t16 := borrow_local($t0) $t16 := $MakePtr(false, _s) - // $t17 := borrow_field<0x2::M::S>.a($t16) + // $t17 := borrow_field.a($t16) $t17 := $IndexPtr($t16, 32) // $t18 := read_ref($t17) $t18 := $LoadU64($t17) @@ -1118,13 +1118,13 @@ object "test_A2_M_test_abi_S" { // label L5 // $t22 := borrow_local($t2) $t22 := $MakePtr(false, s) - // $t23 := borrow_field<0x2::M::S>.b($t22) + // $t23 := borrow_field.b($t22) $t23 := $IndexPtr($t22, 40) // $t24 := read_ref($t23) $t24 := $LoadU8($t23) // $t25 := borrow_local($t0) $t25 := $MakePtr(false, _s) - // $t26 := borrow_field<0x2::M::S>.b($t25) + // $t26 := borrow_field.b($t25) $t26 := $IndexPtr($t25, 40) // $t27 := read_ref($t26) $t27 := $LoadU8($t26) @@ -1151,7 +1151,7 @@ object "test_A2_M_test_abi_S" { // label L8 // $t30 := borrow_local($t0) $t30 := $MakePtr(false, _s) - // $t31 := borrow_field<0x2::M::S>.b($t30) + // $t31 := borrow_field.b($t30) $t31 := $IndexPtr($t30, 40) // $t32 := read_ref($t31) $t32 := $LoadU8($t31) @@ -1180,7 +1180,7 @@ object "test_A2_M_test_abi_S" { // label L11 // $t36 := borrow_local($t2) $t36 := $MakePtr(false, s) - // $t37 := borrow_field<0x2::M::S>.c($t36) + // $t37 := borrow_field.c($t36) $t37 := $t36 // $t3 := read_ref($t37) mstore($locals, $LoadU256($t37)) @@ -1222,7 +1222,7 @@ object "test_A2_M_test_abi_S" { } // $t38 := borrow_local($t0) $t38 := $MakePtr(false, _s) - // $t39 := borrow_field<0x2::M::S>.c($t38) + // $t39 := borrow_field.c($t38) $t39 := $t38 // $t1 := read_ref($t39) mstore(add($locals, 32), $LoadU256($t39)) @@ -1264,7 +1264,7 @@ object "test_A2_M_test_abi_S" { } // $t40 := borrow_local($t3) $t40 := $MakePtr(false, $locals) - // $t41 := vector::length<0x2::M::S2>($t40) + // $t41 := vector::length($t40) $t41 := A1_vector_length$A2_M_S2$($t40) // $t42 := 1 $t42 := 1 @@ -1291,7 +1291,7 @@ object "test_A2_M_test_abi_S" { // label L14 // $t45 := borrow_local($t1) $t45 := $MakePtr(false, add($locals, 32)) - // $t46 := vector::length<0x2::M::S2>($t45) + // $t46 := vector::length($t45) $t46 := A1_vector_length$A2_M_S2$($t45) // $t47 := 1 $t47 := 1 @@ -1320,9 +1320,9 @@ object "test_A2_M_test_abi_S" { $t50 := $MakePtr(false, add($locals, 32)) // $t51 := 0 $t51 := 0 - // $t52 := vector::borrow<0x2::M::S2>($t50, $t51) + // $t52 := vector::borrow($t50, $t51) $t52 := A1_vector_borrow$A2_M_S2$($t50, $t51) - // $t53 := borrow_field<0x2::M::S2>.x($t52) + // $t53 := borrow_field.x($t52) $t53 := $t52 // $t54 := 0 $t54 := 0 @@ -1404,7 +1404,7 @@ object "test_A2_M_test_abi_S" { function A2_M_pack_S(a, b) -> $result { let s2, $t4, $t5, $t6, $t7, $t8 let $locals := $Malloc(32) - // $t3 := vector::empty<0x2::M::S2>() + // $t3 := vector::empty() mstore($locals, A1_vector_empty$A2_M_S2$()) // $t4 := (u128)($t0) $t4 := $CastU128(a) @@ -1412,11 +1412,11 @@ object "test_A2_M_test_abi_S" { $t5 := A2_M_pack_S2($t4) // $t6 := borrow_local($t3) $t6 := $MakePtr(false, $locals) - // vector::push_back<0x2::M::S2>($t6, $t5) + // vector::push_back($t6, $t5) A1_vector_push_back$A2_M_S2$($t6, $t5) // $t7 := move($t3) $t7 := mload($locals) - // $t8 := pack 0x2::M::S($t0, $t1, $t7) + // $t8 := pack M::S($t0, $t1, $t7) { let $mem := $Malloc(41) $MemoryStoreU64(add($mem, 32), a) @@ -1474,7 +1474,7 @@ object "test_A2_M_test_abi_S" { A1_vector_push_back$u128$($t2, x) // $t3 := move($t1) $t3 := mload($locals) - // $t4 := pack 0x2::M::S2($t3) + // $t4 := pack M::S2($t3) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t3) @@ -2216,7 +2216,7 @@ object "test_A2_M_test_abi_String" { } function A1_ascii_into_bytes(string) -> $result { let $t1 - // $t1 := unpack 0x1::ascii::String($t0) + // $t1 := unpack ascii::String($t0) $t1 := $MemoryLoadU256(add(string, 0)) $Free(string, 32) // return $t1 @@ -2249,7 +2249,7 @@ object "test_A2_M_test_abi_String" { function A1_ascii_as_bytes(string) -> $result { let $t1 - // $t1 := borrow_field<0x1::ascii::String>.bytes($t0) + // $t1 := borrow_field.bytes($t0) $t1 := string // return $t1 $result := $t1 @@ -2297,7 +2297,7 @@ object "test_A2_M_test_abi_String" { x := A1_ascii_try_string(bytes) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, x) - // $t3 := option::is_some<0x1::ascii::String>($t2) + // $t3 := option::is_some($t2) $t3 := A1_option_is_some$A1_ascii_String$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -2308,7 +2308,7 @@ object "test_A2_M_test_abi_String" { // label L2 // $t5 := move($t1) $t5 := x - // $t6 := option::destroy_some<0x1::ascii::String>($t5) + // $t6 := option::destroy_some($t5) $t6 := A1_option_destroy_some$A1_ascii_String$($t5) // return $t6 $result := $t6 @@ -2349,7 +2349,7 @@ object "test_A2_M_test_abi_String" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2409,7 +2409,7 @@ object "test_A2_M_test_abi_String" { } function A1_option_is_some$A1_ascii_String$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A1_ascii_String$($t1) @@ -2477,13 +2477,13 @@ object "test_A2_M_test_abi_String" { // assert forall j: num: Range(0, $t4): ascii::is_valid_char(Index($t0, j)) // $t14 := move($t0) $t14 := mload($locals) - // $t15 := pack 0x1::ascii::String($t14) + // $t15 := pack ascii::String($t14) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t14) $t15 := $mem } - // $t16 := option::some<0x1::ascii::String>($t15) + // $t16 := option::some($t15) $t16 := A1_option_some$A1_ascii_String$($t15) // return $t16 $result := $t16 @@ -2509,7 +2509,7 @@ object "test_A2_M_test_abi_String" { } case 7 { // label L4 - // $t12 := option::none<0x1::ascii::String>() + // $t12 := option::none() $t12 := A1_option_none$A1_ascii_String$() // return $t12 $result := $t12 @@ -2532,7 +2532,7 @@ object "test_A2_M_test_abi_String" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A1_ascii_String$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2550,7 +2550,7 @@ object "test_A2_M_test_abi_String" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A1_ascii_String$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) diff --git a/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp b/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp index 53d43f5dcd892..0efdfd006698d 100644 --- a/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp +++ b/third_party/move/evm/move-to-yul/tests/TestExternalResult.exp @@ -171,7 +171,7 @@ object "test_A2_M_extract_err_data" { } function A2_ExternalResult_unwrap_err_data$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -181,7 +181,7 @@ object "test_A2_M_extract_err_data" { A1_option_destroy_none$u64$($t4) // option::destroy_none>($t6) A1_option_destroy_none$vec$u8$$($t6) - // option::destroy_none<0x2::U256::U256>($t7) + // option::destroy_none($t7) A1_option_destroy_none$A2_U256_U256$($t7) // $t8 := option::destroy_some>($t5) $t8 := A1_option_destroy_some$vec$u8$$($t5) @@ -221,7 +221,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -274,7 +274,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -332,7 +332,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -351,7 +351,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -407,7 +407,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -420,7 +420,7 @@ object "test_A2_M_extract_err_data" { function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -459,7 +459,7 @@ object "test_A2_M_extract_err_data" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -478,7 +478,7 @@ object "test_A2_M_extract_err_data" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -505,7 +505,7 @@ object "test_A2_M_extract_err_data" { } function A2_ExternalResult_is_err_data$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_data($t0) + // $t1 := borrow_field>.err_data($t0) { let $field_ptr := $IndexPtr(result, 32) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -532,9 +532,9 @@ object "test_A2_M_extract_err_data" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none<0x2::U256::U256>() + // $t4 := option::none() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -551,7 +551,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -569,7 +569,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -587,7 +587,7 @@ object "test_A2_M_extract_err_data" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -645,7 +645,7 @@ object "test_A2_M_extract_err_data" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1082,7 +1082,7 @@ object "test_A2_M_extract_err_reason" { } function A2_ExternalResult_unwrap_err_reason$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -1092,7 +1092,7 @@ object "test_A2_M_extract_err_reason" { A1_option_destroy_none$u64$($t4) // option::destroy_none>($t5) A1_option_destroy_none$vec$u8$$($t5) - // option::destroy_none<0x2::U256::U256>($t7) + // option::destroy_none($t7) A1_option_destroy_none$A2_U256_U256$($t7) // $t8 := option::destroy_some>($t6) $t8 := A1_option_destroy_some$vec$u8$$($t6) @@ -1132,7 +1132,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -1185,7 +1185,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1243,7 +1243,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1262,7 +1262,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -1318,7 +1318,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1331,7 +1331,7 @@ object "test_A2_M_extract_err_reason" { function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1370,7 +1370,7 @@ object "test_A2_M_extract_err_reason" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1389,7 +1389,7 @@ object "test_A2_M_extract_err_reason" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -1416,7 +1416,7 @@ object "test_A2_M_extract_err_reason" { } function A2_ExternalResult_is_err_reason$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_reason($t0) + // $t1 := borrow_field>.err_reason($t0) { let $field_ptr := $IndexPtr(result, 64) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -1443,9 +1443,9 @@ object "test_A2_M_extract_err_reason" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none<0x2::U256::U256>() + // $t8 := option::none() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -1462,7 +1462,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1480,7 +1480,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1498,7 +1498,7 @@ object "test_A2_M_extract_err_reason" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -1556,7 +1556,7 @@ object "test_A2_M_extract_err_reason" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -1950,7 +1950,7 @@ object "test_A2_M_extract_panic_code" { function A2_ExternalResult_unwrap_panic$u64$(result) -> $result { let err_data, err_reason, panic_code, $t4, $t5, $t6, $t7, $t8 - // ($t4, $t5, $t6, $t7) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t4, $t5, $t6, $t7) := unpack ExternalResult::ExternalResult<#0>($t0) $t4 := $MemoryLoadU256(add(result, 0)) $t5 := $MemoryLoadU256(add(result, 32)) $t6 := $MemoryLoadU256(add(result, 64)) @@ -1962,7 +1962,7 @@ object "test_A2_M_extract_panic_code" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t5) A1_option_destroy_none$vec$u8$$($t5) - // $t8 := option::destroy_some<0x2::U256::U256>($t7) + // $t8 := option::destroy_some($t7) $t8 := A1_option_destroy_some$A2_U256_U256$($t7) // return $t8 $result := $t8 @@ -2000,7 +2000,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2036,7 +2036,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_some$A2_U256_U256$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -2094,7 +2094,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2113,7 +2113,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -2169,7 +2169,7 @@ object "test_A2_M_extract_panic_code" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2188,7 +2188,7 @@ object "test_A2_M_extract_panic_code" { } function A1_option_is_none$u64$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -2215,12 +2215,12 @@ object "test_A2_M_extract_panic_code" { } function A2_ExternalResult_is_panic$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.panic_code($t0) + // $t1 := borrow_field>.panic_code($t0) { let $field_ptr := $IndexPtr(result, 96) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) } - // $t2 := option::is_some<0x2::U256::U256>($t1) + // $t2 := option::is_some($t1) $t2 := A1_option_is_some$A2_U256_U256$($t1) // return $t2 $result := $t2 @@ -2242,9 +2242,9 @@ object "test_A2_M_extract_panic_code" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some<0x2::U256::U256>($t0) + // $t8 := option::some($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -2261,7 +2261,7 @@ object "test_A2_M_extract_panic_code" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A2_U256_U256$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -2309,7 +2309,7 @@ object "test_A2_M_extract_panic_code" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2327,7 +2327,7 @@ object "test_A2_M_extract_panic_code" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$u64$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2632,7 +2632,7 @@ object "test_A2_M_extract_value" { function A2_ExternalResult_unwrap$u64$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -2642,7 +2642,7 @@ object "test_A2_M_extract_value" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none<0x2::U256::U256>($t8) + // option::destroy_none($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$u64$($t5) @@ -2682,7 +2682,7 @@ object "test_A2_M_extract_value" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -2718,7 +2718,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_some$u64$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$u64$($t1) @@ -2776,7 +2776,7 @@ object "test_A2_M_extract_value" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2795,7 +2795,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -2851,7 +2851,7 @@ object "test_A2_M_extract_value" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -2870,7 +2870,7 @@ object "test_A2_M_extract_value" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -2897,7 +2897,7 @@ object "test_A2_M_extract_value" { } function A2_ExternalResult_is_ok$u64$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) + // $t1 := borrow_field>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -2923,9 +2923,9 @@ object "test_A2_M_extract_value" { $t2 := A1_option_none$vec$u8$$() // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none<0x2::U256::U256>() + // $t4 := option::none() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -2942,7 +2942,7 @@ object "test_A2_M_extract_value" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2960,7 +2960,7 @@ object "test_A2_M_extract_value" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -2978,7 +2978,7 @@ object "test_A2_M_extract_value" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$u64$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) diff --git a/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp b/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp index d268ad845efe2..7ff6ff55a5591 100644 --- a/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp +++ b/third_party/move/evm/move-to-yul/tests/TestStringLiteral.exp @@ -76,13 +76,13 @@ object "test_A2_M_h1" { $MemoryStoreU64($t5, 3) $MemoryStoreU64(add($t5, 8), $ClosestGreaterPowerOfTwo(3)) copy_literal_string_to_memory_2053440334(add($t5, 32)) - // $t6 := pack 0x2::M::T($t5) + // $t6 := pack M::T($t5) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t5) $t6 := $mem } - // move_to<0x2::M::T>($t6, $t4) + // move_to($t6, $t4) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $LoadU256($t4)) if $AlignedStorageLoad($base_offset) { @@ -111,7 +111,7 @@ object "test_A2_M_h1" { } // $t7 := 0x3 $t7 := 0x3 - // $t8 := borrow_global<0x2::M::T>($t7) + // $t8 := borrow_global($t7) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t7) if iszero($AlignedStorageLoad($base_offset)) { @@ -119,7 +119,7 @@ object "test_A2_M_h1" { } $t8 := $MakePtr(true, add($base_offset, 32)) } - // $t9 := borrow_field<0x2::M::T>.s($t8) + // $t9 := borrow_field.s($t8) $t9 := $t8 // $t1 := read_ref($t9) mstore(add($locals, 32), $LoadU256($t9)) @@ -253,7 +253,7 @@ object "test_A2_M_h1" { copy_literal_string_to_memory_2788570470(add($t36, 32)) // $t37 := 0x3 $t37 := 0x3 - // $t38 := borrow_global<0x2::M::T>($t37) + // $t38 := borrow_global($t37) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t37) if iszero($AlignedStorageLoad($base_offset)) { @@ -261,7 +261,7 @@ object "test_A2_M_h1" { } $t38 := $MakePtr(true, add($base_offset, 32)) } - // $t39 := borrow_field<0x2::M::T>.s($t38) + // $t39 := borrow_field.s($t38) $t39 := $t38 // write_ref($t39, $t36) if $IsStoragePtr($t39){ @@ -279,7 +279,7 @@ object "test_A2_M_h1" { $StoreU256($t39, $t36) // $t40 := 0x3 $t40 := 0x3 - // $t41 := borrow_global<0x2::M::T>($t40) + // $t41 := borrow_global($t40) { let $base_offset := $MakeTypeStorageBase(0, 0x3948ca0a, $t40) if iszero($AlignedStorageLoad($base_offset)) { @@ -287,7 +287,7 @@ object "test_A2_M_h1" { } $t41 := $MakePtr(true, add($base_offset, 32)) } - // $t42 := borrow_field<0x2::M::T>.s($t41) + // $t42 := borrow_field.s($t41) $t42 := $t41 // $t2 := read_ref($t42) mstore(add($locals, 64), $LoadU256($t42)) diff --git a/third_party/move/evm/move-to-yul/tests/Vectors.exp b/third_party/move/evm/move-to-yul/tests/Vectors.exp index 0c52bbbddab24..b173205f13135 100644 --- a/third_party/move/evm/move-to-yul/tests/Vectors.exp +++ b/third_party/move/evm/move-to-yul/tests/Vectors.exp @@ -622,7 +622,7 @@ object "test_A2_Vectors_test_borrow_mut" { $t5 := false // $t6 := 123 $t6 := 123 - // $t7 := pack 0x2::Vectors::S($t4, $t5, $t6) + // $t7 := pack Vectors::S($t4, $t5, $t6) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t4) @@ -630,29 +630,29 @@ object "test_A2_Vectors_test_borrow_mut" { $MemoryStoreU64(add($mem, 16), $t6) $t7 := $mem } - // vector::push_back<0x2::Vectors::S>($t3, $t7) + // vector::push_back($t3, $t7) A1_vector_push_back$A2_Vectors_S$($t3, $t7) // $t8 := borrow_local($t2) $t8 := $MakePtr(false, $locals) // $t9 := 0 $t9 := 0 - // $t10 := vector::borrow_mut<0x2::Vectors::S>($t8, $t9) + // $t10 := vector::borrow_mut($t8, $t9) $t10 := A1_vector_borrow_mut$A2_Vectors_S$($t8, $t9) // $t11 := 90 $t11 := 90 - // $t12 := borrow_field<0x2::Vectors::S>.x($t10) + // $t12 := borrow_field.x($t10) $t12 := $t10 // write_ref($t12, $t11) $StoreU128($t12, $t11) // $t13 := false $t13 := false - // $t14 := borrow_field<0x2::Vectors::S>.y($t10) + // $t14 := borrow_field.y($t10) $t14 := $IndexPtr($t10, 24) // write_ref($t14, $t13) $StoreU8($t14, $t13) // $t15 := 1028 $t15 := 1028 - // $t16 := borrow_field<0x2::Vectors::S>.z($t10) + // $t16 := borrow_field.z($t10) $t16 := $IndexPtr($t10, 16) // write_ref($t16, $t15) $StoreU64($t16, $t15) @@ -660,9 +660,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t17 := $MakePtr(false, $locals) // $t18 := 0 $t18 := 0 - // $t19 := vector::borrow<0x2::Vectors::S>($t17, $t18) + // $t19 := vector::borrow($t17, $t18) $t19 := A1_vector_borrow$A2_Vectors_S$($t17, $t18) - // $t20 := borrow_field<0x2::Vectors::S>.x($t19) + // $t20 := borrow_field.x($t19) $t20 := $t19 // $t21 := read_ref($t20) $t21 := $LoadU128($t20) @@ -681,9 +681,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t25 := $MakePtr(false, $locals) // $t26 := 0 $t26 := 0 - // $t27 := vector::borrow<0x2::Vectors::S>($t25, $t26) + // $t27 := vector::borrow($t25, $t26) $t27 := A1_vector_borrow$A2_Vectors_S$($t25, $t26) - // $t28 := borrow_field<0x2::Vectors::S>.y($t27) + // $t28 := borrow_field.y($t27) $t28 := $IndexPtr($t27, 24) // $t29 := read_ref($t28) $t29 := $LoadU8($t28) @@ -714,9 +714,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t33 := $MakePtr(false, $locals) // $t34 := 0 $t34 := 0 - // $t35 := vector::borrow<0x2::Vectors::S>($t33, $t34) + // $t35 := vector::borrow($t33, $t34) $t35 := A1_vector_borrow$A2_Vectors_S$($t33, $t34) - // $t36 := borrow_field<0x2::Vectors::S>.z($t35) + // $t36 := borrow_field.z($t35) $t36 := $IndexPtr($t35, 16) // $t37 := read_ref($t36) $t37 := $LoadU64($t36) @@ -747,9 +747,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t41 := $MakePtr(false, $locals) // $t42 := 1 $t42 := 1 - // $t43 := vector::borrow<0x2::Vectors::S>($t41, $t42) + // $t43 := vector::borrow($t41, $t42) $t43 := A1_vector_borrow$A2_Vectors_S$($t41, $t42) - // $t44 := borrow_field<0x2::Vectors::S>.x($t43) + // $t44 := borrow_field.x($t43) $t44 := $t43 // $t45 := read_ref($t44) $t45 := $LoadU128($t44) @@ -780,9 +780,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t49 := $MakePtr(false, $locals) // $t50 := 1 $t50 := 1 - // $t51 := vector::borrow<0x2::Vectors::S>($t49, $t50) + // $t51 := vector::borrow($t49, $t50) $t51 := A1_vector_borrow$A2_Vectors_S$($t49, $t50) - // $t52 := borrow_field<0x2::Vectors::S>.y($t51) + // $t52 := borrow_field.y($t51) $t52 := $IndexPtr($t51, 24) // $t53 := read_ref($t52) $t53 := $LoadU8($t52) @@ -813,9 +813,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t57 := $MakePtr(false, $locals) // $t58 := 1 $t58 := 1 - // $t59 := vector::borrow<0x2::Vectors::S>($t57, $t58) + // $t59 := vector::borrow($t57, $t58) $t59 := A1_vector_borrow$A2_Vectors_S$($t57, $t58) - // $t60 := borrow_field<0x2::Vectors::S>.z($t59) + // $t60 := borrow_field.z($t59) $t60 := $IndexPtr($t59, 16) // $t61 := read_ref($t60) $t61 := $LoadU64($t60) @@ -846,23 +846,23 @@ object "test_A2_Vectors_test_borrow_mut" { $t65 := $MakePtr(false, $locals) // $t66 := 1 $t66 := 1 - // $t67 := vector::borrow_mut<0x2::Vectors::S>($t65, $t66) + // $t67 := vector::borrow_mut($t65, $t66) $t67 := A1_vector_borrow_mut$A2_Vectors_S$($t65, $t66) // $t68 := 10 $t68 := 10 - // $t69 := borrow_field<0x2::Vectors::S>.x($t67) + // $t69 := borrow_field.x($t67) $t69 := $t67 // write_ref($t69, $t68) $StoreU128($t69, $t68) // $t70 := true $t70 := true - // $t71 := borrow_field<0x2::Vectors::S>.y($t67) + // $t71 := borrow_field.y($t67) $t71 := $IndexPtr($t67, 24) // write_ref($t71, $t70) $StoreU8($t71, $t70) // $t72 := 456 $t72 := 456 - // $t73 := borrow_field<0x2::Vectors::S>.z($t67) + // $t73 := borrow_field.z($t67) $t73 := $IndexPtr($t67, 16) // write_ref($t73, $t72) $StoreU64($t73, $t72) @@ -870,9 +870,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t74 := $MakePtr(false, $locals) // $t75 := 1 $t75 := 1 - // $t76 := vector::borrow<0x2::Vectors::S>($t74, $t75) + // $t76 := vector::borrow($t74, $t75) $t76 := A1_vector_borrow$A2_Vectors_S$($t74, $t75) - // $t77 := borrow_field<0x2::Vectors::S>.x($t76) + // $t77 := borrow_field.x($t76) $t77 := $t76 // $t78 := read_ref($t77) $t78 := $LoadU128($t77) @@ -903,9 +903,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t82 := $MakePtr(false, $locals) // $t83 := 1 $t83 := 1 - // $t84 := vector::borrow<0x2::Vectors::S>($t82, $t83) + // $t84 := vector::borrow($t82, $t83) $t84 := A1_vector_borrow$A2_Vectors_S$($t82, $t83) - // $t85 := borrow_field<0x2::Vectors::S>.y($t84) + // $t85 := borrow_field.y($t84) $t85 := $IndexPtr($t84, 24) // $t86 := read_ref($t85) $t86 := $LoadU8($t85) @@ -936,9 +936,9 @@ object "test_A2_Vectors_test_borrow_mut" { $t90 := $MakePtr(false, $locals) // $t91 := 1 $t91 := 1 - // $t92 := vector::borrow<0x2::Vectors::S>($t90, $t91) + // $t92 := vector::borrow($t90, $t91) $t92 := A1_vector_borrow$A2_Vectors_S$($t90, $t91) - // $t93 := borrow_field<0x2::Vectors::S>.z($t92) + // $t93 := borrow_field.z($t92) $t93 := $IndexPtr($t92, 16) // $t94 := read_ref($t93) $t94 := $LoadU64($t93) @@ -1014,7 +1014,7 @@ object "test_A2_Vectors_test_borrow_mut" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty<0x2::Vectors::S>() + // $t0 := vector::empty() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -1024,7 +1024,7 @@ object "test_A2_Vectors_test_borrow_mut" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) + // $t5 := pack Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -1032,7 +1032,7 @@ object "test_A2_Vectors_test_borrow_mut" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back<0x2::Vectors::S>($t1, $t5) + // vector::push_back($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -1418,7 +1418,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { let $t0 // $t0 := Vectors::one_elem_struct() $t0 := A2_Vectors_one_elem_struct() - // vector::destroy_empty<0x2::Vectors::S>($t0) + // vector::destroy_empty($t0) A1_vector_destroy_empty$A2_Vectors_S$($t0) // return () } @@ -1432,7 +1432,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty<0x2::Vectors::S>() + // $t0 := vector::empty() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -1442,7 +1442,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) + // $t5 := pack Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -1450,7 +1450,7 @@ object "test_A2_Vectors_test_destroy_non_empty_fail" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back<0x2::Vectors::S>($t1, $t5) + // vector::push_back($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -3121,7 +3121,7 @@ object "test_A2_Vectors_test_one_elem_struct" { mstore($locals, A2_Vectors_one_elem_struct()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) - // $t2 := vector::length<0x2::Vectors::S>($t1) + // $t2 := vector::length($t1) $t2 := A1_vector_length$A2_Vectors_S$($t1) // $t3 := 1 $t3 := 1 @@ -3138,9 +3138,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t6 := $MakePtr(false, $locals) // $t7 := 0 $t7 := 0 - // $t8 := vector::borrow<0x2::Vectors::S>($t6, $t7) + // $t8 := vector::borrow($t6, $t7) $t8 := A1_vector_borrow$A2_Vectors_S$($t6, $t7) - // $t9 := borrow_field<0x2::Vectors::S>.x($t8) + // $t9 := borrow_field.x($t8) $t9 := $t8 // $t10 := read_ref($t9) $t10 := $LoadU128($t9) @@ -3171,9 +3171,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t14 := $MakePtr(false, $locals) // $t15 := 0 $t15 := 0 - // $t16 := vector::borrow<0x2::Vectors::S>($t14, $t15) + // $t16 := vector::borrow($t14, $t15) $t16 := A1_vector_borrow$A2_Vectors_S$($t14, $t15) - // $t17 := borrow_field<0x2::Vectors::S>.y($t16) + // $t17 := borrow_field.y($t16) $t17 := $IndexPtr($t16, 24) // $t18 := read_ref($t17) $t18 := $LoadU8($t17) @@ -3204,9 +3204,9 @@ object "test_A2_Vectors_test_one_elem_struct" { $t22 := $MakePtr(false, $locals) // $t23 := 0 $t23 := 0 - // $t24 := vector::borrow<0x2::Vectors::S>($t22, $t23) + // $t24 := vector::borrow($t22, $t23) $t24 := A1_vector_borrow$A2_Vectors_S$($t22, $t23) - // $t25 := borrow_field<0x2::Vectors::S>.z($t24) + // $t25 := borrow_field.z($t24) $t25 := $IndexPtr($t24, 16) // $t26 := read_ref($t25) $t26 := $LoadU64($t25) @@ -3257,7 +3257,7 @@ object "test_A2_Vectors_test_one_elem_struct" { function A2_Vectors_one_elem_struct() -> $result { let $t1, $t2, $t3, $t4, $t5, $t6 let $locals := $Malloc(32) - // $t0 := vector::empty<0x2::Vectors::S>() + // $t0 := vector::empty() mstore($locals, A1_vector_empty$A2_Vectors_S$()) // $t1 := borrow_local($t0) $t1 := $MakePtr(false, $locals) @@ -3267,7 +3267,7 @@ object "test_A2_Vectors_test_one_elem_struct" { $t3 := true // $t4 := 789 $t4 := 789 - // $t5 := pack 0x2::Vectors::S($t2, $t3, $t4) + // $t5 := pack Vectors::S($t2, $t3, $t4) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t2) @@ -3275,7 +3275,7 @@ object "test_A2_Vectors_test_one_elem_struct" { $MemoryStoreU64(add($mem, 16), $t4) $t5 := $mem } - // vector::push_back<0x2::Vectors::S>($t1, $t5) + // vector::push_back($t1, $t5) A1_vector_push_back$A2_Vectors_S$($t1, $t5) // $t6 := move($t0) $t6 := mload($locals) @@ -6666,9 +6666,9 @@ object "test_A2_Vectors_test_vector_equality_struct" { $Abort($t7) } case 4 { - // $t2 := vector::empty<0x2::Vectors::R>() + // $t2 := vector::empty() mstore($locals, A1_vector_empty$A2_Vectors_R$()) - // $t3 := vector::empty<0x2::Vectors::R>() + // $t3 := vector::empty() mstore(add($locals, 32), A1_vector_empty$A2_Vectors_R$()) // $t4 := copy($t2) $t4 := mload($locals) @@ -6689,7 +6689,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { $t9 := true // $t10 := 9 $t10 := 9 - // $t11 := pack 0x2::Vectors::S($t8, $t9, $t10) + // $t11 := pack Vectors::S($t8, $t9, $t10) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t8) @@ -6699,7 +6699,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t12 := Vectors::one_elem_u64() $t12 := A2_Vectors_one_elem_u64() - // $t13 := pack 0x2::Vectors::R($t11, $t12) + // $t13 := pack Vectors::R($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) @@ -6708,7 +6708,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t14 := borrow_local($t2) $t14 := $MakePtr(false, $locals) - // vector::push_back<0x2::Vectors::R>($t14, $t13) + // vector::push_back($t14, $t13) A1_vector_push_back$A2_Vectors_R$($t14, $t13) // $t15 := copy($t2) $t15 := mload($locals) @@ -6737,7 +6737,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { // label L5 // $t19 := borrow_local($t3) $t19 := $MakePtr(false, add($locals, 32)) - // vector::push_back<0x2::Vectors::R>($t19, $t13) + // vector::push_back($t19, $t13) A1_vector_push_back$A2_Vectors_R$($t19, $t13) // $t20 := copy($t2) $t20 := mload($locals) @@ -6770,7 +6770,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { $t25 := false // $t26 := 9 $t26 := 9 - // $t27 := pack 0x2::Vectors::S($t24, $t25, $t26) + // $t27 := pack Vectors::S($t24, $t25, $t26) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t24) @@ -6780,7 +6780,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t28 := Vectors::one_elem_u64() $t28 := A2_Vectors_one_elem_u64() - // $t29 := pack 0x2::Vectors::R($t27, $t28) + // $t29 := pack Vectors::R($t27, $t28) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t27) @@ -6789,7 +6789,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { } // $t30 := borrow_local($t2) $t30 := $MakePtr(false, $locals) - // vector::push_back<0x2::Vectors::R>($t30, $t13) + // vector::push_back($t30, $t13) A1_vector_push_back$A2_Vectors_R$($t30, $t13) // $t31 := copy($t2) $t31 := mload($locals) @@ -6818,7 +6818,7 @@ object "test_A2_Vectors_test_vector_equality_struct" { // label L11 // $t35 := borrow_local($t3) $t35 := $MakePtr(false, add($locals, 32)) - // vector::push_back<0x2::Vectors::R>($t35, $t29) + // vector::push_back($t35, $t29) A1_vector_push_back$A2_Vectors_R$($t35, $t29) // $t36 := move($t2) $t36 := mload($locals) @@ -7282,7 +7282,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t9 := true // $t10 := 9 $t10 := 9 - // $t11 := pack 0x2::Vectors::S($t8, $t9, $t10) + // $t11 := pack Vectors::S($t8, $t9, $t10) { let $mem := $Malloc(25) $MemoryStoreU128(add($mem, 0), $t8) @@ -7292,7 +7292,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { } // $t12 := move($t1) $t12 := mload($locals) - // $t0 := pack 0x2::Vectors::R($t11, $t12) + // $t0 := pack Vectors::R($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) @@ -7301,7 +7301,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { } // $t13 := borrow_local($t0) $t13 := $MakePtr(false, r) - // $t14 := borrow_field<0x2::Vectors::R>.v($t13) + // $t14 := borrow_field.v($t13) $t14 := $IndexPtr($t13, 32) // $t15 := vector::length($t14) $t15 := A1_vector_length$u64$($t14) @@ -7318,7 +7318,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L2 // $t19 := borrow_local($t0) $t19 := $MakePtr(false, r) - // $t20 := borrow_field<0x2::Vectors::R>.v($t19) + // $t20 := borrow_field.v($t19) $t20 := $IndexPtr($t19, 32) // $t21 := 0 $t21 := 0 @@ -7351,7 +7351,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L5 // $t27 := borrow_local($t0) $t27 := $MakePtr(false, r) - // $t28 := borrow_field<0x2::Vectors::R>.v($t27) + // $t28 := borrow_field.v($t27) $t28 := $IndexPtr($t27, 32) // $t29 := 1 $t29 := 1 @@ -7384,7 +7384,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L8 // $t35 := borrow_local($t0) $t35 := $MakePtr(false, r) - // $t36 := borrow_field<0x2::Vectors::R>.v($t35) + // $t36 := borrow_field.v($t35) $t36 := $IndexPtr($t35, 32) // $t37 := 2 $t37 := 2 @@ -7419,7 +7419,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t43 := 41 // $t44 := borrow_local($t0) $t44 := $MakePtr(false, r) - // $t45 := borrow_field<0x2::Vectors::R>.v($t44) + // $t45 := borrow_field.v($t44) $t45 := $IndexPtr($t44, 32) // $t46 := 1 $t46 := 1 @@ -7429,7 +7429,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $StoreU64($t47, $t43) // $t48 := borrow_local($t0) $t48 := $MakePtr(false, r) - // $t49 := borrow_field<0x2::Vectors::R>.v($t48) + // $t49 := borrow_field.v($t48) $t49 := $IndexPtr($t48, 32) // $t50 := 1 $t50 := 1 @@ -7464,7 +7464,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $t56 := A2_Vectors_one_elem_u64() // $t57 := borrow_local($t0) $t57 := $MakePtr(false, r) - // $t58 := borrow_field<0x2::Vectors::R>.v($t57) + // $t58 := borrow_field.v($t57) $t58 := $IndexPtr($t57, 32) // write_ref($t58, $t56) if $IsStoragePtr($t58){ @@ -7482,7 +7482,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { $StoreU256($t58, $t56) // $t59 := borrow_local($t0) $t59 := $MakePtr(false, r) - // $t60 := borrow_field<0x2::Vectors::R>.v($t59) + // $t60 := borrow_field.v($t59) $t60 := $IndexPtr($t59, 32) // $t61 := vector::length($t60) $t61 := A1_vector_length$u64$($t60) @@ -7511,7 +7511,7 @@ object "test_A2_Vectors_test_vectors_in_structs" { // label L17 // $t65 := borrow_local($t0) $t65 := $MakePtr(false, r) - // $t66 := borrow_field<0x2::Vectors::R>.v($t65) + // $t66 := borrow_field.v($t65) $t66 := $IndexPtr($t65, 32) // $t67 := 0 $t67 := 0 diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp index 8d10b80137a38..970b17cc61d8c 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherArrayDecoding.exp @@ -461,7 +461,7 @@ object "A2_M" { case 3 { // $t7 := borrow_local($t0) $t7 := $MakePtr(false, $locals) - // $t8 := vector::length>($t7) + // $t8 := vector::length>($t7) $t8 := A1_vector_length$vec$A2_U256_U256$$($t7) // $t9 := 0 $t9 := 0 @@ -488,17 +488,17 @@ object "A2_M" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, $locals) - // $t12 := vector::borrow>($t11, $t1) + // $t12 := vector::borrow>($t11, $t1) $t12 := A1_vector_borrow$vec$A2_U256_U256$$($t11, i) // $t13 := 0 $t13 := 0 - // $t14 := vector::borrow<0x2::U256::U256>($t12, $t13) + // $t14 := vector::borrow($t12, $t13) $t14 := A1_vector_borrow$A2_U256_U256$($t12, $t13) // $t15 := read_ref($t14) $t15 := $LoadU256($t14) // $t16 := 1 $t16 := 1 - // $t17 := vector::borrow<0x2::U256::U256>($t12, $t16) + // $t17 := vector::borrow($t12, $t16) $t17 := A1_vector_borrow$A2_U256_U256$($t12, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) @@ -689,9 +689,9 @@ object "A2_M" { // label L2 // $t10 := borrow_local($t0) $t10 := $MakePtr(false, $locals) - // $t11 := vector::borrow>($t10, $t1) + // $t11 := vector::borrow>($t10, $t1) $t11 := A1_vector_borrow$vec$A2_U256_U256$$($t10, i) - // $t12 := vector::length<0x2::U256::U256>($t11) + // $t12 := vector::length($t11) $t12 := A1_vector_length$A2_U256_U256$($t11) // $t13 := 0 $t13 := 0 @@ -726,7 +726,7 @@ object "A2_M" { } case 10 { // label L5 - // $t15 := vector::borrow<0x2::U256::U256>($t11, $t2) + // $t15 := vector::borrow($t11, $t2) $t15 := A1_vector_borrow$A2_U256_U256$($t11, j) // $t16 := read_ref($t15) $t16 := $LoadU256($t15) @@ -959,7 +959,7 @@ object "A2_M" { case 3 { // $t7 := borrow_local($t0) $t7 := $MakePtr(false, $locals) - // $t8 := vector::length>($t7) + // $t8 := vector::length>($t7) $t8 := A1_vector_length$vec$A2_U256_U256$$($t7) // $t9 := 0 $t9 := 0 @@ -986,17 +986,17 @@ object "A2_M" { // label L2 // $t11 := borrow_local($t0) $t11 := $MakePtr(false, $locals) - // $t12 := vector::borrow>($t11, $t1) + // $t12 := vector::borrow>($t11, $t1) $t12 := A1_vector_borrow$vec$A2_U256_U256$$($t11, i) // $t13 := 0 $t13 := 0 - // $t14 := vector::borrow<0x2::U256::U256>($t12, $t13) + // $t14 := vector::borrow($t12, $t13) $t14 := A1_vector_borrow$A2_U256_U256$($t12, $t13) // $t15 := read_ref($t14) $t15 := $LoadU256($t14) // $t16 := 1 $t16 := 1 - // $t17 := vector::borrow<0x2::U256::U256>($t12, $t16) + // $t17 := vector::borrow($t12, $t16) $t17 := A1_vector_borrow$A2_U256_U256$($t12, $t16) // $t18 := read_ref($t17) $t18 := $LoadU256($t17) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp index f18ac758a350e..bc0463b511e92 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherBasicStorage.exp @@ -26,7 +26,7 @@ object "A2_M" { let $t0, $t1 // $t0 := 0 $t0 := 0 - // $t1 := pack 0x2::M::Storage($t0) + // $t1 := pack M::Storage($t0) { let $mem := $Malloc(8) $MemoryStoreU64(add($mem, 0), $t0) @@ -139,7 +139,7 @@ object "A2_M" { } function A2_M_current(self) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::M::Storage>.counter($t0) + // $t1 := borrow_field.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -149,7 +149,7 @@ object "A2_M" { function A2_M_increment(self) { let $t1, $t2, $t3, $t4, $t5 - // $t1 := borrow_field<0x2::M::Storage>.counter($t0) + // $t1 := borrow_field.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -157,7 +157,7 @@ object "A2_M" { $t3 := 1 // $t4 := +($t2, $t3) $t4 := $AddU64($t2, $t3) - // $t5 := borrow_field<0x2::M::Storage>.counter($t0) + // $t5 := borrow_field.counter($t0) $t5 := self // write_ref($t5, $t4) $StoreU64($t5, $t4) @@ -166,7 +166,7 @@ object "A2_M" { function A2_M_receive(self) { let $t1, $t2, $t3, $t4, $t5 - // $t1 := borrow_field<0x2::M::Storage>.counter($t0) + // $t1 := borrow_field.counter($t0) $t1 := self // $t2 := read_ref($t1) $t2 := $LoadU64($t1) @@ -174,7 +174,7 @@ object "A2_M" { $t3 := 2 // $t4 := +($t2, $t3) $t4 := $AddU64($t2, $t3) - // $t5 := borrow_field<0x2::M::Storage>.counter($t0) + // $t5 := borrow_field.counter($t0) $t5 := self // write_ref($t5, $t4) $StoreU64($t5, $t4) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp index b748bf5ebed78..9112f59810d17 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/DispatcherEncodingStorage.exp @@ -61,13 +61,13 @@ object "A2_M" { $t5 := $MakePtr(false, add($locals, 32)) // $t6 := move($t1) $t6 := mload($locals) - // $t7 := pack 0x2::M::T($t6) + // $t7 := pack M::T($t6) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t6) $t7 := $mem } - // move_to<0x2::M::T>($t7, $t5) + // move_to>($t7, $t5) { let $base_offset := $MakeTypeStorageBase(0, 0x2e75402e, $LoadU256($t5)) if $AlignedStorageLoad($base_offset) { @@ -96,7 +96,7 @@ object "A2_M" { } // $t8 := 0x42 $t8 := 0x42 - // $t9 := borrow_global<0x2::M::T>($t8) + // $t9 := borrow_global>($t8) { let $base_offset := $MakeTypeStorageBase(0, 0x2e75402e, $t8) if iszero($AlignedStorageLoad($base_offset)) { @@ -104,7 +104,7 @@ object "A2_M" { } $t9 := $MakePtr(true, add($base_offset, 32)) } - // $t10 := borrow_field<0x2::M::T>.v($t9) + // $t10 := borrow_field>.v($t9) $t10 := $t9 // $t11 := read_ref($t10) $t11 := $LoadU256($t10) @@ -139,19 +139,19 @@ object "A2_M" { $t4 := 65 // vector::push_back($t3, $t4) A1_vector_push_back$u8$($t3, $t4) - // $t2 := vector::empty<0x2::U256::U256>() + // $t2 := vector::empty() mstore(add($locals, 32), A1_vector_empty$A2_U256_U256$()) // $t5 := borrow_local($t2) $t5 := $MakePtr(false, add($locals, 32)) // $t6 := 64 $t6 := 64 - // vector::push_back<0x2::U256::U256>($t5, $t6) + // vector::push_back($t5, $t6) A1_vector_push_back$A2_U256_U256$($t5, $t6) // $t7 := borrow_local($t2) $t7 := $MakePtr(false, add($locals, 32)) // $t8 := 65 $t8 := 65 - // vector::push_back<0x2::U256::U256>($t7, $t8) + // vector::push_back($t7, $t8) A1_vector_push_back$A2_U256_U256$($t7, $t8) // $t9 := 0x42 $t9 := 0x42 @@ -163,14 +163,14 @@ object "A2_M" { $t11 := mload($locals) // $t12 := move($t2) $t12 := mload(add($locals, 32)) - // $t13 := pack 0x2::M::State($t11, $t12) + // $t13 := pack M::State($t11, $t12) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), $t11) $MemoryStoreU256(add($mem, 32), $t12) $t13 := $mem } - // move_to<0x2::M::State>($t13, $t10) + // move_to($t13, $t10) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $LoadU256($t10)) if $AlignedStorageLoad($base_offset) { @@ -213,7 +213,7 @@ object "A2_M" { } // $t14 := 0x42 $t14 := 0x42 - // $t15 := borrow_global<0x2::M::State>($t14) + // $t15 := borrow_global($t14) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $t14) if iszero($AlignedStorageLoad($base_offset)) { @@ -221,7 +221,7 @@ object "A2_M" { } $t15 := $MakePtr(true, add($base_offset, 32)) } - // $t16 := borrow_field<0x2::M::State>.s1($t15) + // $t16 := borrow_field.s1($t15) $t16 := $t15 // $t17 := read_ref($t16) $t17 := $LoadU256($t16) @@ -242,7 +242,7 @@ object "A2_M" { } // $t18 := 0x42 $t18 := 0x42 - // $t19 := borrow_global<0x2::M::State>($t18) + // $t19 := borrow_global($t18) { let $base_offset := $MakeTypeStorageBase(0, 0x7d9cc237, $t18) if iszero($AlignedStorageLoad($base_offset)) { @@ -250,7 +250,7 @@ object "A2_M" { } $t19 := $MakePtr(true, add($base_offset, 32)) } - // $t20 := borrow_field<0x2::M::State>.s2($t19) + // $t20 := borrow_field.s2($t19) $t20 := $IndexPtr($t19, 32) // $t21 := read_ref($t20) $t21 := $LoadU256($t20) diff --git a/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp b/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp index 3026fbefb4c60..a4be571a266c6 100644 --- a/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp +++ b/third_party/move/evm/move-to-yul/tests/test-dispatcher/ExternalCall.exp @@ -114,7 +114,7 @@ object "A2_M" { // label L1 // $t4 := move($t1) $t4 := v - // $t5 := ExternalResult::unwrap<0x2::U256::U256>($t4) + // $t5 := ExternalResult::unwrap($t4) $t5 := A2_ExternalResult_unwrap$A2_U256_U256$($t4) // return $t5 $result := $t5 @@ -133,7 +133,7 @@ object "A2_M" { v := A2_M_success(addr) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, v) - // $t3 := ExternalResult::is_ok<0x2::U256::U256>($t2) + // $t3 := ExternalResult::is_ok($t2) $t3 := A2_ExternalResult_is_ok$A2_U256_U256$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -152,7 +152,7 @@ object "A2_M" { // label L1 // $t4 := move($t1) $t4 := v - // $t5 := ExternalResult::unwrap<0x2::Evm::Unit>($t4) + // $t5 := ExternalResult::unwrap($t4) $t5 := A2_ExternalResult_unwrap$A2_Evm_Unit$($t4) // drop($t5) $Free($t5, 1) @@ -169,7 +169,7 @@ object "A2_M" { v := A2_M_test_unit(addr) // $t2 := borrow_local($t1) $t2 := $MakePtr(false, v) - // $t3 := ExternalResult::is_ok<0x2::Evm::Unit>($t2) + // $t3 := ExternalResult::is_ok($t2) $t3 := A2_ExternalResult_is_ok$A2_Evm_Unit$($t2) // if ($t3) goto L1 else goto L0 switch $t3 @@ -197,7 +197,7 @@ object "A2_M" { let data, v, $t2, $t3, $t4, $t5, $t6 // $t2 := 0 $t2 := 0 - // $t3 := vector::empty<0x2::U256::U256>() + // $t3 := vector::empty() $t3 := A1_vector_empty$A2_U256_U256$() // $t4 := 0x3 $t4 := 0x3 @@ -251,7 +251,7 @@ object "A2_M" { // label L0 // $t7 := borrow_local($t1) $t7 := $MakePtr(false, value) - // $t8 := ExternalResult::is_err_reason<0x2::U256::U256>($t7) + // $t8 := ExternalResult::is_err_reason($t7) $t8 := A2_ExternalResult_is_err_reason$A2_U256_U256$($t7) // if ($t8) goto L3 else goto L2 switch $t8 @@ -267,7 +267,7 @@ object "A2_M" { value := A2_M_test_try_call($t3, $t2) // $t4 := borrow_local($t1) $t4 := $MakePtr(false, value) - // $t5 := ExternalResult::is_ok<0x2::U256::U256>($t4) + // $t5 := ExternalResult::is_ok($t4) $t5 := A2_ExternalResult_is_ok$A2_U256_U256$($t4) // if ($t5) goto L1 else goto L0 switch $t5 @@ -286,7 +286,7 @@ object "A2_M" { // label L2 // $t10 := borrow_local($t1) $t10 := $MakePtr(false, value) - // $t11 := ExternalResult::is_panic<0x2::U256::U256>($t10) + // $t11 := ExternalResult::is_panic($t10) $t11 := A2_ExternalResult_is_panic$A2_U256_U256$($t10) // if ($t11) goto L5 else goto L4 switch $t11 @@ -314,12 +314,12 @@ object "A2_M" { function A2_ExternalResult_is_panic$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.panic_code($t0) + // $t1 := borrow_field>.panic_code($t0) { let $field_ptr := $IndexPtr(result, 96) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) } - // $t2 := option::is_some<0x2::U256::U256>($t1) + // $t2 := option::is_some($t1) $t2 := A1_option_is_some$A2_U256_U256$($t1) // return $t2 $result := $t2 @@ -327,7 +327,7 @@ object "A2_M" { function A1_option_is_some$A2_U256_U256$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -356,7 +356,7 @@ object "A2_M" { } function A2_ExternalResult_is_ok$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) + // $t1 := borrow_field>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -412,9 +412,9 @@ object "A2_M" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none<0x2::U256::U256>() + // $t4 := option::none() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -431,7 +431,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_U256_U256$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -449,7 +449,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$vec$u8$$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -467,7 +467,7 @@ object "A2_M" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$vec$u8$$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -529,9 +529,9 @@ object "A2_M" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some<0x2::U256::U256>($t0) + // $t8 := option::some($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -548,7 +548,7 @@ object "A2_M" { let $t1, $t2 // $t1 := vector::singleton<#0>($t0) $t1 := A1_vector_singleton$A2_U256_U256$(e) - // $t2 := pack 0x1::option::Option<#0>($t1) + // $t2 := pack option::Option<#0>($t1) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t1) @@ -596,9 +596,9 @@ object "A2_M" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none<0x2::U256::U256>() + // $t8 := option::none() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -619,9 +619,9 @@ object "A2_M" { $t2 := A1_option_none$vec$u8$$() // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none<0x2::U256::U256>() + // $t4 := option::none() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -636,7 +636,7 @@ object "A2_M" { function A2_ExternalResult_is_err_reason$A2_U256_U256$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.err_reason($t0) + // $t1 := borrow_field>.err_reason($t0) { let $field_ptr := $IndexPtr(result, 64) $t1 := $MakePtr($IsStoragePtr($field_ptr), $LoadU256($field_ptr)) @@ -649,7 +649,7 @@ object "A2_M" { function A1_option_is_some$vec$u8$$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -742,7 +742,7 @@ object "A2_M" { } function A2_ExternalResult_is_ok$A2_Evm_Unit$(result) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x2::ExternalResult::ExternalResult<#0>>.value($t0) + // $t1 := borrow_field>.value($t0) { $t1 := $MakePtr($IsStoragePtr(result), $LoadU256(result)) } @@ -754,7 +754,7 @@ object "A2_M" { function A1_option_is_some$A2_Evm_Unit$(t) -> $result { let $t1, $t2, $t3 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_Evm_Unit$($t1) @@ -827,9 +827,9 @@ object "A2_M" { $t2 := A1_option_some$vec$u8$$(error) // $t3 := option::none>() $t3 := A1_option_none$vec$u8$$() - // $t4 := option::none<0x2::U256::U256>() + // $t4 := option::none() $t4 := A1_option_none$A2_U256_U256$() - // $t5 := pack 0x2::ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) + // $t5 := pack ExternalResult::ExternalResult<#0>($t1, $t2, $t3, $t4) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t1) @@ -846,7 +846,7 @@ object "A2_M" { let $t0, $t1 // $t0 := vector::empty<#0>() $t0 := A1_vector_empty$A2_Evm_Unit$() - // $t1 := pack 0x1::option::Option<#0>($t0) + // $t1 := pack option::Option<#0>($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), $t0) @@ -868,9 +868,9 @@ object "A2_M" { $t6 := A1_option_none$vec$u8$$() // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::some<0x2::U256::U256>($t0) + // $t8 := option::some($t0) $t8 := A1_option_some$A2_U256_U256$(panic_code) - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -891,9 +891,9 @@ object "A2_M" { $t6 := A1_option_some$vec$u8$$(error) // $t7 := option::none>() $t7 := A1_option_none$vec$u8$$() - // $t8 := option::none<0x2::U256::U256>() + // $t8 := option::none() $t8 := A1_option_none$A2_U256_U256$() - // $t9 := pack 0x2::ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) + // $t9 := pack ExternalResult::ExternalResult<#0>($t5, $t7, $t6, $t8) { let $mem := $Malloc(128) $MemoryStoreU256(add($mem, 0), $t5) @@ -908,7 +908,7 @@ object "A2_M" { function A2_ExternalResult_unwrap$A2_Evm_Unit$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -918,7 +918,7 @@ object "A2_M" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none<0x2::U256::U256>($t8) + // option::destroy_none($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$A2_Evm_Unit$($t5) @@ -958,7 +958,7 @@ object "A2_M" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) @@ -1031,7 +1031,7 @@ object "A2_M" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1050,7 +1050,7 @@ object "A2_M" { } function A1_option_is_none$A2_U256_U256$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$A2_U256_U256$($t1) @@ -1089,7 +1089,7 @@ object "A2_M" { // label L2 // $t4 := move($t0) $t4 := t - // $t5 := unpack 0x1::option::Option<#0>($t4) + // $t5 := unpack option::Option<#0>($t4) $t5 := $MemoryLoadU256(add($t4, 0)) $Free($t4, 32) // vector::destroy_empty<#0>($t5) @@ -1108,7 +1108,7 @@ object "A2_M" { } function A1_option_is_none$vec$u8$$(t) -> $result { let $t1, $t2 - // $t1 := borrow_field<0x1::option::Option<#0>>.vec($t0) + // $t1 := borrow_field>.vec($t0) $t1 := t // $t2 := vector::is_empty<#0>($t1) $t2 := A1_vector_is_empty$vec$u8$$($t1) @@ -1164,7 +1164,7 @@ object "A2_M" { function A2_ExternalResult_unwrap$A2_U256_U256$(result) -> $result { let err_data, err_reason, panic_code, value, $t5, $t6, $t7, $t8, $t9 - // ($t5, $t6, $t7, $t8) := unpack 0x2::ExternalResult::ExternalResult<#0>($t0) + // ($t5, $t6, $t7, $t8) := unpack ExternalResult::ExternalResult<#0>($t0) $t5 := $MemoryLoadU256(add(result, 0)) $t6 := $MemoryLoadU256(add(result, 32)) $t7 := $MemoryLoadU256(add(result, 64)) @@ -1174,7 +1174,7 @@ object "A2_M" { A1_option_destroy_none$vec$u8$$($t6) // option::destroy_none>($t7) A1_option_destroy_none$vec$u8$$($t7) - // option::destroy_none<0x2::U256::U256>($t8) + // option::destroy_none($t8) A1_option_destroy_none$A2_U256_U256$($t8) // $t9 := option::destroy_some<#0>($t5) $t9 := A1_option_destroy_some$A2_U256_U256$($t5) @@ -1214,7 +1214,7 @@ object "A2_M" { // label L2 // $t6 := move($t0) $t6 := t - // $t2 := unpack 0x1::option::Option<#0>($t6) + // $t2 := unpack option::Option<#0>($t6) mstore($locals, $MemoryLoadU256(add($t6, 0))) $Free($t6, 32) // $t7 := borrow_local($t2) diff --git a/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp b/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp index 57270d396370a..ab8e443702abe 100644 --- a/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp +++ b/third_party/move/evm/move-to-yul/tests/test-events/CallEmit.exp @@ -137,7 +137,7 @@ object "A2_M" { $Abort(97) function A2_M_do_event_1(from, to, amount) { let $t3 - // $t3 := pack 0x2::M::Event_1($t0, $t1, $t2) + // $t3 := pack M::Event_1($t0, $t1, $t2) { let $mem := $Malloc(65) $MemoryStoreU8(add($mem, 64), from) @@ -145,14 +145,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 32), amount) $t3 := $mem } - // Evm::emit<0x2::M::Event_1>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Event_1$($t3) // return () } function A2_M_do_event_2(v1, v2, v3, v4) { let $t4 - // $t4 := pack 0x2::M::Event_2($t0, $t1, $t2, $t3) + // $t4 := pack M::Event_2($t0, $t1, $t2, $t3) { let $mem := $Malloc(73) $MemoryStoreU8(add($mem, 72), v1) @@ -161,14 +161,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 0), v4) $t4 := $mem } - // Evm::emit<0x2::M::Event_2>($t4) + // Evm::emit($t4) A2_Evm_emit$A2_M_Event_2$($t4) // return () } function A2_M_do_event_3(from, to, amount) { let $t3 - // $t3 := pack 0x2::M::Event_3($t0, $t1, $t2) + // $t3 := pack M::Event_3($t0, $t1, $t2) { let $mem := $Malloc(65) $MemoryStoreU8(add($mem, 64), from) @@ -176,14 +176,14 @@ object "A2_M" { $MemoryStoreU256(add($mem, 32), amount) $t3 := $mem } - // Evm::emit<0x2::M::Event_3>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Event_3$($t3) // return () } function A2_M_do_event_4(v1, v2, v3) { let $t3 - // $t3 := pack 0x2::M::Event_4($t0, $t1, $t2) + // $t3 := pack M::Event_4($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), v1) @@ -191,28 +191,28 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), v3) $t3 := $mem } - // Evm::emit<0x2::M::Event_4>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Event_4$($t3) // return () } function A2_M_do_event_5(bys, str) { let $t2 - // $t2 := pack 0x2::M::Event_5($t0, $t1) + // $t2 := pack M::Event_5($t0, $t1) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), bys) $MemoryStoreU256(add($mem, 32), str) $t2 := $mem } - // Evm::emit<0x2::M::Event_5>($t2) + // Evm::emit($t2) A2_Evm_emit$A2_M_Event_5$($t2) // return () } function A2_M_do_event_6(bys, str, uint16_array) { let $t3 - // $t3 := pack 0x2::M::Event_6($t0, $t1, $t2) + // $t3 := pack M::Event_6($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), bys) @@ -220,41 +220,41 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), uint16_array) $t3 := $mem } - // Evm::emit<0x2::M::Event_6>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Event_6$($t3) // return () } function A2_M_do_event_7(bys) { let $t1 - // $t1 := pack 0x2::M::Event_7($t0) + // $t1 := pack M::Event_7($t0) { let $mem := $Malloc(32) $MemoryStoreU256(add($mem, 0), bys) $t1 := $mem } - // Evm::emit<0x2::M::Event_7>($t1) + // Evm::emit($t1) A2_Evm_emit$A2_M_Event_7$($t1) // return () } function A2_M_do_event_8(bys, strs) { let $t2 - // $t2 := pack 0x2::M::Event_8($t0, $t1) + // $t2 := pack M::Event_8($t0, $t1) { let $mem := $Malloc(64) $MemoryStoreU256(add($mem, 0), bys) $MemoryStoreU256(add($mem, 32), strs) $t2 := $mem } - // Evm::emit<0x2::M::Event_8>($t2) + // Evm::emit($t2) A2_Evm_emit$A2_M_Event_8$($t2) // return () } function A2_M_do_transfer(from, to, amount) { let $t3 - // $t3 := pack 0x2::M::Transfer($t0, $t1, $t2) + // $t3 := pack M::Transfer($t0, $t1, $t2) { let $mem := $Malloc(96) $MemoryStoreU256(add($mem, 0), from) @@ -262,7 +262,7 @@ object "A2_M" { $MemoryStoreU256(add($mem, 64), amount) $t3 := $mem } - // Evm::emit<0x2::M::Transfer>($t3) + // Evm::emit($t3) A2_Evm_emit$A2_M_Transfer$($t3) // return () } diff --git a/third_party/move/move-binary-format/src/file_format.rs b/third_party/move/move-binary-format/src/file_format.rs index 3037cec1eaea5..13c2836f6679e 100644 --- a/third_party/move/move-binary-format/src/file_format.rs +++ b/third_party/move/move-binary-format/src/file_format.rs @@ -849,10 +849,13 @@ impl AbilitySet { | (Ability::Store as u8) | (Ability::Key as u8), ); + /// Abilities for user-defined/"primitive" functions (not closures) + pub const DEFINED_FUNCTIONS: AbilitySet = + Self((Ability::Copy as u8) | (Ability::Drop as u8) | (Ability::Store as u8)); /// The empty ability set pub const EMPTY: Self = Self(0); /// Abilities for `Functions` - pub const FUNCTIONS: AbilitySet = Self(Ability::Drop as u8); + pub const FUNCTIONS: AbilitySet = Self(0); /// Abilities for `Bool`, `U8`, `U64`, `U128`, and `Address` pub const PRIMITIVES: AbilitySet = Self((Ability::Copy as u8) | (Ability::Drop as u8) | (Ability::Store as u8)); diff --git a/third_party/move/move-compiler-v2/src/bytecode_generator.rs b/third_party/move/move-compiler-v2/src/bytecode_generator.rs index 9cb45341d9743..b4c99ac5e7681 100644 --- a/third_party/move/move-compiler-v2/src/bytecode_generator.rs +++ b/third_party/move/move-compiler-v2/src/bytecode_generator.rs @@ -480,13 +480,23 @@ impl<'env> Generator<'env> { self.emit_with(*id, |attr| Bytecode::SpecBlock(attr, spec)); }, // TODO(LAMBDA) - ExpData::Lambda(id, _, _) => self.error( + ExpData::Lambda(id, _, _, _, _) => self.error( *id, "Function-typed values not yet supported except as parameters to calls to inline functions", ), // TODO(LAMBDA) - ExpData::Invoke(_, exp, _) => self.error( - exp.as_ref().node_id(), + ExpData::MoveFunctionExp(id, _mid, _fid) => self.error( + *id, + "Function-typed values not yet supported except as parameters to calls to inline functions", + ), + // TODO(LAMBDA) + ExpData::Curry(id, _mask, _fnexp, _args) => self.error( + *id, + "Function-typed values not yet supported except as parameters to calls to inline functions", + ), + // TODO(LAMBDA) + ExpData::Invoke(id, _exp, _) => self.error( + *id, "Calls to function values other than inline function parameters not yet supported", ), ExpData::Quant(id, _, _, _, _, _) => { @@ -813,12 +823,6 @@ impl<'env> Generator<'env> { Operation::NoOp => {}, // do nothing - // TODO(LAMBDA) - Operation::Closure(..) => self.error( - id, - "Function-typed values not yet supported except as parameters to calls to inline functions", - ), - // Non-supported specification related operations Operation::Exists(Some(_)) | Operation::SpecFunction(_, _, _) diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/ast_simplifier.rs b/third_party/move/move-compiler-v2/src/env_pipeline/ast_simplifier.rs index f60012a917544..b24120ab8a14c 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/ast_simplifier.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/ast_simplifier.rs @@ -214,7 +214,7 @@ fn find_possibly_modified_vars( exp.visit_positions(&mut |pos, e| { use ExpData::*; match e { - Invalid(_) | Value(..) | LoopCont(..) => { + Invalid(_) | Value(..) | LoopCont(..) | MoveFunctionExp(..) => { // Nothing happens inside these expressions, so don't bother `modifying` state. }, LocalVar(id, sym) => { @@ -359,7 +359,7 @@ fn find_possibly_modified_vars( _ => {}, } }, - Lambda(node_id, pat, _) => { + Lambda(node_id, pat, _, _, _) => { // Define a new scope for bound vars, and turn off `modifying` within. match pos { VisitorPosition::Pre => { @@ -380,6 +380,19 @@ fn find_possibly_modified_vars( _ => {}, }; }, + Curry(_, _mask, _fnexp, _explist) => { + // Turn off `modifying` inside. + match pos { + VisitorPosition::Pre => { + modifying_stack.push(modifying); + modifying = false; + }, + VisitorPosition::Post => { + modifying = modifying_stack.pop().expect("unbalanced visit 10"); + }, + _ => {}, + } + }, Block(node_id, pat, _, _) => { // Define a new scope for bound vars, and turn off `modifying` within. match pos { @@ -978,7 +991,8 @@ impl<'env> ExpRewriterFunctions for SimplifierRewriter<'env> { let ability_set = self .env() .type_abilities(&ty, self.func_env.get_type_parameters_ref()); - ability_set.has_ability(Ability::Drop) + // Don't drop a function-valued expression so we don't lose errors. + !ty.has_function() && ability_set.has_ability(Ability::Drop) } else { // We're missing type info, be conservative false diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/flow_insensitive_checkers.rs b/third_party/move/move-compiler-v2/src/env_pipeline/flow_insensitive_checkers.rs index dd6dabec91723..72bbd295d5853 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/flow_insensitive_checkers.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/flow_insensitive_checkers.rs @@ -147,7 +147,7 @@ impl<'env, 'params> SymbolVisitor<'env, 'params> { Pre | Post | BeforeBody | MidMutate | BeforeThen | BeforeElse | PreSequenceValue => {}, }, - Lambda(_, pat, _) => { + Lambda(_, pat, _, _, _) => { match position { Pre => self.seen_uses.enter_scope(), Post => { diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs index d7dbcc3cfce2b..acc3de4f65eef 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/function_checker.rs @@ -5,6 +5,7 @@ use crate::{experiments::Experiment, Options}; use codespan_reporting::diagnostic::Severity; +use log::debug; use move_binary_format::file_format::Visibility; use move_model::{ ast::{ExpData, Operation, Pattern}, @@ -20,8 +21,8 @@ fn identify_function_types_with_functions_in_args(func_types: Vec) -> Vec< func_types .into_iter() .filter_map(|ty| { - if let Type::Fun(argt, _) = &ty { - if argt.deref().has_function() { + if let Type::Fun(args, _, _) = &ty { + if args.deref().has_function() { Some(ty) } else { None @@ -41,8 +42,8 @@ fn identify_function_typed_params_with_functions_in_rets( func_types .iter() .filter_map(|param| { - if let Type::Fun(_argt, rest) = ¶m.1 { - let rest_unboxed = rest.deref(); + if let Type::Fun(_args, result, _) = ¶m.1 { + let rest_unboxed = result.deref(); if rest_unboxed.has_function() { Some((*param, rest_unboxed)) } else { @@ -215,6 +216,10 @@ fn check_privileged_operations_on_structs(env: &GlobalEnv, fun_env: &FunctionEnv | Operation::MoveFrom | Operation::MoveTo => { let inst = env.get_node_instantiation(*id); + if inst.is_empty() { + debug!("no instantiation on call node `{}`", exp.display(env)); + debug!("id is {:?}", id); + } debug_assert!(!inst.is_empty()); if let Some((struct_env, _)) = inst[0].get_struct(env) { let mid = struct_env.module_env.get_id(); @@ -270,7 +275,7 @@ fn check_privileged_operations_on_structs(env: &GlobalEnv, fun_env: &FunctionEnv }, ExpData::Assign(_, pat, _) | ExpData::Block(_, pat, _, _) - | ExpData::Lambda(_, pat, _) => { + | ExpData::Lambda(_, pat, _, _, _) => { pat.visit_pre_post(&mut |_, pat| { if let Pattern::Struct(id, str, _, _) = pat { let module_id = str.module_id; @@ -344,7 +349,7 @@ pub fn check_access_and_use(env: &mut GlobalEnv, before_inlining: bool) { // Check that functions being called are accessible. if let Some(def) = caller_func.get_def() { - let callees_with_sites = def.called_funs_with_callsites(); + let callees_with_sites = def.used_funs_with_uses(); for (callee, sites) in &callees_with_sites { let callee_func = env.get_function(*callee); // Check visibility. diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs index 636f0d95d6728..06eaa909705dd 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs @@ -90,7 +90,7 @@ pub fn run_inlining(env: &mut GlobalEnv, scope: RewritingScope, keep_inline_func let mut visited_targets = BTreeSet::new(); while let Some(target) = todo.pop_first() { if visited_targets.insert(target.clone()) { - let callees_with_sites = target.called_funs_with_call_sites(env); + let callees_with_sites = target.used_funs_with_uses(env); for (callee, sites) in callees_with_sites { todo.insert(RewriteTarget::MoveFun(callee)); targets.entry(RewriteTarget::MoveFun(callee)); @@ -1161,7 +1161,7 @@ impl<'env, 'rewriter> ExpRewriterFunctions for InlinedRewriter<'env, 'rewriter> }; let call_loc = self.env.get_node_loc(id); if let Some(lambda_target) = optional_lambda_target { - if let ExpData::Lambda(_, pat, body) = lambda_target.as_ref() { + if let ExpData::Lambda(_, pat, body, _, _) = lambda_target.as_ref() { let args_vec: Vec = args.to_vec(); Some(InlinedRewriter::construct_inlined_call_expression( self.env, diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs b/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs index 8326c3e8af618..ed066b3cb3964 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/lambda_lifter.rs @@ -40,11 +40,11 @@ //! ``` use itertools::Itertools; -use move_binary_format::file_format::Visibility; +use move_binary_format::file_format::{Ability, AbilitySet, Visibility}; use move_model::{ - ast::{Exp, ExpData, Operation, Pattern, TempIndex}, + ast::{Exp, ExpData, LambdaCaptureKind, Operation, Pattern, TempIndex}, exp_rewriter::{ExpRewriter, ExpRewriterFunctions, RewriteTarget}, - model::{FunId, FunctionEnv, GlobalEnv, Loc, NodeId, Parameter, TypeParameter}, + model::{FunId, FunctionEnv, GlobalEnv, Loc, ModuleId, NodeId, Parameter, TypeParameter}, symbol::Symbol, ty::{ReferenceKind, Type}, }; @@ -185,13 +185,285 @@ impl<'a> LambdaLifter<'a> { let env = self.fun_env.module_env.env; let body = self.bind(bindings, exp); let loc = env.get_node_loc(pat.node_id()); - let ty = env.get_node_type(body.node_id()); + let body_id = body.node_id(); + let ty = env.get_node_type(body_id); let new_id = env.new_node(loc, ty); + if let Some(inst) = env.get_node_instantiation_opt(body_id) { + env.set_node_instantiation(new_id, inst); + } ExpData::Block(new_id, pat, Some(binding), body).into_exp() } else { exp } } + + // For the current state, calculate: (params, closure_args, param_index_mapping), where + // params = new Parameter for each free var to represent it in the lifted function + // closure_args = corresponding expressions to provide as actual arg for each param + // param_index_mapping = for each free var which is a Parameter from the enclosing function, + // a mapping from index there to index in the params list + fn get_params_for_freevars(&mut self) -> (Vec, Vec, BTreeMap) { + let env = self.fun_env.module_env.env; + let mut closure_args = vec![]; + + // Add captured parameters. We also need to record a mapping of + // parameter indices in the lambda context to indices in the lifted + // functions (courtesy of #12317) + let mut param_index_mapping = BTreeMap::new(); + let mut params = vec![]; + for (used_param_count, (param, var_info)) in + mem::take(&mut self.free_params).into_iter().enumerate() + { + let name = self.fun_env.get_local_name(param); + let var_node_id = var_info.node_id; + let ty = env.get_node_type(var_node_id); + let loc = env.get_node_loc(var_node_id); + if var_info.modified { + env.error( + &loc, + &format!( + "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA) + name.display(env.symbol_pool()) + ), + ); + } + params.push(Parameter(name, ty.clone(), loc.clone())); + let new_id = env.new_node(loc, ty); + if let Some(inst) = env.get_node_instantiation_opt(var_node_id) { + env.set_node_instantiation(new_id, inst); + } + closure_args.push(ExpData::Temporary(new_id, param).into_exp()); + param_index_mapping.insert(param, used_param_count); + } + + // Add captured LocalVar parameters + for (name, var_info) in mem::take(&mut self.free_locals) { + let var_info_id = var_info.node_id; + let ty = env.get_node_type(var_info_id); + let loc = env.get_node_loc(var_info_id); + if var_info.modified { + env.error( + &loc, + &format!( + "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA) + name.display(env.symbol_pool()) + ), + ); + } + params.push(Parameter(name, ty.clone(), loc.clone())); + let new_id = env.new_node(loc, ty); + if let Some(inst) = env.get_node_instantiation_opt(var_info_id) { + env.set_node_instantiation(new_id, inst); + } + closure_args.push(ExpData::LocalVar(new_id, name).into_exp()) + } + + (params, closure_args, param_index_mapping) + } + + fn get_arg_if_simple(arg: &Exp) -> Option<&Exp> { + use ExpData::*; + match &arg.as_ref() { + Value(..) | LocalVar(..) | Temporary(..) | MoveFunctionExp(..) => Some(arg), + Sequence(_, exp_vec) => { + if let [exp] = &exp_vec[..] { + Self::get_arg_if_simple(&exp) + } else { + None + } + }, + Invalid(..) | Call(..) | Invoke(..) | Lambda(..) | Curry(..) | Quant(..) + | Block(..) | IfElse(..) | Match(..) | Return(..) | Loop(..) | LoopCont(..) + | Assign(..) | Mutate(..) | SpecBlock(..) => None, + } + } + + fn get_args_if_simple(args: &[Exp]) -> Option> { + let result: Vec<&Exp> = args + .iter() + .filter_map(|exp| Self::get_arg_if_simple(exp)) + .collect(); + if result.len() == args.len() { + Some(result) + } else { + None + } + } + + fn get_fun_if_simple(fn_exp: &Exp) -> Option { + use ExpData::*; + match fn_exp.as_ref() { + MoveFunctionExp(..) => Some(fn_exp.clone()), + Curry(id, mask, fn_exp, args) => Self::get_fun_if_simple(fn_exp).and_then(|fn_exp| { + Self::get_args_if_simple(args).and_then(|args| { + let args = args.iter().map(|expref| (*expref).clone()).collect(); + Some(ExpData::Curry(*id, *mask, fn_exp, args).into_exp()) + }) + }), + Sequence(_, exp_vec) => { + if let [exp] = &exp_vec[..] { + Self::get_fun_if_simple(&exp) + } else { + None + } + }, + Lambda(_, _pat, _body, _capture_kind, _abilities) => { + // maybe could test lambda_is_direct_curry(pat, body) + // and do something with it, but it is nontrivial. + None + }, + Value(..) | LocalVar(..) | Temporary(..) | Invalid(..) | Call(..) | Invoke(..) + | Quant(..) | Block(..) | IfElse(..) | Match(..) | Return(..) | Loop(..) + | LoopCont(..) | Assign(..) | Mutate(..) | SpecBlock(..) => None, + } + } + + fn make_move_fn_exp( + &mut self, + loc: Loc, + fn_type: Type, + module_id: ModuleId, + fun_id: FunId, + instantiation: Option>, + ) -> Exp { + let env = self.fun_env.module_env.env; + let id = env.new_node(loc, fn_type); + if let Some(inst) = instantiation { + env.set_node_instantiation(id, inst); + } + let fn_exp = ExpData::MoveFunctionExp(id, module_id, fun_id); + fn_exp.into_exp() + } + + fn get_move_fn_type(&mut self, expr_id: NodeId, module_id: ModuleId, fun_id: FunId) -> Type { + let env = self.fun_env.module_env.env; + let fn_env = env.get_function(module_id.qualified(fun_id)); + let params = fn_env.get_parameters_ref(); + let param_types = params.iter().map(|param| param.get_type()).collect(); + let node_instantiation = env.get_node_instantiation(expr_id); + let result_type = fn_env.get_result_type(); + let visibility = fn_env.visibility(); + let abilities = AbilitySet::FUNCTIONS + | match visibility { + Visibility::Public => { + AbilitySet::singleton(Ability::Store) | AbilitySet::singleton(Ability::Copy) + }, + Visibility::Private | Visibility::Friend => AbilitySet::singleton(Ability::Copy), + }; + Type::Fun( + Box::new(Type::Tuple(param_types)), + Box::new(result_type), + abilities, + ) + .instantiate(&node_instantiation) + } + + // If body is a function call expression with the function value and each parameter a + // simple expression (constant, var, or Move function name) then returns expressions for + // the function and the arguments. Otherwise, returns `None`. + fn lambda_reduces_to_curry<'b>(&mut self, body: &'b Exp) -> Option<(Exp, Vec<&'b Exp>)> { + use ExpData::*; + let env = self.fun_env.module_env.env; + match body.as_ref() { + Call(id, oper, args) => { + if let Operation::MoveFunction(mid, fid) = oper { + Self::get_args_if_simple(args).map(|args| { + let fn_type = self.get_move_fn_type(*id, *mid, *fid); + let loc = env.get_node_loc(*id); + let fn_exp = self.make_move_fn_exp( + loc, + fn_type, + *mid, + *fid, + env.get_node_instantiation_opt(*id), + ); + (fn_exp, args) + }) + } else { + None + } + }, + Invoke(_id, fn_exp, args) => Self::get_args_if_simple(args) + .and_then(|args| Self::get_fun_if_simple(fn_exp).map(|exp| (exp, args))), + Curry(_id, _mask, _fn_exp, _args) => None, + MoveFunctionExp(_id, _mid, _fid) => None, + ExpData::Sequence(_id, exp_vec) => { + if let [exp] = &exp_vec[..] { + self.lambda_reduces_to_curry(exp) + } else { + None + } + }, + _ => None, + } + } + + // We can rewrite a lambda directly into a curry expression if: + // - lambda parameters are a simple variable tuple (v1, v2, ...) === (bindings.is_empty()) + // Caller should already check that, and place the tuple of variables in parameter list lambda_params. + // + // Then, we can reduce to curry if: + // - lambda body is a function call with + // - each lambda parameter used exactly once as a call argument, in order (possibly with gaps) + // - every other argument is a simple expression containing only constants and free variables + // Arguments here are + // - id: original lambda expr NodeId + // - body: body of lambda + // - lambda_params: a Parameter corresponding to each lambda param + fn try_to_reduce_lambda_to_curry( + &mut self, + id: NodeId, + body: &Exp, + lambda_params: Vec, + ) -> Option { + if let Some((fn_exp, args)) = self.lambda_reduces_to_curry(body) { + // lambda has form |lambda_params| fn_exp(args) + // where each arg is a constant or simple variable + let mut new_args = vec![]; + let mut mask: u128 = 0; // has a 1 bit for the position of each lambda parameter in call + let mut param_cursor = 0; // tracks which lambda param we are expecting + let mut has_mismatch = false; + let param_syms: BTreeSet = + lambda_params.iter().map(|param| param.get_name()).collect(); + let mut mask_cursor = 1u128; // = 1u128<<(loop index) + for arg in args.iter() { + let this_arg_is_lambda_param = if let ExpData::LocalVar(_id, name) = arg.as_ref() { + if param_syms.contains(name) { + if let Some(param) = lambda_params.get(param_cursor) { + if param.get_name() == *name { + param_cursor += 1; + true + } else { + has_mismatch = true; + break; + } + } else { + has_mismatch = true; + break; + } + } else { + false + } + } else { + false + }; + if !this_arg_is_lambda_param { + // this arg is a free var and is provided as an arg to curry + new_args.push((*arg).clone()); + } else { + // this arg is a lambda parameter + mask |= mask_cursor; + } + mask_cursor <<= 1; + } + if !has_mismatch { + let env = self.fun_env.module_env.env; + let id = env.clone_node(id); + return Some(ExpData::Curry(id, mask, fn_exp, new_args).into_exp()); + }; + }; + None + } } impl<'a> ExpRewriterFunctions for LambdaLifter<'a> { @@ -288,79 +560,88 @@ impl<'a> ExpRewriterFunctions for LambdaLifter<'a> { None } - fn rewrite_lambda(&mut self, id: NodeId, pat: &Pattern, body: &Exp) -> Option { + fn rewrite_lambda( + &mut self, + id: NodeId, + pat: &Pattern, + body: &Exp, + capture_kind: LambdaCaptureKind, + abilities: AbilitySet, // TODO(LAMBDA): do something with this + ) -> Option { if self.exempted_lambdas.contains(&id) { return None; } let env = self.fun_env.module_env.env; - let mut params = vec![]; - let mut closure_args = vec![]; - // Add captured parameters. We also need to record a mapping of - // parameter indices in the lambda context to indices in the lifted - // functions (courtesy of #12317) - let mut param_index_mapping = BTreeMap::new(); - for (used_param_count, (param, var_info)) in - mem::take(&mut self.free_params).into_iter().enumerate() - { - let name = self.fun_env.get_local_name(param); - let ty = env.get_node_type(var_info.node_id); - let loc = env.get_node_loc(var_info.node_id); - if var_info.modified { - env.error( - &loc, - &format!( - "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA) - name.display(env.symbol_pool()) - ), - ); - } - params.push(Parameter(name, ty.clone(), loc.clone())); - let new_id = env.new_node(loc, ty); - closure_args.push(ExpData::Temporary(new_id, param).into_exp()); - param_index_mapping.insert(param, used_param_count); - } - // Add captured locals - for (name, var_info) in mem::take(&mut self.free_locals) { - let ty = env.get_node_type(var_info.node_id); - let loc = env.get_node_loc(var_info.node_id); - if var_info.modified { + let module_id = self.fun_env.module_env.get_id(); + + match capture_kind { + LambdaCaptureKind::Move => { + // OK. + }, + LambdaCaptureKind::Default | LambdaCaptureKind::Copy | LambdaCaptureKind::Borrow => { + let loc = env.get_node_loc(id); env.error( &loc, - &format!( - "captured variable `{}` cannot be modified inside of a lambda", // TODO(LAMBDA) - name.display(env.symbol_pool()) - ), + // TODO(LAMBDA) + "Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall." ); - } - params.push(Parameter(name, ty.clone(), loc.clone())); - let new_id = env.new_node(loc, ty); - closure_args.push(ExpData::LocalVar(new_id, name).into_exp()) - } + return None; + }, + }; + + // params = new Parameter for each free var to represent it in the lifted function + // closure_args = corresponding expressions to provide as actual arg for each param + // param_index_mapping = for each free var which is a Parameter from the enclosing function, + // a mapping from index there to index in the params list; other free vars are + // substituted automatically by using the same symbol for the param + let (params, closure_args, param_index_mapping) = self.get_params_for_freevars(); + + // Some(ExpData::Invalid(env.clone_node(id)).into_exp()); // Add lambda args. For dealing with patterns in lambdas (`|S{..}|e`) we need // to collect a list of bindings. let mut bindings = vec![]; + let mut lambda_params = vec![]; for (i, arg) in pat.clone().flatten().into_iter().enumerate() { let id = arg.node_id(); let ty = env.get_node_type(id); let loc = env.get_node_loc(id); if let Pattern::Var(_, name) = arg { - params.push(Parameter(name, ty, loc)) + lambda_params.push(Parameter(name, ty, loc)); } else { let name = self.gen_parameter_name(i); - params.push(Parameter(name, ty.clone(), loc.clone())); + lambda_params.push(Parameter(name, ty.clone(), loc.clone())); let new_id = env.new_node(loc, ty); + if let Some(inst) = env.get_node_instantiation_opt(id) { + env.set_node_instantiation(new_id, inst); + } bindings.push((arg.clone(), ExpData::LocalVar(new_id, name).into_exp())) } } + + // We can rewrite a lambda directly into a curry expression if: + // - lambda parameters are a simple variable tuple (v1, v2, ...) === (bindings.is_empty()) + // + // - lambda body is a function call with + // - each lambda parameter used exactly once as a call argument, in order (possibly with gaps) + // - every other argument is a simple expression containing only constants and free variables + if bindings.is_empty() { + let possible_curry_exp = self.try_to_reduce_lambda_to_curry(id, body, lambda_params); + if possible_curry_exp.is_some() { + return possible_curry_exp; + } + } + // Add new closure function let fun_name = self.gen_closure_function_name(); let lambda_loc = env.get_node_loc(id).clone(); let lambda_type = env.get_node_type(id); - let result_type = if let Type::Fun(_, result_type) = &lambda_type { + let lambda_inst_opt = env.get_node_instantiation_opt(id); + let result_type = if let Type::Fun(_, result_type, _) = &lambda_type { *result_type.clone() } else { Type::Error // type error reported }; + // Rewrite references to Temporary in the new functions body (#12317) let mut replacer = |id: NodeId, target: RewriteTarget| { if let RewriteTarget::Temporary(temp) = target { @@ -370,23 +651,43 @@ impl<'a> ExpRewriterFunctions for LambdaLifter<'a> { None }; let body = ExpRewriter::new(env, &mut replacer).rewrite_exp(body.clone()); + let fun_id = FunId::new(fun_name); + let params_types = params.iter().map(|param| param.get_type()).collect(); self.lifted.push(ClosureFunction { loc: lambda_loc.clone(), - fun_id: FunId::new(fun_name), + fun_id: fun_id.clone(), type_params: self.fun_env.get_type_parameters(), params, - result_type, + result_type: result_type.clone(), def: self.bind(bindings, body), }); - // Return closure expression - let id = env.new_node(lambda_loc, lambda_type); - Some( - ExpData::Call( - id, - Operation::Closure(self.fun_env.module_env.get_id(), FunId::new(fun_name)), - closure_args, - ) - .into_exp(), - ) + + // Create an expression for the function reference + let fn_type = Type::Fun( + Box::new(Type::Tuple(params_types)), + Box::new(result_type), + abilities, + ); + let id = env.new_node(lambda_loc.clone(), fn_type); + if let Some(inst) = &lambda_inst_opt { + env.set_node_instantiation(id, inst.clone()); + } + let fn_exp = ExpData::MoveFunctionExp(id, module_id, fun_id).into_exp(); + + let bound_param_count = closure_args.len(); + if bound_param_count == 0 { + // No free variables, just return the function reference + Some(fn_exp) + } else { + // Create a bitmask for the early-bound parameters. + let bitmask: u128 = (1u128 << bound_param_count) - 1; + + // Create and return closure expression + let id = env.new_node(lambda_loc, lambda_type); + if let Some(inst) = lambda_inst_opt { + env.set_node_instantiation(id, inst); + } + Some(ExpData::Curry(id, bitmask, fn_exp, closure_args).into_exp()) + } } } diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/rewrite_target.rs b/third_party/move/move-compiler-v2/src/env_pipeline/rewrite_target.rs index 2851f5c2b79c3..9e7adfe62d3b1 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/rewrite_target.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/rewrite_target.rs @@ -159,8 +159,8 @@ impl RewriteTargets { } impl RewriteTarget { - /// Gets the call sites for the target. - pub fn called_funs_with_call_sites( + /// Gets the functions called or referenced in the target. + pub fn used_funs_with_uses( &self, env: &GlobalEnv, ) -> BTreeMap, BTreeSet> { @@ -179,7 +179,7 @@ impl RewriteTarget { .unwrap_or_default(), SpecBlock(target) => { let spec = env.get_spec_block(target); - spec.called_funs_with_callsites() + spec.used_funs_with_uses() }, } } diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/spec_rewriter.rs b/third_party/move/move-compiler-v2/src/env_pipeline/spec_rewriter.rs index dd9fd65ae1402..1251e40f021ee 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/spec_rewriter.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/spec_rewriter.rs @@ -70,7 +70,7 @@ pub fn run_spec_rewriter(env: &mut GlobalEnv) { if let RewriteState::Def(def) = target.get_env_state(env) { let mut spec_callees = BTreeSet::new(); def.visit_inline_specs(&mut |spec| { - spec_callees.extend(spec.called_funs_with_callsites().into_keys()); + spec_callees.extend(spec.used_funs_with_uses().into_keys()); true // keep going }); spec_callees @@ -78,10 +78,9 @@ pub fn run_spec_rewriter(env: &mut GlobalEnv) { BTreeSet::new() } }, - RewriteTarget::SpecFun(_) | RewriteTarget::SpecBlock(_) => target - .called_funs_with_call_sites(env) - .into_keys() - .collect(), + RewriteTarget::SpecFun(_) | RewriteTarget::SpecBlock(_) => { + target.used_funs_with_uses(env).into_keys().collect() + }, }; for callee in callees { called_funs.insert(callee); diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs b/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs index e9da0d5cbb053..a7a22a0186aca 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/unused_params_checker.rs @@ -60,7 +60,7 @@ fn used_type_parameters_in_ty(ty: &Type) -> BTreeSet { }, Type::TypeParameter(i) => BTreeSet::from([*i]), Type::Vector(ty) => used_type_parameters_in_ty(ty), - Type::Fun(t1, t2) => [t1, t2] + Type::Fun(t1, t2, _) => [t1, t2] .iter() .flat_map(|t| used_type_parameters_in_ty(t)) .collect(), diff --git a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs index ab7c9b862dbd0..ce120a5ca1170 100644 --- a/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs +++ b/third_party/move/move-compiler-v2/src/file_format_generator/module_generator.rs @@ -367,7 +367,7 @@ impl ModuleGenerator { ReferenceKind::Mutable => FF::SignatureToken::MutableReference(target_ty), } }, - Fun(_param_ty, _result_ty) => { + Fun(_param_ty, _result_ty, _abilities) => { // TODO(LAMBDA) ctx.error( loc, @@ -1077,7 +1077,7 @@ impl<'env> ModuleContext<'env> { if fun.is_inline() { continue; } - if let Some(callees) = fun.get_called_functions() { + if let Some(callees) = fun.get_used_functions() { let mut usage = usage_map[&fun.get_id()].clone(); let count = usage.len(); // Extend usage by that of callees from the same module. Acquires is only diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp b/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp index 64fd1e4a61b95..322649a3dde34 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/borrowed_from_one_path.exp @@ -6,7 +6,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -15,8 +15,8 @@ fun m::f($t0: u8, $t1: &vector): u64 { 2: if ($t4) goto 3 else goto 8 3: label L0 4: $t7 := 0x1 - 5: $t6 := borrow_global<0x42::m::R>($t7) - 6: $t3 := borrow_field<0x42::m::R>.data($t6) + 5: $t6 := borrow_global($t7) + 6: $t3 := borrow_field.data($t6) 7: goto 10 8: label L1 9: $t3 := infer($t1) @@ -35,7 +35,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -50,9 +50,9 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: 4: $t7 := 0x1 # live vars: $t7 - 5: $t6 := borrow_global<0x42::m::R>($t7) + 5: $t6 := borrow_global($t7) # live vars: $t6 - 6: $t3 := borrow_field<0x42::m::R>.data($t6) + 6: $t3 := borrow_field.data($t6) # live vars: $t3 7: goto 10 # live vars: $t1 @@ -79,7 +79,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -94,9 +94,9 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: 4: $t7 := 0x1 # live vars: $t7 - 5: $t6 := borrow_global<0x42::m::R>($t7) + 5: $t6 := borrow_global($t7) # live vars: $t6 - 6: $t3 := borrow_field<0x42::m::R>.data($t6) + 6: $t3 := borrow_field.data($t6) # live vars: $t3 7: goto 10 # live vars: $t1 @@ -123,7 +123,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -166,7 +166,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: $t7 # refs: [] # - 5: $t6 := borrow_global<0x42::m::R>($t7) + 5: $t6 := borrow_global($t7) # live vars: $t6 # refs: [$t6 => #6] # #6 @@ -174,7 +174,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # #root # -> #6 via [struct `m::R`] at line 12 # - 6: $t3 := borrow_field<0x42::m::R>.data($t6) + 6: $t3 := borrow_field.data($t6) # live vars: $t3 # refs: [$t3 => #3] # #3 @@ -245,7 +245,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -294,7 +294,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # live vars: $t7 # refs: [] # - 5: $t6 := borrow_global<0x42::m::R>($t7) + 5: $t6 := borrow_global($t7) # abort state: {returns,aborts} # live vars: $t6 # refs: [$t6 => #6] @@ -303,7 +303,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { # #root # -> #6 via [struct `m::R`] at line 12 # - 6: $t3 := borrow_field<0x42::m::R>.data($t6) + 6: $t3 := borrow_field.data($t6) # abort state: {returns,aborts} # live vars: $t3 # refs: [$t3 => #3] @@ -382,7 +382,7 @@ fun m::f($t0: u8, $t1: &vector): u64 { var $t3: &vector var $t4: bool var $t5: u8 - var $t6: &0x42::m::R + var $t6: &m::R var $t7: address var $t8: &u64 var $t9: u64 @@ -392,8 +392,8 @@ fun m::f($t0: u8, $t1: &vector): u64 { 3: label L0 4: drop($t1) 5: $t7 := 0x1 - 6: $t6 := borrow_global<0x42::m::R>($t7) - 7: $t3 := borrow_field<0x42::m::R>.data($t6) + 6: $t6 := borrow_global($t7) + 7: $t3 := borrow_field.data($t6) 8: goto 11 9: label L1 10: $t3 := move($t1) diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp b/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp index 3af453f1202a4..f1da3a8a76fdd 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/copy_ability_tuple.exp @@ -1,8 +1,8 @@ ============ initial bytecode ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 0: $t1 := infer($t0) 1: $t2 := 0 @@ -12,22 +12,22 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 0: $t2 := 1 - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) 2: $t3 := 3 3: ($t1, $t3) := M::f($t1) - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) 5: return () } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 # live vars: $t0 0: $t1 := infer($t0) @@ -40,19 +40,19 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 # live vars: $t0 0: $t2 := 1 # live vars: $t0, $t2 - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) # live vars: $t0, $t1 2: $t3 := 3 # live vars: $t0, $t1 3: ($t1, $t3) := M::f($t1) # live vars: $t0, $t1 - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) # live vars: 5: return () } @@ -60,8 +60,8 @@ public fun M::g($t0: &signer) { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 # live vars: $t0 0: $t1 := infer($t0) @@ -74,19 +74,19 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 # live vars: $t0 0: $t2 := 1 # live vars: $t0, $t2 - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) # live vars: $t0, $t1 2: $t3 := 3 # live vars: $t0, $t1 3: ($t1, $t3) := M::f($t1) # live vars: $t0, $t1 - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) # live vars: 5: return () } @@ -94,8 +94,8 @@ public fun M::g($t0: &signer) { ============ after ReferenceSafetyProcessor: ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 # live vars: $t0 # refs: [] @@ -114,7 +114,7 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 # live vars: $t0 @@ -132,7 +132,7 @@ public fun M::g($t0: &signer) { # #root # # - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) # live vars: $t0, $t1 # refs: [$t0 => #0] # #0 @@ -156,7 +156,7 @@ public fun M::g($t0: &signer) { # #root # # - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) # live vars: # refs: [] # @@ -166,8 +166,8 @@ public fun M::g($t0: &signer) { ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 # abort state: {returns} # live vars: $t0 @@ -189,7 +189,7 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 # abort state: {returns,aborts} @@ -209,7 +209,7 @@ public fun M::g($t0: &signer) { # #root # # - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) # abort state: {returns,aborts} # live vars: $t0, $t1 # refs: [$t0 => #0] @@ -236,7 +236,7 @@ public fun M::g($t0: &signer) { # #root # # - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) # abort state: {returns} # live vars: # refs: [] @@ -247,8 +247,8 @@ public fun M::g($t0: &signer) { ============ after AbilityProcessor: ================ [variant baseline] -public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { - var $t1: 0x42::M::R +public fun M::f($t0: M::R): (M::R, u64) { + var $t1: M::R var $t2: u64 0: $t1 := move($t0) 1: $t2 := 0 @@ -258,13 +258,13 @@ public fun M::f($t0: 0x42::M::R): (0x42::M::R, u64) { [variant baseline] public fun M::g($t0: &signer) { - var $t1: 0x42::M::R + var $t1: M::R var $t2: u64 var $t3: u64 0: $t2 := 1 - 1: $t1 := pack 0x42::M::R($t2) + 1: $t1 := pack M::R($t2) 2: $t3 := 3 3: ($t1, $t3) := M::f($t1) - 4: move_to<0x42::M::R>($t0, $t1) + 4: move_to($t0, $t1) 5: return () } diff --git a/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp b/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp index 7259af56e7847..358ffa25771a9 100644 --- a/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp +++ b/third_party/move/move-compiler-v2/tests/ability-transform/mutate_vector.exp @@ -1,16 +1,16 @@ ============ initial bytecode ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 0: $t2 := m::scalar_zero() 1: $t5 := borrow_local($t2) - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) 3: $t6 := 0 4: $t3 := vector::borrow_mut($t4, $t6) 5: write_ref($t3, $t0) @@ -20,30 +20,30 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector 0: $t1 := [0] - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) 2: return $t0 } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 # live vars: $t0 0: $t2 := m::scalar_zero() # live vars: $t0, $t2 1: $t5 := borrow_local($t2) # live vars: $t0, $t2, $t5 - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) # live vars: $t0, $t2, $t4 3: $t6 := 0 # live vars: $t0, $t2, $t4, $t6 @@ -58,13 +58,13 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector # live vars: 0: $t1 := [0] # live vars: $t1 - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) # live vars: $t0 2: return $t0 } @@ -72,19 +72,19 @@ public fun m::scalar_zero(): 0x42::m::Scalar { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 # live vars: $t0 0: $t2 := m::scalar_zero() # live vars: $t0, $t2 1: $t5 := borrow_local($t2) # live vars: $t0, $t2, $t5 - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) # live vars: $t0, $t2, $t4 3: $t6 := 0 # live vars: $t0, $t2, $t4, $t6 @@ -99,13 +99,13 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector # live vars: 0: $t1 := [0] # live vars: $t1 - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) # live vars: $t0 2: return $t0 } @@ -113,12 +113,12 @@ public fun m::scalar_zero(): 0x42::m::Scalar { ============ after ReferenceSafetyProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 # live vars: $t0 # refs: [] @@ -135,7 +135,7 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { # #root # => (mut) #5 via [local `s`] at line 11 # - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) # live vars: $t0, $t2, $t4 # refs: [$t4 => #4] # #4 @@ -172,8 +172,8 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector # live vars: # refs: [] @@ -182,7 +182,7 @@ public fun m::scalar_zero(): 0x42::m::Scalar { # live vars: $t1 # refs: [] # - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) # live vars: $t0 # refs: [] # @@ -192,12 +192,12 @@ public fun m::scalar_zero(): 0x42::m::Scalar { ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 # abort state: {returns,aborts} # live vars: $t0 @@ -217,7 +217,7 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { # #root # => (mut) #5 via [local `s`] at line 11 # - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) # abort state: {returns,aborts} # live vars: $t0, $t2, $t4 # refs: [$t4 => #4] @@ -259,8 +259,8 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector # abort state: {returns} # live vars: @@ -271,7 +271,7 @@ public fun m::scalar_zero(): 0x42::m::Scalar { # live vars: $t1 # refs: [] # - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) # abort state: {returns} # live vars: $t0 # refs: [] @@ -282,16 +282,16 @@ public fun m::scalar_zero(): 0x42::m::Scalar { ============ after AbilityProcessor: ================ [variant baseline] -public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { - var $t1: 0x42::m::Scalar - var $t2: 0x42::m::Scalar +public fun m::new_scalar_from_u8($t0: u8): m::Scalar { + var $t1: m::Scalar + var $t2: m::Scalar var $t3: &mut u8 var $t4: &mut vector - var $t5: &mut 0x42::m::Scalar + var $t5: &mut m::Scalar var $t6: u64 0: $t2 := m::scalar_zero() 1: $t5 := borrow_local($t2) - 2: $t4 := borrow_field<0x42::m::Scalar>.data($t5) + 2: $t4 := borrow_field.data($t5) 3: $t6 := 0 4: $t3 := vector::borrow_mut($t4, $t6) 5: write_ref($t3, $t0) @@ -301,10 +301,10 @@ public fun m::new_scalar_from_u8($t0: u8): 0x42::m::Scalar { [variant baseline] -public fun m::scalar_zero(): 0x42::m::Scalar { - var $t0: 0x42::m::Scalar +public fun m::scalar_zero(): m::Scalar { + var $t0: m::Scalar var $t1: vector 0: $t1 := [0] - 1: $t0 := pack 0x42::m::Scalar($t1) + 1: $t0 := pack m::Scalar($t1) 2: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp b/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp index 95b75cc0831fd..702e8dcfb42c3 100644 --- a/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp +++ b/third_party/move/move-compiler-v2/tests/abort-analysis/drop_on_abort.exp @@ -1,8 +1,8 @@ ============ initial bytecode ================ [variant baseline] -public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { - var $t1: 0x42::m::Option<#0> +public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { + var $t1: m::Option<#0> var $t2: bool var $t3: u64 var $t4: &vector<#0> @@ -19,15 +19,15 @@ public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { 8: goto 10 9: label L1 10: label L2 - 11: $t1 := pack 0x42::m::Option<#0>($t0) + 11: $t1 := pack m::Option<#0>($t0) 12: return $t1 } ============ after AbortAnalysisProcessor: ================ [variant baseline] -public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { - var $t1: 0x42::m::Option<#0> +public fun m::from_vec<#0>($t0: vector<#0>): m::Option<#0> { + var $t1: m::Option<#0> var $t2: bool var $t3: u64 var $t4: &vector<#0> @@ -94,7 +94,7 @@ public fun m::from_vec<#0>($t0: vector<#0>): 0x42::m::Option<#0> { # live vars: $t0 # refs: [] # - 11: $t1 := pack 0x42::m::Option<#0>($t0) + 11: $t1 := pack m::Option<#0>($t0) # abort state: {returns} # live vars: $t1 # refs: [] diff --git a/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp b/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp index 2e42d922264cd..931538cfa9bf7 100644 --- a/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp +++ b/third_party/move/move-compiler-v2/tests/abort-analysis/loop_abort.exp @@ -2,10 +2,10 @@ [variant baseline] fun Test::test0() { - var $t0: 0x42::Test::Impotent + var $t0: Test::Impotent var $t1: bool 0: $t1 := false - 1: $t0 := pack 0x42::Test::Impotent($t1) + 1: $t0 := pack Test::Impotent($t1) 2: label L0 3: goto 2 4: label L1 @@ -15,11 +15,11 @@ fun Test::test0() { [variant baseline] fun Test::test1() { - var $t0: 0x42::Test::Impotent + var $t0: Test::Impotent var $t1: bool var $t2: bool 0: $t1 := false - 1: $t0 := pack 0x42::Test::Impotent($t1) + 1: $t0 := pack Test::Impotent($t1) 2: label L0 3: $t2 := true 4: if ($t2) goto 5 else goto 7 @@ -36,11 +36,11 @@ fun Test::test1() { [variant baseline] fun Test::test2($t0: bool) { - var $t1: 0x42::Test::Impotent + var $t1: Test::Impotent var $t2: bool var $t3: u64 0: $t2 := false - 1: $t1 := pack 0x42::Test::Impotent($t2) + 1: $t1 := pack Test::Impotent($t2) 2: if ($t0) goto 3 else goto 8 3: label L0 4: label L3 @@ -58,7 +58,7 @@ fun Test::test2($t0: bool) { [variant baseline] fun Test::test0() { - var $t0: 0x42::Test::Impotent + var $t0: Test::Impotent var $t1: bool # abort state: {} # live vars: @@ -69,7 +69,7 @@ fun Test::test0() { # live vars: $t1 # refs: [] # - 1: $t0 := pack 0x42::Test::Impotent($t1) + 1: $t0 := pack Test::Impotent($t1) # abort state: {} # live vars: # refs: [] @@ -91,7 +91,7 @@ fun Test::test0() { [variant baseline] fun Test::test1() { - var $t0: 0x42::Test::Impotent + var $t0: Test::Impotent var $t1: bool var $t2: bool # abort state: {returns} @@ -103,7 +103,7 @@ fun Test::test1() { # live vars: $t1 # refs: [] # - 1: $t0 := pack 0x42::Test::Impotent($t1) + 1: $t0 := pack Test::Impotent($t1) # abort state: {returns} # live vars: # refs: [] @@ -164,7 +164,7 @@ fun Test::test1() { [variant baseline] fun Test::test2($t0: bool) { - var $t1: 0x42::Test::Impotent + var $t1: Test::Impotent var $t2: bool var $t3: u64 # abort state: {aborts} @@ -176,7 +176,7 @@ fun Test::test2($t0: bool) { # live vars: $t0, $t2 # refs: [] # - 1: $t1 := pack 0x42::Test::Impotent($t2) + 1: $t1 := pack Test::Impotent($t2) # abort state: {aborts} # live vars: $t0 # refs: [] diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp index 19a38d4478a92..cc9a18d315a38 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp @@ -52,9 +52,9 @@ module 0x42::assign { ============ initial bytecode ================ [variant baseline] -fun assign::assign_field($t0: &mut 0x42::assign::S, $t1: u64) { +fun assign::assign_field($t0: &mut assign::S, $t1: u64) { var $t2: &mut u64 - 0: $t2 := borrow_field<0x42::assign::S>.f($t0) + 0: $t2 := borrow_field.f($t0) 1: write_ref($t2, $t1) 2: return () } @@ -70,26 +70,26 @@ fun assign::assign_int($t0: &mut u64) { [variant baseline] -fun assign::assign_pattern($t0: 0x42::assign::S, $t1: u64, $t2: u64): u64 { +fun assign::assign_pattern($t0: assign::S, $t1: u64, $t2: u64): u64 { var $t3: u64 - var $t4: 0x42::assign::T - 0: ($t1, $t4) := unpack 0x42::assign::S($t0) - 1: $t2 := unpack 0x42::assign::T($t4) + var $t4: assign::T + 0: ($t1, $t4) := unpack assign::S($t0) + 1: $t2 := unpack assign::T($t4) 2: $t3 := +($t1, $t2) 3: return $t3 } [variant baseline] -fun assign::assign_struct($t0: &mut 0x42::assign::S) { - var $t1: 0x42::assign::S +fun assign::assign_struct($t0: &mut assign::S) { + var $t1: assign::S var $t2: u64 - var $t3: 0x42::assign::T + var $t3: assign::T var $t4: u64 0: $t2 := 42 1: $t4 := 42 - 2: $t3 := pack 0x42::assign::T($t4) - 3: $t1 := pack 0x42::assign::S($t2, $t3) + 2: $t3 := pack assign::T($t4) + 3: $t1 := pack assign::S($t2, $t3) 4: write_ref($t0, $t1) 5: return () } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp index 2ede6b56aa928..cdd26e37991c9 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow.exp @@ -99,10 +99,10 @@ module 0x42::borrow { ============ initial bytecode ================ [variant baseline] -fun borrow::field($t0: &0x42::borrow::S): u64 { +fun borrow::field($t0: &borrow::S): u64 { var $t1: u64 var $t2: &u64 - 0: $t2 := borrow_field<0x42::borrow::S>.f($t0) + 0: $t2 := borrow_field.f($t0) 1: $t1 := read_ref($t2) 2: return $t1 } @@ -131,11 +131,11 @@ fun borrow::param($t0: u64): u64 { [variant baseline] -fun borrow::mut_field($t0: &mut 0x42::borrow::S): u64 { +fun borrow::mut_field($t0: &mut borrow::S): u64 { var $t1: u64 var $t2: &mut u64 var $t3: u64 - 0: $t2 := borrow_field<0x42::borrow::S>.f($t0) + 0: $t2 := borrow_field.f($t0) 1: $t3 := 22 2: write_ref($t2, $t3) 3: $t1 := read_ref($t2) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp index bc23929966e0e..9e88127d71ad3 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_deref_optimize.exp @@ -67,16 +67,16 @@ module 0x42::test { [variant baseline] fun test::no_optimize_resource(): bool { var $t0: bool - var $t1: &mut 0x42::test::X - var $t2: 0x42::test::X - var $t3: &0x42::test::X + var $t1: &mut test::X + var $t2: test::X + var $t3: &test::X var $t4: address var $t5: &bool 0: $t4 := 0x1 - 1: $t3 := borrow_global<0x42::test::X>($t4) + 1: $t3 := borrow_global($t4) 2: $t2 := read_ref($t3) 3: $t1 := borrow_local($t2) - 4: $t5 := borrow_field<0x42::test::X>.value($t1) + 4: $t5 := borrow_field.value($t1) 5: $t0 := read_ref($t5) 6: return $t0 } @@ -109,12 +109,12 @@ fun test::no_optimize_vector() { [variant baseline] fun test::optimize_resource(): bool { var $t0: bool - var $t1: &0x42::test::X + var $t1: &test::X var $t2: address var $t3: &bool 0: $t2 := 0x1 - 1: $t1 := borrow_global<0x42::test::X>($t2) - 2: $t3 := borrow_field<0x42::test::X>.value($t1) + 1: $t1 := borrow_global($t2) + 2: $t3 := borrow_field.value($t1) 3: $t0 := read_ref($t3) 4: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp index e81fbf75afa73..fd8f1e112c0b5 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_update_variant_select.exp @@ -75,25 +75,25 @@ module 0x815::m { [variant baseline] fun m::update_common_field(): u64 { var $t0: u64 - var $t1: 0x815::m::CommonFields + var $t1: m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u64 var $t6: &mut u64 - var $t7: &mut 0x815::m::CommonFields - var $t8: &0x815::m::CommonFields + var $t7: &mut m::CommonFields + var $t8: &m::CommonFields var $t9: &u64 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t6 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.x($t7) + 6: $t6 := borrow_variant_field.x($t7) 7: write_ref($t6, $t5) 8: $t8 := borrow_local($t1) - 9: $t9 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.x($t8) + 9: $t9 := borrow_variant_field.x($t8) 10: $t0 := read_ref($t9) 11: return $t0 } @@ -102,50 +102,50 @@ fun m::update_common_field(): u64 { [variant baseline] fun m::update_common_field_different_offset(): u8 { var $t0: u8 - var $t1: 0x815::m::CommonFields + var $t1: m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u8 var $t6: &mut u8 - var $t7: &mut 0x815::m::CommonFields + var $t7: &mut m::CommonFields var $t8: bool - var $t9: &0x815::m::CommonFields + var $t9: &m::CommonFields var $t10: &u8 var $t11: bool 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t8 := test_variant 0x815::m::CommonFields::Foo($t7) + 6: $t8 := test_variant m::CommonFields::Foo($t7) 7: if ($t8) goto 13 else goto 8 8: label L3 - 9: $t8 := test_variant 0x815::m::CommonFields::Bar($t7) + 9: $t8 := test_variant m::CommonFields::Bar($t7) 10: if ($t8) goto 13 else goto 11 11: label L4 12: goto 16 13: label L2 - 14: $t6 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.y($t7) + 14: $t6 := borrow_variant_field.y($t7) 15: goto 18 16: label L1 - 17: $t6 := borrow_variant_field<0x815::m::CommonFields::Baz>.y($t7) + 17: $t6 := borrow_variant_field.y($t7) 18: label L0 19: write_ref($t6, $t5) 20: $t9 := borrow_local($t1) - 21: $t11 := test_variant 0x815::m::CommonFields::Foo($t9) + 21: $t11 := test_variant m::CommonFields::Foo($t9) 22: if ($t11) goto 28 else goto 23 23: label L8 - 24: $t11 := test_variant 0x815::m::CommonFields::Bar($t9) + 24: $t11 := test_variant m::CommonFields::Bar($t9) 25: if ($t11) goto 28 else goto 26 26: label L9 27: goto 31 28: label L7 - 29: $t10 := borrow_variant_field<0x815::m::CommonFields::Foo|Bar>.y($t9) + 29: $t10 := borrow_variant_field.y($t9) 30: goto 33 31: label L6 - 32: $t10 := borrow_variant_field<0x815::m::CommonFields::Baz>.y($t9) + 32: $t10 := borrow_variant_field.y($t9) 33: label L5 34: $t0 := read_ref($t10) 35: return $t0 @@ -155,25 +155,25 @@ fun m::update_common_field_different_offset(): u8 { [variant baseline] fun m::update_non_common_field(): u32 { var $t0: u32 - var $t1: 0x815::m::CommonFields + var $t1: m::CommonFields var $t2: u64 var $t3: u8 var $t4: u32 var $t5: u32 var $t6: &mut u32 - var $t7: &mut 0x815::m::CommonFields - var $t8: &0x815::m::CommonFields + var $t7: &mut m::CommonFields + var $t8: &m::CommonFields var $t9: &u32 0: $t2 := 30 1: $t3 := 40 2: $t4 := 50 - 3: $t1 := pack_variant 0x815::m::CommonFields::Bar($t2, $t3, $t4) + 3: $t1 := pack_variant m::CommonFields::Bar($t2, $t3, $t4) 4: $t5 := 15 5: $t7 := borrow_local($t1) - 6: $t6 := borrow_variant_field<0x815::m::CommonFields::Bar>.z($t7) + 6: $t6 := borrow_variant_field.z($t7) 7: write_ref($t6, $t5) 8: $t8 := borrow_local($t1) - 9: $t9 := borrow_variant_field<0x815::m::CommonFields::Bar>.z($t8) + 9: $t9 := borrow_variant_field.z($t8) 10: $t0 := read_ref($t9) 11: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp index c26adc0db393d..c397077658cb6 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14300_variant_select_autoref.exp @@ -39,16 +39,16 @@ module 0x815::m { [variant baseline] fun m::test_common_access(): u8 { var $t0: u8 - var $t1: 0x815::m::Positional + var $t1: m::Positional var $t2: u8 var $t3: u8 var $t4: &mut u8 - var $t5: &mut 0x815::m::Positional + var $t5: &mut m::Positional 0: $t2 := 42 - 1: $t1 := pack_variant 0x815::m::Positional::A($t2) + 1: $t1 := pack_variant m::Positional::A($t2) 2: $t3 := 19 3: $t5 := borrow_local($t1) - 4: $t4 := borrow_variant_field<0x815::m::Positional::A|B>.0($t5) + 4: $t4 := borrow_variant_field.0($t5) 5: write_ref($t4, $t3) 6: $t0 := 20 7: return $t0 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp index 693daacb1ff71..a7238e92b909d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14471_receiver_inference.exp @@ -65,7 +65,7 @@ module 0x815::m { ============ initial bytecode ================ [variant baseline] -fun m::contains<#0, #1>($t0: &0x815::m::Table<#0, #1>, $t1: #0): bool { +fun m::contains<#0, #1>($t0: &m::Table<#0, #1>, $t1: #0): bool { var $t2: bool 0: $t2 := true 1: return $t2 @@ -73,30 +73,30 @@ fun m::contains<#0, #1>($t0: &0x815::m::Table<#0, #1>, $t1: #0): bool { [variant baseline] -fun m::add<#0, #1>($t0: &mut 0x815::m::Table<#0, #1>, $t1: #0, $t2: #1) { +fun m::add<#0, #1>($t0: &mut m::Table<#0, #1>, $t1: #0, $t2: #1) { 0: return () } [variant baseline] public fun m::add_when_missing($t0: address, $t1: u64) { - var $t2: &mut 0x815::m::MyMap + var $t2: &mut m::MyMap var $t3: address var $t4: bool var $t5: bool - var $t6: &0x815::m::Table - var $t7: 0x815::m::ValueWrap - var $t8: &mut 0x815::m::Table + var $t6: &m::Table + var $t7: m::ValueWrap + var $t8: &mut m::Table 0: $t3 := 0x815 - 1: $t2 := borrow_global<0x815::m::MyMap>($t3) - 2: $t6 := borrow_field<0x815::m::MyMap>.table($t2) - 3: $t5 := m::contains($t6, $t0) + 1: $t2 := borrow_global($t3) + 2: $t6 := borrow_field.table($t2) + 3: $t5 := m::contains($t6, $t0) 4: $t4 := !($t5) 5: if ($t4) goto 6 else goto 11 6: label L0 - 7: $t7 := pack 0x815::m::ValueWrap($t1) - 8: $t8 := borrow_field<0x815::m::MyMap>.table($t2) - 9: m::add($t8, $t0, $t7) + 7: $t7 := pack m::ValueWrap($t1) + 8: $t8 := borrow_field.table($t2) + 9: m::add($t8, $t0, $t7) 10: goto 12 11: label L1 12: label L2 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp index 2e4693e518bd7..55c966ebe4156 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/conditional_borrow.exp @@ -259,49 +259,49 @@ fun M::test1($t0: u64): u64 { [variant baseline] -fun M::test1b($t0: 0x8675::M::S): u64 { +fun M::test1b($t0: M::S): u64 { var $t1: u64 - var $t2: 0x8675::M::S + var $t2: M::S var $t3: u64 - var $t4: &mut 0x8675::M::S - var $t5: 0x8675::M::S + var $t4: &mut M::S + var $t5: M::S var $t6: bool var $t7: u64 - var $t8: &0x8675::M::S + var $t8: &M::S var $t9: &u64 var $t10: u64 var $t11: u64 var $t12: &mut u64 - var $t13: 0x8675::M::S - var $t14: &mut 0x8675::M::S - var $t15: 0x8675::M::S - var $t16: &mut 0x8675::M::S + var $t13: M::S + var $t14: &mut M::S + var $t15: M::S + var $t16: &mut M::S var $t17: u64 var $t18: u64 - var $t19: 0x8675::M::S - var $t20: &0x8675::M::S + var $t19: M::S + var $t20: &M::S var $t21: &u64 var $t22: u64 var $t23: &mut u64 - var $t24: 0x8675::M::S - var $t25: &mut 0x8675::M::S - var $t26: 0x8675::M::S + var $t24: M::S + var $t25: &mut M::S + var $t26: M::S var $t27: &mut u64 - var $t28: &mut 0x8675::M::S + var $t28: &mut M::S var $t29: u64 var $t30: u64 var $t31: u64 - var $t32: 0x8675::M::S + var $t32: M::S var $t33: &mut u64 var $t34: u64 - var $t35: &0x8675::M::S + var $t35: &M::S var $t36: &u64 var $t37: u64 var $t38: u64 var $t39: u64 var $t40: &mut u64 var $t41: u64 - var $t42: &0x8675::M::S + var $t42: &M::S var $t43: &u64 var $t44: u64 var $t45: u64 @@ -309,17 +309,17 @@ fun M::test1b($t0: 0x8675::M::S): u64 { var $t47: &mut u64 var $t48: u64 var $t49: u64 - var $t50: &0x8675::M::S + var $t50: &M::S var $t51: &u64 var $t52: u64 var $t53: u64 var $t54: u64 - var $t55: &0x8675::M::S + var $t55: &M::S var $t56: &u64 0: $t3 := 3 - 1: $t2 := pack 0x8675::M::S($t3) + 1: $t2 := pack M::S($t3) 2: $t8 := borrow_local($t0) - 3: $t9 := borrow_field<0x8675::M::S>.f($t8) + 3: $t9 := borrow_field.f($t8) 4: $t7 := read_ref($t9) 5: $t10 := 4 6: $t6 := <($t7, $t10) @@ -334,30 +334,30 @@ fun M::test1b($t0: 0x8675::M::S): u64 { 15: $t11 := 10 16: $t13 := read_ref($t4) 17: $t14 := borrow_local($t13) - 18: $t12 := borrow_field<0x8675::M::S>.f($t14) + 18: $t12 := borrow_field.f($t14) 19: write_ref($t12, $t11) 20: $t15 := infer($t0) 21: $t16 := borrow_local($t15) 22: $t19 := read_ref($t16) 23: $t20 := borrow_local($t19) - 24: $t21 := borrow_field<0x8675::M::S>.f($t20) + 24: $t21 := borrow_field.f($t20) 25: $t18 := read_ref($t21) 26: $t22 := 1 27: $t17 := +($t18, $t22) 28: $t24 := read_ref($t16) 29: $t25 := borrow_local($t24) - 30: $t23 := borrow_field<0x8675::M::S>.f($t25) + 30: $t23 := borrow_field.f($t25) 31: write_ref($t23, $t17) 32: $t26 := infer($t15) 33: $t28 := borrow_local($t26) - 34: $t27 := borrow_field<0x8675::M::S>.f($t28) + 34: $t27 := borrow_field.f($t28) 35: $t30 := read_ref($t27) 36: $t31 := 1 37: $t29 := +($t30, $t31) 38: write_ref($t27, $t29) 39: $t32 := infer($t26) 40: $t35 := borrow_local($t32) - 41: $t36 := borrow_field<0x8675::M::S>.f($t35) + 41: $t36 := borrow_field.f($t35) 42: $t34 := read_ref($t36) 43: $t33 := borrow_local($t34) 44: $t38 := read_ref($t33) @@ -365,7 +365,7 @@ fun M::test1b($t0: 0x8675::M::S): u64 { 46: $t37 := +($t38, $t39) 47: write_ref($t33, $t37) 48: $t42 := borrow_local($t32) - 49: $t43 := borrow_field<0x8675::M::S>.f($t42) + 49: $t43 := borrow_field.f($t42) 50: $t41 := read_ref($t43) 51: $t40 := borrow_local($t41) 52: $t45 := read_ref($t40) @@ -374,7 +374,7 @@ fun M::test1b($t0: 0x8675::M::S): u64 { 55: write_ref($t40, $t44) 56: $t49 := 3 57: $t50 := borrow_local($t32) - 58: $t51 := borrow_field<0x8675::M::S>.f($t50) + 58: $t51 := borrow_field.f($t50) 59: $t48 := read_ref($t51) 60: $t47 := borrow_local($t48) 61: $t53 := read_ref($t47) @@ -382,7 +382,7 @@ fun M::test1b($t0: 0x8675::M::S): u64 { 63: $t52 := +($t53, $t54) 64: write_ref($t47, $t52) 65: $t55 := borrow_local($t32) - 66: $t56 := borrow_field<0x8675::M::S>.f($t55) + 66: $t56 := borrow_field.f($t55) 67: $t1 := read_ref($t56) 68: return $t1 } @@ -392,16 +392,16 @@ fun M::test1b($t0: 0x8675::M::S): u64 { public fun M::testb(): u64 { var $t0: u64 var $t1: u64 - var $t2: 0x8675::M::S + var $t2: M::S var $t3: u64 var $t4: u64 - var $t5: 0x8675::M::S + var $t5: M::S var $t6: u64 0: $t3 := 7 - 1: $t2 := pack 0x8675::M::S($t3) + 1: $t2 := pack M::S($t3) 2: $t1 := M::test1b($t2) 3: $t6 := 2 - 4: $t5 := pack 0x8675::M::S($t6) + 4: $t5 := pack M::S($t6) 5: $t4 := M::test1b($t5) 6: $t0 := +($t1, $t4) 7: return $t0 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp index aae0dcbebfe42..a39c031ed87c0 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/escape_autoref.exp @@ -57,8 +57,8 @@ module 0x42::m { ============ initial bytecode ================ [variant baseline] -fun m::make(): 0x42::m::Object { - var $t0: 0x42::m::Object +fun m::make(): m::Object { + var $t0: m::Object var $t1: u64 0: $t1 := 0 1: abort($t1) @@ -67,36 +67,36 @@ fun m::make(): 0x42::m::Object { [variant baseline] -fun m::owner_correct($t0: 0x42::m::Object): address { +fun m::owner_correct($t0: m::Object): address { var $t1: address var $t2: address - var $t3: &0x42::m::Object + var $t3: &m::Object var $t4: &address - var $t5: &0x42::m::ObjectCore + var $t5: &m::ObjectCore var $t6: &address 0: $t3 := borrow_local($t0) - 1: $t4 := borrow_field<0x42::m::Object>.inner($t3) + 1: $t4 := borrow_field.inner($t3) 2: $t2 := read_ref($t4) - 3: $t5 := borrow_global<0x42::m::ObjectCore>($t2) - 4: $t6 := borrow_field<0x42::m::ObjectCore>.owner($t5) + 3: $t5 := borrow_global($t2) + 4: $t6 := borrow_field.owner($t5) 5: $t1 := read_ref($t6) 6: return $t1 } [variant baseline] -fun m::owner_read_ref_missing($t0: 0x42::m::Object): address { +fun m::owner_read_ref_missing($t0: m::Object): address { var $t1: address - var $t2: &0x42::m::ObjectCore + var $t2: &m::ObjectCore var $t3: address - var $t4: &0x42::m::Object + var $t4: &m::Object var $t5: &address var $t6: &address 0: $t4 := borrow_local($t0) - 1: $t5 := borrow_field<0x42::m::Object>.inner($t4) + 1: $t5 := borrow_field.inner($t4) 2: $t3 := read_ref($t5) - 3: $t2 := borrow_global<0x42::m::ObjectCore>($t3) - 4: $t6 := borrow_field<0x42::m::ObjectCore>.owner($t2) + 3: $t2 := borrow_global($t3) + 4: $t6 := borrow_field.owner($t2) 5: $t1 := read_ref($t6) 6: return $t1 } @@ -105,12 +105,12 @@ fun m::owner_read_ref_missing($t0: 0x42::m::Object): address { [variant baseline] fun m::will_autoref(): address { var $t0: address - var $t1: 0x42::m::Object - var $t2: &0x42::m::Object + var $t1: m::Object + var $t2: &m::Object var $t3: &address 0: $t1 := m::make() 1: $t2 := borrow_local($t1) - 2: $t3 := borrow_field<0x42::m::Object>.inner($t2) + 2: $t3 := borrow_field.inner($t2) 3: $t0 := read_ref($t3) 4: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp index 72ad2c417ca09..5413968e0585d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/fields.exp @@ -112,71 +112,71 @@ module 0x42::fields { ============ initial bytecode ================ [variant baseline] -fun fields::read_generic_val($t0: 0x42::fields::G): u64 { +fun fields::read_generic_val($t0: fields::G): u64 { var $t1: u64 - var $t2: &0x42::fields::G + var $t2: &fields::G var $t3: &u64 0: $t2 := borrow_local($t0) - 1: $t3 := borrow_field<0x42::fields::G>.f($t2) + 1: $t3 := borrow_field>.f($t2) 2: $t1 := read_ref($t3) 3: return $t1 } [variant baseline] -fun fields::read_ref($t0: &0x42::fields::S): u64 { +fun fields::read_ref($t0: &fields::S): u64 { var $t1: u64 - var $t2: &0x42::fields::T + var $t2: &fields::T var $t3: &u64 - 0: $t2 := borrow_field<0x42::fields::S>.g($t0) - 1: $t3 := borrow_field<0x42::fields::T>.h($t2) + 0: $t2 := borrow_field.g($t0) + 1: $t3 := borrow_field.h($t2) 2: $t1 := read_ref($t3) 3: return $t1 } [variant baseline] -fun fields::read_val($t0: 0x42::fields::S): u64 { +fun fields::read_val($t0: fields::S): u64 { var $t1: u64 - var $t2: &0x42::fields::T - var $t3: &0x42::fields::S + var $t2: &fields::T + var $t3: &fields::S var $t4: &u64 0: $t3 := borrow_local($t0) - 1: $t2 := borrow_field<0x42::fields::S>.g($t3) - 2: $t4 := borrow_field<0x42::fields::T>.h($t2) + 1: $t2 := borrow_field.g($t3) + 2: $t4 := borrow_field.h($t2) 3: $t1 := read_ref($t4) 4: return $t1 } [variant baseline] -fun fields::write_generic_val($t0: &mut 0x42::fields::G, $t1: u64) { +fun fields::write_generic_val($t0: &mut fields::G, $t1: u64) { var $t2: &mut u64 - 0: $t2 := borrow_field<0x42::fields::G>.f($t0) + 0: $t2 := borrow_field>.f($t0) 1: write_ref($t2, $t1) 2: return () } [variant baseline] -fun fields::write_local_direct(): 0x42::fields::S { - var $t0: 0x42::fields::S - var $t1: 0x42::fields::S +fun fields::write_local_direct(): fields::S { + var $t0: fields::S + var $t1: fields::S var $t2: u64 - var $t3: 0x42::fields::T + var $t3: fields::T var $t4: u64 var $t5: u64 var $t6: &mut u64 - var $t7: &mut 0x42::fields::T - var $t8: &mut 0x42::fields::S + var $t7: &mut fields::T + var $t8: &mut fields::S 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack 0x42::fields::T($t4) - 3: $t1 := pack 0x42::fields::S($t2, $t3) + 2: $t3 := pack fields::T($t4) + 3: $t1 := pack fields::S($t2, $t3) 4: $t5 := 42 5: $t8 := borrow_local($t1) - 6: $t7 := borrow_field<0x42::fields::S>.g($t8) - 7: $t6 := borrow_field<0x42::fields::T>.h($t7) + 6: $t7 := borrow_field.g($t8) + 7: $t6 := borrow_field.h($t7) 8: write_ref($t6, $t5) 9: $t0 := infer($t1) 10: return $t0 @@ -184,24 +184,24 @@ fun fields::write_local_direct(): 0x42::fields::S { [variant baseline] -fun fields::write_local_via_ref(): 0x42::fields::S { - var $t0: 0x42::fields::S - var $t1: 0x42::fields::S +fun fields::write_local_via_ref(): fields::S { + var $t0: fields::S + var $t1: fields::S var $t2: u64 - var $t3: 0x42::fields::T + var $t3: fields::T var $t4: u64 - var $t5: &mut 0x42::fields::S + var $t5: &mut fields::S var $t6: u64 var $t7: &mut u64 - var $t8: &mut 0x42::fields::T + var $t8: &mut fields::T 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack 0x42::fields::T($t4) - 3: $t1 := pack 0x42::fields::S($t2, $t3) + 2: $t3 := pack fields::T($t4) + 3: $t1 := pack fields::S($t2, $t3) 4: $t5 := borrow_local($t1) 5: $t6 := 42 - 6: $t8 := borrow_field<0x42::fields::S>.g($t5) - 7: $t7 := borrow_field<0x42::fields::T>.h($t8) + 6: $t8 := borrow_field.g($t5) + 7: $t7 := borrow_field.h($t8) 8: write_ref($t7, $t6) 9: $t0 := infer($t1) 10: return $t0 @@ -209,23 +209,23 @@ fun fields::write_local_via_ref(): 0x42::fields::S { [variant baseline] -fun fields::write_local_via_ref_2(): 0x42::fields::S { - var $t0: 0x42::fields::S - var $t1: 0x42::fields::S +fun fields::write_local_via_ref_2(): fields::S { + var $t0: fields::S + var $t1: fields::S var $t2: u64 - var $t3: 0x42::fields::T + var $t3: fields::T var $t4: u64 var $t5: &mut u64 - var $t6: &mut 0x42::fields::T - var $t7: &mut 0x42::fields::S + var $t6: &mut fields::T + var $t7: &mut fields::S var $t8: u64 0: $t2 := 0 1: $t4 := 0 - 2: $t3 := pack 0x42::fields::T($t4) - 3: $t1 := pack 0x42::fields::S($t2, $t3) + 2: $t3 := pack fields::T($t4) + 3: $t1 := pack fields::S($t2, $t3) 4: $t7 := borrow_local($t1) - 5: $t6 := borrow_field<0x42::fields::S>.g($t7) - 6: $t5 := borrow_field<0x42::fields::T>.h($t6) + 5: $t6 := borrow_field.g($t7) + 6: $t5 := borrow_field.h($t6) 7: $t8 := 42 8: write_ref($t5, $t8) 9: $t0 := infer($t1) @@ -234,29 +234,29 @@ fun fields::write_local_via_ref_2(): 0x42::fields::S { [variant baseline] -fun fields::write_param($t0: &mut 0x42::fields::S) { +fun fields::write_param($t0: &mut fields::S) { var $t1: u64 var $t2: &mut u64 - var $t3: &mut 0x42::fields::T + var $t3: &mut fields::T 0: $t1 := 42 - 1: $t3 := borrow_field<0x42::fields::S>.g($t0) - 2: $t2 := borrow_field<0x42::fields::T>.h($t3) + 1: $t3 := borrow_field.g($t0) + 2: $t2 := borrow_field.h($t3) 3: write_ref($t2, $t1) 4: return () } [variant baseline] -fun fields::write_val($t0: 0x42::fields::S): 0x42::fields::S { - var $t1: 0x42::fields::S +fun fields::write_val($t0: fields::S): fields::S { + var $t1: fields::S var $t2: u64 var $t3: &mut u64 - var $t4: &mut 0x42::fields::T - var $t5: &mut 0x42::fields::S + var $t4: &mut fields::T + var $t5: &mut fields::S 0: $t2 := 42 1: $t5 := borrow_local($t0) - 2: $t4 := borrow_field<0x42::fields::S>.g($t5) - 3: $t3 := borrow_field<0x42::fields::T>.h($t4) + 2: $t4 := borrow_field.g($t5) + 3: $t3 := borrow_field.h($t4) 4: write_ref($t3, $t2) 5: $t1 := infer($t0) 6: return $t1 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp index cf24cf3290946..4f48d5df49307 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/freeze_mut_ref.exp @@ -8,7 +8,7 @@ module 0x42::freeze_mut_ref { dummy_field: bool, } public fun borrow_mut(map: &mut vector): &Element { - Freeze(false)(vector::borrow_mut(map, 0)) + vector::borrow_mut(map, 0) } public fun borrow_mut2(v: &mut Element): &Element { Freeze(false)(v) @@ -111,7 +111,7 @@ module 0x42::freeze_mut_ref { struct S has drop { } public fun borrow_mut(map: &mut vector): &Element { - /*freeze*/0x1::vector::borrow_mut(map, 0) + 0x1::vector::borrow_mut(map, 0) } public fun borrow_mut2(v: &mut Element): &Element { /*freeze*/v @@ -173,11 +173,11 @@ module 0x42::freeze_mut_ref { [variant baseline] public fun freeze_mut_ref::borrow_mut<#0>($t0: &mut vector<#0>): � { var $t1: � - var $t2: &mut #0 - var $t3: u64 - 0: $t3 := 0 - 1: $t2 := vector::borrow_mut<#0>($t0, $t3) - 2: $t1 := freeze_ref(implicit)($t2) + var $t2: u64 + var $t3: &mut #0 + 0: $t2 := 0 + 1: $t3 := vector::borrow_mut<#0>($t0, $t2) + 2: $t1 := freeze_ref(implicit)($t3) 3: return $t1 } @@ -230,8 +230,8 @@ fun freeze_mut_ref::t0() { [variant baseline] -fun freeze_mut_ref::t1($t0: &mut 0x42::freeze_mut_ref::S): &0x42::freeze_mut_ref::S { - var $t1: &0x42::freeze_mut_ref::S +fun freeze_mut_ref::t1($t0: &mut freeze_mut_ref::S): &freeze_mut_ref::S { + var $t1: &freeze_mut_ref::S 0: $t1 := freeze_ref(implicit)($t0) 1: return $t1 } @@ -270,14 +270,14 @@ public fun freeze_mut_ref::t4() { [variant baseline] -public fun freeze_mut_ref::t5($t0: &mut 0x42::freeze_mut_ref::G) { +public fun freeze_mut_ref::t5($t0: &mut freeze_mut_ref::G) { var $t1: u64 var $t2: &mut u64 - var $t3: &mut 0x42::freeze_mut_ref::G + var $t3: &mut freeze_mut_ref::G var $t4: u64 var $t5: u64 var $t6: &mut u64 - var $t7: &mut 0x42::freeze_mut_ref::G + var $t7: &mut freeze_mut_ref::G var $t8: u64 var $t9: u64 var $t10: &mut u64 @@ -292,12 +292,12 @@ public fun freeze_mut_ref::t5($t0: &mut 0x42::freeze_mut_ref::G) { 2: $t4 := +($t1, $t5) 3: $t1 := infer($t4) 4: $t3 := infer($t0) - 5: $t2 := borrow_field<0x42::freeze_mut_ref::G>.f($t3) + 5: $t2 := borrow_field.f($t3) 6: $t9 := 1 7: $t8 := +($t1, $t9) 8: $t1 := infer($t8) 9: $t7 := infer($t0) - 10: $t6 := borrow_field<0x42::freeze_mut_ref::G>.f($t7) + 10: $t6 := borrow_field.f($t7) 11: $t11 := 2 12: $t10 := borrow_local($t11) 13: $t13 := 2 @@ -312,10 +312,10 @@ public fun freeze_mut_ref::t5($t0: &mut 0x42::freeze_mut_ref::G) { [variant baseline] -fun freeze_mut_ref::t6($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { - var $t3: &0x42::freeze_mut_ref::S - var $t4: &0x42::freeze_mut_ref::S - var $t5: &mut 0x42::freeze_mut_ref::S +fun freeze_mut_ref::t6($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { + var $t3: &freeze_mut_ref::S + var $t4: &freeze_mut_ref::S + var $t5: &mut freeze_mut_ref::S 0: if ($t0) goto 1 else goto 6 1: label L0 2: $t5 := copy($t1) @@ -330,9 +330,9 @@ fun freeze_mut_ref::t6($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42: [variant baseline] -fun freeze_mut_ref::t7($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { - var $t3: &0x42::freeze_mut_ref::S - var $t4: &0x42::freeze_mut_ref::S +fun freeze_mut_ref::t7($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { + var $t3: &freeze_mut_ref::S + var $t4: &freeze_mut_ref::S 0: if ($t0) goto 1 else goto 4 1: label L0 2: $t4 := freeze_ref(implicit)($t1) @@ -346,8 +346,8 @@ fun freeze_mut_ref::t7($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42: [variant baseline] -fun freeze_mut_ref::t8($t0: bool, $t1: &mut 0x42::freeze_mut_ref::S, $t2: &0x42::freeze_mut_ref::S) { - var $t3: &0x42::freeze_mut_ref::S +fun freeze_mut_ref::t8($t0: bool, $t1: &mut freeze_mut_ref::S, $t2: &freeze_mut_ref::S) { + var $t3: &freeze_mut_ref::S 0: if ($t0) goto 1 else goto 4 1: label L0 2: $t3 := freeze_ref(implicit)($t1) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp index 58f17e58316dc..8bd1390faac8d 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/globals.exp @@ -68,18 +68,18 @@ module 0x42::globals { [variant baseline] fun globals::check($t0: address): bool { var $t1: bool - 0: $t1 := exists<0x42::globals::R>($t0) + 0: $t1 := exists($t0) 1: return $t1 } [variant baseline] fun globals::publish($t0: &signer) { - var $t1: 0x42::globals::R + var $t1: globals::R var $t2: u64 0: $t2 := 1 - 1: $t1 := pack 0x42::globals::R($t2) - 2: move_to<0x42::globals::R>($t0, $t1) + 1: $t1 := pack globals::R($t2) + 2: move_to($t0, $t1) 3: return () } @@ -87,10 +87,10 @@ fun globals::publish($t0: &signer) { [variant baseline] fun globals::read($t0: address): u64 { var $t1: u64 - var $t2: &0x42::globals::R + var $t2: &globals::R var $t3: &u64 - 0: $t2 := borrow_global<0x42::globals::R>($t0) - 1: $t3 := borrow_field<0x42::globals::R>.f($t2) + 0: $t2 := borrow_global($t0) + 1: $t3 := borrow_field.f($t2) 2: $t1 := read_ref($t3) 3: return $t1 } @@ -99,12 +99,12 @@ fun globals::read($t0: address): u64 { [variant baseline] fun globals::write($t0: address, $t1: u64): u64 { var $t2: u64 - var $t3: &mut 0x42::globals::R + var $t3: &mut globals::R var $t4: u64 var $t5: &mut u64 - 0: $t3 := borrow_global<0x42::globals::R>($t0) + 0: $t3 := borrow_global($t0) 1: $t4 := 2 - 2: $t5 := borrow_field<0x42::globals::R>.f($t3) + 2: $t5 := borrow_field.f($t3) 3: write_ref($t5, $t4) 4: $t2 := 9 5: return $t2 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp index 06001c73b254d..dbecf2c0b8369 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ability_err.exp @@ -106,26 +106,26 @@ module 0xc0ffee::m { ============ initial bytecode ================ [variant baseline] -public fun m::condition_requires_copy($t0: 0xc0ffee::m::Outer): 0xc0ffee::m::Outer { - var $t1: 0xc0ffee::m::Outer - var $t2: &0xc0ffee::m::Outer +public fun m::condition_requires_copy($t0: m::Outer): m::Outer { + var $t1: m::Outer + var $t2: &m::Outer var $t3: bool - var $t4: &0xc0ffee::m::Inner - var $t5: 0xc0ffee::m::Inner - var $t6: 0xc0ffee::m::Inner - var $t7: 0xc0ffee::m::Outer + var $t4: &m::Inner + var $t5: m::Inner + var $t6: m::Inner + var $t7: m::Outer var $t8: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 1: $t3 := test_variant m::Outer::One($t2) 2: if ($t3) goto 3 else goto 12 3: label L2 - 4: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) + 4: $t4 := borrow_variant_field.i($t2) 5: $t5 := read_ref($t4) 6: $t3 := m::consume($t5) 7: if ($t3) goto 8 else goto 12 8: label L3 - 9: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) - 10: $t1 := pack_variant 0xc0ffee::m::Outer::One($t6) + 9: $t6 := unpack_variant m::Outer::One($t0) + 10: $t1 := pack_variant m::Outer::One($t6) 11: goto 19 12: label L1 13: $t7 := infer($t0) @@ -140,25 +140,25 @@ public fun m::condition_requires_copy($t0: 0xc0ffee::m::Outer): 0xc0ffee::m::Out [variant baseline] -fun m::consume($t0: 0xc0ffee::m::Inner): bool { +fun m::consume($t0: m::Inner): bool { var $t1: bool - var $t2: &0xc0ffee::m::Inner + var $t2: &m::Inner var $t3: bool var $t4: u64 var $t5: u64 var $t6: u64 var $t7: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t2) + 1: $t3 := test_variant m::Inner::Inner1($t2) 2: if ($t3) goto 3 else goto 6 3: label L2 - 4: $t4 := unpack_variant 0xc0ffee::m::Inner::Inner1($t0) + 4: $t4 := unpack_variant m::Inner::Inner1($t0) 5: goto 15 6: label L1 - 7: $t3 := test_variant 0xc0ffee::m::Inner::Inner2($t2) + 7: $t3 := test_variant m::Inner::Inner2($t2) 8: if ($t3) goto 9 else goto 12 9: label L4 - 10: ($t5, $t6) := unpack_variant 0xc0ffee::m::Inner::Inner2($t0) + 10: ($t5, $t6) := unpack_variant m::Inner::Inner2($t0) 11: goto 15 12: label L3 13: $t7 := 14566554180833181697 @@ -170,17 +170,17 @@ fun m::consume($t0: 0xc0ffee::m::Inner): bool { [variant baseline] -public fun m::matched_value_not_consumed($t0: 0xc0ffee::m::Outer) { - var $t1: &0xc0ffee::m::Outer +public fun m::matched_value_not_consumed($t0: m::Outer) { + var $t1: &m::Outer var $t2: bool - var $t3: 0xc0ffee::m::Inner - var $t4: 0xc0ffee::m::Outer + var $t3: m::Inner + var $t4: m::Outer var $t5: u64 0: $t1 := borrow_local($t0) - 1: $t2 := test_variant 0xc0ffee::m::Outer::One($t1) + 1: $t2 := test_variant m::Outer::One($t1) 2: if ($t2) goto 3 else goto 6 3: label L2 - 4: $t3 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 4: $t3 := unpack_variant m::Outer::One($t0) 5: goto 12 6: label L1 7: $t4 := infer($t0) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp index 0e40ef6056174..5c91926c59d3c 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_ok.exp @@ -339,26 +339,26 @@ module 0xc0ffee::m { ============ initial bytecode ================ [variant baseline] -public fun m::inner_value($t0: 0xc0ffee::m::Inner): u64 { +public fun m::inner_value($t0: m::Inner): u64 { var $t1: u64 - var $t2: &0xc0ffee::m::Inner + var $t2: &m::Inner var $t3: bool var $t4: u64 var $t5: u64 var $t6: u64 var $t7: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t2) + 1: $t3 := test_variant m::Inner::Inner1($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: $t4 := unpack_variant 0xc0ffee::m::Inner::Inner1($t0) + 4: $t4 := unpack_variant m::Inner::Inner1($t0) 5: $t1 := infer($t4) 6: goto 17 7: label L1 - 8: $t3 := test_variant 0xc0ffee::m::Inner::Inner2($t2) + 8: $t3 := test_variant m::Inner::Inner2($t2) 9: if ($t3) goto 10 else goto 14 10: label L4 - 11: ($t5, $t6) := unpack_variant 0xc0ffee::m::Inner::Inner2($t0) + 11: ($t5, $t6) := unpack_variant m::Inner::Inner2($t0) 12: $t1 := +($t5, $t6) 13: goto 17 14: label L3 @@ -370,12 +370,12 @@ public fun m::inner_value($t0: 0xc0ffee::m::Inner): u64 { [variant baseline] -public fun m::is_inner1($t0: &0xc0ffee::m::Inner): bool { +public fun m::is_inner1($t0: &m::Inner): bool { var $t1: bool var $t2: bool - var $t3: &0xc0ffee::m::Inner + var $t3: &m::Inner var $t4: u64 - 0: $t2 := test_variant 0xc0ffee::m::Inner::Inner1($t0) + 0: $t2 := test_variant m::Inner::Inner1($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := true @@ -393,17 +393,17 @@ public fun m::is_inner1($t0: &0xc0ffee::m::Inner): bool { [variant baseline] -public fun m::is_some<#0>($t0: &0xc0ffee::m::Option<#0>): bool { +public fun m::is_some<#0>($t0: &m::Option<#0>): bool { var $t1: bool var $t2: bool var $t3: u64 - 0: $t2 := test_variant 0xc0ffee::m::Option<#0>::None($t0) + 0: $t2 := test_variant m::Option<#0>::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 14 5: label L1 - 6: $t2 := test_variant 0xc0ffee::m::Option<#0>::Some($t0) + 6: $t2 := test_variant m::Option<#0>::Some($t0) 7: if ($t2) goto 8 else goto 11 8: label L4 9: $t1 := true @@ -417,17 +417,17 @@ public fun m::is_some<#0>($t0: &0xc0ffee::m::Option<#0>): bool { [variant baseline] -public fun m::is_some_dropped<#0>($t0: 0xc0ffee::m::Option<#0>): bool { +public fun m::is_some_dropped<#0>($t0: m::Option<#0>): bool { var $t1: bool - var $t2: &0xc0ffee::m::Option<#0> + var $t2: &m::Option<#0> var $t3: bool - var $t4: 0xc0ffee::m::Option<#0> + var $t4: m::Option<#0> var $t5: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Option<#0>::None($t2) + 1: $t3 := test_variant m::Option<#0>::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant 0xc0ffee::m::Option<#0>::None($t0) + 4: unpack_variant m::Option<#0>::None($t0) 5: $t1 := false 6: goto 14 7: label L1 @@ -443,33 +443,33 @@ public fun m::is_some_dropped<#0>($t0: 0xc0ffee::m::Option<#0>): bool { [variant baseline] -public fun m::is_some_specialized($t0: &0xc0ffee::m::Option<0xc0ffee::m::Option>): bool { +public fun m::is_some_specialized($t0: &m::Option>): bool { var $t1: bool var $t2: bool - var $t3: &0xc0ffee::m::Option - var $t4: &0xc0ffee::m::Option + var $t3: &m::Option + var $t4: &m::Option var $t5: u64 - 0: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::None($t0) + 0: $t2 := test_variant m::Option>::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 28 5: label L1 - 6: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::Some($t0) + 6: $t2 := test_variant m::Option>::Some($t0) 7: if ($t2) goto 8 else goto 15 8: label L4 - 9: $t3 := borrow_variant_field<0xc0ffee::m::Option<0xc0ffee::m::Option>::Some>.value($t0) - 10: $t2 := test_variant 0xc0ffee::m::Option::None($t3) + 9: $t3 := borrow_variant_field>::Some>.value($t0) + 10: $t2 := test_variant m::Option::None($t3) 11: if ($t2) goto 12 else goto 15 12: label L5 13: $t1 := false 14: goto 28 15: label L3 - 16: $t2 := test_variant 0xc0ffee::m::Option<0xc0ffee::m::Option>::Some($t0) + 16: $t2 := test_variant m::Option>::Some($t0) 17: if ($t2) goto 18 else goto 25 18: label L7 - 19: $t4 := borrow_variant_field<0xc0ffee::m::Option<0xc0ffee::m::Option>::Some>.value($t0) - 20: $t2 := test_variant 0xc0ffee::m::Option::Some($t4) + 19: $t4 := borrow_variant_field>::Some>.value($t0) + 20: $t2 := test_variant m::Option::Some($t4) 21: if ($t2) goto 22 else goto 25 22: label L8 23: $t1 := true @@ -483,40 +483,40 @@ public fun m::is_some_specialized($t0: &0xc0ffee::m::Option<0xc0ffee::m::Option< [variant baseline] -public fun m::outer_value($t0: 0xc0ffee::m::Outer): u64 { +public fun m::outer_value($t0: m::Outer): u64 { var $t1: u64 - var $t2: &0xc0ffee::m::Outer + var $t2: &m::Outer var $t3: bool - var $t4: 0xc0ffee::m::Inner - var $t5: 0xc0ffee::m::Inner - var $t6: 0xc0ffee::m::Box + var $t4: m::Inner + var $t5: m::Inner + var $t6: m::Box var $t7: u64 var $t8: u64 - var $t9: &0xc0ffee::m::Box + var $t9: &m::Box var $t10: &u64 var $t11: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) + 1: $t3 := test_variant m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant 0xc0ffee::m::Outer::None($t0) + 4: unpack_variant m::Outer::None($t0) 5: $t1 := 0 6: goto 28 7: label L1 - 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 8: $t3 := test_variant m::Outer::One($t2) 9: if ($t3) goto 10 else goto 14 10: label L4 - 11: $t4 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 11: $t4 := unpack_variant m::Outer::One($t0) 12: $t1 := m::inner_value($t4) 13: goto 28 14: label L3 - 15: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) + 15: $t3 := test_variant m::Outer::Two($t2) 16: if ($t3) goto 17 else goto 25 17: label L6 - 18: ($t5, $t6) := unpack_variant 0xc0ffee::m::Outer::Two($t0) + 18: ($t5, $t6) := unpack_variant m::Outer::Two($t0) 19: $t7 := m::inner_value($t5) 20: $t9 := borrow_local($t6) - 21: $t10 := borrow_field<0xc0ffee::m::Box>.x($t9) + 21: $t10 := borrow_field.x($t9) 22: $t8 := read_ref($t10) 23: $t1 := +($t7, $t8) 24: goto 28 @@ -529,55 +529,55 @@ public fun m::outer_value($t0: 0xc0ffee::m::Outer): u64 { [variant baseline] -public fun m::outer_value_nested($t0: 0xc0ffee::m::Outer): u64 { +public fun m::outer_value_nested($t0: m::Outer): u64 { var $t1: u64 - var $t2: &0xc0ffee::m::Outer + var $t2: &m::Outer var $t3: bool - var $t4: &0xc0ffee::m::Inner + var $t4: &m::Inner var $t5: u64 - var $t6: 0xc0ffee::m::Inner - var $t7: 0xc0ffee::m::Inner - var $t8: 0xc0ffee::m::Inner - var $t9: 0xc0ffee::m::Box + var $t6: m::Inner + var $t7: m::Inner + var $t8: m::Inner + var $t9: m::Box var $t10: u64 var $t11: u64 - var $t12: &0xc0ffee::m::Box + var $t12: &m::Box var $t13: &u64 var $t14: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) + 1: $t3 := test_variant m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant 0xc0ffee::m::Outer::None($t0) + 4: unpack_variant m::Outer::None($t0) 5: $t1 := 0 6: goto 40 7: label L1 - 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 8: $t3 := test_variant m::Outer::One($t2) 9: if ($t3) goto 10 else goto 19 10: label L4 - 11: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) - 12: $t3 := test_variant 0xc0ffee::m::Inner::Inner1($t4) + 11: $t4 := borrow_variant_field.i($t2) + 12: $t3 := test_variant m::Inner::Inner1($t4) 13: if ($t3) goto 14 else goto 19 14: label L5 - 15: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) - 16: $t5 := unpack_variant 0xc0ffee::m::Inner::Inner1($t6) + 15: $t6 := unpack_variant m::Outer::One($t0) + 16: $t5 := unpack_variant m::Inner::Inner1($t6) 17: $t1 := infer($t5) 18: goto 40 19: label L3 - 20: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 20: $t3 := test_variant m::Outer::One($t2) 21: if ($t3) goto 22 else goto 26 22: label L7 - 23: $t7 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 23: $t7 := unpack_variant m::Outer::One($t0) 24: $t1 := m::inner_value($t7) 25: goto 40 26: label L6 - 27: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) + 27: $t3 := test_variant m::Outer::Two($t2) 28: if ($t3) goto 29 else goto 37 29: label L9 - 30: ($t8, $t9) := unpack_variant 0xc0ffee::m::Outer::Two($t0) + 30: ($t8, $t9) := unpack_variant m::Outer::Two($t0) 31: $t10 := m::inner_value($t8) 32: $t12 := borrow_local($t9) - 33: $t13 := borrow_field<0xc0ffee::m::Box>.x($t12) + 33: $t13 := borrow_field.x($t12) 34: $t11 := read_ref($t13) 35: $t1 := +($t10, $t11) 36: goto 40 @@ -590,59 +590,59 @@ public fun m::outer_value_nested($t0: 0xc0ffee::m::Outer): u64 { [variant baseline] -public fun m::outer_value_with_cond($t0: 0xc0ffee::m::Outer): u64 { +public fun m::outer_value_with_cond($t0: m::Outer): u64 { var $t1: u64 - var $t2: &0xc0ffee::m::Outer + var $t2: &m::Outer var $t3: bool - var $t4: &0xc0ffee::m::Inner - var $t5: &0xc0ffee::m::Inner - var $t6: 0xc0ffee::m::Inner + var $t4: &m::Inner + var $t5: &m::Inner + var $t6: m::Inner var $t7: u64 var $t8: u64 - var $t9: 0xc0ffee::m::Inner - var $t10: 0xc0ffee::m::Inner - var $t11: 0xc0ffee::m::Box + var $t9: m::Inner + var $t10: m::Inner + var $t11: m::Box var $t12: u64 var $t13: u64 - var $t14: &0xc0ffee::m::Box + var $t14: &m::Box var $t15: &u64 var $t16: u64 0: $t2 := borrow_local($t0) - 1: $t3 := test_variant 0xc0ffee::m::Outer::None($t2) + 1: $t3 := test_variant m::Outer::None($t2) 2: if ($t3) goto 3 else goto 7 3: label L2 - 4: unpack_variant 0xc0ffee::m::Outer::None($t0) + 4: unpack_variant m::Outer::None($t0) 5: $t1 := 0 6: goto 42 7: label L1 - 8: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 8: $t3 := test_variant m::Outer::One($t2) 9: if ($t3) goto 10 else goto 21 10: label L4 - 11: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t2) + 11: $t4 := borrow_variant_field.i($t2) 12: $t5 := infer($t4) 13: $t3 := m::is_inner1($t5) 14: if ($t3) goto 15 else goto 21 15: label L5 - 16: $t6 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 16: $t6 := unpack_variant m::Outer::One($t0) 17: $t7 := m::inner_value($t6) 18: $t8 := 2 19: $t1 := %($t7, $t8) 20: goto 42 21: label L3 - 22: $t3 := test_variant 0xc0ffee::m::Outer::One($t2) + 22: $t3 := test_variant m::Outer::One($t2) 23: if ($t3) goto 24 else goto 28 24: label L7 - 25: $t9 := unpack_variant 0xc0ffee::m::Outer::One($t0) + 25: $t9 := unpack_variant m::Outer::One($t0) 26: $t1 := m::inner_value($t9) 27: goto 42 28: label L6 - 29: $t3 := test_variant 0xc0ffee::m::Outer::Two($t2) + 29: $t3 := test_variant m::Outer::Two($t2) 30: if ($t3) goto 31 else goto 39 31: label L9 - 32: ($t10, $t11) := unpack_variant 0xc0ffee::m::Outer::Two($t0) + 32: ($t10, $t11) := unpack_variant m::Outer::Two($t0) 33: $t12 := m::inner_value($t10) 34: $t14 := borrow_local($t11) - 35: $t15 := borrow_field<0xc0ffee::m::Box>.x($t14) + 35: $t15 := borrow_field.x($t14) 36: $t13 := read_ref($t15) 37: $t1 := +($t12, $t13) 38: goto 42 @@ -655,40 +655,40 @@ public fun m::outer_value_with_cond($t0: 0xc0ffee::m::Outer): u64 { [variant baseline] -public fun m::outer_value_with_cond_ref($t0: &0xc0ffee::m::Outer): bool { +public fun m::outer_value_with_cond_ref($t0: &m::Outer): bool { var $t1: bool var $t2: bool - var $t3: &0xc0ffee::m::Inner - var $t4: &0xc0ffee::m::Inner - var $t5: &0xc0ffee::m::Inner + var $t3: &m::Inner + var $t4: &m::Inner + var $t5: &m::Inner var $t6: u64 - 0: $t2 := test_variant 0xc0ffee::m::Outer::None($t0) + 0: $t2 := test_variant m::Outer::None($t0) 1: if ($t2) goto 2 else goto 5 2: label L2 3: $t1 := false 4: goto 32 5: label L1 - 6: $t2 := test_variant 0xc0ffee::m::Outer::One($t0) + 6: $t2 := test_variant m::Outer::One($t0) 7: if ($t2) goto 8 else goto 15 8: label L4 - 9: $t3 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t0) + 9: $t3 := borrow_variant_field.i($t0) 10: $t2 := m::is_inner1($t3) 11: if ($t2) goto 12 else goto 15 12: label L5 13: $t1 := true 14: goto 32 15: label L3 - 16: $t2 := test_variant 0xc0ffee::m::Outer::One($t0) + 16: $t2 := test_variant m::Outer::One($t0) 17: if ($t2) goto 18 else goto 22 18: label L7 - 19: $t4 := borrow_variant_field<0xc0ffee::m::Outer::One>.i($t0) + 19: $t4 := borrow_variant_field.i($t0) 20: $t1 := m::is_inner1($t4) 21: goto 32 22: label L6 - 23: $t2 := test_variant 0xc0ffee::m::Outer::Two($t0) + 23: $t2 := test_variant m::Outer::Two($t0) 24: if ($t2) goto 25 else goto 29 25: label L9 - 26: $t5 := borrow_variant_field<0xc0ffee::m::Outer::Two>.i($t0) + 26: $t5 := borrow_variant_field.i($t0) 27: $t1 := m::is_inner1($t5) 28: goto 32 29: label L8 @@ -700,13 +700,13 @@ public fun m::outer_value_with_cond_ref($t0: &0xc0ffee::m::Outer): bool { [variant baseline] -fun m::select_common_fields($t0: 0xc0ffee::m::CommonFields): u64 { +fun m::select_common_fields($t0: m::CommonFields): u64 { var $t1: u64 var $t2: u64 - var $t3: &0xc0ffee::m::CommonFields + var $t3: &m::CommonFields var $t4: &u64 var $t5: u64 - var $t6: &0xc0ffee::m::CommonFields + var $t6: &m::CommonFields var $t7: bool var $t8: u64 var $t9: u64 @@ -714,20 +714,20 @@ fun m::select_common_fields($t0: 0xc0ffee::m::CommonFields): u64 { var $t11: u64 var $t12: u64 0: $t3 := borrow_local($t0) - 1: $t4 := borrow_variant_field<0xc0ffee::m::CommonFields::Foo|Bar>.x($t3) + 1: $t4 := borrow_variant_field.x($t3) 2: $t2 := read_ref($t4) 3: $t6 := borrow_local($t0) - 4: $t7 := test_variant 0xc0ffee::m::CommonFields::Foo($t6) + 4: $t7 := test_variant m::CommonFields::Foo($t6) 5: if ($t7) goto 6 else goto 10 6: label L2 - 7: ($t9, $t8) := unpack_variant 0xc0ffee::m::CommonFields::Foo($t0) + 7: ($t9, $t8) := unpack_variant m::CommonFields::Foo($t0) 8: $t5 := infer($t8) 9: goto 20 10: label L1 - 11: $t7 := test_variant 0xc0ffee::m::CommonFields::Bar($t6) + 11: $t7 := test_variant m::CommonFields::Bar($t6) 12: if ($t7) goto 13 else goto 17 13: label L4 - 14: ($t11, $t10) := unpack_variant 0xc0ffee::m::CommonFields::Bar($t0) + 14: ($t11, $t10) := unpack_variant m::CommonFields::Bar($t0) 15: $t5 := infer($t10) 16: goto 20 17: label L3 @@ -740,24 +740,24 @@ fun m::select_common_fields($t0: 0xc0ffee::m::CommonFields): u64 { [variant baseline] -fun m::select_common_fields_different_offset($t0: 0xc0ffee::m::CommonFieldsAtDifferentOffset): u64 { +fun m::select_common_fields_different_offset($t0: m::CommonFieldsAtDifferentOffset): u64 { var $t1: u64 - var $t2: &0xc0ffee::m::CommonFieldsAtDifferentOffset + var $t2: &m::CommonFieldsAtDifferentOffset var $t3: &u64 var $t4: bool 0: $t2 := borrow_local($t0) - 1: $t4 := test_variant 0xc0ffee::m::CommonFieldsAtDifferentOffset::Bar($t2) + 1: $t4 := test_variant m::CommonFieldsAtDifferentOffset::Bar($t2) 2: if ($t4) goto 8 else goto 3 3: label L3 - 4: $t4 := test_variant 0xc0ffee::m::CommonFieldsAtDifferentOffset::Balt($t2) + 4: $t4 := test_variant m::CommonFieldsAtDifferentOffset::Balt($t2) 5: if ($t4) goto 8 else goto 6 6: label L4 7: goto 11 8: label L2 - 9: $t3 := borrow_variant_field<0xc0ffee::m::CommonFieldsAtDifferentOffset::Bar|Balt>.z($t2) + 9: $t3 := borrow_variant_field.z($t2) 10: goto 13 11: label L1 - 12: $t3 := borrow_variant_field<0xc0ffee::m::CommonFieldsAtDifferentOffset::Baz>.z($t2) + 12: $t3 := borrow_variant_field.z($t2) 13: label L0 14: $t1 := read_ref($t3) 15: return $t1 @@ -765,14 +765,14 @@ fun m::select_common_fields_different_offset($t0: 0xc0ffee::m::CommonFieldsAtDif [variant baseline] -fun m::test_common($t0: 0xc0ffee::m::CommonFields): bool { +fun m::test_common($t0: m::CommonFields): bool { var $t1: bool - var $t2: &0xc0ffee::m::CommonFields + var $t2: &m::CommonFields 0: $t2 := borrow_local($t0) - 1: $t1 := test_variant 0xc0ffee::m::CommonFields::Foo($t2) + 1: $t1 := test_variant m::CommonFields::Foo($t2) 2: if ($t1) goto 7 else goto 3 3: label L1 - 4: $t1 := test_variant 0xc0ffee::m::CommonFields::Bar($t2) + 4: $t1 := test_variant m::CommonFields::Bar($t2) 5: if ($t1) goto 7 else goto 6 6: label L2 7: label L0 @@ -781,12 +781,12 @@ fun m::test_common($t0: 0xc0ffee::m::CommonFields): bool { [variant baseline] -fun m::test_common_ref($t0: &0xc0ffee::m::CommonFields): bool { +fun m::test_common_ref($t0: &m::CommonFields): bool { var $t1: bool - 0: $t1 := test_variant 0xc0ffee::m::CommonFields::Foo($t0) + 0: $t1 := test_variant m::CommonFields::Foo($t0) 1: if ($t1) goto 6 else goto 2 2: label L1 - 3: $t1 := test_variant 0xc0ffee::m::CommonFields::Bar($t0) + 3: $t1 := test_variant m::CommonFields::Bar($t0) 4: if ($t1) goto 6 else goto 5 5: label L2 6: label L0 diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp index c930a13a552b1..cb279233ae21a 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/matching_refutable_err.exp @@ -31,10 +31,10 @@ module 0x815::m { ============ initial bytecode ================ [variant baseline] -fun m::t($t0: 0x815::m::E): u64 { +fun m::t($t0: m::E): u64 { var $t1: u64 var $t2: u64 - 0: $t2 := unpack_variant 0x815::m::E::Some($t0) + 0: $t2 := unpack_variant m::E::Some($t0) 1: $t1 := infer($t2) 2: return $t1 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp index 52cea517af73a..8cb749b3d7d54 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_order.exp @@ -87,65 +87,65 @@ module 0x42::pack_unpack { ============ initial bytecode ================ [variant baseline] -fun pack_unpack::pack1($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S - 0: $t3 := pack 0x42::pack_unpack::S($t0, $t1, $t2) +fun pack_unpack::pack1($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S + 0: $t3 := pack pack_unpack::S($t0, $t1, $t2) 1: return $t3 } [variant baseline] -fun pack_unpack::pack2($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S +fun pack_unpack::pack2($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack 0x42::pack_unpack::S($t4, $t2, $t5) + 2: $t3 := pack pack_unpack::S($t4, $t2, $t5) 3: return $t3 } [variant baseline] -fun pack_unpack::pack3($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S +fun pack_unpack::pack3($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S var $t4: u8 0: $t4 := infer($t0) - 1: $t3 := pack 0x42::pack_unpack::S($t1, $t4, $t2) + 1: $t3 := pack pack_unpack::S($t1, $t4, $t2) 2: return $t3 } [variant baseline] -fun pack_unpack::pack4($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S +fun pack_unpack::pack4($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack 0x42::pack_unpack::S($t2, $t4, $t5) + 2: $t3 := pack pack_unpack::S($t2, $t4, $t5) 3: return $t3 } [variant baseline] -fun pack_unpack::pack5($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S +fun pack_unpack::pack5($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S var $t4: u8 0: $t4 := infer($t0) - 1: $t3 := pack 0x42::pack_unpack::S($t1, $t2, $t4) + 1: $t3 := pack pack_unpack::S($t1, $t2, $t4) 2: return $t3 } [variant baseline] -fun pack_unpack::pack6($t0: u8, $t1: u8, $t2: u8): 0x42::pack_unpack::S { - var $t3: 0x42::pack_unpack::S +fun pack_unpack::pack6($t0: u8, $t1: u8, $t2: u8): pack_unpack::S { + var $t3: pack_unpack::S var $t4: u8 var $t5: u8 0: $t4 := infer($t0) 1: $t5 := infer($t1) - 2: $t3 := pack 0x42::pack_unpack::S($t2, $t5, $t4) + 2: $t3 := pack pack_unpack::S($t2, $t5, $t4) 3: return $t3 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp index 17e454f6177ee..6f2e0327d938c 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/pack_unpack.exp @@ -39,24 +39,24 @@ module 0x42::pack_unpack { ============ initial bytecode ================ [variant baseline] -fun pack_unpack::pack($t0: u64, $t1: u64): 0x42::pack_unpack::S { - var $t2: 0x42::pack_unpack::S - var $t3: 0x42::pack_unpack::T - 0: $t3 := pack 0x42::pack_unpack::T($t1) - 1: $t2 := pack 0x42::pack_unpack::S($t0, $t3) +fun pack_unpack::pack($t0: u64, $t1: u64): pack_unpack::S { + var $t2: pack_unpack::S + var $t3: pack_unpack::T + 0: $t3 := pack pack_unpack::T($t1) + 1: $t2 := pack pack_unpack::S($t0, $t3) 2: return $t2 } [variant baseline] -fun pack_unpack::unpack($t0: 0x42::pack_unpack::S): (u64, u64) { +fun pack_unpack::unpack($t0: pack_unpack::S): (u64, u64) { var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: 0x42::pack_unpack::T - 0: ($t3, $t5) := unpack 0x42::pack_unpack::S($t0) - 1: $t4 := unpack 0x42::pack_unpack::T($t5) + var $t5: pack_unpack::T + 0: ($t3, $t5) := unpack pack_unpack::S($t0) + 1: $t4 := unpack pack_unpack::T($t5) 2: $t1 := infer($t3) 3: $t2 := infer($t4) 4: return ($t1, $t2) diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp index 6108d5abdaa96..7667cb16711ed 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/spec_construct.exp @@ -28,16 +28,16 @@ module 0x42::m { ============ initial bytecode ================ [variant baseline] -public fun m::foo($t0: &0x42::m::S): u8 { +public fun m::foo($t0: &m::S): u8 { var $t1: u8 - var $t2: &0x42::m::E - var $t3: &vector<0x42::m::E> + var $t2: &m::E + var $t3: &vector var $t4: u64 var $t5: &u8 - 0: $t3 := borrow_field<0x42::m::S>.data($t0) + 0: $t3 := borrow_field.data($t0) 1: $t4 := 0 - 2: $t2 := vector::borrow<0x42::m::E>($t3, $t4) - 3: $t5 := borrow_field<0x42::m::E>.k($t2) + 2: $t2 := vector::borrow($t3, $t4) + 3: $t5 := borrow_field.k($t2) 4: $t1 := read_ref($t5) 5: return $t1 } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp index d88443f618863..bb24fe5dec87c 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard3.exp @@ -37,19 +37,19 @@ module 0xc0ffee::m { [variant baseline] public fun m::bar() { - var $t0: 0xc0ffee::m::S + var $t0: m::S var $t1: bool - var $t2: 0xc0ffee::m::S + var $t2: m::S 0: $t1 := false - 1: $t0 := pack 0xc0ffee::m::S($t1) + 1: $t0 := pack m::S($t1) 2: $t2 := infer($t0) 3: return () } [variant baseline] -public fun m::foo($t0: 0xc0ffee::m::S) { - var $t1: 0xc0ffee::m::S +public fun m::foo($t0: m::S) { + var $t1: m::S 0: $t1 := infer($t0) 1: return () } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp index 44dca347d8756..be337256489ac 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp @@ -31,15 +31,15 @@ module 0xc0ffee::m { [variant baseline] public fun m::test() { - var $t0: 0xc0ffee::m::S + var $t0: m::S var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 0: $t1 := 3 1: $t2 := 4 - 2: $t0 := pack 0xc0ffee::m::S($t1, $t2) - 3: ($t3, $t4) := unpack 0xc0ffee::m::S($t0) + 2: $t0 := pack m::S($t1, $t2) + 3: ($t3, $t4) := unpack m::S($t0) 4: return () } diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp index 5524b749b2ebc..9994a1b7b74bc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/conditions_ok.exp @@ -8,7 +8,7 @@ module 0x42::M { Deref(x) } spec { - aborts_if Or(Eq(Freeze(false)($t0), 0), Eq(select M::Ghost$some_global.v(global<0x42::M::Ghost$some_global>(0x0)), 0)); + aborts_if Or(Eq(Freeze(false)($t0), 0), Eq(select M::Ghost$some_global.v(global(0x0)), 0)); ensures Gt(Old($t0), $t0); ensures Eq(result0(), Freeze(false)($t0)); } diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp index 007310efd886e..d2dd6a769bbee 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec.exp @@ -1,14 +1,14 @@ // -- Model dump before bytecode pipeline module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), { + invariant forall a: address: TypeDomain
(): Implies(exists(a), { let (x: address): (address) = Tuple(a); { let r: bool = { let (a: address): (address) = Tuple(x); - Lt(select m::S.f<0x42::m::S>({ + Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - global<0x42::m::S>(a) + global(a) }), 10) }; r diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp index 06ac84e29aaa4..a03f2ee69c731 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/inline_fun_in_spec_typed.exp @@ -1,14 +1,14 @@ // -- Model dump before bytecode pipeline module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), { + invariant forall a: address: TypeDomain
(): Implies(exists(a), { let (x: address): (address) = Tuple(a); { let r: bool = { let (a: address): (address) = Tuple(x); - Lt(select m::S.f<0x42::m::S>({ + Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - global<0x42::m::S>(a) + global(a) }), 10) }; r diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp index 00ce3b6b54444..0a2052b6dbd84 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/invariants_ok.exp @@ -4,7 +4,7 @@ module 0x42::M { s: S, } spec { - invariant M::less10(true, select M::S.x<0x42::M::S>(select M::R.s())); + invariant M::less10(true, select M::S.x(select M::R.s())); } struct S { @@ -34,7 +34,7 @@ module 0x42::M { } /* spec { - invariant M::less10(true, select M::S.x<0x42::M::S>(select M::R.s())); + invariant M::less10(true, select M::S.x(select M::R.s())); } */ diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp index b9a89a9fa7950..86a113d53cbb2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/move_function_in_spec_ok.exp @@ -10,7 +10,7 @@ module 0x42::move_function_in_spec { let account_address: address = select move_function_in_spec::TypeInfo.account_address(type_info); spec { assert move_function_in_spec::$no_change(account_address, account_address); - assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(move_function_in_spec::$type_of<#0>())); + assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address(move_function_in_spec::$type_of<#0>())); } ; Tuple() @@ -30,8 +30,8 @@ module 0x42::move_function_in_spec { } spec fun $no_change(target: address,new_addr: address): bool { { - let ty: &0x42::move_function_in_spec::TypeInfo = global<0x42::move_function_in_spec::TypeInfo>(target); - Eq
(select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(ty), new_addr) + let ty: &move_function_in_spec::TypeInfo = global(target); + Eq
(select move_function_in_spec::TypeInfo.account_address(ty), new_addr) } } spec fun $type_of(): TypeInfo { @@ -50,7 +50,7 @@ module 0x42::move_function_in_spec { /* spec { assert move_function_in_spec::$no_change(account_address, account_address); - assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address<0x42::move_function_in_spec::TypeInfo>(move_function_in_spec::$type_of<#0>())); + assert Eq
(account_address, select move_function_in_spec::TypeInfo.account_address(move_function_in_spec::$type_of<#0>())); } */ ; diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp index 113804cb1f31b..666f68b98c33d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/quantifiers_ok.exp @@ -4,10 +4,10 @@ module 0x42::M { x: u64, } spec fun exists_in_vector(v: vector): bool { - exists s: 0x42::M::S: v: Gt(select M::S.x<0x42::M::S>(s), 0) + exists s: M::S: v: Gt(select M::S.x(s), 0) } spec fun some_in_vector(v: vector): S { - choose s: 0x42::M::S: v: Eq(select M::S.x<0x42::M::S>(s), 0) + choose s: M::S: v: Eq(select M::S.x(s), 0) } } // end 0x42::M diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp index 69ded91a3a375..a86b6de452387 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/structs_ok.exp @@ -19,10 +19,10 @@ module 0x42::M { pack M::T(select M::S.x(select M::R.s(r))) } spec fun struct_access(s: S): u64 { - select M::S.x<0x42::M::S>(s) + select M::S.x(s) } spec fun nested_struct_access(r: R): bool { - select M::S.y<0x42::M::S>(select M::R.s<0x42::M::R>(r)) + select M::S.y(select M::R.s(r)) } spec fun struct_pack(x: u64,y: bool,z: vector): S { pack M::S(x, y, z) @@ -43,10 +43,10 @@ module 0x42::M { pack M::G(x, y) } spec fun resource_global(addr: address): T { - global<0x42::M::T>(addr) + global(addr) } spec fun resource_global_exists(addr: address): bool { - exists<0x42::M::T>(addr) + exists(addr) } } // end 0x42::M diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp index 7e15d2d3c36be..0bb8a21bd74cd 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/update_field_ok.exp @@ -10,11 +10,11 @@ module 0x42::update_field_ok { } spec { aborts_if false; - ensures Eq<0x42::update_field_ok::R>(Freeze(false)($t0), update_field_ok::assign_x_1(Old<0x42::update_field_ok::R>($t0))); + ensures Eq(Freeze(false)($t0), update_field_ok::assign_x_1(Old($t0))); } spec fun assign_x_1(r: R): R { - update update_field_ok::R.x<0x42::update_field_ok::R>(r, 1) + update update_field_ok::R.x(r, 1) } } // end 0x42::update_field_ok diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp index 302baa8097a2f..6c5fc3e523e54 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/nested_post_process.exp @@ -12,7 +12,7 @@ module 0x42::simple_map { } public fun borrow(map: &SimpleMap,key: &Key): &Value { { - let maybe_idx: 0x1::option::Option = simple_map::find(map, key); + let maybe_idx: option::Option = simple_map::find(map, key); if option::is_some(Borrow(Immutable)(maybe_idx)) { Tuple() } else { @@ -24,7 +24,7 @@ module 0x42::simple_map { } } } - private fun find(map: &SimpleMap,key: &Key): 0x1::option::Option { + private fun find(map: &SimpleMap,key: &Key): option::Option { { let leng: u64 = vector::length>(Borrow(Immutable)(select simple_map::SimpleMap.data<&SimpleMap>(map))); { @@ -66,7 +66,7 @@ module 0x42::simple_map { let idx = 0x1::option::extract(&mut maybe_idx); &0x1::vector::borrow>(&map.data, idx).value } - fun find(map: &SimpleMap, key: &Key): 0x1::option::Option { + fun find(map: &SimpleMap, key: &Key): option::Option { let leng = 0x1::vector::length>(&map.data); let i = 0; while (i < leng) { diff --git a/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp b/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp index 1905db1c3f9dc..7c701b069981b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp +++ b/third_party/move/move-compiler-v2/tests/checking/unused/unused_enum.exp @@ -4,10 +4,10 @@ module 0x42::enum_types { enum MessageHolder { Empty, Message { - message: 0x1::string::String, + message: string::String, } NewMessage { - message: 0x1::string::String, + message: string::String, } } } // end 0x42::enum_types @@ -17,10 +17,10 @@ module 0x42::enum_types { enum MessageHolder has drop, key { Empty, Message { - message: 0x1::string::String, + message: string::String, } NewMessage { - message: 0x1::string::String, + message: string::String, } } } diff --git a/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp b/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp index 5ad35eeb9ecae..450d583197d37 100644 --- a/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp +++ b/third_party/move/move-compiler-v2/tests/control-flow-simplification/jump-label.on.exp @@ -3,20 +3,20 @@ [variant baseline] fun test::test<#0>($t0: vector): #0 { var $t1: #0 - var $t2: 0x1::string::String + var $t2: string::String var $t3: bool - var $t4: 0x1::string::String - var $t5: 0x1::string::String + var $t4: string::String + var $t5: string::String var $t6: vector var $t7: bool var $t8: bool - var $t9: 0x1::string::String - var $t10: 0x1::string::String + var $t9: string::String + var $t10: string::String var $t11: vector var $t12: bool var $t13: bool - var $t14: 0x1::string::String - var $t15: 0x1::string::String + var $t14: string::String + var $t15: string::String var $t16: vector var $t17: bool var $t18: u64 @@ -75,8 +75,8 @@ fun test::baz<#0>($t0: vector): #0 { [variant baseline] -fun test::foo<#0>(): 0x1::string::String { - var $t0: 0x1::string::String [unused] +fun test::foo<#0>(): string::String { + var $t0: string::String [unused] var $t1: u64 0: $t1 := 0 1: abort($t1) diff --git a/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp b/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp index f5a73992e920b..5b0883a469c2c 100644 --- a/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp +++ b/third_party/move/move-compiler-v2/tests/copy-propagation/mut_refs_2.exp @@ -1,23 +1,23 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } diff --git a/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp b/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp index 0b75ab964eac4..4497f58bc7399 100644 --- a/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp +++ b/third_party/move/move-compiler-v2/tests/copy-propagation/sequential_assign_struct.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_02.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_02.exp index e2b68c2225ac0..e2edfacaae736 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_02.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_02.exp @@ -1,29 +1,29 @@ ============ initial bytecode ================ [variant baseline] -public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: &0xc0ffee::m::S, $t4: u64): 0xc0ffee::m::Wrap { - var $t5: 0xc0ffee::m::Wrap +public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: &m::S, $t4: u64): m::Wrap { + var $t5: m::Wrap var $t6: u64 var $t7: &u64 - 0: $t7 := borrow_field<0xc0ffee::m::S>.x($t3) + 0: $t7 := borrow_field.x($t3) 1: $t6 := read_ref($t7) - 2: $t5 := pack 0xc0ffee::m::Wrap($t0, $t1, $t2, $t6, $t4) + 2: $t5 := pack m::Wrap($t0, $t1, $t2, $t6, $t4) 3: return $t5 } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: &0xc0ffee::m::S, $t4: u64): 0xc0ffee::m::Wrap { - var $t5: 0xc0ffee::m::Wrap +public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: &m::S, $t4: u64): m::Wrap { + var $t5: m::Wrap var $t6: u64 var $t7: &u64 # live vars: $t0, $t1, $t2, $t3, $t4 - 0: $t7 := borrow_field<0xc0ffee::m::S>.x($t3) + 0: $t7 := borrow_field.x($t3) # live vars: $t0, $t1, $t2, $t4, $t7 1: $t6 := read_ref($t7) # live vars: $t0, $t1, $t2, $t4, $t6 - 2: $t5 := pack 0xc0ffee::m::Wrap($t0, $t1, $t2, $t6, $t4) + 2: $t5 := pack m::Wrap($t0, $t1, $t2, $t6, $t4) # live vars: $t5 3: return $t5 } diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_03.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_03.exp index a203fca7796c0..05eed01a88bb4 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_03.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_03.exp @@ -1,44 +1,44 @@ ============ initial bytecode ================ [variant baseline] -public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: address, $t4: u64): 0xc0ffee::m::Wrap { - var $t5: 0xc0ffee::m::Wrap - var $t6: &0xc0ffee::m::S +public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: address, $t4: u64): m::Wrap { + var $t5: m::Wrap + var $t6: &m::S var $t7: u64 var $t8: &u64 var $t9: u64 var $t10: &u64 - 0: $t6 := borrow_global<0xc0ffee::m::S>($t3) - 1: $t8 := borrow_field<0xc0ffee::m::S>.x($t6) + 0: $t6 := borrow_global($t3) + 1: $t8 := borrow_field.x($t6) 2: $t7 := read_ref($t8) - 3: $t10 := borrow_field<0xc0ffee::m::S>.y($t6) + 3: $t10 := borrow_field.y($t6) 4: $t9 := read_ref($t10) - 5: $t5 := pack 0xc0ffee::m::Wrap($t0, $t1, $t2, $t7, $t4, $t9) + 5: $t5 := pack m::Wrap($t0, $t1, $t2, $t7, $t4, $t9) 6: return $t5 } ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: address, $t4: u64): 0xc0ffee::m::Wrap { - var $t5: 0xc0ffee::m::Wrap - var $t6: &0xc0ffee::m::S +public fun m::make($t0: u64, $t1: u64, $t2: u64, $t3: address, $t4: u64): m::Wrap { + var $t5: m::Wrap + var $t6: &m::S var $t7: u64 var $t8: &u64 var $t9: u64 var $t10: &u64 [unused] # live vars: $t0, $t1, $t2, $t3, $t4 - 0: $t6 := borrow_global<0xc0ffee::m::S>($t3) + 0: $t6 := borrow_global($t3) # live vars: $t0, $t1, $t2, $t4, $t6 - 1: $t8 := borrow_field<0xc0ffee::m::S>.x($t6) + 1: $t8 := borrow_field.x($t6) # live vars: $t0, $t1, $t2, $t4, $t6, $t8 2: $t7 := read_ref($t8) # live vars: $t0, $t1, $t2, $t4, $t6, $t7 - 3: $t8 := borrow_field<0xc0ffee::m::S>.y($t6) + 3: $t8 := borrow_field.y($t6) # live vars: $t0, $t1, $t2, $t4, $t7, $t8 4: $t9 := read_ref($t8) # live vars: $t0, $t1, $t2, $t4, $t7, $t9 - 5: $t5 := pack 0xc0ffee::m::Wrap($t0, $t1, $t2, $t7, $t4, $t9) + 5: $t5 := pack m::Wrap($t0, $t1, $t2, $t7, $t4, $t9) # live vars: $t5 6: return $t5 } diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_04.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_04.exp index 9aa46823a704c..50399a3d72650 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_04.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_04.exp @@ -1,31 +1,31 @@ ============ initial bytecode ================ [variant baseline] -fun m::bar($t0: &signer, $t1: &mut u64, $t2: 0xc0ffee::m::Wrap) { +fun m::bar($t0: &signer, $t1: &mut u64, $t2: m::Wrap) { 0: return () } [variant baseline] public fun m::test($t0: signer, $t1: address) { - var $t2: &mut 0xc0ffee::m::Wrap + var $t2: &mut m::Wrap var $t3: &signer var $t4: &mut u64 - var $t5: 0xc0ffee::m::Wrap + var $t5: m::Wrap var $t6: u64 var $t7: u64 var $t8: u64 var $t9: u64 var $t10: u64 - 0: $t2 := borrow_global<0xc0ffee::m::Wrap>($t1) + 0: $t2 := borrow_global($t1) 1: $t3 := borrow_local($t0) - 2: $t4 := borrow_field<0xc0ffee::m::Wrap>.a($t2) + 2: $t4 := borrow_field.a($t2) 3: $t6 := 0 4: $t7 := 0 5: $t9 := 0 6: $t8 := m::zero($t9) 7: $t10 := 0 - 8: $t5 := pack 0xc0ffee::m::Wrap($t6, $t7, $t8, $t10) + 8: $t5 := pack m::Wrap($t6, $t7, $t8, $t10) 9: m::bar($t3, $t4, $t5) 10: return () } @@ -41,7 +41,7 @@ fun m::zero($t0: u64): u64 { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun m::bar($t0: &signer, $t1: &mut u64, $t2: 0xc0ffee::m::Wrap) { +fun m::bar($t0: &signer, $t1: &mut u64, $t2: m::Wrap) { # live vars: $t0, $t1, $t2 0: drop($t0) # live vars: $t1 @@ -53,21 +53,21 @@ fun m::bar($t0: &signer, $t1: &mut u64, $t2: 0xc0ffee::m::Wrap) { [variant baseline] public fun m::test($t0: signer, $t1: address) { - var $t2: &mut 0xc0ffee::m::Wrap + var $t2: &mut m::Wrap var $t3: &signer var $t4: &mut u64 - var $t5: 0xc0ffee::m::Wrap + var $t5: m::Wrap var $t6: u64 var $t7: u64 var $t8: u64 [unused] var $t9: u64 var $t10: u64 # live vars: $t0, $t1 - 0: $t2 := borrow_global<0xc0ffee::m::Wrap>($t1) + 0: $t2 := borrow_global($t1) # live vars: $t0, $t2 1: $t3 := borrow_local($t0) # live vars: $t2, $t3 - 2: $t4 := borrow_field<0xc0ffee::m::Wrap>.a($t2) + 2: $t4 := borrow_field.a($t2) # live vars: $t3, $t4 3: $t6 := 0 # live vars: $t3, $t4, $t6 @@ -79,7 +79,7 @@ public fun m::test($t0: signer, $t1: address) { # live vars: $t3, $t4, $t6, $t7, $t9 7: $t10 := 0 # live vars: $t3, $t4, $t6, $t7, $t9, $t10 - 8: $t5 := pack 0xc0ffee::m::Wrap($t6, $t7, $t9, $t10) + 8: $t5 := pack m::Wrap($t6, $t7, $t9, $t10) # live vars: $t3, $t4, $t5 9: m::bar($t3, $t4, $t5) # live vars: diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_05.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_05.exp index df80a414a62d7..5553bcae1bd3d 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_05.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_05.exp @@ -7,18 +7,18 @@ fun m::foo($t0: &signer, $t1: u64, $t2: u64) { [variant baseline] -public fun m::test($t0: &signer, $t1: 0xc0ffee::m::S) { +public fun m::test($t0: &signer, $t1: m::S) { var $t2: u64 - var $t3: &0xc0ffee::m::S + var $t3: &m::S var $t4: &u64 var $t5: u64 - var $t6: &0xc0ffee::m::S + var $t6: &m::S var $t7: &u64 0: $t3 := borrow_local($t1) - 1: $t4 := borrow_field<0xc0ffee::m::S>.a($t3) + 1: $t4 := borrow_field.a($t3) 2: $t2 := read_ref($t4) 3: $t6 := borrow_local($t1) - 4: $t7 := borrow_field<0xc0ffee::m::S>.b($t6) + 4: $t7 := borrow_field.b($t6) 5: $t5 := read_ref($t7) 6: m::foo($t0, $t2, $t5) 7: return () @@ -36,23 +36,23 @@ fun m::foo($t0: &signer, $t1: u64, $t2: u64) { [variant baseline] -public fun m::test($t0: &signer, $t1: 0xc0ffee::m::S) { +public fun m::test($t0: &signer, $t1: m::S) { var $t2: u64 - var $t3: &0xc0ffee::m::S + var $t3: &m::S var $t4: &u64 var $t5: u64 - var $t6: &0xc0ffee::m::S [unused] + var $t6: &m::S [unused] var $t7: &u64 [unused] # live vars: $t0, $t1 0: $t3 := borrow_local($t1) # live vars: $t0, $t1, $t3 - 1: $t4 := borrow_field<0xc0ffee::m::S>.a($t3) + 1: $t4 := borrow_field.a($t3) # live vars: $t0, $t1, $t4 2: $t2 := read_ref($t4) # live vars: $t0, $t1, $t2 3: $t3 := borrow_local($t1) # live vars: $t0, $t2, $t3 - 4: $t4 := borrow_field<0xc0ffee::m::S>.b($t3) + 4: $t4 := borrow_field.b($t3) # live vars: $t0, $t2, $t4 5: $t5 := read_ref($t4) # live vars: $t0, $t2, $t5 diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_06.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_06.exp index f55c5a103ba6d..53d62687c4b3f 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_06.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_06.exp @@ -1,10 +1,10 @@ ============ initial bytecode ================ [variant baseline] -fun m::bar($t0: &mut 0xc0ffee::m::S, $t1: u64): u64 { +fun m::bar($t0: &mut m::S, $t1: u64): u64 { var $t2: u64 var $t3: &mut u64 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) 1: write_ref($t3, $t1) 2: $t2 := infer($t1) 3: return $t2 @@ -12,30 +12,30 @@ fun m::bar($t0: &mut 0xc0ffee::m::S, $t1: u64): u64 { [variant baseline] -fun m::destroy($t0: 0xc0ffee::m::S) { +fun m::destroy($t0: m::S) { var $t1: u64 - 0: $t1 := unpack 0xc0ffee::m::S($t0) + 0: $t1 := unpack m::S($t0) 1: return () } [variant baseline] -fun m::foo($t0: &mut 0xc0ffee::m::S, $t1: u64) { +fun m::foo($t0: &mut m::S, $t1: u64) { var $t2: &mut u64 - 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t2 := borrow_field.x($t0) 1: write_ref($t2, $t1) 2: return () } [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: 0xc0ffee::m::S) { +public fun m::test($t0: &mut m::S, $t1: m::S) { var $t2: u64 var $t3: bool var $t4: u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &mut 0xc0ffee::m::S + var $t7: &mut m::S var $t8: u64 var $t9: u64 0: $t2 := 0 @@ -64,11 +64,11 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: 0xc0ffee::m::S) { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun m::bar($t0: &mut 0xc0ffee::m::S, $t1: u64): u64 { +fun m::bar($t0: &mut m::S, $t1: u64): u64 { var $t2: u64 [unused] var $t3: &mut u64 # live vars: $t0, $t1 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) # live vars: $t1, $t3 1: write_ref($t3, $t1) # live vars: $t1 @@ -77,20 +77,20 @@ fun m::bar($t0: &mut 0xc0ffee::m::S, $t1: u64): u64 { [variant baseline] -fun m::destroy($t0: 0xc0ffee::m::S) { +fun m::destroy($t0: m::S) { var $t1: u64 # live vars: $t0 - 0: $t1 := unpack 0xc0ffee::m::S($t0) + 0: $t1 := unpack m::S($t0) # live vars: 1: return () } [variant baseline] -fun m::foo($t0: &mut 0xc0ffee::m::S, $t1: u64) { +fun m::foo($t0: &mut m::S, $t1: u64) { var $t2: &mut u64 # live vars: $t0, $t1 - 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t2 := borrow_field.x($t0) # live vars: $t1, $t2 1: write_ref($t2, $t1) # live vars: @@ -99,13 +99,13 @@ fun m::foo($t0: &mut 0xc0ffee::m::S, $t1: u64) { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: 0xc0ffee::m::S) { +public fun m::test($t0: &mut m::S, $t1: m::S) { var $t2: u64 var $t3: bool var $t4: u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 [unused] - var $t7: &mut 0xc0ffee::m::S + var $t7: &mut m::S var $t8: u64 [unused] var $t9: u64 [unused] # live vars: $t0, $t1 diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_07.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_07.exp index 2b2cd73ef54e5..4140b4d006add 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_07.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_07.exp @@ -17,7 +17,7 @@ fun m::foo($t0: &mut u64, $t1: u64): &mut u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: &mut u64 var $t3: &mut u64 var $t4: u64 @@ -26,12 +26,12 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t7: u64 var $t8: u64 var $t9: &u64 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) - 1: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 0: $t3 := borrow_field.x($t0) + 1: $t6 := borrow_field.y($t0) 2: $t5 := read_ref($t6) 3: $t4 := /($t1, $t5) 4: $t2 := m::foo($t3, $t4) - 5: $t9 := borrow_field<0xc0ffee::m::S>.y($t0) + 5: $t9 := borrow_field.y($t0) 6: $t8 := read_ref($t9) 7: $t7 := /($t1, $t8) 8: m::bar($t2, $t7) @@ -60,7 +60,7 @@ fun m::foo($t0: &mut u64, $t1: u64): &mut u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: &mut u64 [unused] var $t3: &mut u64 var $t4: u64 [unused] @@ -70,9 +70,9 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t8: u64 [unused] var $t9: &u64 [unused] # live vars: $t0, $t1 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) # live vars: $t0, $t1, $t3 - 1: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 1: $t6 := borrow_field.y($t0) # live vars: $t0, $t1, $t3, $t6 2: $t5 := read_ref($t6) # live vars: $t0, $t1, $t3, $t5 @@ -80,7 +80,7 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { # live vars: $t0, $t1, $t3, $t5 4: $t3 := m::foo($t3, $t5) # live vars: $t0, $t1, $t3 - 5: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 5: $t6 := borrow_field.y($t0) # live vars: $t1, $t3, $t6 6: $t5 := read_ref($t6) # live vars: $t1, $t3, $t5 diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_08.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_08.exp index f8557d046d801..dad8871f91918 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_08.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_08.exp @@ -15,7 +15,7 @@ fun m::foo($t0: &u64, $t1: u64): &u64 { [variant baseline] -public fun m::test($t0: &0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &m::S, $t1: u64) { var $t2: &u64 var $t3: &u64 var $t4: u64 @@ -24,12 +24,12 @@ public fun m::test($t0: &0xc0ffee::m::S, $t1: u64) { var $t7: u64 var $t8: u64 var $t9: &u64 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) - 1: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 0: $t3 := borrow_field.x($t0) + 1: $t6 := borrow_field.y($t0) 2: $t5 := read_ref($t6) 3: $t4 := /($t1, $t5) 4: $t2 := m::foo($t3, $t4) - 5: $t9 := borrow_field<0xc0ffee::m::S>.y($t0) + 5: $t9 := borrow_field.y($t0) 6: $t8 := read_ref($t9) 7: $t7 := /($t1, $t8) 8: m::bar($t2, $t7) @@ -56,7 +56,7 @@ fun m::foo($t0: &u64, $t1: u64): &u64 { [variant baseline] -public fun m::test($t0: &0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &m::S, $t1: u64) { var $t2: &u64 [unused] var $t3: &u64 var $t4: u64 [unused] @@ -66,9 +66,9 @@ public fun m::test($t0: &0xc0ffee::m::S, $t1: u64) { var $t8: u64 [unused] var $t9: &u64 [unused] # live vars: $t0, $t1 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) # live vars: $t0, $t1, $t3 - 1: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 1: $t6 := borrow_field.y($t0) # live vars: $t0, $t1, $t3, $t6 2: $t5 := read_ref($t6) # live vars: $t0, $t1, $t3, $t5 @@ -76,7 +76,7 @@ public fun m::test($t0: &0xc0ffee::m::S, $t1: u64) { # live vars: $t0, $t1, $t3, $t5 4: $t3 := m::foo($t3, $t5) # live vars: $t0, $t1, $t3 - 5: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 5: $t6 := borrow_field.y($t0) # live vars: $t1, $t3, $t6 6: $t5 := read_ref($t6) # live vars: $t1, $t3, $t5 diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_09.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_09.exp index df94d0ba33f15..65c51a8575388 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_09.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_09.exp @@ -25,7 +25,7 @@ fun m::foo($t0: &u64): u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: u64 var $t3: &u64 var $t4: bool @@ -36,17 +36,17 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t9: &u64 var $t10: &mut u64 var $t11: &mut u64 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) 1: $t2 := m::foo($t3) - 2: $t6 := borrow_field<0xc0ffee::m::S>.x($t0) + 2: $t6 := borrow_field.x($t0) 3: $t5 := read_ref($t6) - 4: $t9 := borrow_field<0xc0ffee::m::S>.y($t0) + 4: $t9 := borrow_field.y($t0) 5: $t8 := read_ref($t9) 6: $t7 := *($t2, $t8) 7: $t4 := ==($t5, $t7) 8: if ($t4) goto 9 else goto 14 9: label L0 - 10: $t11 := borrow_field<0xc0ffee::m::S>.x($t0) + 10: $t11 := borrow_field.x($t0) 11: $t10 := m::bar($t11, $t2) 12: m::baz($t10, $t1) 13: goto 15 @@ -87,7 +87,7 @@ fun m::foo($t0: &u64): u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: u64 var $t3: &u64 var $t4: bool @@ -99,15 +99,15 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t10: &mut u64 [unused] var $t11: &mut u64 # live vars: $t0, $t1 - 0: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t3 := borrow_field.x($t0) # live vars: $t0, $t1, $t3 1: $t2 := m::foo($t3) # live vars: $t0, $t1, $t2 - 2: $t3 := borrow_field<0xc0ffee::m::S>.x($t0) + 2: $t3 := borrow_field.x($t0) # live vars: $t0, $t1, $t2, $t3 3: $t5 := read_ref($t3) # live vars: $t0, $t1, $t2, $t5 - 4: $t3 := borrow_field<0xc0ffee::m::S>.y($t0) + 4: $t3 := borrow_field.y($t0) # live vars: $t0, $t1, $t2, $t3, $t5 5: $t8 := read_ref($t3) # live vars: $t0, $t1, $t2, $t5, $t8 @@ -119,7 +119,7 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { # live vars: $t0, $t1, $t2 9: label L0 # live vars: $t0, $t1, $t2 - 10: $t11 := borrow_field<0xc0ffee::m::S>.x($t0) + 10: $t11 := borrow_field.x($t0) # live vars: $t1, $t2, $t11 11: $t11 := m::bar($t11, $t2) # live vars: $t1, $t11 diff --git a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_10.exp b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_10.exp index ff95289d51c83..ad2834d099ca2 100644 --- a/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_10.exp +++ b/third_party/move/move-compiler-v2/tests/eager-pushes/framework_reduced_10.exp @@ -16,7 +16,7 @@ fun m::foo($t0: &u64): u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: u64 var $t3: u64 var $t4: &u64 @@ -28,16 +28,16 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t10: u64 var $t11: u64 var $t12: u64 - 0: $t4 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t4 := borrow_field.x($t0) 1: $t3 := read_ref($t4) 2: $t2 := /($t1, $t3) - 3: $t6 := borrow_field<0xc0ffee::m::S>.y($t0) + 3: $t6 := borrow_field.y($t0) 4: $t5 := m::foo($t6) 5: label L0 6: $t7 := <($t2, $t5) 7: if ($t7) goto 8 else goto 17 8: label L2 - 9: $t8 := borrow_field<0xc0ffee::m::S>.z($t0) + 9: $t8 := borrow_field.z($t0) 10: $t10 := 1 11: $t9 := -($t2, $t10) 12: m::bar($t8, $t9) @@ -75,7 +75,7 @@ fun m::foo($t0: &u64): u64 { [variant baseline] -public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { +public fun m::test($t0: &mut m::S, $t1: u64) { var $t2: u64 [unused] var $t3: u64 var $t4: &u64 @@ -88,13 +88,13 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { var $t11: u64 [unused] var $t12: u64 [unused] # live vars: $t0, $t1 - 0: $t4 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t4 := borrow_field.x($t0) # live vars: $t0, $t1, $t4 1: $t3 := read_ref($t4) # live vars: $t0, $t1, $t3 2: $t1 := /($t1, $t3) # live vars: $t0, $t1 - 3: $t4 := borrow_field<0xc0ffee::m::S>.y($t0) + 3: $t4 := borrow_field.y($t0) # live vars: $t0, $t1, $t4 4: $t3 := m::foo($t4) # live vars: $t0, $t1, $t3 @@ -106,7 +106,7 @@ public fun m::test($t0: &mut 0xc0ffee::m::S, $t1: u64) { # live vars: $t0, $t1, $t3 8: label L2 # live vars: $t0, $t1, $t3 - 9: $t8 := borrow_field<0xc0ffee::m::S>.z($t0) + 9: $t8 := borrow_field.z($t0) # live vars: $t0, $t1, $t3, $t8 10: $t10 := 1 # live vars: $t0, $t1, $t3, $t8, $t10 diff --git a/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp b/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp index 51166063aa526..5f908c1d91e1b 100644 --- a/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/empty_tvectors.exp @@ -5,8 +5,8 @@ module 0x42::m { use std::vector; public entry fun init() { { - let _: vector<0x1::string::String> = { - let result: vector<0x1::string::String> = Vector<0x1::string::String>(); + let _: vector = { + let result: vector = Vector(); { let (v: vector>): (vector>) = Tuple([]); vector::reverse>(Borrow(Mutable)(v)); @@ -16,7 +16,7 @@ module 0x42::m { let e: vector = vector::pop_back>(Borrow(Mutable)(v)); { let (elem: vector): (vector) = Tuple(e); - vector::push_back<0x1::string::String>(Borrow(Mutable)(result), { + vector::push_back(Borrow(Mutable)(result), { let (key: vector): (vector) = Tuple(elem); string::utf8(key) }) @@ -76,7 +76,7 @@ module 0x42::m { let e = 0x1::vector::pop_back>(&mut v); { let (elem) = (e); - 0x1::vector::push_back<0x1::string::String>(&mut result, { + 0x1::vector::push_back(&mut result, { let (key) = (elem); 0x1::string::utf8(key) }) diff --git a/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp b/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp index f8822d3a0a187..2fdc0b802b5fc 100644 --- a/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp +++ b/third_party/move/move-compiler-v2/tests/folding/nonempty_tvectors.exp @@ -5,8 +5,8 @@ module 0x42::m { use std::vector; public entry fun init() { { - let _: vector<0x1::string::String> = { - let result: vector<0x1::string::String> = Vector<0x1::string::String>(); + let _: vector = { + let result: vector = Vector(); { let (v: vector>): (vector>) = Tuple([Vector([Number(3)])]); vector::reverse>(Borrow(Mutable)(v)); @@ -16,7 +16,7 @@ module 0x42::m { let e: vector = vector::pop_back>(Borrow(Mutable)(v)); { let (elem: vector): (vector) = Tuple(e); - vector::push_back<0x1::string::String>(Borrow(Mutable)(result), { + vector::push_back(Borrow(Mutable)(result), { let (key: vector): (vector) = Tuple(elem); string::utf8(key) }) @@ -76,7 +76,7 @@ module 0x42::m { let e = 0x1::vector::pop_back>(&mut v); { let (elem) = (e); - 0x1::vector::push_back<0x1::string::String>(&mut result, { + 0x1::vector::push_back(&mut result, { let (key) = (elem); 0x1::string::utf8(key) }) diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.lambda.exp index aecce2d0e9059..92770b9697f58 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/basic.lambda.exp @@ -218,114 +218,21 @@ module 0xcafe::m { } // end 0xcafe::m -// -- Model dump after env processor lambda-lifting: -module 0xcafe::m { - private fun map(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun no_name_clash(x: u64,c: u64): u64 { - m::map(x, closure m::no_name_clash$lambda$1(c)) - } - private fun with_name_clash1(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash1$lambda$1(c)) - } - private fun with_name_clash2(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash2$lambda$1(c)) - } - private fun no_name_clash$lambda$1(c: u64,y: u64): u64 { - Add(y, c) - } - private fun with_name_clash1$lambda$1(c: u64,x: u64): u64 { - Add(x, c) - } - private fun with_name_clash2$lambda$1(c: u64,x: u64): u64 { - Add({ - let x: u64 = Add(c, 1); - x - }, x) - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification checker: -module 0xcafe::m { - private fun map(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun no_name_clash(x: u64,c: u64): u64 { - m::map(x, closure m::no_name_clash$lambda$1(c)) - } - private fun with_name_clash1(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash1$lambda$1(c)) - } - private fun with_name_clash2(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash2$lambda$1(c)) - } - private fun no_name_clash$lambda$1(c: u64,y: u64): u64 { - Add(y, c) - } - private fun with_name_clash1$lambda$1(c: u64,x: u64): u64 { - Add(x, c) - } - private fun with_name_clash2$lambda$1(c: u64,x: u64): u64 { - Add({ - let x: u64 = Add(c, 1); - x - }, x) - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification rewriter: -module 0xcafe::m { - private fun map(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun no_name_clash(x: u64,c: u64): u64 { - m::map(x, closure m::no_name_clash$lambda$1(c)) - } - private fun with_name_clash1(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash1$lambda$1(c)) - } - private fun with_name_clash2(x: u64,c: u64): u64 { - m::map(x, closure m::with_name_clash2$lambda$1(c)) - } - private fun no_name_clash$lambda$1(c: u64,y: u64): u64 { - Add(y, c) - } - private fun with_name_clash1$lambda$1(c: u64,x: u64): u64 { - Add(x, c) - } - private fun with_name_clash2$lambda$1(c: u64,x: u64): u64 { - Add({ - let x: u64 = Add(c, 1); - x - }, x) - } -} // end 0xcafe::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda-lifting/basic.move:5:9 - │ -5 │ f(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/basic.move:10:16 │ 10 │ map(x, |y| y + c) │ ^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/basic.move:15:16 │ 15 │ map(x, |x| x + c) │ ^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/basic.move:20:16 │ 20 │ map(x, |x| { diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.lambda.exp index 3664bd2e163bb..989a0f262f376 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/modify.lambda.exp @@ -503,26 +503,52 @@ module 0xcafe::m { Diagnostics: -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda-lifting/modify.move:14:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda-lifting/modify.move:13:16 │ -14 │ x = 2; - │ ^ +13 │ map(x, |y| { + │ ╭────────────────^ +14 │ │ x = 2; +15 │ │ y + c +16 │ │ }) + │ ╰─────────^ -error: captured variable `c` cannot be modified inside of a lambda - ┌─ tests/lambda-lifting/modify.move:21:26 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda-lifting/modify.move:20:16 │ -21 │ let r = &mut c; - │ ^ +20 │ map(x, |y| { + │ ╭────────────────^ +21 │ │ let r = &mut c; +22 │ │ y + *r +23 │ │ }) + │ ╰─────────^ -error: captured variable `z` cannot be modified inside of a lambda - ┌─ tests/lambda-lifting/modify.move:29:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda-lifting/modify.move:28:16 │ -29 │ z = 2; - │ ^ +28 │ map(x, |y| { + │ ╭────────────────^ +29 │ │ z = 2; +30 │ │ y + c +31 │ │ }) + │ ╰─────────^ -error: captured variable `z` cannot be modified inside of a lambda - ┌─ tests/lambda-lifting/modify.move:37:26 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda-lifting/modify.move:36:16 │ -37 │ let r = &mut z; - │ ^ +36 │ map(x, |y| { + │ ╭────────────────^ +37 │ │ let r = &mut z; +38 │ │ y + *r +39 │ │ }) + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda-lifting/modify.move:44:16 + │ +44 │ map(x, |y| { + │ ╭────────────────^ +45 │ │ let r = &z; +46 │ │ y + *r +47 │ │ }) + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.lambda.exp index cb00e1c4256e8..6c180672b04c3 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/nested.lambda.exp @@ -152,87 +152,15 @@ module 0xcafe::m { } // end 0xcafe::m -// -- Model dump after env processor lambda-lifting: -module 0xcafe::m { - private fun map1(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun map2(x: u8,f: |u8|u8): u8 { - (f)(x) - } - private fun nested(x: u64,c: u64): u64 { - m::map1(x, closure m::nested$lambda$2(c)) - } - private fun nested$lambda$1(c: u64,y: u8): u8 { - Add(y, Cast(c)) - } - private fun nested$lambda$2(c: u64,y: u64): u64 { - Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification checker: -module 0xcafe::m { - private fun map1(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun map2(x: u8,f: |u8|u8): u8 { - (f)(x) - } - private fun nested(x: u64,c: u64): u64 { - m::map1(x, closure m::nested$lambda$2(c)) - } - private fun nested$lambda$1(c: u64,y: u8): u8 { - Add(y, Cast(c)) - } - private fun nested$lambda$2(c: u64,y: u64): u64 { - Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification rewriter: -module 0xcafe::m { - private fun map1(x: u64,f: |u64|u64): u64 { - (f)(x) - } - private fun map2(x: u8,f: |u8|u8): u8 { - (f)(x) - } - private fun nested(x: u64,c: u64): u64 { - m::map1(x, closure m::nested$lambda$2(c)) - } - private fun nested$lambda$1(c: u64,y: u8): u8 { - Add(y, Cast(c)) - } - private fun nested$lambda$2(c: u64,y: u64): u64 { - Cast(m::map2(Cast(Sub(y, c)), closure m::nested$lambda$1(c))) - } -} // end 0xcafe::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda-lifting/nested.move:5:9 - │ -5 │ f(x) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda-lifting/nested.move:10:9 - │ -10 │ f(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/nested.move:15:42 │ 15 │ map1(x, |y| (map2((y - c as u8), |y| y + (c as u8)) as u64)) │ ^^^^^^^^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/nested.move:15:17 │ 15 │ map1(x, |y| (map2((y - c as u8), |y| y + (c as u8)) as u64)) diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.lambda.exp index 6a897fa9ce92d..3f1c75d9bb2d9 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.lambda.exp @@ -185,84 +185,9 @@ module 0xcafe::m { } // end 0xcafe::m -// -- Model dump after env processor lambda-lifting: -module 0xcafe::m { - struct S { - x: T, - } - private fun consume(s: S,x: T,f: |(S, T)|T): T { - (f)(s, x) - } - private fun pattern(s: S,x: u64): u64 { - m::consume(s, x, closure m::pattern$lambda$1()) - } - private fun pattern$lambda$1(param$0: S,_y: u64): u64 { - { - let m::S{ x } = param$0; - { - let y: u64 = x; - Add(x, y) - } - } - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification checker: -module 0xcafe::m { - struct S { - x: T, - } - private fun consume(s: S,x: T,f: |(S, T)|T): T { - (f)(s, x) - } - private fun pattern(s: S,x: u64): u64 { - m::consume(s, x, closure m::pattern$lambda$1()) - } - private fun pattern$lambda$1(param$0: S,_y: u64): u64 { - { - let m::S{ x } = param$0; - { - let y: u64 = x; - Add(x, y) - } - } - } -} // end 0xcafe::m - - -// -- Model dump after env processor specification rewriter: -module 0xcafe::m { - struct S { - x: T, - } - private fun consume(s: S,x: T,f: |(S, T)|T): T { - (f)(s, x) - } - private fun pattern(s: S,x: u64): u64 { - m::consume(s, x, closure m::pattern$lambda$1()) - } - private fun pattern$lambda$1(param$0: S,_y: u64): u64 { - { - let m::S{ x } = param$0; - { - let y: u64 = x; - Add(x, y) - } - } - } -} // end 0xcafe::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda-lifting/pattern.move:10:9 - │ -10 │ f(s, x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda-lifting/pattern.move:15:23 │ 15 │ consume(s, x, |S{x}, _y| { let y = x; x + y}) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/break_continue_in_lambda.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/break_continue_in_lambda.lambda.exp index 356f716bf1076..7c68b7f60b418 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/break_continue_in_lambda.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/break_continue_in_lambda.lambda.exp @@ -1043,364 +1043,22 @@ module 0xc0ffee::m { } // end 0xc0ffee::m -// -- Model dump after env processor lambda-lifting: -module 0xc0ffee::m { - public fun bar(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk2(closure m::bar$lambda$1()); - m::brk2(closure m::bar$lambda$2()); - m::brk2(closure m::bar$lambda$3()); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun brk() { - break; - Tuple() - } - private fun brk2(f: |()|) { - (f)(); - Tuple() - } - private fun brk3() { - loop { - if true { - break; - Tuple() - } else { - break - } - } - } - private fun brk4() { - loop { - if true { - continue; - Tuple() - } else { - break - } - } - } - private fun broken() { - break; - Tuple() - } - private fun continued() { - continue; - Tuple() - } - public fun foo(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk(); - m::brk3(); - m::brk4(); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun bar$lambda$1() { - break - } - private fun bar$lambda$2() { - loop { - if true { - break - } else { - break - } - } - } - private fun bar$lambda$3() { - loop { - if true { - continue - } else { - break - } - } - } -} // end 0xc0ffee::m - - -// -- Model dump after env processor specification checker: -module 0xc0ffee::m { - public fun bar(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk2(closure m::bar$lambda$1()); - m::brk2(closure m::bar$lambda$2()); - m::brk2(closure m::bar$lambda$3()); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun brk() { - break; - Tuple() - } - private fun brk2(f: |()|) { - (f)(); - Tuple() - } - private fun brk3() { - loop { - if true { - break; - Tuple() - } else { - break - } - } - } - private fun brk4() { - loop { - if true { - continue; - Tuple() - } else { - break - } - } - } - private fun broken() { - break; - Tuple() - } - private fun continued() { - continue; - Tuple() - } - public fun foo(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk(); - m::brk3(); - m::brk4(); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun bar$lambda$1() { - break - } - private fun bar$lambda$2() { - loop { - if true { - break - } else { - break - } - } - } - private fun bar$lambda$3() { - loop { - if true { - continue - } else { - break - } - } - } -} // end 0xc0ffee::m - - -// -- Model dump after env processor specification rewriter: -module 0xc0ffee::m { - public fun bar(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk2(closure m::bar$lambda$1()); - m::brk2(closure m::bar$lambda$2()); - m::brk2(closure m::bar$lambda$3()); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun brk() { - break; - Tuple() - } - private fun brk2(f: |()|) { - (f)(); - Tuple() - } - private fun brk3() { - loop { - if true { - break; - Tuple() - } else { - break - } - } - } - private fun brk4() { - loop { - if true { - continue; - Tuple() - } else { - break - } - } - } - private fun broken() { - break; - Tuple() - } - private fun continued() { - continue; - Tuple() - } - public fun foo(): u64 { - { - let i: u64 = 0; - loop { - if Lt(i, 10) { - i: u64 = Add(i, 1); - if Eq(i, 5) { - m::brk(); - m::brk3(); - m::brk4(); - Tuple() - } else { - Tuple() - } - } else { - break - } - }; - i - } - } - private fun bar$lambda$1() { - break - } - private fun bar$lambda$2() { - loop { - if true { - break - } else { - break - } - } - } - private fun bar$lambda$3() { - loop { - if true { - continue - } else { - break - } - } - } -} // end 0xc0ffee::m - - Diagnostics: -error: missing enclosing loop statement - ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:3:9 - │ -3 │ break; - │ ^^^^^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:7:9 - │ -7 │ f(); - │ ^ - -error: missing enclosing loop statement - ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:40:26 - │ -40 │ brk2(| | break); - │ ^^^^^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:40:22 │ 40 │ brk2(| | break); │ ^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:41:8 │ 41 │ brk2(| | while (true) { break }); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:42:8 │ 42 │ brk2(| | while (true) { continue }); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: missing enclosing loop statement - ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:49:2 - │ -49 │ break; - │ ^^^^^ - -error: missing enclosing loop statement - ┌─ tests/lambda/inline-parity/break_continue_in_lambda.move:53:2 - │ -53 │ continue; - │ ^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991.lambda.exp index fea2410cdc948..b6033f5c4d799 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991.lambda.exp @@ -174,111 +174,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 110) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 110) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 110) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991.move:4:9 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991.move:4:20 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991.move:8:21 │ 8 │ assert!(foo(|x, _| x, |_, y| y, 10, 100) == 110, 0); │ ^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991.move:8:31 │ 8 │ assert!(foo(|x, _| x, |_, y| y, 10, 100) == 110, 0); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam.lambda.exp index b1ce2d980a7d7..f6349e5c41ca1 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam.lambda.exp @@ -174,129 +174,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 3 - } - } - } - private fun test$lambda$2(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 10 - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 3 - } - } - } - private fun test$lambda$2(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 10 - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 3 - } - } - } - private fun test$lambda$2(param$0: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - { - let _: u64 = param$0; - 10 - } - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991_noparam.move:4:9 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991_noparam.move:4:20 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991_noparam.move:8:21 │ 8 │ assert!(foo(|_, _| 3, |_, _| 10, 10, 100) == 13, 0); │ ^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991_noparam.move:8:31 │ 8 │ assert!(foo(|_, _| 3, |_, _| 10, 10, 100) == 13, 0); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam2.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam2.lambda.exp index f0eec150641eb..1fe73e99a79a0 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam2.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991_noparam2.lambda.exp @@ -174,111 +174,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |u64|u64,g: |u64|u64,x: u64,_: u64): u64 { - Add((f)(x), (g)(x)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } - private fun test$lambda$2(param$0: u64): u64 { - { - let _: u64 = param$0; - 10 - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |u64|u64,g: |u64|u64,x: u64,_: u64): u64 { - Add((f)(x), (g)(x)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } - private fun test$lambda$2(param$0: u64): u64 { - { - let _: u64 = param$0; - 10 - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |u64|u64,g: |u64|u64,x: u64,_: u64): u64 { - Add((f)(x), (g)(x)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 10, 100), 13) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } - private fun test$lambda$2(param$0: u64): u64 { - { - let _: u64 = param$0; - 10 - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991_noparam2.move:4:9 - │ -4 │ f(x) + g(x) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991_noparam2.move:4:16 - │ -4 │ f(x) + g(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991_noparam2.move:8:21 │ 8 │ assert!(foo(|_| 3, |_| 10, 10, 100) == 13, 0); │ ^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991_noparam2.move:8:28 │ 8 │ assert!(foo(|_| 3, |_| 10, 10, 100) == 13, 0); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991a.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991a.lambda.exp index 172a728293cdf..f663404ad3a6a 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991a.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991a.lambda.exp @@ -174,153 +174,27 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,h: |(u64, u64)|u64,i: |(u64, u64)|u64,x: u64,y: u64): u64 { - Add(Add(Add((f)(x, y), (g)(x, y)), (h)(x, y)), (i)(x, y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), closure Test::test$lambda$3(), closure Test::test$lambda$4(), 10, 100), 220) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } - private fun test$lambda$3(a: u64,_b: u64): u64 { - a - } - private fun test$lambda$4(_c: u64,d: u64): u64 { - d - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,h: |(u64, u64)|u64,i: |(u64, u64)|u64,x: u64,y: u64): u64 { - Add(Add(Add((f)(x, y), (g)(x, y)), (h)(x, y)), (i)(x, y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), closure Test::test$lambda$3(), closure Test::test$lambda$4(), 10, 100), 220) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } - private fun test$lambda$3(a: u64,_b: u64): u64 { - a - } - private fun test$lambda$4(_c: u64,d: u64): u64 { - d - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,h: |(u64, u64)|u64,i: |(u64, u64)|u64,x: u64,y: u64): u64 { - Add(Add(Add((f)(x, y), (g)(x, y)), (h)(x, y)), (i)(x, y)) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), closure Test::test$lambda$3(), closure Test::test$lambda$4(), 10, 100), 220) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun test$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } - private fun test$lambda$3(a: u64,_b: u64): u64 { - a - } - private fun test$lambda$4(_c: u64,d: u64): u64 { - d - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991a.move:6:13 - │ -6 │ f(x, y) + g(x, y) + h(x, y) + i(x, y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991a.move:6:23 - │ -6 │ f(x, y) + g(x, y) + h(x, y) + i(x, y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991a.move:6:33 - │ -6 │ f(x, y) + g(x, y) + h(x, y) + i(x, y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991a.move:6:43 - │ -6 │ f(x, y) + g(x, y) + h(x, y) + i(x, y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991a.move:10:21 │ 10 │ assert!(foo(|x, _| x, |_, y| y, │ ^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991a.move:10:31 │ 10 │ assert!(foo(|x, _| x, |_, y| y, │ ^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991a.move:11:6 │ 11 │ |a, _b| a, |_c, d| d, │ ^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991a.move:11:17 │ 11 │ |a, _b| a, |_c, d| d, diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991b.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991b.lambda.exp index 4d75c19204ac0..8e8d7d83ebbcc 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991b.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991b.lambda.exp @@ -174,81 +174,9 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - (g)(x, _y) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100), 100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - (g)(x, _y) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100), 100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - (g)(x, _y) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100), 100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991b.move:4:9 - │ -4 │ g(x, _y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991b.move:8:21 │ 8 │ assert!(foo(|_, y| y, diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991c.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991c.lambda.exp index 486526cead33b..9f12751a6a6f4 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991c.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/bug_10991c.lambda.exp @@ -174,90 +174,9 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(g: |(u64, u64, u64, u64)|u64,x: u64,y: u64,z: u64,q: u64): u64 { - (g)(x, y, z, q) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100, 1000, 10000), 10100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64,param$2: u64,q: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - Add(y, q) - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(g: |(u64, u64, u64, u64)|u64,x: u64,y: u64,z: u64,q: u64): u64 { - (g)(x, y, z, q) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100, 1000, 10000), 10100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64,param$2: u64,q: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - Add(y, q) - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(g: |(u64, u64, u64, u64)|u64,x: u64,y: u64,z: u64,q: u64): u64 { - (g)(x, y, z, q) - } - public fun test() { - if Eq(Test::foo(closure Test::test$lambda$1(), 10, 100, 1000, 10000), 10100) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - private fun test$lambda$1(param$0: u64,y: u64,param$2: u64,q: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - Add(y, q) - } - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/bug_10991c.move:4:9 - │ -4 │ g(x, y, z, q) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/bug_10991c.move:8:21 │ 8 │ assert!(foo(|_, y, _, q| y + q, diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/dotdot_valid.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/dotdot_valid.lambda.exp index de57ae7f20e1a..6906d3513308f 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/dotdot_valid.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/dotdot_valid.lambda.exp @@ -3265,940 +3265,9 @@ module 0x42::test { } // end 0x42::test -// -- Model dump after env processor lambda-lifting: -module 0x42::test { - enum E1 { - A { - 0: u8, - 1: bool, - } - B { - 0: u8, - } - C { - x: u8, - y: S1, - } - } - struct S0 { - dummy_field: bool, - } - struct S1 { - 0: u8, - } - struct S2 { - 0: bool, - 1: S0, - } - struct S3 { - x: bool, - y: u8, - } - struct S4 { - x: T, - y: S3, - } - struct S5 { - 0: T, - 1: U, - } - struct S6 { - x: T, - y: U, - } - struct S7 { - 0: u8, - 1: u16, - 2: u32, - 3: u64, - } - private fun lambda_param(f: |S2|bool): bool { - { - let x: S2 = pack test::S2(true, pack test::S0(false)); - (f)(x) - } - } - private fun nested1(x: S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested1_ref(x: &S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested2(x: S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested2_ref(x: &S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested3(x: S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested3_ref(x: &S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested4(x: S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun nested4_ref(x: &S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun simple_0(x: S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_0_ref(x: &S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_1(x: S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_1_ref(x: &mut S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_2(x: S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_2_ref(x: &S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_3(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_3_ref(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_4(x: E1): u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x, y: _ } => { - x - } - } - - } - private fun simple_4_ref(x: &E1): &u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - } - - } - private fun simple_5(x: E1): u8 { - match (x) { - test::E1::A{ 0: _, 1: y } => { - if y { - 1 - } else { - 0 - } - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x: _, y: test::S1{ 0: x } } => { - x - } - } - - } - private fun simple_6(x: &S7) { - { - let test::S7{ 0: _w, 1: _, 2: _, 3: _z } = x; - { - let test::S7{ 0: _w, 1: _x, 2: _y, 3: _z } = x; - Tuple() - } - } - } - private fun test_lambda_param(): bool { - test::lambda_param(closure test::test_lambda_param$lambda$1()) - } - private fun test_lambda_param$lambda$1(param$0: S2): bool { - { - let test::S2{ 0: x, 1: _ } = param$0; - x - } - } -} // end 0x42::test - - -// -- Model dump after env processor specification checker: -module 0x42::test { - enum E1 { - A { - 0: u8, - 1: bool, - } - B { - 0: u8, - } - C { - x: u8, - y: S1, - } - } - struct S0 { - dummy_field: bool, - } - struct S1 { - 0: u8, - } - struct S2 { - 0: bool, - 1: S0, - } - struct S3 { - x: bool, - y: u8, - } - struct S4 { - x: T, - y: S3, - } - struct S5 { - 0: T, - 1: U, - } - struct S6 { - x: T, - y: U, - } - struct S7 { - 0: u8, - 1: u16, - 2: u32, - 3: u64, - } - private fun lambda_param(f: |S2|bool): bool { - { - let x: S2 = pack test::S2(true, pack test::S0(false)); - (f)(x) - } - } - private fun nested1(x: S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested1_ref(x: &S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested2(x: S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested2_ref(x: &S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested3(x: S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested3_ref(x: &S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested4(x: S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun nested4_ref(x: &S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun simple_0(x: S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_0_ref(x: &S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_1(x: S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_1_ref(x: &mut S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_2(x: S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_2_ref(x: &S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_3(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_3_ref(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_4(x: E1): u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x, y: _ } => { - x - } - } - - } - private fun simple_4_ref(x: &E1): &u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - } - - } - private fun simple_5(x: E1): u8 { - match (x) { - test::E1::A{ 0: _, 1: y } => { - if y { - 1 - } else { - 0 - } - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x: _, y: test::S1{ 0: x } } => { - x - } - } - - } - private fun simple_6(x: &S7) { - { - let test::S7{ 0: _w, 1: _, 2: _, 3: _z } = x; - { - let test::S7{ 0: _w, 1: _x, 2: _y, 3: _z } = x; - Tuple() - } - } - } - private fun test_lambda_param(): bool { - test::lambda_param(closure test::test_lambda_param$lambda$1()) - } - private fun test_lambda_param$lambda$1(param$0: S2): bool { - { - let test::S2{ 0: x, 1: _ } = param$0; - x - } - } -} // end 0x42::test - - -// -- Model dump after env processor specification rewriter: -module 0x42::test { - enum E1 { - A { - 0: u8, - 1: bool, - } - B { - 0: u8, - } - C { - x: u8, - y: S1, - } - } - struct S0 { - dummy_field: bool, - } - struct S1 { - 0: u8, - } - struct S2 { - 0: bool, - 1: S0, - } - struct S3 { - x: bool, - y: u8, - } - struct S4 { - x: T, - y: S3, - } - struct S5 { - 0: T, - 1: U, - } - struct S6 { - x: T, - y: U, - } - struct S7 { - 0: u8, - 1: u16, - 2: u32, - 3: u64, - } - private fun lambda_param(f: |S2|bool): bool { - { - let x: S2 = pack test::S2(true, pack test::S0(false)); - (f)(x) - } - } - private fun nested1(x: S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested1_ref(x: &S4) { - { - let test::S4{ x: _x, y: _ } = x; - { - let test::S4{ x: _, y: _y } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _x, y: _ } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - { - let test::S4{ x: _, y: test::S3{ x: _, y: _y } } = x; - { - let test::S4{ x: _x2, y: test::S3{ x: _x1, y: _ } } = x; - Tuple() - } - } - } - } - } - } - } - } - private fun nested2(x: S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested2_ref(x: &S5) { - { - let test::S5{ 0: _, 1: test::S1{ 0: _ } } = x; - Tuple() - } - } - private fun nested3(x: S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested3_ref(x: &S5>) { - { - let test::S5>{ 0: _, 1: test::S4{ x: _, y: _ } } = x; - Tuple() - } - } - private fun nested4(x: S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun nested4_ref(x: &S4) { - { - let test::S4{ x: test::S1{ 0: _ }, y: _ } = x; - Tuple() - } - } - private fun simple_0(x: S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_0_ref(x: &S0) { - { - let test::S0{ dummy_field: _ } = x; - Tuple() - } - } - private fun simple_1(x: S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_1_ref(x: &mut S1) { - { - let test::S1{ 0: _ } = x; - Tuple() - } - } - private fun simple_2(x: S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_2_ref(x: &S2) { - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _ } = x; - { - let test::S2{ 0: _, 1: _x } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _, 1: _ } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - { - let test::S2{ 0: _x, 1: _y } = x; - Tuple() - } - } - } - } - } - } - } - } - } - private fun simple_3(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_3_ref(x: S3) { - { - let test::S3{ x: _, y: _ } = x; - { - let test::S3{ x: _x, y: _ } = x; - { - let test::S3{ x: _, y: _y } = x; - Tuple() - } - } - } - } - private fun simple_4(x: E1): u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x, y: _ } => { - x - } - } - - } - private fun simple_4_ref(x: &E1): &u8 { - match (x) { - test::E1::A{ 0: x, 1: _ } => { - x - } - test::E1::B{ 0: x } => { - x - } - } - - } - private fun simple_5(x: E1): u8 { - match (x) { - test::E1::A{ 0: _, 1: y } => { - if y { - 1 - } else { - 0 - } - } - test::E1::B{ 0: x } => { - x - } - test::E1::C{ x: _, y: test::S1{ 0: x } } => { - x - } - } - - } - private fun simple_6(x: &S7) { - { - let test::S7{ 0: _w, 1: _, 2: _, 3: _z } = x; - { - let test::S7{ 0: _w, 1: _x, 2: _y, 3: _z } = x; - Tuple() - } - } - } - private fun test_lambda_param(): bool { - test::lambda_param(closure test::test_lambda_param$lambda$1()) - } - private fun test_lambda_param$lambda$1(param$0: S2): bool { - { - let test::S2{ 0: x, 1: _ } = param$0; - x - } - } -} // end 0x42::test - - Diagnostics: -error: match not exhaustive - ┌─ tests/lambda/inline-parity/dotdot_valid.move:142:16 - │ -142 │ match (x) { - │ ^ - │ - = missing `E1::C{..}` - -error: match not exhaustive - ┌─ tests/lambda/inline-parity/dotdot_valid.move:153:16 - │ -153 │ match (x) { - │ ^ - │ - = missing `E1::C{..}` - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/dotdot_valid.move:177:9 - │ -177 │ f(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/dotdot_valid.move:181:22 │ 181 │ lambda_param(|S2(x, ..)| x) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eq_inline.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eq_inline.lambda.exp index 7fc8364520041..0027551e42e3a 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eq_inline.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eq_inline.lambda.exp @@ -141,54 +141,6 @@ module 0x42::m { } // end 0x42::m -// -- Model dump after env processor lambda-lifting: -module 0x42::m { - private fun foo(f: |&u64|) { - Tuple() - } - private fun g() { - m::foo(closure m::g$lambda$1()); - Tuple() - } - private fun g$lambda$1(v: &u64) { - Eq(v, Borrow(Immutable)(1)); - Tuple() - } -} // end 0x42::m - - -// -- Model dump after env processor specification checker: -module 0x42::m { - private fun foo(f: |&u64|) { - Tuple() - } - private fun g() { - m::foo(closure m::g$lambda$1()); - Tuple() - } - private fun g$lambda$1(v: &u64) { - Eq(v, Borrow(Immutable)(1)); - Tuple() - } -} // end 0x42::m - - -// -- Model dump after env processor specification rewriter: -module 0x42::m { - private fun foo(f: |&u64|) { - Tuple() - } - private fun g() { - m::foo(closure m::g$lambda$1()); - Tuple() - } - private fun g$lambda$1(v: &u64) { - Eq(v, Borrow(Immutable)(1)); - Tuple() - } -} // end 0x42::m - - Diagnostics: warning: Unused parameter `f`. Consider removing or prefixing with an underscore: `_f` @@ -197,9 +149,7 @@ warning: Unused parameter `f`. Consider removing or prefixing with an underscore 3 │ fun foo(f: |&u64|) { │ ^ - -Diagnostics: -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/eq_inline.move:7:13 │ 7 │ foo(|v| { diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eval_ignored_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eval_ignored_param.lambda.exp index 2bbc4c4bfd603..3f86f6d4bbd8f 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eval_ignored_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/eval_ignored_param.lambda.exp @@ -339,165 +339,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |(u64, u64, u64)|u64,g: |(u64, u64, u64)|u64,x: u64,_: u64,y: u64,z: u64): u64 { - { - let r1: u64 = (f)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - { - let r2: u64 = (g)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - Add(Add(Add(Add(r1, r2), Mul(3, x)), Mul(5, y)), Mul(7, z)) - } - } - } - public fun test() { - { - let r: u64 = Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 1, 10, 100, 1000); - if Eq(r, 9637) { - Tuple() - } else { - Abort(r) - }; - Tuple() - } - } - private fun test$lambda$1(x: u64,param$1: u64,z: u64): u64 { - { - let _: u64 = param$1; - Mul(x, z) - } - } - private fun test$lambda$2(param$0: u64,y: u64,param$2: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - y - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |(u64, u64, u64)|u64,g: |(u64, u64, u64)|u64,x: u64,_: u64,y: u64,z: u64): u64 { - { - let r1: u64 = (f)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - { - let r2: u64 = (g)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - Add(Add(Add(Add(r1, r2), Mul(3, x)), Mul(5, y)), Mul(7, z)) - } - } - } - public fun test() { - { - let r: u64 = Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 1, 10, 100, 1000); - if Eq(r, 9637) { - Tuple() - } else { - Abort(r) - }; - Tuple() - } - } - private fun test$lambda$1(x: u64,param$1: u64,z: u64): u64 { - { - let _: u64 = param$1; - Mul(x, z) - } - } - private fun test$lambda$2(param$0: u64,y: u64,param$2: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - y - } - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |(u64, u64, u64)|u64,g: |(u64, u64, u64)|u64,x: u64,_: u64,y: u64,z: u64): u64 { - { - let r1: u64 = (f)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - { - let r2: u64 = (g)(x: u64 = Add(x, 1); - x, y: u64 = Add(y, 1); - y, z: u64 = Add(z, 1); - z); - Add(Add(Add(Add(r1, r2), Mul(3, x)), Mul(5, y)), Mul(7, z)) - } - } - } - public fun test() { - { - let r: u64 = Test::foo(closure Test::test$lambda$1(), closure Test::test$lambda$2(), 1, 10, 100, 1000); - if Eq(r, 9637) { - Tuple() - } else { - Abort(r) - }; - Tuple() - } - } - private fun test$lambda$1(x: u64,param$1: u64,z: u64): u64 { - { - let _: u64 = param$1; - Mul(x, z) - } - } - private fun test$lambda$2(param$0: u64,y: u64,param$2: u64): u64 { - { - let _: u64 = param$2; - { - let _: u64 = param$0; - y - } - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/eval_ignored_param.move:4:11 - │ -4 │ let r1 = f({x = x + 1; x}, {y = y + 1; y}, {z = z + 1; z}); - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/eval_ignored_param.move:5:11 - │ -5 │ let r2 = g({x = x + 1; x}, {y = y + 1; y}, {z = z + 1 ; z}); - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/eval_ignored_param.move:10:14 │ 10 │ let r = foo(|x, _, z| x*z, |_, y, _| y, 1, 10, 100, 1000); │ ^^^^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/eval_ignored_param.move:10:29 │ 10 │ let r = foo(|x, _, z| x*z, |_, y, _| y, 1, 10, 100, 1000); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generic_calls.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generic_calls.lambda.exp index 3381b1bbcf75c..91a8aa3bfc41d 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generic_calls.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generic_calls.lambda.exp @@ -460,150 +460,9 @@ module 0x42::m { } // end 0x42::m -// -- Model dump after env processor lambda-lifting: -module 0x42::m { - struct S { - x: T, - } - private fun id(self: S): S { - self - } - private fun inlined(f: |S|S,s: S) { - (f)(s); - Tuple() - } - private fun receiver(self: S,y: T) { - select m::S.x>(self) = y; - Tuple() - } - private fun receiver_more_generics(self: S,_y: R) { - Tuple() - } - private fun receiver_needs_type_args(self: S,_y: T) { - Abort(1) - } - private fun receiver_ref(self: &S,_y: T) { - Tuple() - } - private fun receiver_ref_mut(self: &mut S,y: T) { - select m::S.x<&mut S>(self) = y - } - private fun test_call_styles(s: S,x: u64) { - m::receiver(s, x); - m::receiver_ref(Borrow(Immutable)(s), x); - m::receiver_ref_mut(Borrow(Mutable)(s), x); - m::receiver_more_generics(s, 22); - m::receiver_needs_type_args(s, x); - Tuple() - } - private fun test_receiver_inference(s: S) { - m::inlined(closure m::test_receiver_inference$lambda$1(), s) - } - private fun test_receiver_inference$lambda$1(s: S): S { - m::id(s) - } -} // end 0x42::m - - -// -- Model dump after env processor specification checker: -module 0x42::m { - struct S { - x: T, - } - private fun id(self: S): S { - self - } - private fun inlined(f: |S|S,s: S) { - (f)(s); - Tuple() - } - private fun receiver(self: S,y: T) { - select m::S.x>(self) = y; - Tuple() - } - private fun receiver_more_generics(self: S,_y: R) { - Tuple() - } - private fun receiver_needs_type_args(self: S,_y: T) { - Abort(1) - } - private fun receiver_ref(self: &S,_y: T) { - Tuple() - } - private fun receiver_ref_mut(self: &mut S,y: T) { - select m::S.x<&mut S>(self) = y - } - private fun test_call_styles(s: S,x: u64) { - m::receiver(s, x); - m::receiver_ref(Borrow(Immutable)(s), x); - m::receiver_ref_mut(Borrow(Mutable)(s), x); - m::receiver_more_generics(s, 22); - m::receiver_needs_type_args(s, x); - Tuple() - } - private fun test_receiver_inference(s: S) { - m::inlined(closure m::test_receiver_inference$lambda$1(), s) - } - private fun test_receiver_inference$lambda$1(s: S): S { - m::id(s) - } -} // end 0x42::m - - -// -- Model dump after env processor specification rewriter: -module 0x42::m { - struct S { - x: T, - } - private fun id(self: S): S { - self - } - private fun inlined(f: |S|S,s: S) { - (f)(s); - Tuple() - } - private fun receiver(self: S,y: T) { - select m::S.x>(self) = y; - Tuple() - } - private fun receiver_more_generics(self: S,_y: R) { - Tuple() - } - private fun receiver_needs_type_args(self: S,_y: T) { - Abort(1) - } - private fun receiver_ref(self: &S,_y: T) { - Tuple() - } - private fun receiver_ref_mut(self: &mut S,y: T) { - select m::S.x<&mut S>(self) = y - } - private fun test_call_styles(s: S,x: u64) { - m::receiver(s, x); - m::receiver_ref(Borrow(Immutable)(s), x); - m::receiver_ref_mut(Borrow(Mutable)(s), x); - m::receiver_more_generics(s, 22); - m::receiver_needs_type_args(s, x); - Tuple() - } - private fun test_receiver_inference(s: S) { - m::inlined(closure m::test_receiver_inference$lambda$1(), s) - } - private fun test_receiver_inference$lambda$1(s: S): S { - m::id(s) - } -} // end 0x42::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/generic_calls.move:36:9 - │ -36 │ f(s); - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/generic_calls.move:47:17 │ 47 │ inlined(|s| s.id(), s) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generics.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generics.lambda.exp index 2a10fb8eecd8e..663955aa5147d 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generics.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/generics.lambda.exp @@ -327,8 +327,8 @@ module 0x42::Test { Diagnostics: -error: captured variable `sum` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/generics.move:16:30 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/generics.move:16:26 │ 16 │ foreach(&v, |e| sum = sum + *e); - │ ^^^ + │ ^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inline_fun_in_spec.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inline_fun_in_spec.lambda.exp index d4783a884aa54..b6f53faf5b92f 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inline_fun_in_spec.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inline_fun_in_spec.lambda.exp @@ -1,7 +1,7 @@ // -- Model dump before env processor pipeline: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -44,7 +44,7 @@ module 0x42::m { // -- Model dump after env processor unused checks: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -87,7 +87,7 @@ module 0x42::m { // -- Model dump after env processor type parameter check: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -130,7 +130,7 @@ module 0x42::m { // -- Model dump after env processor check recursive struct definition: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -173,7 +173,7 @@ module 0x42::m { // -- Model dump after env processor check cyclic type instantiation: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -216,7 +216,7 @@ module 0x42::m { // -- Model dump after env processor unused struct params check: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -259,7 +259,7 @@ module 0x42::m { // -- Model dump after env processor access and use check before inlining: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>(m::get<0x42::m::S>(a)), 10), a)); + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f(m::get(a)), 10), a)); } struct S { @@ -302,9 +302,9 @@ module 0x42::m { // -- Model dump after env processor inlining: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) + BorrowGlobal(Immutable)(a) }), 10), a)); } @@ -348,9 +348,9 @@ module 0x42::m { // -- Model dump after env processor access and use check after inlining: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) + BorrowGlobal(Immutable)(a) }), 10), a)); } @@ -394,9 +394,9 @@ module 0x42::m { // -- Model dump after env processor acquires check: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) + BorrowGlobal(Immutable)(a) }), 10), a)); } @@ -440,9 +440,9 @@ module 0x42::m { // -- Model dump after env processor simplifier: module 0x42::m { spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ + invariant forall a: address: TypeDomain
(): Implies(exists(a), m::exec(|a: address| Lt(select m::S.f({ let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) + BorrowGlobal(Immutable)(a) }), 10), a)); } @@ -483,163 +483,10 @@ module 0x42::m { } // end 0x42::m -// -- Model dump after env processor lambda-lifting: -module 0x42::m { - spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ - let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) - }), 10), a)); - } - - struct S { - f: u64, - } - spec { - invariant m::exec(|x: num| Gt(x, 0), select m::S.f()); - } - - private fun exec(f: |T|R,x: T): R { - { - let r: R = (f)(x); - spec { - assert Eq<#1>(r, (f)($t1)); - } - ; - r - } - } - private fun function_code_spec_block(x: u64): u64 { - spec { - assert m::exec(closure m::function_code_spec_block$lambda$1(), $t0); - } - ; - Add(x, 1) - } - private fun function_spec_block(x: u64): u64 { - Add(x, 1) - } - spec { - ensures Eq(result0(), m::exec(|x: num| Add(x, 1), $t0)); - } - - private inline fun get(a: address): &R { - BorrowGlobal(Immutable)(a) - } - private fun function_code_spec_block$lambda$1(y: num): bool { - Gt(y, 0) - } -} // end 0x42::m - - -// -- Model dump after env processor specification checker: -module 0x42::m { - spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::exec(|a: address| Lt(select m::S.f<0x42::m::S>({ - let (a: address): (address) = Tuple(a); - BorrowGlobal(Immutable)<0x42::m::S>(a) - }), 10), a)); - } - - struct S { - f: u64, - } - spec { - invariant m::exec(|x: num| Gt(x, 0), select m::S.f()); - } - - private fun exec(f: |T|R,x: T): R { - { - let r: R = (f)(x); - spec { - assert Eq<#1>(r, (f)($t1)); - } - ; - r - } - } - private fun function_code_spec_block(x: u64): u64 { - spec { - assert m::exec(closure m::function_code_spec_block$lambda$1(), $t0); - } - ; - Add(x, 1) - } - private fun function_spec_block(x: u64): u64 { - Add(x, 1) - } - spec { - ensures Eq(result0(), m::exec(|x: num| Add(x, 1), $t0)); - } - - private inline fun get(a: address): &R { - BorrowGlobal(Immutable)(a) - } - private fun function_code_spec_block$lambda$1(y: num): bool { - Gt(y, 0) - } -} // end 0x42::m - - -// -- Model dump after env processor specification rewriter: -module 0x42::m { - spec { - invariant forall a: address: TypeDomain
(): Implies(exists<0x42::m::S>(a), m::$exec(|a: address| Lt(select m::S.f<0x42::m::S>({ - let (a: address): (address) = Tuple(a); - global<0x42::m::S>(a) - }), 10), a)); - } - - struct S { - f: u64, - } - spec { - invariant m::$exec(|x: num| Gt(x, 0), select m::S.f()); - } - - private fun exec(f: |T|R,x: T): R { - { - let r: R = (f)(x); - spec { - assert Eq<#1>(r, (f)($t1)); - } - ; - r - } - } - private fun function_code_spec_block(x: u64): u64 { - spec { - assert m::$exec(closure m::function_code_spec_block$lambda$1(), $t0); - } - ; - Add(x, 1) - } - private fun function_spec_block(x: u64): u64 { - Add(x, 1) - } - spec { - ensures Eq(result0(), m::$exec(|x: num| Add(x, 1), $t0)); - } - - private inline fun get(a: address): &R { - BorrowGlobal(Immutable)(a) - } - private fun function_code_spec_block$lambda$1(y: num): bool { - Gt(y, 0) - } - spec fun $exec(f: |#0|#1,x: #0): #1 { - { - let r: #1 = (f)(x); - r - } - } -} // end 0x42::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/inline_fun_in_spec.move:4:17 - │ -4 │ let r = f(x); - │ ^ +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/inline_fun_in_spec.move:19:28 + │ +19 │ spec { assert exec(|y| y > 0, x); }; + │ ^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inlining1.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inlining1.lambda.exp index ccd5c61991485..407e0091ccec5 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inlining1.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/inlining1.lambda.exp @@ -207,90 +207,9 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |u64|u64,x: u64): u64 { - (f)(x) - } - public fun main() { - if Eq(Test::test(), 3) { - Tuple() - } else { - Abort(5) - }; - Tuple() - } - public fun test(): u64 { - Test::foo(closure Test::test$lambda$1(), 10) - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |u64|u64,x: u64): u64 { - (f)(x) - } - public fun main() { - if Eq(Test::test(), 3) { - Tuple() - } else { - Abort(5) - }; - Tuple() - } - public fun test(): u64 { - Test::foo(closure Test::test$lambda$1(), 10) - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |u64|u64,x: u64): u64 { - (f)(x) - } - public fun main() { - if Eq(Test::test(), 3) { - Tuple() - } else { - Abort(5) - }; - Tuple() - } - public fun test(): u64 { - Test::foo(closure Test::test$lambda$1(), 10) - } - private fun test$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 3 - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/inlining1.move:4:9 - │ -4 │ f(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/inlining1.move:8:13 │ 8 │ foo(|_| 3, 10) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda.lambda.exp index 0edf647447ceb..74c1c8173821c 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda.lambda.exp @@ -745,8 +745,53 @@ module 0x42::LambdaTest { Diagnostics: -error: captured variable `product` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/lambda.move:30:18 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:30:14 │ 30 │ foreach(&v, |e| product = LambdaTest1::inline_mul(product, *e)); - │ ^^^^^^^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:34:29 + │ +34 │ LambdaTest1::inline_apply1(|z|z, g(LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x|x, 3)))) + 2 + │ ^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:34:90 + │ +34 │ LambdaTest1::inline_apply1(|z|z, g(LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x|x, 3)))) + 2 + │ ^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:40:29 + │ +40 │ LambdaTest1::inline_apply(|y|y, x) + │ ^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:39:59 + │ +39 │ LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x| { + │ ╭──────────────────────────────────────────────────────────────^ +40 │ │ LambdaTest1::inline_apply(|y|y, x) +41 │ │ }, + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:54:29 + │ +54 │ LambdaTest2::inline_apply2(|x| x + 1, 3) + + │ ^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:55:29 + │ +55 │ LambdaTest2::inline_apply2(|x| x * x, inline_apply(|y|y, 3)) + │ ^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda.move:55:53 + │ +55 │ LambdaTest2::inline_apply2(|x| x * x, inline_apply(|y|y, 3)) + │ ^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_cast.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_cast.lambda.exp index cc4db35759051..554461a9bacdf 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_cast.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_cast.lambda.exp @@ -434,8 +434,20 @@ module 0x12391283::M { Diagnostics: -error: captured variable `accu` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/lambda_cast.move:18:35 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda_cast.move:18:28 │ 18 │ vector_for_each(v, |elem| accu = f(accu, elem)); - │ ^^^^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda_cast.move:26:61 + │ +26 │ vector_fold(gas_schedule_blob, (0 as u64), |sum, addend| sum + (addend as u64)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda_cast.move:33:52 + │ +33 │ vector_fold(gas_schedule_blob, (0 as u64), |sum, addend| sum + (addend as u64)) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_no_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_no_param.lambda.exp index eb23c97b263b2..17a526afd1b21 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_no_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_no_param.lambda.exp @@ -207,102 +207,15 @@ module 0xdecafbad::m { } // end 0xdecafbad::m -// -- Model dump after env processor lambda-lifting: -module 0xdecafbad::m { - private fun bar(f: |()|u64): u64 { - (f)() - } - private fun foo(f: |()|) { - (f)(); - Tuple() - } - public fun one() { - m::foo(closure m::one$lambda$1()); - Tuple() - } - public fun two(x: u64): u64 { - m::bar(closure m::two$lambda$1(x)) - } - private fun one$lambda$1() { - Tuple() - } - private fun two$lambda$1(x: u64): u64 { - x - } -} // end 0xdecafbad::m - - -// -- Model dump after env processor specification checker: -module 0xdecafbad::m { - private fun bar(f: |()|u64): u64 { - (f)() - } - private fun foo(f: |()|) { - (f)(); - Tuple() - } - public fun one() { - m::foo(closure m::one$lambda$1()); - Tuple() - } - public fun two(x: u64): u64 { - m::bar(closure m::two$lambda$1(x)) - } - private fun one$lambda$1() { - Tuple() - } - private fun two$lambda$1(x: u64): u64 { - x - } -} // end 0xdecafbad::m - - -// -- Model dump after env processor specification rewriter: -module 0xdecafbad::m { - private fun bar(f: |()|u64): u64 { - (f)() - } - private fun foo(f: |()|) { - (f)(); - Tuple() - } - public fun one() { - m::foo(closure m::one$lambda$1()); - Tuple() - } - public fun two(x: u64): u64 { - m::bar(closure m::two$lambda$1(x)) - } - private fun one$lambda$1() { - Tuple() - } - private fun two$lambda$1(x: u64): u64 { - x - } -} // end 0xdecafbad::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/lambda_no_param.move:3:9 - │ -3 │ f(); - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_no_param.move:7:13 │ 7 │ foo(|| {}); │ ^^^^^ -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/lambda_no_param.move:11:9 - │ -11 │ f() - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_no_param.move:15:13 │ 15 │ bar(||x) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_param.lambda.exp index b3587c0f077ef..2714266dff66f 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_param.lambda.exp @@ -603,234 +603,27 @@ module 0x42::LambdaParam { } // end 0x42::LambdaParam -// -- Model dump after env processor lambda-lifting: -module 0x42::LambdaParam { - public fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply(f, b) - } - public fun inline_apply3(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply4(f, b) - } - public fun inline_apply4(_f: |u64|u64,b: u64): u64 { - b - } - private fun test_lambda_symbol_param1() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param1$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param2() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param2$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply(closure LambdaParam::test_lambda_symbol_param2$lambda$2(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply3(closure LambdaParam::test_lambda_symbol_param2$lambda$3(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - } - } - private fun test_lambda_symbol_param1$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$2(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$3(x: u64): u64 { - x - } -} // end 0x42::LambdaParam - - -// -- Model dump after env processor specification checker: -module 0x42::LambdaParam { - public fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply(f, b) - } - public fun inline_apply3(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply4(f, b) - } - public fun inline_apply4(_f: |u64|u64,b: u64): u64 { - b - } - private fun test_lambda_symbol_param1() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param1$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param2() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param2$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply(closure LambdaParam::test_lambda_symbol_param2$lambda$2(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply3(closure LambdaParam::test_lambda_symbol_param2$lambda$3(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - } - } - private fun test_lambda_symbol_param1$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$2(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$3(x: u64): u64 { - x - } -} // end 0x42::LambdaParam - - -// -- Model dump after env processor specification rewriter: -module 0x42::LambdaParam { - public fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply(f, b) - } - public fun inline_apply3(f: |u64|u64,b: u64): u64 { - LambdaParam::inline_apply4(f, b) - } - public fun inline_apply4(_f: |u64|u64,b: u64): u64 { - b - } - private fun test_lambda_symbol_param1() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param1$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param2() { - { - let a: u64 = LambdaParam::inline_apply2(closure LambdaParam::test_lambda_symbol_param2$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply(closure LambdaParam::test_lambda_symbol_param2$lambda$2(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - { - let b: u64 = LambdaParam::inline_apply3(closure LambdaParam::test_lambda_symbol_param2$lambda$3(), 3); - if Eq(b, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - } - } - private fun test_lambda_symbol_param1$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$1(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$2(x: u64): u64 { - x - } - private fun test_lambda_symbol_param2$lambda$3(x: u64): u64 { - x - } -} // end 0x42::LambdaParam - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/lambda_param.move:3:2 - │ -3 │ f(b) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_param.move:19:24 │ 19 │ let a = inline_apply2(|x| x, 3); │ ^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_param.move:24:24 │ 24 │ let a = inline_apply2(|x| x, 3); │ ^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_param.move:26:23 │ 26 │ let b = inline_apply(|x| x, 3); │ ^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_param.move:28:24 │ 28 │ let b = inline_apply3(|x| x, 3); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_return.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_return.lambda.exp index 2b9ffb4ba4160..c4e937cdf67b4 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_return.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_return.lambda.exp @@ -207,81 +207,9 @@ module 0x42::LambdaReturn { } // end 0x42::LambdaReturn -// -- Model dump after env processor lambda-lifting: -module 0x42::LambdaReturn { - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - return (f)(b) - } - private fun test_lambda_symbol_param() { - { - let a: u64 = LambdaReturn::inline_apply2(closure LambdaReturn::test_lambda_symbol_param$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param$lambda$1(x: u64): u64 { - x - } -} // end 0x42::LambdaReturn - - -// -- Model dump after env processor specification checker: -module 0x42::LambdaReturn { - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - return (f)(b) - } - private fun test_lambda_symbol_param() { - { - let a: u64 = LambdaReturn::inline_apply2(closure LambdaReturn::test_lambda_symbol_param$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param$lambda$1(x: u64): u64 { - x - } -} // end 0x42::LambdaReturn - - -// -- Model dump after env processor specification rewriter: -module 0x42::LambdaReturn { - public fun inline_apply2(f: |u64|u64,b: u64): u64 { - return (f)(b) - } - private fun test_lambda_symbol_param() { - { - let a: u64 = LambdaReturn::inline_apply2(closure LambdaReturn::test_lambda_symbol_param$lambda$1(), 3); - if Eq(a, 3) { - Tuple() - } else { - Abort(0) - }; - Tuple() - } - } - private fun test_lambda_symbol_param$lambda$1(x: u64): u64 { - x - } -} // end 0x42::LambdaReturn - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/lambda_return.move:3:9 - │ -3 │ return f(b) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_return.move:7:24 │ 7 │ let a = inline_apply2(|x| { x }, 3); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_typed.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_typed.lambda.exp index 396fdaf35ada9..8ad3cf5705649 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_typed.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/lambda_typed.lambda.exp @@ -1285,325 +1285,19 @@ module 0x42::LambdaTest { } // end 0x42::LambdaTest -// -- Model dump after env processor lambda-lifting: -module 0x42::LambdaTest1 { - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply1(f: |u64|u64,b: u64): u64 { - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add((f)(b), 1), 12); - Mul(a, 12) - } - } - public inline fun inline_mul(a: u64,b: u64): u64 { - Mul(a, b) - } -} // end 0x42::LambdaTest1 -module 0x42::LambdaTest2 { - use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1 - use std::vector; - public inline fun foreach(v: &vector,action: |&T|) { - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - (action)(vector::borrow(v, i)); - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - } - public inline fun inline_apply2(g: |u64|u64,c: u64): u64 { - Add({ - let (b: u64): (u64) = Tuple((g)({ - let (a: u64, b: u64): (u64, u64) = Tuple(c, 3); - Mul(a, 3) - })); - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add({ - let (z: u64): (u64) = Tuple(b); - z - }, 1), 12); - Mul(a, 12) - } - }, 2) - } - public inline fun inline_apply3(g: |u64|u64,c: u64): u64 { - Add(LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$2(), 3))), 4) - } - public fun test_inline_lambda() { - { - let product: u64 = 1; - { - let (v: &vector): (&vector) = Tuple(Borrow(Immutable)([Number(1), Number(2), Number(3)])); - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - { - let (e: &u64): (&u64) = Tuple(vector::borrow(v, i)); - product: u64 = { - let (a: u64, b: u64): (u64, u64) = Tuple(product, Deref(e)); - Mul(a, b) - } - }; - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - }; - Tuple() - } - } - private fun inline_apply3$lambda$1(y: u64): u64 { - y - } - private fun inline_apply3$lambda$2(x: u64): u64 { - LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$1(), x) - } -} // end 0x42::LambdaTest2 -module 0x42::LambdaTest { - use 0x42::LambdaTest2; // resolved as: 0x42::LambdaTest2 - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply_test(): u64 { - 1120 - } - private fun test_lambda() { - if false { - Tuple() - } else { - Abort(0) - }; - Tuple() - } -} // end 0x42::LambdaTest - - -// -- Model dump after env processor specification checker: -module 0x42::LambdaTest1 { - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply1(f: |u64|u64,b: u64): u64 { - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add((f)(b), 1), 12); - Mul(a, 12) - } - } - public inline fun inline_mul(a: u64,b: u64): u64 { - Mul(a, b) - } -} // end 0x42::LambdaTest1 -module 0x42::LambdaTest2 { - use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1 - use std::vector; - public inline fun foreach(v: &vector,action: |&T|) { - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - (action)(vector::borrow(v, i)); - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - } - public inline fun inline_apply2(g: |u64|u64,c: u64): u64 { - Add({ - let (b: u64): (u64) = Tuple((g)({ - let (a: u64, b: u64): (u64, u64) = Tuple(c, 3); - Mul(a, 3) - })); - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add({ - let (z: u64): (u64) = Tuple(b); - z - }, 1), 12); - Mul(a, 12) - } - }, 2) - } - public inline fun inline_apply3(g: |u64|u64,c: u64): u64 { - Add(LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$2(), 3))), 4) - } - public fun test_inline_lambda() { - { - let product: u64 = 1; - { - let (v: &vector): (&vector) = Tuple(Borrow(Immutable)([Number(1), Number(2), Number(3)])); - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - { - let (e: &u64): (&u64) = Tuple(vector::borrow(v, i)); - product: u64 = { - let (a: u64, b: u64): (u64, u64) = Tuple(product, Deref(e)); - Mul(a, b) - } - }; - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - }; - Tuple() - } - } - private fun inline_apply3$lambda$1(y: u64): u64 { - y - } - private fun inline_apply3$lambda$2(x: u64): u64 { - LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$1(), x) - } -} // end 0x42::LambdaTest2 -module 0x42::LambdaTest { - use 0x42::LambdaTest2; // resolved as: 0x42::LambdaTest2 - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply_test(): u64 { - 1120 - } - private fun test_lambda() { - if false { - Tuple() - } else { - Abort(0) - }; - Tuple() - } -} // end 0x42::LambdaTest - - -// -- Model dump after env processor specification rewriter: -module 0x42::LambdaTest1 { - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply1(f: |u64|u64,b: u64): u64 { - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add((f)(b), 1), 12); - Mul(a, 12) - } - } - public inline fun inline_mul(a: u64,b: u64): u64 { - Mul(a, b) - } -} // end 0x42::LambdaTest1 -module 0x42::LambdaTest2 { - use 0x42::LambdaTest1; // resolved as: 0x42::LambdaTest1 - use std::vector; - public inline fun foreach(v: &vector,action: |&T|) { - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - (action)(vector::borrow(v, i)); - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - } - public inline fun inline_apply2(g: |u64|u64,c: u64): u64 { - Add({ - let (b: u64): (u64) = Tuple((g)({ - let (a: u64, b: u64): (u64, u64) = Tuple(c, 3); - Mul(a, 3) - })); - { - let (a: u64, b: u64): (u64, u64) = Tuple(Add({ - let (z: u64): (u64) = Tuple(b); - z - }, 1), 12); - Mul(a, 12) - } - }, 2) - } - public inline fun inline_apply3(g: |u64|u64,c: u64): u64 { - Add(LambdaTest1::inline_apply1(g, LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$2(), 3))), 4) - } - public fun test_inline_lambda() { - { - let product: u64 = 1; - { - let (v: &vector): (&vector) = Tuple(Borrow(Immutable)([Number(1), Number(2), Number(3)])); - { - let i: u64 = 0; - loop { - if Lt(i, vector::length(v)) { - { - let (e: &u64): (&u64) = Tuple(vector::borrow(v, i)); - product: u64 = { - let (a: u64, b: u64): (u64, u64) = Tuple(product, Deref(e)); - Mul(a, b) - } - }; - i: u64 = Add(i, 1); - Tuple() - } else { - break - } - } - } - }; - Tuple() - } - } - private fun inline_apply3$lambda$1(y: u64): u64 { - y - } - private fun inline_apply3$lambda$2(x: u64): u64 { - LambdaTest1::inline_apply(closure LambdaTest2::inline_apply3$lambda$1(), x) - } -} // end 0x42::LambdaTest2 -module 0x42::LambdaTest { - use 0x42::LambdaTest2; // resolved as: 0x42::LambdaTest2 - public inline fun inline_apply(f: |u64|u64,b: u64): u64 { - (f)(b) - } - public inline fun inline_apply_test(): u64 { - 1120 - } - private fun test_lambda() { - if false { - Tuple() - } else { - Abort(0) - }; - Tuple() - } -} // end 0x42::LambdaTest - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/lambda_typed.move:11:2 - │ -11 │ f(b) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/lambda_typed.move:40:29 │ 40 │ LambdaTest1::inline_apply(|y: u64|y, x) │ ^^^^^^^^^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/lambda_typed.move:39:59 + │ +39 │ LambdaTest1::inline_mul(c, LambdaTest1::inline_apply(|x:u64| { + │ ╭──────────────────────────────────────────────────────────────^ +40 │ │ LambdaTest1::inline_apply(|y: u64|y, x) +41 │ │ }, + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/masking.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/masking.lambda.exp index a89c6271195d1..05fa66c009795 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/masking.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/masking.lambda.exp @@ -119,96 +119,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun main(): u64 { - Test::foo(closure Test::main$lambda$1(), closure Test::main$lambda$2(), 10, 100) - } - private fun main$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun main$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun main(): u64 { - Test::foo(closure Test::main$lambda$1(), closure Test::main$lambda$2(), 10, 100) - } - private fun main$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun main$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun foo(f: |(u64, u64)|u64,g: |(u64, u64)|u64,x: u64,_y: u64): u64 { - Add((f)(x, _y), (g)(x, _y)) - } - public fun main(): u64 { - Test::foo(closure Test::main$lambda$1(), closure Test::main$lambda$2(), 10, 100) - } - private fun main$lambda$1(x: u64,param$1: u64): u64 { - { - let _: u64 = param$1; - x - } - } - private fun main$lambda$2(param$0: u64,y: u64): u64 { - { - let _: u64 = param$0; - y - } - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/masking.move:4:9 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/masking.move:4:20 - │ -4 │ f(x, _y) + g(x, _y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/masking.move:8:13 │ 8 │ foo(|x, _| x, |_, y| y, 10, 100) │ ^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/masking.move:8:23 │ 8 │ foo(|x, _| x, |_, y| y, 10, 100) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/multi_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/multi_param.lambda.exp index 79df5cae6a545..8978cb782f6d6 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/multi_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/multi_param.lambda.exp @@ -451,8 +451,18 @@ module 0x42::Test { Diagnostics: -error: captured variable `result` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/multi_param.move:21:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/multi_param.move:19:29 │ -21 │ result = result + f(&elem.k, &mut elem.v); - │ ^^^^^^ +19 │ for_each_ref_mut(v, |elem| { + │ ╭─────────────────────────────^ +20 │ │ let elem: &mut Elem = elem; // Checks whether scoping is fine +21 │ │ result = result + f(&elem.k, &mut elem.v); +22 │ │ }); + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/multi_param.move:27:64 + │ +27 │ assert!(elem_for_each_ref(&mut vector[Elem{k:1, v:2}], |x,y| *x + *y) == 3, 0) + │ ^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda.lambda.exp index 019feaaebebc4..9988efc1c2a49 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda.lambda.exp @@ -119,72 +119,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun test(): u64 { - Test::apply(closure Test::test$lambda$1(), 1, Test::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun test(): u64 { - Test::apply(closure Test::test$lambda$1(), 1, Test::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun test(): u64 { - Test::apply(closure Test::test$lambda$1(), 1, Test::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/nested_lambda.move:5:9 - │ -5 │ f(x, y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/nested_lambda.move:9:15 │ 9 │ apply(|x, y| x + y, 1, apply(|x, y| x * y, 2, 1)) │ ^^^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/nested_lambda.move:9:38 │ 9 │ apply(|x, y| x + y, 1, apply(|x, y| x * y, 2, 1)) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda_module.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda_module.lambda.exp index f5ed4cea4f283..aeacf221c2e90 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda_module.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/nested_lambda_module.lambda.exp @@ -152,81 +152,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test1 { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } -} // end 0x42::Test1 -module 0x42::Test { - use 0x42::Test1; // resolved as: 0x42::Test1 - public fun test(): u64 { - Test1::apply(closure Test::test$lambda$1(), 1, Test1::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test1 { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } -} // end 0x42::Test1 -module 0x42::Test { - use 0x42::Test1; // resolved as: 0x42::Test1 - public fun test(): u64 { - Test1::apply(closure Test::test$lambda$1(), 1, Test1::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test1 { - public fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } -} // end 0x42::Test1 -module 0x42::Test { - use 0x42::Test1; // resolved as: 0x42::Test1 - public fun test(): u64 { - Test1::apply(closure Test::test$lambda$1(), 1, Test1::apply(closure Test::test$lambda$2(), 2, 1)) - } - private fun test$lambda$1(x: u64,y: u64): u64 { - Add(x, y) - } - private fun test$lambda$2(x: u64,y: u64): u64 { - Mul(x, y) - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/nested_lambda_module.move:4:9 - │ -4 │ f(x, y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/nested_lambda_module.move:13:22 │ 13 │ Test1::apply(|x, y| x + y, 1, Test1::apply(|x, y| x * y, 2, 1)) │ ^^^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/nested_lambda_module.move:13:52 │ 13 │ Test1::apply(|x, y| x + y, 1, Test1::apply(|x, y| x * y, 2, 1)) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/op_with_side_effect_49.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/op_with_side_effect_49.lambda.exp index a9a1dc063d69f..05665d18d8283 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/op_with_side_effect_49.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/op_with_side_effect_49.lambda.exp @@ -176,14 +176,14 @@ module 0xc0ffee::m { Diagnostics: -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/op_with_side_effect_49.move:9:22 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/op_with_side_effect_49.move:9:18 │ 9 │ x + call(|| {x = x + 1; x}) + call(|| {x = x + 7; x}) - │ ^ + │ ^^^^^^^^^^^^^^^^^ -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/op_with_side_effect_49.move:9:48 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/op_with_side_effect_49.move:9:44 │ 9 │ x + call(|| {x = x + 1; x}) + call(|| {x = x + 7; x}) - │ ^ + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/options.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/options.lambda.exp index 01a7a59635ddc..f9182d2788054 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/options.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/options.lambda.exp @@ -1,7 +1,7 @@ // -- Model dump before env processor pipeline: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -14,9 +14,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -27,7 +27,7 @@ module 0x42::Test { // -- Model dump after env processor unused checks: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -40,9 +40,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -53,7 +53,7 @@ module 0x42::Test { // -- Model dump after env processor type parameter check: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -66,9 +66,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -79,7 +79,7 @@ module 0x42::Test { // -- Model dump after env processor check recursive struct definition: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -92,9 +92,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -105,7 +105,7 @@ module 0x42::Test { // -- Model dump after env processor check cyclic type instantiation: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -118,9 +118,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -131,7 +131,7 @@ module 0x42::Test { // -- Model dump after env processor unused struct params check: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -144,9 +144,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -157,7 +157,7 @@ module 0x42::Test { // -- Model dump after env processor access and use check before inlining: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -170,9 +170,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -183,7 +183,7 @@ module 0x42::Test { // -- Model dump after env processor inlining: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -196,9 +196,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -209,7 +209,7 @@ module 0x42::Test { // -- Model dump after env processor access and use check after inlining: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -222,9 +222,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -235,7 +235,7 @@ module 0x42::Test { // -- Model dump after env processor acquires check: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -248,9 +248,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -261,7 +261,7 @@ module 0x42::Test { // -- Model dump after env processor simplifier: module 0x42::map_opt { use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { + public fun map(t: option::Option,f: |Element|OtherElement): option::Option { if option::is_some(Borrow(Immutable)(t)) { option::some((f)(option::extract(Borrow(Mutable)(t)))) } else { @@ -274,9 +274,9 @@ module 0x42::Test { use 0x42::map_opt; // resolved as: 0x42::map_opt public fun test(): u64 { { - let t: 0x1::option::Option = option::some(1); + let t: option::Option = option::some(1); { - let x: 0x1::option::Option = map_opt::map(t, |e: u64| Add(e, 1)); + let x: option::Option = map_opt::map(t, |e: u64| Add(e, 1)); option::extract(Borrow(Mutable)(x)) } } @@ -284,102 +284,9 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::map_opt { - use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { - if option::is_some(Borrow(Immutable)(t)) { - option::some((f)(option::extract(Borrow(Mutable)(t)))) - } else { - option::none() - } - } -} // end 0x42::map_opt -module 0x42::Test { - use std::option; - use 0x42::map_opt; // resolved as: 0x42::map_opt - public fun test(): u64 { - { - let t: 0x1::option::Option = option::some(1); - { - let x: 0x1::option::Option = map_opt::map(t, closure Test::test$lambda$1()); - option::extract(Borrow(Mutable)(x)) - } - } - } - private fun test$lambda$1(e: u64): u64 { - Add(e, 1) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::map_opt { - use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { - if option::is_some(Borrow(Immutable)(t)) { - option::some((f)(option::extract(Borrow(Mutable)(t)))) - } else { - option::none() - } - } -} // end 0x42::map_opt -module 0x42::Test { - use std::option; - use 0x42::map_opt; // resolved as: 0x42::map_opt - public fun test(): u64 { - { - let t: 0x1::option::Option = option::some(1); - { - let x: 0x1::option::Option = map_opt::map(t, closure Test::test$lambda$1()); - option::extract(Borrow(Mutable)(x)) - } - } - } - private fun test$lambda$1(e: u64): u64 { - Add(e, 1) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::map_opt { - use std::option; - public fun map(t: 0x1::option::Option,f: |Element|OtherElement): 0x1::option::Option { - if option::is_some(Borrow(Immutable)(t)) { - option::some((f)(option::extract(Borrow(Mutable)(t)))) - } else { - option::none() - } - } -} // end 0x42::map_opt -module 0x42::Test { - use std::option; - use 0x42::map_opt; // resolved as: 0x42::map_opt - public fun test(): u64 { - { - let t: 0x1::option::Option = option::some(1); - { - let x: 0x1::option::Option = map_opt::map(t, closure Test::test$lambda$1()); - option::extract(Borrow(Mutable)(x)) - } - } - } - private fun test$lambda$1(e: u64): u64 { - Add(e, 1) - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/options.move:7:26 - │ -7 │ option::some(f(option::extract(&mut t))) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/options.move:22:33 │ 22 │ let x = map_opt::map(t, |e| e + 1); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/return_in_lambda.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/return_in_lambda.lambda.exp index bf94c6a9de653..c83c2256d3373 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/return_in_lambda.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/return_in_lambda.lambda.exp @@ -152,66 +152,9 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun adder(x: u64,y: u64): u64 { - Add(x, y) - } - private fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun main(): u64 { - Test::apply(closure Test::main$lambda$1(), 10, 100) - } - private fun main$lambda$1(x: u64,y: u64): u64 { - return Test::adder(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun adder(x: u64,y: u64): u64 { - Add(x, y) - } - private fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun main(): u64 { - Test::apply(closure Test::main$lambda$1(), 10, 100) - } - private fun main$lambda$1(x: u64,y: u64): u64 { - return Test::adder(x, y) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun adder(x: u64,y: u64): u64 { - Add(x, y) - } - private fun apply(f: |(u64, u64)|u64,x: u64,y: u64): u64 { - (f)(x, y) - } - public fun main(): u64 { - Test::apply(closure Test::main$lambda$1(), 10, 100) - } - private fun main$lambda$1(x: u64,y: u64): u64 { - return Test::adder(x, y) - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/return_in_lambda.move:4:9 - │ -4 │ f(x, y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/return_in_lambda.move:12:15 │ 12 │ apply(|x, y| { diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/same_names.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/same_names.lambda.exp index c473f81866042..779e1bd8e5014 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/same_names.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/same_names.lambda.exp @@ -361,123 +361,9 @@ module 0x42::c { } // end 0x42::c -// -- Model dump after env processor lambda-lifting: -module 0x42::b { - struct MyOtherList { - len: u64, - } - public fun len(self: &MyOtherList): u64 { - select b::MyOtherList.len<&MyOtherList>(self) - } -} // end 0x42::b -module 0x42::a { - struct MyList { - len: u64, - } - public fun len(self: &MyList): u64 { - select a::MyList.len<&MyList>(self) - } -} // end 0x42::a -module 0x42::c { - use 0x42::a; // resolved as: 0x42::a - use 0x42::b; // resolved as: 0x42::b - private fun foo(f: |(a::MyList, b::MyOtherList)|,x: a::MyList,y: b::MyOtherList) { - (f)(x, y) - } - private fun test(x: a::MyList,y: b::MyOtherList) { - c::foo(closure c::test$lambda$1(), x, y) - } - private fun test$lambda$1(x: a::MyList,y: b::MyOtherList) { - if Eq(Add(a::len(Borrow(Immutable)(x)), b::len(Borrow(Immutable)(y))), 1) { - Tuple() - } else { - Abort(1) - } - } -} // end 0x42::c - - -// -- Model dump after env processor specification checker: -module 0x42::b { - struct MyOtherList { - len: u64, - } - public fun len(self: &MyOtherList): u64 { - select b::MyOtherList.len<&MyOtherList>(self) - } -} // end 0x42::b -module 0x42::a { - struct MyList { - len: u64, - } - public fun len(self: &MyList): u64 { - select a::MyList.len<&MyList>(self) - } -} // end 0x42::a -module 0x42::c { - use 0x42::a; // resolved as: 0x42::a - use 0x42::b; // resolved as: 0x42::b - private fun foo(f: |(a::MyList, b::MyOtherList)|,x: a::MyList,y: b::MyOtherList) { - (f)(x, y) - } - private fun test(x: a::MyList,y: b::MyOtherList) { - c::foo(closure c::test$lambda$1(), x, y) - } - private fun test$lambda$1(x: a::MyList,y: b::MyOtherList) { - if Eq(Add(a::len(Borrow(Immutable)(x)), b::len(Borrow(Immutable)(y))), 1) { - Tuple() - } else { - Abort(1) - } - } -} // end 0x42::c - - -// -- Model dump after env processor specification rewriter: -module 0x42::b { - struct MyOtherList { - len: u64, - } - public fun len(self: &MyOtherList): u64 { - select b::MyOtherList.len<&MyOtherList>(self) - } -} // end 0x42::b -module 0x42::a { - struct MyList { - len: u64, - } - public fun len(self: &MyList): u64 { - select a::MyList.len<&MyList>(self) - } -} // end 0x42::a -module 0x42::c { - use 0x42::a; // resolved as: 0x42::a - use 0x42::b; // resolved as: 0x42::b - private fun foo(f: |(a::MyList, b::MyOtherList)|,x: a::MyList,y: b::MyOtherList) { - (f)(x, y) - } - private fun test(x: a::MyList,y: b::MyOtherList) { - c::foo(closure c::test$lambda$1(), x, y) - } - private fun test$lambda$1(x: a::MyList,y: b::MyOtherList) { - if Eq(Add(a::len(Borrow(Immutable)(x)), b::len(Borrow(Immutable)(y))), 1) { - Tuple() - } else { - Abort(1) - } - } -} // end 0x42::c - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/same_names.move:24:9 - │ -24 │ f(x, y) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/same_names.move:30:13 │ 30 │ foo(|x, y| { assert!(x.len() + y.len() == 1, 1) }, x, y) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing.lambda.exp index 813306a5f3a94..37dd8e8b4fd3a 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing.lambda.exp @@ -250,8 +250,12 @@ module 0x42::Test { Diagnostics: -error: captured variable `_x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing.move:12:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing.move:11:13 │ -12 │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^^ +11 │ foo(|y| { + │ ╭─────────────^ +12 │ │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +13 │ │ // have the value 1. +14 │ │ }); + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed.lambda.exp index 57fbdb400d002..d06dc58292f36 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed.lambda.exp @@ -250,8 +250,12 @@ module 0x42::Test { Diagnostics: -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_renamed.move:12:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_renamed.move:11:13 │ -12 │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^ +11 │ foo(|y| { + │ ╭─────────────^ +12 │ │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +13 │ │ // have the value 1. +14 │ │ }); + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed_param.lambda.exp index bf8fa10008821..c2be62764c09b 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_renamed_param.lambda.exp @@ -561,26 +561,42 @@ module 0x42::Test { Diagnostics: -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:15:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:14:13 │ -15 │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^ +14 │ foo(|y| { + │ ╭─────────────^ +15 │ │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +16 │ │ // have the value 1. +17 │ │ }, 3); + │ ╰─────────^ -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:21:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:20:14 │ -21 │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^ +20 │ foo2(|y| { + │ ╭──────────────^ +21 │ │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +22 │ │ // have the value 1. +23 │ │ }, 5); + │ ╰─────────^ -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:30:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:29:13 │ -30 │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^ +29 │ foo(|y| { + │ ╭─────────────^ +30 │ │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +31 │ │ // have the value 1. +32 │ │ }, 3); + │ ╰─────────^ -error: captured variable `x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:36:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_renamed_param.move:35:14 │ -36 │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^ +35 │ foo2(|y| { + │ ╭──────────────^ +36 │ │ x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +37 │ │ // have the value 1. +38 │ │ }, 5); + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused.lambda.exp index 7c4b85b3b4291..ad9dfbc2c013e 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused.lambda.exp @@ -505,14 +505,28 @@ module 0x42::Test { Diagnostics: -error: captured variable `_x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_unused.move:18:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused.move:11:14 │ -18 │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^^ +11 │ quux(|a, b| f(a, b), z); + │ ^^^^^^^^^^^^^^ -error: captured variable `_x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_unused.move:28:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused.move:17:13 │ -28 │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^^ +17 │ foo(|y, _q| { + │ ╭─────────────^ +18 │ │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +19 │ │ // have the value 1. +20 │ │ }, z); + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused.move:27:14 + │ +27 │ quux(|y, _q| { + │ ╭──────────────^ +28 │ │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +29 │ │ // have the value 1. +30 │ │ }, z); + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused_nodecl.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused_nodecl.lambda.exp index ccbae64fbd2f7..a5c3ecf66a652 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused_nodecl.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/shadowing_unused_nodecl.lambda.exp @@ -511,14 +511,28 @@ warning: Unused parameter `z`. Consider removing or prefixing with an underscore 6 │ public fun quux(f:|u64, u64|, z: u64) { │ ^ -error: captured variable `_x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_unused_nodecl.move:20:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused_nodecl.move:13:14 │ -20 │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^^ +13 │ quux(|a, b| f(a, b), z); + │ ^^^^^^^^^^^^^^ -error: captured variable `_x` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/shadowing_unused_nodecl.move:30:13 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused_nodecl.move:19:13 │ -30 │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would - │ ^^ +19 │ foo(|y, _q| { + │ ╭─────────────^ +20 │ │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +21 │ │ // have the value 1. +22 │ │ }, z); + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/shadowing_unused_nodecl.move:29:14 + │ +29 │ quux(|y, _q| { + │ ╭──────────────^ +30 │ │ _x = y // We expect this to assign 3 via foo if renaming works correctly. If not it would +31 │ │ // have the value 1. +32 │ │ }, z); + │ ╰─────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/simple_map_keys.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/simple_map_keys.lambda.exp index 90288bcbca57e..31cd0a4b40cd5 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/simple_map_keys.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/simple_map_keys.lambda.exp @@ -682,8 +682,18 @@ module 0x42::simple_map { Diagnostics: -error: captured variable `result` cannot be modified inside of a lambda - ┌─ tests/lambda/inline-parity/simple_map_keys.move:28:55 +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/simple_map_keys.move:17:28 + │ +17 │ map_ref(&map.data, |e| { + │ ╭────────────────────────────^ +18 │ │ let e: &Element = e; +19 │ │ e.key +20 │ │ }) + │ ╰─────────^ + +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. + ┌─ tests/lambda/inline-parity/simple_map_keys.move:28:25 │ 28 │ for_each_ref(v, |elem| vector::push_back(&mut result, f(elem))); - │ ^^^^^^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/spec_inlining.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/spec_inlining.lambda.exp index 82da96e292c71..da12cb4e3f48a 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/spec_inlining.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/spec_inlining.lambda.exp @@ -427,156 +427,15 @@ module 0x42::Test { } // end 0x42::Test -// -- Model dump after env processor lambda-lifting: -module 0x42::Test { - private fun apply(v: u64,predicate: |u64|bool): bool { - spec { - assert Ge($t0, 0); - } - ; - (predicate)(v) - } - public fun test_apply(x: u64) { - { - let r1: bool = Test::apply(x, closure Test::test_apply$lambda$1()); - spec { - assert r1; - } - ; - if r1 { - Tuple() - } else { - Abort(1) - }; - { - let r2: bool = Test::apply(x, closure Test::test_apply$lambda$2()); - spec { - assert r2; - } - ; - if r2 { - Tuple() - } else { - Abort(2) - }; - Tuple() - } - } - } - private fun test_apply$lambda$1(v: u64): bool { - Ge(v, 0) - } - private fun test_apply$lambda$2(v: u64): bool { - Neq(v, 0) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification checker: -module 0x42::Test { - private fun apply(v: u64,predicate: |u64|bool): bool { - spec { - assert Ge($t0, 0); - } - ; - (predicate)(v) - } - public fun test_apply(x: u64) { - { - let r1: bool = Test::apply(x, closure Test::test_apply$lambda$1()); - spec { - assert r1; - } - ; - if r1 { - Tuple() - } else { - Abort(1) - }; - { - let r2: bool = Test::apply(x, closure Test::test_apply$lambda$2()); - spec { - assert r2; - } - ; - if r2 { - Tuple() - } else { - Abort(2) - }; - Tuple() - } - } - } - private fun test_apply$lambda$1(v: u64): bool { - Ge(v, 0) - } - private fun test_apply$lambda$2(v: u64): bool { - Neq(v, 0) - } -} // end 0x42::Test - - -// -- Model dump after env processor specification rewriter: -module 0x42::Test { - private fun apply(v: u64,predicate: |u64|bool): bool { - spec { - assert Ge($t0, 0); - } - ; - (predicate)(v) - } - public fun test_apply(x: u64) { - { - let r1: bool = Test::apply(x, closure Test::test_apply$lambda$1()); - spec { - assert r1; - } - ; - if r1 { - Tuple() - } else { - Abort(1) - }; - { - let r2: bool = Test::apply(x, closure Test::test_apply$lambda$2()); - spec { - assert r2; - } - ; - if r2 { - Tuple() - } else { - Abort(2) - }; - Tuple() - } - } - } - private fun test_apply$lambda$1(v: u64): bool { - Ge(v, 0) - } - private fun test_apply$lambda$2(v: u64): bool { - Neq(v, 0) - } -} // end 0x42::Test - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/spec_inlining.move:6:9 - │ -6 │ predicate(v) - │ ^^^^^^^^^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/spec_inlining.move:10:27 │ 10 │ let r1 = apply(x, |v| v >= 0); │ ^^^^^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/spec_inlining.move:16:27 │ 16 │ let r2 = apply(x, |v| v != 0); diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/subtype_args.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/subtype_args.lambda.exp index 51316f7cd9c17..13fdcad48d3be 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/subtype_args.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/subtype_args.lambda.exp @@ -536,10 +536,10 @@ error: Calls to function values other than inline function parameters not yet su ┌─ tests/lambda/inline-parity/subtype_args.move:24:9 │ 24 │ f(&mut 0, &mut 0); - │ ^ + │ ^^^^^^^^^^^^^^^^^ error: Calls to function values other than inline function parameters not yet supported ┌─ tests/lambda/inline-parity/subtype_args.move:25:9 │ 25 │ f(&0, &mut 0); - │ ^ + │ ^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.lambda.exp index 2506246844937..a4540db5ddd91 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.lambda.exp @@ -1395,405 +1395,9 @@ module 0xc0ffee::no_warn { } // end 0xc0ffee::no_warn -// -- Model dump after env processor lambda-lifting: -module 0xc0ffee::m { - private fun apply(f: |u8|bool,x: u8): bool { - (f)(x) - } - private fun bar() { - Tuple() - } - private fun foo(x: T): T { - x - } - public fun test1(x: u8) { - if Gt(Add(x, 1), 255) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test2(x: &u8,y: &u8) { - if Eq(Gt(Add(Deref(x), Deref(y)), 255), true) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test3(x: u8) { - if Or(Lt(x, 0), Gt(0, x)) { - m::bar() - } else { - Tuple() - }; - if Le(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Ge(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Gt(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Lt(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Ge(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Le(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test4(a: u8,b: u16,c: u32,d: u64,e: u128,f: u256) { - if Or(Gt(a, 255), Gt(f, 255)) { - m::bar() - } else { - Tuple() - }; - if Ge(b, 65535) { - m::bar() - } else { - Tuple() - }; - if Lt(4294967295, c) { - m::bar() - } else { - Tuple() - }; - if Le(18446744073709551615, d) { - m::bar() - } else { - Tuple() - }; - if Lt(e, 340282366920938463463374607431768211455) { - m::bar() - } else { - Tuple() - }; - if Le(f, 115792089237316195423570985008687907853269984665640564039457584007913129639935) { - m::bar() - } else { - Tuple() - }; - if Ge(115792089237316195423570985008687907853269984665640564039457584007913129639935, f) { - m::bar() - } else { - Tuple() - }; - if Gt(340282366920938463463374607431768211455, e) { - m::bar() - } else { - Tuple() - }; - spec { - assert Le($t0, 255); - } - - } - public fun test5(x: u8): bool { - m::apply(closure m::test5$lambda$1(), x) - } - private fun test5$lambda$1(x: u8): bool { - Gt(x, 255) - } -} // end 0xc0ffee::m -module 0xc0ffee::no_warn { - public fun test(x: u8) { - if Lt(x, 0) { - Abort(1) - } else { - Tuple() - }; - Tuple() - } -} // end 0xc0ffee::no_warn - - -// -- Model dump after env processor specification checker: -module 0xc0ffee::m { - private fun apply(f: |u8|bool,x: u8): bool { - (f)(x) - } - private fun bar() { - Tuple() - } - private fun foo(x: T): T { - x - } - public fun test1(x: u8) { - if Gt(Add(x, 1), 255) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test2(x: &u8,y: &u8) { - if Eq(Gt(Add(Deref(x), Deref(y)), 255), true) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test3(x: u8) { - if Or(Lt(x, 0), Gt(0, x)) { - m::bar() - } else { - Tuple() - }; - if Le(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Ge(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Gt(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Lt(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Ge(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Le(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test4(a: u8,b: u16,c: u32,d: u64,e: u128,f: u256) { - if Or(Gt(a, 255), Gt(f, 255)) { - m::bar() - } else { - Tuple() - }; - if Ge(b, 65535) { - m::bar() - } else { - Tuple() - }; - if Lt(4294967295, c) { - m::bar() - } else { - Tuple() - }; - if Le(18446744073709551615, d) { - m::bar() - } else { - Tuple() - }; - if Lt(e, 340282366920938463463374607431768211455) { - m::bar() - } else { - Tuple() - }; - if Le(f, 115792089237316195423570985008687907853269984665640564039457584007913129639935) { - m::bar() - } else { - Tuple() - }; - if Ge(115792089237316195423570985008687907853269984665640564039457584007913129639935, f) { - m::bar() - } else { - Tuple() - }; - if Gt(340282366920938463463374607431768211455, e) { - m::bar() - } else { - Tuple() - }; - spec { - assert Le($t0, 255); - } - - } - public fun test5(x: u8): bool { - m::apply(closure m::test5$lambda$1(), x) - } - private fun test5$lambda$1(x: u8): bool { - Gt(x, 255) - } -} // end 0xc0ffee::m -module 0xc0ffee::no_warn { - public fun test(x: u8) { - if Lt(x, 0) { - Abort(1) - } else { - Tuple() - }; - Tuple() - } -} // end 0xc0ffee::no_warn - - -// -- Model dump after env processor specification rewriter: -module 0xc0ffee::m { - private fun apply(f: |u8|bool,x: u8): bool { - (f)(x) - } - private fun bar() { - Tuple() - } - private fun foo(x: T): T { - x - } - public fun test1(x: u8) { - if Gt(Add(x, 1), 255) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test2(x: &u8,y: &u8) { - if Eq(Gt(Add(Deref(x), Deref(y)), 255), true) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test3(x: u8) { - if Or(Lt(x, 0), Gt(0, x)) { - m::bar() - } else { - Tuple() - }; - if Le(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Ge(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Gt(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Lt(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - if Ge(m::foo(x), 0) { - m::bar() - } else { - Tuple() - }; - if Le(0, m::foo(x)) { - m::bar() - } else { - Tuple() - }; - Tuple() - } - public fun test4(a: u8,b: u16,c: u32,d: u64,e: u128,f: u256) { - if Or(Gt(a, 255), Gt(f, 255)) { - m::bar() - } else { - Tuple() - }; - if Ge(b, 65535) { - m::bar() - } else { - Tuple() - }; - if Lt(4294967295, c) { - m::bar() - } else { - Tuple() - }; - if Le(18446744073709551615, d) { - m::bar() - } else { - Tuple() - }; - if Lt(e, 340282366920938463463374607431768211455) { - m::bar() - } else { - Tuple() - }; - if Le(f, 115792089237316195423570985008687907853269984665640564039457584007913129639935) { - m::bar() - } else { - Tuple() - }; - if Ge(115792089237316195423570985008687907853269984665640564039457584007913129639935, f) { - m::bar() - } else { - Tuple() - }; - if Gt(340282366920938463463374607431768211455, e) { - m::bar() - } else { - Tuple() - }; - spec { - assert Le($t0, 255); - } - - } - public fun test5(x: u8): bool { - m::apply(closure m::test5$lambda$1(), x) - } - private fun test5$lambda$1(x: u8): bool { - Gt(x, 255) - } -} // end 0xc0ffee::m -module 0xc0ffee::no_warn { - public fun test(x: u8) { - if Lt(x, 0) { - Abort(1) - } else { - Tuple() - }; - Tuple() - } -} // end 0xc0ffee::no_warn - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.move:50:9 - │ -50 │ f(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unnecessary_numerical_extreme_comparisons_warn.move:54:15 │ 54 │ apply(|x| x > U8_MAX, x) diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unpack_generic_struct.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unpack_generic_struct.lambda.exp index 2bdecc21d6698..bc7e6d329d721 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unpack_generic_struct.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unpack_generic_struct.lambda.exp @@ -504,177 +504,9 @@ module 0x42::m { } // end 0x42::m -// -- Model dump after env processor lambda-lifting: -module 0x42::m { - use std::vector; - struct E { - key: Key, - } - struct Option { - vec: vector, - } - public fun destroy_none(t: Option) { - if m::is_none(Borrow(Immutable)(t)) { - Tuple() - } else { - Abort(262144) - }; - { - let m::Option{ vec } = t; - vector::destroy_empty(vec) - } - } - public fun foo(data: E,v: &mut Key) { - { - let f: E = m::h(data, closure m::foo$lambda$1()); - m::g(f, closure m::foo$lambda$2(v)); - Tuple() - } - } - public fun g(x: E,v: |E|) { - (v)(x) - } - public fun h(x: E,v: |Key|E): E { - { - let m::E{ key } = x; - (v)(key) - } - } - public fun is_none(t: &Option): bool { - vector::is_empty(Borrow(Immutable)(select m::Option.vec<&Option>(t))) - } - private fun foo$lambda$1(e: Key): E { - pack m::E(e) - } - private fun foo$lambda$2(v: &mut Key,e: E) { - { - let (m::E{ key }, _x: u64): (E, u64) = Tuple(e, 3); - v = key; - Tuple() - } - } -} // end 0x42::m - - -// -- Model dump after env processor specification checker: -module 0x42::m { - use std::vector; - struct E { - key: Key, - } - struct Option { - vec: vector, - } - public fun destroy_none(t: Option) { - if m::is_none(Borrow(Immutable)(t)) { - Tuple() - } else { - Abort(262144) - }; - { - let m::Option{ vec } = t; - vector::destroy_empty(vec) - } - } - public fun foo(data: E,v: &mut Key) { - { - let f: E = m::h(data, closure m::foo$lambda$1()); - m::g(f, closure m::foo$lambda$2(v)); - Tuple() - } - } - public fun g(x: E,v: |E|) { - (v)(x) - } - public fun h(x: E,v: |Key|E): E { - { - let m::E{ key } = x; - (v)(key) - } - } - public fun is_none(t: &Option): bool { - vector::is_empty(Borrow(Immutable)(select m::Option.vec<&Option>(t))) - } - private fun foo$lambda$1(e: Key): E { - pack m::E(e) - } - private fun foo$lambda$2(v: &mut Key,e: E) { - { - let (m::E{ key }, _x: u64): (E, u64) = Tuple(e, 3); - v = key; - Tuple() - } - } -} // end 0x42::m - - -// -- Model dump after env processor specification rewriter: -module 0x42::m { - use std::vector; - struct E { - key: Key, - } - struct Option { - vec: vector, - } - public fun destroy_none(t: Option) { - if m::is_none(Borrow(Immutable)(t)) { - Tuple() - } else { - Abort(262144) - }; - { - let m::Option{ vec } = t; - vector::destroy_empty(vec) - } - } - public fun foo(data: E,v: &mut Key) { - { - let f: E = m::h(data, closure m::foo$lambda$1()); - m::g(f, closure m::foo$lambda$2(v)); - Tuple() - } - } - public fun g(x: E,v: |E|) { - (v)(x) - } - public fun h(x: E,v: |Key|E): E { - { - let m::E{ key } = x; - (v)(key) - } - } - public fun is_none(t: &Option): bool { - vector::is_empty(Borrow(Immutable)(select m::Option.vec<&Option>(t))) - } - private fun foo$lambda$1(e: Key): E { - pack m::E(e) - } - private fun foo$lambda$2(v: &mut Key,e: E) { - { - let (m::E{ key }, _x: u64): (E, u64) = Tuple(e, 3); - v = key; - Tuple() - } - } -} // end 0x42::m - - Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/unpack_generic_struct.move:24:9 - │ -24 │ v(key) - │ ^ - -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/unpack_generic_struct.move:28:9 - │ -28 │ v(x) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unpack_generic_struct.move:33:25 │ 33 │ let f = h(data, |e| { @@ -683,7 +515,7 @@ error: Function-typed values not yet supported except as parameters to calls to 35 │ │ }); │ ╰─────────^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unpack_generic_struct.move:36:14 │ 36 │ g(f, |e| { diff --git a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unused_lambda_param.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unused_lambda_param.lambda.exp index a720df7124c63..a5d0e3f4ec627 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unused_lambda_param.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/inline-parity/unused_lambda_param.lambda.exp @@ -218,102 +218,6 @@ module 0xc0ffee::m { } // end 0xc0ffee::m -// -- Model dump after env processor lambda-lifting: -module 0xc0ffee::m { - private fun test(p: u64,f: |u64|u64): u64 { - (f)(p) - } - private fun unused_lambda() { - m::test(0, closure m::unused_lambda$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed1() { - m::test(0, closure m::unused_lambda_suppressed1$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed2() { - m::test(0, closure m::unused_lambda_suppressed2$lambda$1()); - Tuple() - } - private fun unused_lambda$lambda$1(x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed1$lambda$1(_x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed2$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 1 - } - } -} // end 0xc0ffee::m - - -// -- Model dump after env processor specification checker: -module 0xc0ffee::m { - private fun test(p: u64,f: |u64|u64): u64 { - (f)(p) - } - private fun unused_lambda() { - m::test(0, closure m::unused_lambda$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed1() { - m::test(0, closure m::unused_lambda_suppressed1$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed2() { - m::test(0, closure m::unused_lambda_suppressed2$lambda$1()); - Tuple() - } - private fun unused_lambda$lambda$1(x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed1$lambda$1(_x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed2$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 1 - } - } -} // end 0xc0ffee::m - - -// -- Model dump after env processor specification rewriter: -module 0xc0ffee::m { - private fun test(p: u64,f: |u64|u64): u64 { - (f)(p) - } - private fun unused_lambda() { - m::test(0, closure m::unused_lambda$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed1() { - m::test(0, closure m::unused_lambda_suppressed1$lambda$1()); - Tuple() - } - private fun unused_lambda_suppressed2() { - m::test(0, closure m::unused_lambda_suppressed2$lambda$1()); - Tuple() - } - private fun unused_lambda$lambda$1(x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed1$lambda$1(_x: u64): u64 { - 1 - } - private fun unused_lambda_suppressed2$lambda$1(param$0: u64): u64 { - { - let _: u64 = param$0; - 1 - } - } -} // end 0xc0ffee::m - - Diagnostics: warning: Unused anonymous function parameter `x`. Consider removing or prefixing with an underscore: `_x` @@ -322,27 +226,19 @@ warning: Unused anonymous function parameter `x`. Consider removing or prefixing 7 │ test(0, |x| 1); │ ^ - -Diagnostics: -error: Calls to function values other than inline function parameters not yet supported - ┌─ tests/lambda/inline-parity/unused_lambda_param.move:3:9 - │ -3 │ f(p) - │ ^ - -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unused_lambda_param.move:7:17 │ 7 │ test(0, |x| 1); │ ^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unused_lambda_param.move:11:17 │ 11 │ test(0, |_x| 1); │ ^^^^^^ -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/inline-parity/unused_lambda_param.move:15:17 │ 15 │ test(0, |_| 1); diff --git a/third_party/move/move-compiler-v2/tests/lambda/lambda3.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/lambda3.lambda.exp index db9ce1b64dc58..60e5fd96148f5 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/lambda3.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/lambda3.lambda.exp @@ -119,51 +119,9 @@ module 0x8675309::M { } // end 0x8675309::M -// -- Model dump after env processor lambda-lifting: -module 0x8675309::M { - public fun lambda_not_allowed() { - { - let _x: |u64|u64 = closure M::lambda_not_allowed$lambda$1(); - Tuple() - } - } - private fun lambda_not_allowed$lambda$1(i: u64): u64 { - Add(i, 1) - } -} // end 0x8675309::M - - -// -- Model dump after env processor specification checker: -module 0x8675309::M { - public fun lambda_not_allowed() { - { - let _x: |u64|u64 = closure M::lambda_not_allowed$lambda$1(); - Tuple() - } - } - private fun lambda_not_allowed$lambda$1(i: u64): u64 { - Add(i, 1) - } -} // end 0x8675309::M - - -// -- Model dump after env processor specification rewriter: -module 0x8675309::M { - public fun lambda_not_allowed() { - { - let _x: |u64|u64 = closure M::lambda_not_allowed$lambda$1(); - Tuple() - } - } - private fun lambda_not_allowed$lambda$1(i: u64): u64 { - Add(i, 1) - } -} // end 0x8675309::M - - Diagnostics: -error: Function-typed values not yet supported except as parameters to calls to inline functions +error: Currently, lambda expressions must explicitly declare `move` capture of free variables, except when appearing as an argument to an inline functioncall. ┌─ tests/lambda/lambda3.move:77:18 │ 77 │ let _x = |i| i + 1; // expected lambda not allowed diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.exp b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.exp new file mode 100644 index 0000000000000..89cd739e41c37 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.exp @@ -0,0 +1,20 @@ + +Diagnostics: +error: expected `u64` but found a value of type `|u64|u64` + ┌─ tests/lambda/storable/doable_func.move:67:17 + │ +67 │ g(_, 11) + │ ^^^^^^^^ + +error: expected `|u64|u64` but found a value of type `u64` + ┌─ tests/lambda/storable/doable_func.move:65:20 + │ +65 │ } else if (key == 11) { + │ ╭────────────────────^ +66 │ │ let g = move |x, y| mod3::multiply(x, y); +67 │ │ g(_, 11) +68 │ │ } else if (key == 12) { + · │ +73 │ │ move |z| i(z) +74 │ │ }; + │ ╰─────────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.lambda.exp new file mode 100644 index 0000000000000..89cd739e41c37 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.lambda.exp @@ -0,0 +1,20 @@ + +Diagnostics: +error: expected `u64` but found a value of type `|u64|u64` + ┌─ tests/lambda/storable/doable_func.move:67:17 + │ +67 │ g(_, 11) + │ ^^^^^^^^ + +error: expected `|u64|u64` but found a value of type `u64` + ┌─ tests/lambda/storable/doable_func.move:65:20 + │ +65 │ } else if (key == 11) { + │ ╭────────────────────^ +66 │ │ let g = move |x, y| mod3::multiply(x, y); +67 │ │ g(_, 11) +68 │ │ } else if (key == 12) { + · │ +73 │ │ move |z| i(z) +74 │ │ }; + │ ╰─────────────^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.move b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.move new file mode 100644 index 0000000000000..8eb3f948fa6ef --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/doable_func.move @@ -0,0 +1,91 @@ +module 0x42::mod1 { + package fun triple(x: u64) : u64 { + x * 3 + } +} + +module 0x42::mod2 { + friend 0x42::test; + friend fun double(x: u64): u64 { + x * 2 + } +} + +module 0x42::mod3 { + public fun multiply(x: u64, y: u64): u64 { + x * y + } +} + +module 0x42::mod4 { + public fun alt_multiply(x: u64, y: u64): u64 { + x * y + } +} + +module 0x42::test { + use 0x42::mod1; + use 0x42::mod2; + use 0x42::mod3; + use 0x42::mod4::alt_multiply; + fun multiply3(x: u64, y: u64, z: u64): u64 { + x * y * z + } + + // compute ((key + 2) * x) in different ways + fun choose_function1(key: u64, x: u64): u64 { + let f = + if (key == 0) { + mod2::double + } else if (key == 1) { + mod1::triple + } else if (key == 2) { + mod3::multiply(4, _) + } else if (key == 3) { + let x = 5; + alt_multiply(x, _) + } else if (key == 4) { + let x = 6; + mod3::multiply(_, x) + } else if (key == 5) { + multiply3(_, 3, 2) + } else if (key == 6) { + move |x| mod3::multiply(x, 7) + } else if (key == 7) { + multiply3(4, _, 2) + } else if (key == 8) { + multiply3(3, 3, _) + } else if (key == 9) { + let x = 2; + let y = 5; + move |z| multiply3(x, y, z) + } else if (key == 10) { + let z = 11; + move |x| alt_multiply(x, z) + } else if (key == 11) { + let g = move |x, y| mod3::multiply(x, y); + g(_, 11) + } else if (key == 12) { + let h = mod3::multiply(_, 12); + move |x| h(x) + } else { + let i = multiply3(2, _, 2); + move |z| i(z) + }; + f(x) + } + + fun add_mul(x: u64, y: u64, z: u64): u64 { + z * (x + y) + } + + public fun test_functions() { + // let sum = vector[]; + let x = 3; + + for (i in 0..14) { + let y = choose_function1(i, 3); + assert!(y == (i + 2) * x, i); + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/registry.move b/third_party/move/move-compiler-v2/tests/lambda/storable/registry.move index a6fd8bfab655c..19b7f22387d0d 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/storable/registry.move +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/registry.move @@ -15,7 +15,7 @@ module 0x42::test { fun get_function(v: &vector, k: u64): Option { mut x = Option::None; - for_each_ref(v, |f: &Function| { + vector::for_each_ref(v, |f: &Function| { if f.key == k { x = f.f } @@ -25,7 +25,7 @@ module 0x42::test { fun replace_or_add_function(v: &mut vector, k: u64, f: |u64| u64 has store): Option { mut done = false; - for_each_mut(v, |f: &mut Function| { + vector::for_each_mut(v, |f: &mut Function| { if f.key == k { f.f = f; done = true; @@ -78,16 +78,20 @@ module 0x42::test { } fun multiply_by_x(x: u64): |u64|u64 has store { - curry(&multiply, x) + multiply(x..) } + fun multiply_by_x2(x: u64): |u64|u64 has store { + move |y| multiply(x, y) + } #[test(a = @0x42)] test_registry1(a; signer) { - register(a, &double, 2); - register(a, &negate, 3); + register(a, double, 2); + register(a, negate, 3); register(a, multiply_by_x(4), 4); register(a, multiply_by_x(5), 5); + register(a, multiply_by_x2(6), 6); match invoke(a, 2, 10) { Some(x) => { assert!(x == 20); } @@ -105,5 +109,9 @@ module 0x42::test { Some(x) => { assert!(x == 15); } _ => assert!(false); } + match invoke(a, 6, 3) { + Some(x) => { assert!(x == 18); } + _ => assert!(false); + } } } diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.exp b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.exp index 38e1020313014..a54e0c6d68c06 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.exp @@ -1,10 +1,153 @@ Diagnostics: -error: unexpected token - ┌─ tests/lambda/storable/return_func.move:14:41 - │ -14 │ fun multiply_by_x(x: u64): |u64|u64 has store { - │ ^^^ - │ │ - │ Unexpected 'has' - │ Expected '{' +error: type `|u64|u64` is missing required ability `store` + ┌─ :1:1 + │ +1 │ + │ ^ + +error: cannot return `&_` from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:24:13 + │ +24 │ &double + │ ^^^^^^^ + +error: cannot return `&_` from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:26:13 + │ +26 │ &triple + │ ^^^^^^^ + +error: cannot return nothing from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:34:31 + │ +34 │ move |x| double(x); + │ ^ + +error: cannot return nothing from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:36:31 + │ +36 │ move |x| triple(x); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:75:9 + │ +75 │ sum.push_back(choose_function(0)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:76:9 + │ +76 │ sum.push_back(choose_function(1)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:77:9 + │ +77 │ sum.push_back(choose_function(2)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:83:23 + │ +83 │ sum.push_back(f(5)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:83:9 + │ +83 │ sum.push_back(f(5)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:84:23 + │ +84 │ sum.push_back(g(7)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:84:9 + │ +84 │ sum.push_back(g(7)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:85:23 + │ +85 │ sum.push_back(h(6)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:85:9 + │ +85 │ sum.push_back(h(6)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: function type `|u64|u64:store` is not allowed as a type argument (type was inferred) + ┌─ tests/lambda/storable/return_func.move:87:21 + │ +87 │ let funcs = vector[choose_function(0), choose_function(1), choose_function(2)]; + │ ^^^^^^ + │ + = required by instantiating vector type parameter + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:88:23 + │ +88 │ sum.push_back(f[0](9)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:88:9 + │ +88 │ sum.push_back(f[0](9)); + │ ^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:89:23 + │ +89 │ sum.push_back(f[1](11)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:89:9 + │ +89 │ sum.push_back(f[1](11)); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:90:23 + │ +90 │ sum.push_back(f[2](13)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:90:9 + │ +90 │ sum.push_back(f[2](13)); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `bool` but found a value of type `vector` + ┌─ tests/lambda/storable/return_func.move:92:17 + │ +92 │ assert!(vector[6, 9, 12, 10, 21, 24, 18, 33, 52]) + │ ^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:96:24 + │ +96 │ test_functions(&choose_function); + │ ^^^^^^^^^^^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:97:24 + │ +97 │ test_functions(&choose_function2); + │ ^^^^^^^^^^^^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:98:24 + │ +98 │ test_functions(&choose_function3); + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.lambda.exp b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.lambda.exp index 38e1020313014..a54e0c6d68c06 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.lambda.exp +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.lambda.exp @@ -1,10 +1,153 @@ Diagnostics: -error: unexpected token - ┌─ tests/lambda/storable/return_func.move:14:41 - │ -14 │ fun multiply_by_x(x: u64): |u64|u64 has store { - │ ^^^ - │ │ - │ Unexpected 'has' - │ Expected '{' +error: type `|u64|u64` is missing required ability `store` + ┌─ :1:1 + │ +1 │ + │ ^ + +error: cannot return `&_` from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:24:13 + │ +24 │ &double + │ ^^^^^^^ + +error: cannot return `&_` from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:26:13 + │ +26 │ &triple + │ ^^^^^^^ + +error: cannot return nothing from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:34:31 + │ +34 │ move |x| double(x); + │ ^ + +error: cannot return nothing from a function with result type `|u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:36:31 + │ +36 │ move |x| triple(x); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:75:9 + │ +75 │ sum.push_back(choose_function(0)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:76:9 + │ +76 │ sum.push_back(choose_function(1)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:77:9 + │ +77 │ sum.push_back(choose_function(2)(x)); + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:83:23 + │ +83 │ sum.push_back(f(5)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:83:9 + │ +83 │ sum.push_back(f(5)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:84:23 + │ +84 │ sum.push_back(g(7)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:84:9 + │ +84 │ sum.push_back(g(7)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: expected `|integer|_` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:85:23 + │ +85 │ sum.push_back(h(6)); + │ ^^^^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:85:9 + │ +85 │ sum.push_back(h(6)); + │ ^^^^^^^^^^^^^^^^^^^ + +error: function type `|u64|u64:store` is not allowed as a type argument (type was inferred) + ┌─ tests/lambda/storable/return_func.move:87:21 + │ +87 │ let funcs = vector[choose_function(0), choose_function(1), choose_function(2)]; + │ ^^^^^^ + │ + = required by instantiating vector type parameter + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:88:23 + │ +88 │ sum.push_back(f[0](9)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:88:9 + │ +88 │ sum.push_back(f[0](9)); + │ ^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:89:23 + │ +89 │ sum.push_back(f[1](11)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:89:9 + │ +89 │ sum.push_back(f[1](11)); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `vector<_>` but found a value of type `u64` + ┌─ tests/lambda/storable/return_func.move:90:23 + │ +90 │ sum.push_back(f[2](13)); + │ ^ + +error: undeclared receiver function `push_back` for type `vector<_>` + ┌─ tests/lambda/storable/return_func.move:90:9 + │ +90 │ sum.push_back(f[2](13)); + │ ^^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `bool` but found a value of type `vector` + ┌─ tests/lambda/storable/return_func.move:92:17 + │ +92 │ assert!(vector[6, 9, 12, 10, 21, 24, 18, 33, 52]) + │ ^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:96:24 + │ +96 │ test_functions(&choose_function); + │ ^^^^^^^^^^^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:97:24 + │ +97 │ test_functions(&choose_function2); + │ ^^^^^^^^^^^^^^^^^ + +error: cannot pass `&|u64||u64|u64:store:copy+drop+store` to a function which expects argument of type `|u64||u64|u64:store` + ┌─ tests/lambda/storable/return_func.move:98:24 + │ +98 │ test_functions(&choose_function3); + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.move b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.move index 4f6e078d8a460..eacdd02e69639 100644 --- a/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.move +++ b/third_party/move/move-compiler-v2/tests/lambda/storable/return_func.move @@ -11,36 +11,57 @@ module 0x42::test { x * y } - fun multiply_by_x(x: u64): |u64|u64 has store { - curry(&multiply, x) + public fun multiply3(x: u64, y: u64, z: u64): u64 { + x * y * z } - fun choose_function(key: u64) : |u64|u64 has store { - if key == 0 { + fun multiply_by_x(x: u64): |u64|u64: store { + multiply(x, _) + } + + fun choose_function(key: u64) : |u64|u64: store { + if (key == 0) { &double - } else if key == 1 { + } else if (key == 1) { &triple } else { multiply_by_x(4) } } - fun choose_function2(key: u64) : |u64|u64 has store { - if key == 0 { - |x| double(x); - } else if key == 1 { - |x| triple(x); + fun choose_function2(key: u64): |u64|u64: store { + if (key == 0) { + move |x| double(x); + } else if (key == 1) { + move |x| triple(x); + } else if (key == 2) { + let f = multiply_by_x(4); + move |x| f(x) + } else if (key == 3) { + let f = multiply_by_x(5); + move |x| f(x) + } else if (key == 4) { + let f = multiply(6, _); + f + } else if (key == 5) { + multiply(_, 7) + } else if (key == 6) { + let f = multiply(6, _); + move |x| f(x) + } else if (key == 7) { + let f = multiply_by_x(5); + move |x| f(x) } else { - |x| multiply_by_x(4)(x) + multiply3(_, 3, 4) } } - fun choose_function3(key: u64) : |u64|u64 has store { - if key == 0 { - let f = |x| double(x); + fun choose_function3(key: u64) : |u64|u64: store { + if (key == 0) { + let f = move |x| double(x); f - } else if key == 1 { - let g = |x| triple(x); + } else if (key == 1) { + let g = move |x| triple(x); g } else { let h = multiply_by_x(4); @@ -48,7 +69,7 @@ module 0x42::test { } } - public fun test_functions(choose_function: |u64|(|u64|u64 has store)) { + public fun test_functions(choose_function: |u64|(|u64|u64: store)) { let sum = vector[]; let x = 3; sum.push_back(choose_function(0)(x)); diff --git a/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp b/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp index b2dabe6d743a4..9e5ec15c0ef21 100644 --- a/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp +++ b/third_party/move/move-compiler-v2/tests/live-var/mut_ref.exp @@ -2,11 +2,11 @@ [variant baseline] fun m::f1_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R + var $t2: &mut m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: m::some($t2) @@ -16,12 +16,12 @@ fun m::f1_ok() { [variant baseline] fun m::f1a_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: 0x42::m::R + var $t2: &mut m::R + var $t3: m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: $t3 := read_ref($t2) 4: m::some($t2) @@ -32,12 +32,12 @@ fun m::f1a_ok() { [variant baseline] fun m::f1b_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: 0x42::m::R + var $t2: &mut m::R + var $t3: m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: $t3 := read_ref($t2) @@ -48,11 +48,11 @@ fun m::f1b_ok() { [variant baseline] fun m::f2_fail() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R + var $t2: &mut m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some2($t2, $t2) 4: return () @@ -61,12 +61,12 @@ fun m::f2_fail() { [variant baseline] fun m::f3_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: &mut 0x42::m::R + var $t2: &mut m::R + var $t3: &mut m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: m::some($t2) 4: $t3 := borrow_local($t0) @@ -78,12 +78,12 @@ fun m::f3_ok() { [variant baseline] fun m::f4_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: &mut 0x42::m::R + var $t2: &mut m::R + var $t3: &mut m::R 0: $t1 := 0 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) 2: $t2 := borrow_local($t0) 3: $t3 := m::id($t2) 4: $t2 := infer($t3) @@ -94,12 +94,12 @@ fun m::f4_ok() { [variant baseline] fun m::f5_fail($t0: bool) { - var $t1: 0x42::m::R + var $t1: m::R var $t2: u64 - var $t3: &mut 0x42::m::R - var $t4: &mut 0x42::m::R + var $t3: &mut m::R + var $t4: &mut m::R 0: $t2 := 0 - 1: $t1 := pack 0x42::m::R($t2) + 1: $t1 := pack m::R($t2) 2: $t3 := borrow_local($t1) 3: $t4 := infer($t3) 4: if ($t0) goto 5 else goto 9 @@ -116,21 +116,21 @@ fun m::f5_fail($t0: bool) { [variant baseline] -fun m::id($t0: &mut 0x42::m::R): &mut 0x42::m::R { - var $t1: &mut 0x42::m::R +fun m::id($t0: &mut m::R): &mut m::R { + var $t1: &mut m::R 0: $t1 := infer($t0) 1: return $t1 } [variant baseline] -fun m::some($t0: &mut 0x42::m::R) { +fun m::some($t0: &mut m::R) { 0: return () } [variant baseline] -fun m::some2($t0: &mut 0x42::m::R, $t1: &mut 0x42::m::R) { +fun m::some2($t0: &mut m::R, $t1: &mut m::R) { 0: return () } @@ -138,13 +138,13 @@ fun m::some2($t0: &mut 0x42::m::R, $t1: &mut 0x42::m::R) { [variant baseline] fun m::f1_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R + var $t2: &mut m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -158,14 +158,14 @@ fun m::f1_ok() { [variant baseline] fun m::f1a_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: 0x42::m::R + var $t2: &mut m::R + var $t3: m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -181,14 +181,14 @@ fun m::f1a_ok() { [variant baseline] fun m::f1b_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: 0x42::m::R + var $t2: &mut m::R + var $t3: m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -204,13 +204,13 @@ fun m::f1b_ok() { [variant baseline] fun m::f2_fail() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R + var $t2: &mut m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -222,14 +222,14 @@ fun m::f2_fail() { [variant baseline] fun m::f3_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: &mut 0x42::m::R + var $t2: &mut m::R + var $t3: &mut m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t0, $t2 @@ -247,14 +247,14 @@ fun m::f3_ok() { [variant baseline] fun m::f4_ok() { - var $t0: 0x42::m::R + var $t0: m::R var $t1: u64 - var $t2: &mut 0x42::m::R - var $t3: &mut 0x42::m::R + var $t2: &mut m::R + var $t3: &mut m::R # live vars: 0: $t1 := 0 # live vars: $t1 - 1: $t0 := pack 0x42::m::R($t1) + 1: $t0 := pack m::R($t1) # live vars: $t0 2: $t2 := borrow_local($t0) # live vars: $t2 @@ -270,14 +270,14 @@ fun m::f4_ok() { [variant baseline] fun m::f5_fail($t0: bool) { - var $t1: 0x42::m::R + var $t1: m::R var $t2: u64 - var $t3: &mut 0x42::m::R - var $t4: &mut 0x42::m::R + var $t3: &mut m::R + var $t4: &mut m::R # live vars: $t0 0: $t2 := 0 # live vars: $t0, $t2 - 1: $t1 := pack 0x42::m::R($t2) + 1: $t1 := pack m::R($t2) # live vars: $t0, $t1 2: $t3 := borrow_local($t1) # live vars: $t0, $t3 @@ -306,8 +306,8 @@ fun m::f5_fail($t0: bool) { [variant baseline] -fun m::id($t0: &mut 0x42::m::R): &mut 0x42::m::R { - var $t1: &mut 0x42::m::R +fun m::id($t0: &mut m::R): &mut m::R { + var $t1: &mut m::R # live vars: $t0 0: $t1 := infer($t0) # live vars: $t1 @@ -316,14 +316,14 @@ fun m::id($t0: &mut 0x42::m::R): &mut 0x42::m::R { [variant baseline] -fun m::some($t0: &mut 0x42::m::R) { +fun m::some($t0: &mut m::R) { # live vars: $t0 0: return () } [variant baseline] -fun m::some2($t0: &mut 0x42::m::R, $t1: &mut 0x42::m::R) { +fun m::some2($t0: &mut m::R, $t1: &mut m::R) { # live vars: $t0, $t1 0: return () } diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp index eb41afe8197db..cc556f788c76c 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression.exp @@ -1,10 +1,13 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression.move:3:29 +error: expected `|()|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression.move:3:9 │ 3 │ (if (true) 5 else 0)(); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `|(integer, integer)|_` but found a value of type `()` + ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression.move:4:9 + │ +4 │ (while (false) {})(0, 1); + │ ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression2.exp index 03ed8ceb2af6f..f9bd44939a1a8 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression2.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_complex_expression2.exp @@ -1,10 +1,13 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression2.move:3:29 +error: expected `|()|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression2.move:3:9 │ 3 │ (if (true) 5 else 0)(); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^^^^^^^^^^^^^^^^ + +error: expected `|(integer, integer)|_` but found a value of type `()` + ┌─ tests/more-v1/parser/invalid_call_lhs_complex_expression2.move:4:9 + │ +4 │ (while (false) {})(0, 1); + │ ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp index 222dec853b372..8d362e905076d 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name.exp @@ -1,10 +1,7 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_parens_around_name.move:3:14 +error: Calls to function values other than inline function parameters not yet supported + ┌─ tests/more-v1/parser/invalid_call_lhs_parens_around_name.move:3:9 │ 3 │ (foo)() - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name2.exp index f47f13fe5ecb6..7429935364695 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name2.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_parens_around_name2.exp @@ -1,10 +1,7 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_parens_around_name2.move:3:14 +error: Calls to function values other than inline function parameters not yet supported + ┌─ tests/more-v1/parser/invalid_call_lhs_parens_around_name2.move:3:9 │ 3 │ (foo)() - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp index 332165ecd3108..4890ecb1afef1 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return.exp @@ -1,10 +1,7 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_return.move:3:20 +error: Calls to function values other than inline function parameters not yet supported + ┌─ tests/more-v1/parser/invalid_call_lhs_return.move:3:9 │ 3 │ (return ())(0, 1); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return2.exp index b9972c50113c3..9b0ec32618792 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return2.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_return2.exp @@ -1,10 +1,7 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_return2.move:3:20 +error: Calls to function values other than inline function parameters not yet supported + ┌─ tests/more-v1/parser/invalid_call_lhs_return2.move:3:9 │ 3 │ (return ())(0, 1); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp index d17d58623b224..9a9a96a0285a4 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value.exp @@ -1,10 +1,13 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_value.move:3:10 +error: expected `|()|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_value.move:3:9 │ 3 │ 5(); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^ + +error: expected `|(integer, integer)|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_value.move:4:9 + │ +4 │ 5(0, 1); + │ ^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value2.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value2.exp index e2f3d92b38d92..63bab502411bb 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value2.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/invalid_call_lhs_value2.exp @@ -1,10 +1,13 @@ Diagnostics: -error: unexpected token - ┌─ tests/more-v1/parser/invalid_call_lhs_value2.move:3:10 +error: expected `|()|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_value2.move:3:9 │ 3 │ 5(); - │ ^ - │ │ - │ Unexpected '(' - │ Expected ';' + │ ^^^ + +error: expected `|(integer, integer)|_` but found a value of type `integer` + ┌─ tests/more-v1/parser/invalid_call_lhs_value2.move:4:9 + │ +4 │ 5(0, 1); + │ ^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp index b9eafd1f9f753..9808aa198bb4b 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/parser/unexpected_token_after_ability_function_constraint.exp @@ -4,7 +4,6 @@ error: unexpected token ┌─ tests/more-v1/parser/unexpected_token_after_ability_function_constraint.move:4:21 │ 4 │ fun foo() {} - │ ^ - │ │ - │ Unexpected '&' - │ Expected one of: '+', '>', or ',' + │ - ^ Expected '>' + │ │ + │ To match this '<' diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp index e3a00fa6e9edf..3fa251d802b36 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid0.exp @@ -226,12 +226,12 @@ fun test::add1_old($t0: u256): u256 { [variant baseline] -fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_new_1($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -241,12 +241,12 @@ fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_new_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -256,29 +256,29 @@ fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_old_1($t0: &mut test::Coin) { var $t1: u256 var $t2: u256 var $t3: &u256 var $t4: u256 var $t5: &mut u256 - 0: $t3 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t3 := borrow_field.0($t0) 1: $t2 := read_ref($t3) 2: $t4 := 1 3: $t1 := +($t2, $t4) - 4: $t5 := borrow_field<0x42::test::Coin>.0($t0) + 4: $t5 := borrow_field.0($t0) 5: write_ref($t5, $t1) 6: return () } [variant baseline] -fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_old_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 1 3: $t2 := +($t3, $t4) @@ -289,13 +289,13 @@ fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { [variant baseline] fun test::inc_coin_at($t0: address) { - var $t1: &mut 0x42::test::Coin + var $t1: &mut test::Coin var $t2: &mut u256 var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t1 := borrow_global<0x42::test::Coin>($t0) - 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) + 0: $t1 := borrow_global($t0) + 1: $t2 := borrow_field.0($t1) 2: $t4 := read_ref($t2) 3: $t5 := 1 4: $t3 := +($t4, $t5) @@ -333,16 +333,16 @@ fun test::inc_old($t0: &mut u256) { [variant baseline] -fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::inc_vec_coin_new($t0: vector, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut vector<0x42::test::Coin> + var $t3: &mut test::Coin + var $t4: &mut vector var $t5: u256 var $t6: u256 var $t7: u256 0: $t4 := borrow_local($t0) - 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) - 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t3 := vector::borrow_mut($t4, $t1) + 2: $t2 := borrow_field.0($t3) 3: $t6 := read_ref($t2) 4: $t7 := 1 5: $t5 := +($t6, $t7) @@ -352,25 +352,25 @@ fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { [variant baseline] -fun test::inc_vec_coin_old($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::inc_vec_coin_old($t0: vector, $t1: u64) { var $t2: u256 var $t3: u256 - var $t4: &0x42::test::Coin - var $t5: &vector<0x42::test::Coin> + var $t4: &test::Coin + var $t5: &vector var $t6: &u256 var $t7: u256 var $t8: &mut u256 - var $t9: &mut 0x42::test::Coin - var $t10: &mut vector<0x42::test::Coin> + var $t9: &mut test::Coin + var $t10: &mut vector 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow<0x42::test::Coin>($t5, $t1) - 2: $t6 := borrow_field<0x42::test::Coin>.0($t4) + 1: $t4 := vector::borrow($t5, $t1) + 2: $t6 := borrow_field.0($t4) 3: $t3 := read_ref($t6) 4: $t7 := 1 5: $t2 := +($t3, $t7) 6: $t10 := borrow_local($t0) - 7: $t9 := vector::borrow_mut<0x42::test::Coin>($t10, $t1) - 8: $t8 := borrow_field<0x42::test::Coin>.0($t9) + 7: $t9 := vector::borrow_mut($t10, $t1) + 8: $t8 := borrow_field.0($t9) 9: write_ref($t8, $t2) 10: return () } @@ -413,18 +413,18 @@ fun test::inc_vec_old($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 var $t7: u256 var $t8: u256 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t4 := vector::borrow_mut>($t5, $t1) + 2: $t3 := borrow_field>.0($t4) + 3: $t2 := borrow_field.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := +($t7, $t8) @@ -434,43 +434,43 @@ fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::C [variant baseline] -fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: u64) { var $t2: u256 var $t3: u256 - var $t4: &0x42::test::Coin - var $t5: &0x42::test::Wrapper<0x42::test::Coin> - var $t6: &vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t4: &test::Coin + var $t5: &test::Wrapper + var $t6: &vector> var $t7: &u256 var $t8: u256 var $t9: &mut u256 - var $t10: &mut 0x42::test::Coin - var $t11: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t12: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t10: &mut test::Coin + var $t11: &mut test::Wrapper + var $t12: &mut vector> 0: $t6 := borrow_local($t0) - 1: $t5 := vector::borrow<0x42::test::Wrapper<0x42::test::Coin>>($t6, $t1) - 2: $t4 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t5) - 3: $t7 := borrow_field<0x42::test::Coin>.0($t4) + 1: $t5 := vector::borrow>($t6, $t1) + 2: $t4 := borrow_field>.0($t5) + 3: $t7 := borrow_field.0($t4) 4: $t3 := read_ref($t7) 5: $t8 := 1 6: $t2 := +($t3, $t8) 7: $t12 := borrow_local($t0) - 8: $t11 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t12, $t1) - 9: $t10 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t11) - 10: $t9 := borrow_field<0x42::test::Coin>.0($t10) + 8: $t11 := vector::borrow_mut>($t12, $t1) + 9: $t10 := borrow_field>.0($t11) + 10: $t9 := borrow_field.0($t10) 11: write_ref($t9, $t2) 12: return () } [variant baseline] -fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { var $t1: &mut u256 - var $t2: &mut 0x42::test::Coin + var $t2: &mut test::Coin var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) - 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) + 0: $t2 := borrow_field>.0($t0) + 1: $t1 := borrow_field.0($t2) 2: $t4 := read_ref($t1) 3: $t5 := 1 4: $t3 := +($t4, $t5) @@ -480,21 +480,21 @@ fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) [variant baseline] -fun test::inc_wrapped_coin_old($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::inc_wrapped_coin_old($t0: &mut test::Wrapper) { var $t1: u256 var $t2: u256 - var $t3: &0x42::test::Coin + var $t3: &test::Coin var $t4: &u256 var $t5: u256 var $t6: &mut u256 - var $t7: &mut 0x42::test::Coin - 0: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) - 1: $t4 := borrow_field<0x42::test::Coin>.0($t3) + var $t7: &mut test::Coin + 0: $t3 := borrow_field>.0($t0) + 1: $t4 := borrow_field.0($t3) 2: $t2 := read_ref($t4) 3: $t5 := 1 4: $t1 := +($t2, $t5) - 5: $t7 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) - 6: $t6 := borrow_field<0x42::test::Coin>.0($t7) + 5: $t7 := borrow_field>.0($t0) + 6: $t6 := borrow_field.0($t7) 7: write_ref($t6, $t1) 8: return () } @@ -534,13 +534,13 @@ fun test::add1_old($t0: u256): u256 { [variant baseline] -fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_new_1($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -555,13 +555,13 @@ fun test::coin_inc_new_1($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_new_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -576,14 +576,14 @@ fun test::coin_inc_new_2($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_old_1($t0: &mut test::Coin) { var $t1: u256 [unused] var $t2: u256 var $t3: &u256 var $t4: u256 var $t5: &mut u256 # live vars: $t0 - 0: $t3 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t3 := borrow_field.0($t0) # live vars: $t0, $t3 1: $t2 := read_ref($t3) # live vars: $t0, $t2 @@ -591,7 +591,7 @@ fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { # live vars: $t0, $t2, $t4 3: $t2 := +($t2, $t4) # live vars: $t0, $t2 - 4: $t5 := borrow_field<0x42::test::Coin>.0($t0) + 4: $t5 := borrow_field.0($t0) # live vars: $t2, $t5 5: write_ref($t5, $t2) # live vars: @@ -600,13 +600,13 @@ fun test::coin_inc_old_1($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { +fun test::coin_inc_old_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -622,15 +622,15 @@ fun test::coin_inc_old_2($t0: &mut 0x42::test::Coin) { [variant baseline] fun test::inc_coin_at($t0: address) { - var $t1: &mut 0x42::test::Coin + var $t1: &mut test::Coin var $t2: &mut u256 var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t1 := borrow_global<0x42::test::Coin>($t0) + 0: $t1 := borrow_global($t0) # live vars: $t1 - 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) + 1: $t2 := borrow_field.0($t1) # live vars: $t2 2: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -682,19 +682,19 @@ fun test::inc_old($t0: &mut u256) { [variant baseline] -fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::inc_vec_coin_new($t0: vector, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut vector<0x42::test::Coin> + var $t3: &mut test::Coin + var $t4: &mut vector var $t5: u256 [unused] var $t6: u256 var $t7: u256 # live vars: $t0, $t1 0: $t4 := borrow_local($t0) # live vars: $t1, $t4 - 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) + 1: $t3 := vector::borrow_mut($t4, $t1) # live vars: $t3 - 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 2: $t2 := borrow_field.0($t3) # live vars: $t2 3: $t6 := read_ref($t2) # live vars: $t2, $t6 @@ -709,22 +709,22 @@ fun test::inc_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { [variant baseline] -fun test::inc_vec_coin_old($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::inc_vec_coin_old($t0: vector, $t1: u64) { var $t2: u256 [unused] var $t3: u256 - var $t4: &0x42::test::Coin - var $t5: &vector<0x42::test::Coin> + var $t4: &test::Coin + var $t5: &vector var $t6: &u256 var $t7: u256 var $t8: &mut u256 - var $t9: &mut 0x42::test::Coin - var $t10: &mut vector<0x42::test::Coin> + var $t9: &mut test::Coin + var $t10: &mut vector # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t0, $t1, $t5 - 1: $t4 := vector::borrow<0x42::test::Coin>($t5, $t1) + 1: $t4 := vector::borrow($t5, $t1) # live vars: $t0, $t1, $t4 - 2: $t6 := borrow_field<0x42::test::Coin>.0($t4) + 2: $t6 := borrow_field.0($t4) # live vars: $t0, $t1, $t6 3: $t3 := read_ref($t6) # live vars: $t0, $t1, $t3 @@ -734,9 +734,9 @@ fun test::inc_vec_coin_old($t0: vector<0x42::test::Coin>, $t1: u64) { # live vars: $t0, $t1, $t3 6: $t10 := borrow_local($t0) # live vars: $t1, $t3, $t10 - 7: $t9 := vector::borrow_mut<0x42::test::Coin>($t10, $t1) + 7: $t9 := vector::borrow_mut($t10, $t1) # live vars: $t3, $t9 - 8: $t8 := borrow_field<0x42::test::Coin>.0($t9) + 8: $t8 := borrow_field.0($t9) # live vars: $t3, $t8 9: write_ref($t8, $t3) # live vars: @@ -796,22 +796,22 @@ fun test::inc_vec_old($t0: vector, $t1: u64) { [variant baseline] -fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::inc_vec_wrapped_coin_new($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 [unused] var $t7: u256 var $t8: u256 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 1: $t4 := vector::borrow_mut>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 2: $t3 := borrow_field>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 3: $t2 := borrow_field.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 @@ -826,26 +826,26 @@ fun test::inc_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::C [variant baseline] -fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::inc_vec_wrapped_coin_old($t0: vector>, $t1: u64) { var $t2: u256 [unused] var $t3: u256 - var $t4: &0x42::test::Coin - var $t5: &0x42::test::Wrapper<0x42::test::Coin> - var $t6: &vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t4: &test::Coin + var $t5: &test::Wrapper + var $t6: &vector> var $t7: &u256 var $t8: u256 var $t9: &mut u256 - var $t10: &mut 0x42::test::Coin - var $t11: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t12: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t10: &mut test::Coin + var $t11: &mut test::Wrapper + var $t12: &mut vector> # live vars: $t0, $t1 0: $t6 := borrow_local($t0) # live vars: $t0, $t1, $t6 - 1: $t5 := vector::borrow<0x42::test::Wrapper<0x42::test::Coin>>($t6, $t1) + 1: $t5 := vector::borrow>($t6, $t1) # live vars: $t0, $t1, $t5 - 2: $t4 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t5) + 2: $t4 := borrow_field>.0($t5) # live vars: $t0, $t1, $t4 - 3: $t7 := borrow_field<0x42::test::Coin>.0($t4) + 3: $t7 := borrow_field.0($t4) # live vars: $t0, $t1, $t7 4: $t3 := read_ref($t7) # live vars: $t0, $t1, $t3 @@ -855,11 +855,11 @@ fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::C # live vars: $t0, $t1, $t3 7: $t12 := borrow_local($t0) # live vars: $t1, $t3, $t12 - 8: $t11 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t12, $t1) + 8: $t11 := vector::borrow_mut>($t12, $t1) # live vars: $t3, $t11 - 9: $t10 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t11) + 9: $t10 := borrow_field>.0($t11) # live vars: $t3, $t10 - 10: $t9 := borrow_field<0x42::test::Coin>.0($t10) + 10: $t9 := borrow_field.0($t10) # live vars: $t3, $t9 11: write_ref($t9, $t3) # live vars: @@ -868,16 +868,16 @@ fun test::inc_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::C [variant baseline] -fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::inc_wrapped_coin_new($t0: &mut test::Wrapper) { var $t1: &mut u256 - var $t2: &mut 0x42::test::Coin + var $t2: &mut test::Coin var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 0: $t2 := borrow_field>.0($t0) # live vars: $t2 - 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) + 1: $t1 := borrow_field.0($t2) # live vars: $t1 2: $t4 := read_ref($t1) # live vars: $t1, $t4 @@ -892,18 +892,18 @@ fun test::inc_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) [variant baseline] -fun test::inc_wrapped_coin_old($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::inc_wrapped_coin_old($t0: &mut test::Wrapper) { var $t1: u256 [unused] var $t2: u256 - var $t3: &0x42::test::Coin + var $t3: &test::Coin var $t4: &u256 var $t5: u256 var $t6: &mut u256 - var $t7: &mut 0x42::test::Coin + var $t7: &mut test::Coin # live vars: $t0 - 0: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 0: $t3 := borrow_field>.0($t0) # live vars: $t0, $t3 - 1: $t4 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t4 := borrow_field.0($t3) # live vars: $t0, $t4 2: $t2 := read_ref($t4) # live vars: $t0, $t2 @@ -911,9 +911,9 @@ fun test::inc_wrapped_coin_old($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) # live vars: $t0, $t2, $t5 4: $t2 := +($t2, $t5) # live vars: $t0, $t2 - 5: $t7 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 5: $t7 := borrow_field>.0($t0) # live vars: $t2, $t7 - 6: $t6 := borrow_field<0x42::test::Coin>.0($t7) + 6: $t6 := borrow_field.0($t7) # live vars: $t2, $t6 7: write_ref($t6, $t2) # live vars: diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp index d75c575a32c78..804f80fa5ee9f 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid1.exp @@ -146,16 +146,16 @@ module 0x42::test { ============ initial bytecode ================ [variant baseline] -fun test::bitand_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::bitand_vec_coin_new($t0: vector, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut vector<0x42::test::Coin> + var $t3: &mut test::Coin + var $t4: &mut vector var $t5: u256 var $t6: u256 var $t7: u256 0: $t4 := borrow_local($t0) - 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) - 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t3 := vector::borrow_mut($t4, $t1) + 2: $t2 := borrow_field.0($t3) 3: $t6 := read_ref($t2) 4: $t7 := 42 5: $t5 := &($t6, $t7) @@ -180,12 +180,12 @@ fun test::bitor_vec_new($t0: &mut vector, $t1: u64) { [variant baseline] -fun test::coin_double($t0: &mut 0x42::test::Coin) { +fun test::coin_double($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 2 3: $t2 := *($t3, $t4) @@ -195,12 +195,12 @@ fun test::coin_double($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { +fun test::coin_mod_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 var $t3: u256 var $t4: u256 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) 1: $t3 := read_ref($t1) 2: $t4 := 2 3: $t2 := %($t3, $t4) @@ -210,14 +210,14 @@ fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { var $t1: &mut u256 - var $t2: &mut 0x42::test::Coin + var $t2: &mut test::Coin var $t3: u256 var $t4: u256 var $t5: u256 - 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) - 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) + 0: $t2 := borrow_field>.0($t0) + 1: $t1 := borrow_field.0($t2) 2: $t4 := read_ref($t1) 3: $t5 := 2 4: $t3 := /($t4, $t5) @@ -227,18 +227,18 @@ fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) [variant baseline] -fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 var $t7: u256 var $t8: u8 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t4 := vector::borrow_mut>($t5, $t1) + 2: $t3 := borrow_field>.0($t4) + 3: $t2 := borrow_field.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := <<($t7, $t8) @@ -249,13 +249,13 @@ fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::C [variant baseline] fun test::shr_coin_at($t0: address) { - var $t1: &mut 0x42::test::Coin + var $t1: &mut test::Coin var $t2: &mut u256 var $t3: u256 var $t4: u256 var $t5: u8 - 0: $t1 := borrow_global<0x42::test::Coin>($t0) - 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) + 0: $t1 := borrow_global($t0) + 1: $t2 := borrow_field.0($t1) 2: $t4 := read_ref($t2) 3: $t5 := 1 4: $t3 := >>($t4, $t5) @@ -280,18 +280,18 @@ fun test::sub1($t0: &mut u256) { [variant baseline] -fun test::xor_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::xor_vec_wrapped_coin_new($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 var $t7: u256 var $t8: u256 0: $t5 := borrow_local($t0) - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 1: $t4 := vector::borrow_mut>($t5, $t1) + 2: $t3 := borrow_field>.0($t4) + 3: $t2 := borrow_field.0($t3) 4: $t7 := read_ref($t2) 5: $t8 := 1 6: $t6 := ^($t7, $t8) @@ -302,19 +302,19 @@ fun test::xor_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::C ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun test::bitand_vec_coin_new($t0: vector<0x42::test::Coin>, $t1: u64) { +fun test::bitand_vec_coin_new($t0: vector, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut vector<0x42::test::Coin> + var $t3: &mut test::Coin + var $t4: &mut vector var $t5: u256 [unused] var $t6: u256 var $t7: u256 # live vars: $t0, $t1 0: $t4 := borrow_local($t0) # live vars: $t1, $t4 - 1: $t3 := vector::borrow_mut<0x42::test::Coin>($t4, $t1) + 1: $t3 := vector::borrow_mut($t4, $t1) # live vars: $t3 - 2: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 2: $t2 := borrow_field.0($t3) # live vars: $t2 3: $t6 := read_ref($t2) # live vars: $t2, $t6 @@ -350,13 +350,13 @@ fun test::bitor_vec_new($t0: &mut vector, $t1: u64) { [variant baseline] -fun test::coin_double($t0: &mut 0x42::test::Coin) { +fun test::coin_double($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -371,13 +371,13 @@ fun test::coin_double($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { +fun test::coin_mod_2($t0: &mut test::Coin) { var $t1: &mut u256 var $t2: u256 [unused] var $t3: u256 var $t4: u256 # live vars: $t0 - 0: $t1 := borrow_field<0x42::test::Coin>.0($t0) + 0: $t1 := borrow_field.0($t0) # live vars: $t1 1: $t3 := read_ref($t1) # live vars: $t1, $t3 @@ -392,16 +392,16 @@ fun test::coin_mod_2($t0: &mut 0x42::test::Coin) { [variant baseline] -fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) { +fun test::half_wrapped_coin_new($t0: &mut test::Wrapper) { var $t1: &mut u256 - var $t2: &mut 0x42::test::Coin + var $t2: &mut test::Coin var $t3: u256 [unused] var $t4: u256 var $t5: u256 # live vars: $t0 - 0: $t2 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t0) + 0: $t2 := borrow_field>.0($t0) # live vars: $t2 - 1: $t1 := borrow_field<0x42::test::Coin>.0($t2) + 1: $t1 := borrow_field.0($t2) # live vars: $t1 2: $t4 := read_ref($t1) # live vars: $t1, $t4 @@ -416,22 +416,22 @@ fun test::half_wrapped_coin_new($t0: &mut 0x42::test::Wrapper<0x42::test::Coin>) [variant baseline] -fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::shl_vec_wrapped_coin_old($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 [unused] var $t7: u256 var $t8: u8 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 1: $t4 := vector::borrow_mut>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 2: $t3 := borrow_field>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 3: $t2 := borrow_field.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 @@ -447,15 +447,15 @@ fun test::shl_vec_wrapped_coin_old($t0: vector<0x42::test::Wrapper<0x42::test::C [variant baseline] fun test::shr_coin_at($t0: address) { - var $t1: &mut 0x42::test::Coin + var $t1: &mut test::Coin var $t2: &mut u256 var $t3: u256 [unused] var $t4: u256 var $t5: u8 # live vars: $t0 - 0: $t1 := borrow_global<0x42::test::Coin>($t0) + 0: $t1 := borrow_global($t0) # live vars: $t1 - 1: $t2 := borrow_field<0x42::test::Coin>.0($t1) + 1: $t2 := borrow_field.0($t1) # live vars: $t2 2: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -489,22 +489,22 @@ fun test::sub1($t0: &mut u256) { [variant baseline] -fun test::xor_vec_wrapped_coin_new($t0: vector<0x42::test::Wrapper<0x42::test::Coin>>, $t1: u64) { +fun test::xor_vec_wrapped_coin_new($t0: vector>, $t1: u64) { var $t2: &mut u256 - var $t3: &mut 0x42::test::Coin - var $t4: &mut 0x42::test::Wrapper<0x42::test::Coin> - var $t5: &mut vector<0x42::test::Wrapper<0x42::test::Coin>> + var $t3: &mut test::Coin + var $t4: &mut test::Wrapper + var $t5: &mut vector> var $t6: u256 [unused] var $t7: u256 var $t8: u256 # live vars: $t0, $t1 0: $t5 := borrow_local($t0) # live vars: $t1, $t5 - 1: $t4 := vector::borrow_mut<0x42::test::Wrapper<0x42::test::Coin>>($t5, $t1) + 1: $t4 := vector::borrow_mut>($t5, $t1) # live vars: $t4 - 2: $t3 := borrow_field<0x42::test::Wrapper<0x42::test::Coin>>.0($t4) + 2: $t3 := borrow_field>.0($t4) # live vars: $t3 - 3: $t2 := borrow_field<0x42::test::Coin>.0($t3) + 3: $t2 := borrow_field.0($t3) # live vars: $t2 4: $t7 := read_ref($t2) # live vars: $t2, $t7 diff --git a/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp b/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp index e8c5f393627ac..6d752da6f4b64 100644 --- a/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp +++ b/third_party/move/move-compiler-v2/tests/op-equal/valid2.exp @@ -51,13 +51,13 @@ module 0xc0ffee::m { ============ initial bytecode ================ [variant baseline] -fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { +fun m::foo($t0: &mut m::S): u64 { var $t1: u64 var $t2: &mut u64 var $t3: u64 var $t4: u64 var $t5: u64 - 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t2 := borrow_field.x($t0) 1: $t4 := read_ref($t2) 2: $t5 := 1 3: $t3 := +($t4, $t5) @@ -70,27 +70,27 @@ fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { [variant baseline] public fun m::test(): u64 { var $t0: u64 - var $t1: 0xc0ffee::m::S + var $t1: m::S var $t2: u64 var $t3: u64 - var $t4: &mut 0xc0ffee::m::S + var $t4: &mut m::S var $t5: &mut u64 - var $t6: &mut 0xc0ffee::m::S + var $t6: &mut m::S var $t7: u64 var $t8: u64 - var $t9: &0xc0ffee::m::S + var $t9: &m::S var $t10: &u64 0: $t2 := 0 - 1: $t1 := pack 0xc0ffee::m::S($t2) + 1: $t1 := pack m::S($t2) 2: $t4 := borrow_local($t1) 3: $t3 := m::foo($t4) 4: $t6 := borrow_local($t1) - 5: $t5 := borrow_field<0xc0ffee::m::S>.x($t6) + 5: $t5 := borrow_field.x($t6) 6: $t8 := read_ref($t5) 7: $t7 := +($t8, $t3) 8: write_ref($t5, $t7) 9: $t9 := borrow_local($t1) - 10: $t10 := borrow_field<0xc0ffee::m::S>.x($t9) + 10: $t10 := borrow_field.x($t9) 11: $t0 := read_ref($t10) 12: return $t0 } @@ -98,14 +98,14 @@ public fun m::test(): u64 { ============ after LiveVarAnalysisProcessor: ================ [variant baseline] -fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { +fun m::foo($t0: &mut m::S): u64 { var $t1: u64 [unused] var $t2: &mut u64 var $t3: u64 [unused] var $t4: u64 var $t5: u64 # live vars: $t0 - 0: $t2 := borrow_field<0xc0ffee::m::S>.x($t0) + 0: $t2 := borrow_field.x($t0) # live vars: $t2 1: $t4 := read_ref($t2) # live vars: $t2, $t4 @@ -124,20 +124,20 @@ fun m::foo($t0: &mut 0xc0ffee::m::S): u64 { [variant baseline] public fun m::test(): u64 { var $t0: u64 [unused] - var $t1: 0xc0ffee::m::S + var $t1: m::S var $t2: u64 var $t3: u64 [unused] - var $t4: &mut 0xc0ffee::m::S + var $t4: &mut m::S var $t5: &mut u64 - var $t6: &mut 0xc0ffee::m::S [unused] + var $t6: &mut m::S [unused] var $t7: u64 [unused] var $t8: u64 - var $t9: &0xc0ffee::m::S + var $t9: &m::S var $t10: &u64 # live vars: 0: $t2 := 0 # live vars: $t2 - 1: $t1 := pack 0xc0ffee::m::S($t2) + 1: $t1 := pack m::S($t2) # live vars: $t1 2: $t4 := borrow_local($t1) # live vars: $t1, $t4 @@ -145,7 +145,7 @@ public fun m::test(): u64 { # live vars: $t1, $t2 4: $t4 := borrow_local($t1) # live vars: $t1, $t2, $t4 - 5: $t5 := borrow_field<0xc0ffee::m::S>.x($t4) + 5: $t5 := borrow_field.x($t4) # live vars: $t1, $t2, $t5 6: $t8 := read_ref($t5) # live vars: $t1, $t2, $t5, $t8 @@ -155,7 +155,7 @@ public fun m::test(): u64 { # live vars: $t1 9: $t9 := borrow_local($t1) # live vars: $t9 - 10: $t10 := borrow_field<0xc0ffee::m::S>.x($t9) + 10: $t10 := borrow_field.x($t9) # live vars: $t10 11: $t2 := read_ref($t10) # live vars: $t2 diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp index a133044ef3459..f343d5441ac03 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/struct_use_before_assign.exp @@ -53,15 +53,15 @@ warning: Unused local variable `q`. Consider removing or prefixing with an under [variant baseline] fun M::main() { var $t0: u64 - var $t1: 0x876543::M::R + var $t1: M::R var $t2: u64 var $t3: u64 var $t4: u64 var $t5: u64 var $t6: u64 0: $t2 := 3 - 1: $t1 := pack 0x876543::M::R($t2, $t0) - 2: ($t3, $t4) := unpack 0x876543::M::R($t1) + 1: $t1 := pack M::R($t2, $t0) + 2: ($t3, $t4) := unpack M::R($t1) 3: $t5 := infer($t4) 4: $t6 := infer($t3) 5: return () @@ -71,15 +71,15 @@ fun M::main() { [variant baseline] fun M::main2() { var $t0: u64 - var $t1: 0x876543::M::R + var $t1: M::R var $t2: u64 var $t3: u64 var $t4: u64 var $t5: u64 var $t6: u64 0: $t2 := 0 - 1: $t1 := pack 0x876543::M::R($t2, $t0) - 2: ($t3, $t4) := unpack 0x876543::M::R($t1) + 1: $t1 := pack M::R($t2, $t0) + 2: ($t3, $t4) := unpack M::R($t1) 3: $t5 := infer($t4) 4: $t6 := infer($t3) 5: return () @@ -88,12 +88,12 @@ fun M::main2() { [variant baseline] fun M::main3() { - var $t0: 0x876543::M::R + var $t0: M::R var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 - 0: ($t1, $t2) := unpack 0x876543::M::R($t0) + 0: ($t1, $t2) := unpack M::R($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t1) 3: return () @@ -148,7 +148,7 @@ error: use of unassigned local `x` [variant baseline] fun M::main() { var $t0: u64 - var $t1: 0x876543::M::R + var $t1: M::R var $t2: u64 var $t3: u64 var $t4: u64 @@ -157,9 +157,9 @@ fun M::main() { # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := 3 # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t3, $t4, $t5, $t6 } - 1: $t1 := pack 0x876543::M::R($t2, $t0) + 1: $t1 := pack M::R($t2, $t0) # before: { no: $t0, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t5, $t6 } - 2: ($t3, $t4) := unpack 0x876543::M::R($t1) + 2: ($t3, $t4) := unpack M::R($t1) # before: { no: $t0, $t5, $t6 }, after: { no: $t0, $t6 } 3: $t5 := infer($t4) # before: { no: $t0, $t6 }, after: { no: $t0 } @@ -172,7 +172,7 @@ fun M::main() { [variant baseline] fun M::main2() { var $t0: u64 - var $t1: 0x876543::M::R + var $t1: M::R var $t2: u64 var $t3: u64 var $t4: u64 @@ -181,9 +181,9 @@ fun M::main2() { # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := 0 # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t3, $t4, $t5, $t6 } - 1: $t1 := pack 0x876543::M::R($t2, $t0) + 1: $t1 := pack M::R($t2, $t0) # before: { no: $t0, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t5, $t6 } - 2: ($t3, $t4) := unpack 0x876543::M::R($t1) + 2: ($t3, $t4) := unpack M::R($t1) # before: { no: $t0, $t5, $t6 }, after: { no: $t0, $t6 } 3: $t5 := infer($t4) # before: { no: $t0, $t6 }, after: { no: $t0 } @@ -195,13 +195,13 @@ fun M::main2() { [variant baseline] fun M::main3() { - var $t0: 0x876543::M::R + var $t0: M::R var $t1: u64 var $t2: u64 var $t3: u64 var $t4: u64 # before: { no: $t0, $t1, $t2, $t3, $t4 }, after: { no: $t0, $t3, $t4 } - 0: ($t1, $t2) := unpack 0x876543::M::R($t0) + 0: ($t1, $t2) := unpack M::R($t0) # before: { no: $t0, $t3, $t4 }, after: { no: $t0, $t4 } 1: $t3 := infer($t2) # before: { no: $t0, $t4 }, after: { no: $t0 } diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp index 0157525a3a232..1749474d122c6 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/unused_reference.exp @@ -2,8 +2,8 @@ [variant baseline] public fun Module0::function0() { - var $t0: &0xcafe::Module0::S - var $t1: 0xcafe::Module0::S + var $t0: &Module0::S + var $t1: Module0::S 0: $t1 := read_ref($t0) 1: return () } @@ -20,8 +20,8 @@ error: use of unassigned local `y` [variant baseline] public fun Module0::function0() { - var $t0: &0xcafe::Module0::S - var $t1: 0xcafe::Module0::S + var $t0: &Module0::S + var $t1: Module0::S # before: { no: $t0, $t1 }, after: { no: $t0 } 0: $t1 := read_ref($t0) # before: { no: $t0 }, after: { no: $t0 } diff --git a/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp b/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp index 46ecf613deaa7..89b580d92ae0c 100644 --- a/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp +++ b/third_party/move/move-compiler-v2/tests/uninit-use-checker/v1-locals/use_before_assign_simple.exp @@ -5,8 +5,8 @@ fun M::tborrow() { var $t0: u64 var $t1: &u64 var $t2: &u64 - var $t3: 0x8675309::M::S - var $t4: &0x8675309::M::S + var $t3: M::S + var $t4: &M::S 0: $t1 := borrow_local($t0) 1: $t2 := infer($t1) 2: $t4 := borrow_local($t3) @@ -20,8 +20,8 @@ fun M::tcopy() { var $t1: u64 var $t2: u64 var $t3: u64 - var $t4: 0x8675309::M::S - var $t5: 0x8675309::M::S + var $t4: M::S + var $t5: M::S 0: $t2 := 1 1: $t1 := +($t0, $t2) 2: $t3 := infer($t1) @@ -37,8 +37,8 @@ fun M::tmove() { var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: 0x8675309::M::S - var $t6: 0x8675309::M::S + var $t5: M::S + var $t6: M::S 0: $t2 := move($t0) 1: $t3 := 1 2: $t1 := +($t2, $t3) @@ -92,8 +92,8 @@ fun M::tborrow() { var $t0: u64 var $t1: &u64 var $t2: &u64 - var $t3: 0x8675309::M::S - var $t4: &0x8675309::M::S + var $t3: M::S + var $t4: &M::S # before: { no: $t0, $t1, $t2, $t3, $t4 }, after: { no: $t0, $t2, $t3, $t4 } 0: $t1 := borrow_local($t0) # before: { no: $t0, $t2, $t3, $t4 }, after: { no: $t0, $t3, $t4 } @@ -111,8 +111,8 @@ fun M::tcopy() { var $t1: u64 var $t2: u64 var $t3: u64 - var $t4: 0x8675309::M::S - var $t5: 0x8675309::M::S + var $t4: M::S + var $t5: M::S # before: { no: $t0, $t1, $t2, $t3, $t4, $t5 }, after: { no: $t0, $t1, $t3, $t4, $t5 } 0: $t2 := 1 # before: { no: $t0, $t1, $t3, $t4, $t5 }, after: { no: $t0, $t3, $t4, $t5 } @@ -133,8 +133,8 @@ fun M::tmove() { var $t2: u64 var $t3: u64 var $t4: u64 - var $t5: 0x8675309::M::S - var $t6: 0x8675309::M::S + var $t5: M::S + var $t6: M::S # before: { no: $t0, $t1, $t2, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t3, $t4, $t5, $t6 } 0: $t2 := move($t0) # before: { no: $t0, $t1, $t3, $t4, $t5, $t6 }, after: { no: $t0, $t1, $t4, $t5, $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp index 74ef544575ec3..2f685d7e7352d 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -33,8 +33,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := infer($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -43,8 +43,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := infer($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -60,7 +60,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -86,8 +86,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -96,8 +96,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -115,7 +115,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -157,8 +157,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -174,8 +174,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -198,7 +198,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -224,8 +224,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -234,8 +234,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -251,7 +251,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -277,8 +277,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -287,8 +287,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp index 74ef544575ec3..2f685d7e7352d 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_1.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -33,8 +33,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := infer($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -43,8 +43,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := infer($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -60,7 +60,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -86,8 +86,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -96,8 +96,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -115,7 +115,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -157,8 +157,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -174,8 +174,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -198,7 +198,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -224,8 +224,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -234,8 +234,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -251,7 +251,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -277,8 +277,8 @@ public fun m::test2($t0: u64) { [variant baseline] -public fun m::test3($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test3($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t0) 2: m::consume_($t1) @@ -287,8 +287,8 @@ public fun m::test3($t0: 0xc0ffee::m::W) { [variant baseline] -public fun m::test4($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test4($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp index 9467564dc9e2c..d80d47d848cef 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -40,7 +40,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -75,7 +75,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -99,8 +99,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, e:$t0, b:$t1 0: $t1 := move($t0) @@ -122,7 +122,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -138,8 +138,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W [unused] +public fun m::test2($t0: m::W) { + var $t1: m::W [unused] 0: $t0 := move($t0) 1: m::consume_($t0) 2: m::consume_($t0) @@ -155,7 +155,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -170,8 +170,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W [unused] +public fun m::test2($t0: m::W) { + var $t1: m::W [unused] 0: m::consume_($t0) 1: m::consume_($t0) 2: return () diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp index 9467564dc9e2c..d80d47d848cef 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_2.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -40,7 +40,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W 0: $t1 := move($t0) 1: m::consume_($t1) 2: m::consume_($t1) @@ -75,7 +75,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -99,8 +99,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test2($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, e:$t0, b:$t1 0: $t1 := move($t0) @@ -122,7 +122,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -138,8 +138,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W [unused] +public fun m::test2($t0: m::W) { + var $t1: m::W [unused] 0: $t0 := move($t0) 1: m::consume_($t0) 2: m::consume_($t0) @@ -155,7 +155,7 @@ fun m::consume($t0: u64) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -170,8 +170,8 @@ public fun m::test1($t0: u64) { [variant baseline] -public fun m::test2($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W [unused] +public fun m::test2($t0: m::W) { + var $t1: m::W [unused] 0: m::consume_($t0) 1: m::consume_($t0) 2: return () diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp index 7ecc0e6a884b1..606dd277acd0c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -40,7 +40,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -75,7 +75,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -100,8 +100,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -124,7 +124,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -140,8 +140,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -157,7 +157,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -173,8 +173,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp index 7ecc0e6a884b1..606dd277acd0c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_3.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -23,8 +23,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -40,7 +40,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -56,8 +56,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -75,7 +75,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -100,8 +100,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -124,7 +124,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -140,8 +140,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) @@ -157,7 +157,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -173,8 +173,8 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W +public fun m::test_($t0: m::W) { + var $t1: m::W 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp index f2b1a0c6caaf7..0c6d1f781f678 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -25,9 +25,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -44,7 +44,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -62,9 +62,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -83,7 +83,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -112,9 +112,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -140,7 +140,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -158,9 +158,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W [unused] +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W [unused] 0: $t1 := copy($t0) 1: $t1 := move($t1) 2: m::consume_($t1) @@ -177,7 +177,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -194,9 +194,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W [unused] +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W [unused] 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp index f2b1a0c6caaf7..0c6d1f781f678 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_4.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -25,9 +25,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -44,7 +44,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -62,9 +62,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W 0: $t1 := copy($t0) 1: $t2 := move($t1) 2: m::consume_($t2) @@ -83,7 +83,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -112,9 +112,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W # live vars: $t0 # events: b:$t0, b:$t1 0: $t1 := copy($t0) @@ -140,7 +140,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -158,9 +158,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W [unused] +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W [unused] 0: $t1 := copy($t0) 1: $t1 := move($t1) 2: m::consume_($t1) @@ -177,7 +177,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -194,9 +194,9 @@ public fun m::test($t0: u32) { [variant baseline] -public fun m::test_struct($t0: 0xc0ffee::m::W) { - var $t1: 0xc0ffee::m::W - var $t2: 0xc0ffee::m::W [unused] +public fun m::test_struct($t0: m::W) { + var $t1: m::W + var $t2: m::W [unused] 0: $t1 := copy($t0) 1: m::consume_($t1) 2: m::consume_($t0) diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp index 1c5c097d9e7c9..77bfd28f9ff4c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -37,8 +37,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 5 @@ -68,7 +68,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -98,8 +98,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -131,7 +131,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -184,8 +184,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool # live vars: $t0, $t1 # events: b:$t0, b:$t1, b:$t2 @@ -236,7 +236,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -266,8 +266,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -297,7 +297,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -327,8 +327,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp index 1c5c097d9e7c9..77bfd28f9ff4c 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/consume_5.opt.exp @@ -7,7 +7,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -37,8 +37,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 5 @@ -68,7 +68,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -98,8 +98,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -131,7 +131,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { # live vars: $t0 # events: b:$t0, e:$t0 0: return () @@ -184,8 +184,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool # live vars: $t0, $t1 # events: b:$t0, b:$t1, b:$t2 @@ -236,7 +236,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -266,8 +266,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 @@ -297,7 +297,7 @@ fun m::consume($t0: u32) { [variant baseline] -fun m::consume_($t0: 0xc0ffee::m::W) { +fun m::consume_($t0: m::W) { 0: return () } @@ -327,8 +327,8 @@ public fun m::test($t0: bool, $t1: u32) { [variant baseline] -public fun m::test_struct($t0: bool, $t1: 0xc0ffee::m::W) { - var $t2: 0xc0ffee::m::W +public fun m::test_struct($t0: bool, $t1: m::W) { + var $t2: m::W var $t3: bool 0: $t2 := copy($t1) 1: if ($t0) goto 2 else goto 14 diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp index 1b05ff1d6aaec..1a59b3c7f2a73 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.exp @@ -1,23 +1,23 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -25,23 +25,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -49,14 +49,14 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 # live vars: $t0 # events: b:$t0, e:$t0 @@ -68,7 +68,7 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { 2: $t5 := borrow_local($t2) # live vars: $t3, $t5 # events: e:$t5, b:$t4 - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) # live vars: $t3, $t4 # events: b:$t6 4: $t6 := 0 @@ -80,7 +80,7 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { 6: $t7 := borrow_local($t3) # live vars: $t7 # events: e:$t7, b:$t8 - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) # live vars: $t8 # events: e:$t8, b:$t1 8: $t1 := read_ref($t8) @@ -92,23 +92,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 [unused] - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } @@ -116,23 +116,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 [unused] - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp index 1b05ff1d6aaec..1a59b3c7f2a73 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/mut_refs_2.opt.exp @@ -1,23 +1,23 @@ ============ initial bytecode ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -25,23 +25,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t1 := read_ref($t8) 9: return $t1 } @@ -49,14 +49,14 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 # live vars: $t0 # events: b:$t0, e:$t0 @@ -68,7 +68,7 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { 2: $t5 := borrow_local($t2) # live vars: $t3, $t5 # events: e:$t5, b:$t4 - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) # live vars: $t3, $t4 # events: b:$t6 4: $t6 := 0 @@ -80,7 +80,7 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { 6: $t7 := borrow_local($t3) # live vars: $t7 # events: e:$t7, b:$t8 - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) # live vars: $t8 # events: e:$t8, b:$t1 8: $t1 := read_ref($t8) @@ -92,23 +92,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 [unused] - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } @@ -116,23 +116,23 @@ fun m::test($t0: 0xc0ffee::m::S): u64 { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::test($t0: 0xc0ffee::m::S): u64 { +fun m::test($t0: m::S): u64 { var $t1: u64 [unused] - var $t2: 0xc0ffee::m::S - var $t3: 0xc0ffee::m::S + var $t2: m::S + var $t3: m::S var $t4: &mut u64 - var $t5: &mut 0xc0ffee::m::S + var $t5: &mut m::S var $t6: u64 - var $t7: &0xc0ffee::m::S + var $t7: &m::S var $t8: &u64 0: $t2 := move($t0) 1: $t3 := copy($t2) 2: $t5 := borrow_local($t2) - 3: $t4 := borrow_field<0xc0ffee::m::S>.a($t5) + 3: $t4 := borrow_field.a($t5) 4: $t6 := 0 5: write_ref($t4, $t6) 6: $t7 := borrow_local($t3) - 7: $t8 := borrow_field<0xc0ffee::m::S>.a($t7) + 7: $t8 := borrow_field.a($t7) 8: $t6 := read_ref($t8) 9: return $t6 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp index d07e8b35bdcd3..ef5799020a8ac 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) @@ -39,13 +39,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo # live vars: $t0 # events: b:$t0, e:$t0, b:$t2 0: $t2 := move($t0) @@ -72,13 +72,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo [unused] - var $t2: 0xc0ffee::m::Foo [unused] - var $t3: 0xc0ffee::m::Foo [unused] - var $t4: 0xc0ffee::m::Foo [unused] - var $t5: 0xc0ffee::m::Foo [unused] - var $t6: 0xc0ffee::m::Foo [unused] +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo [unused] + var $t2: m::Foo [unused] + var $t3: m::Foo [unused] + var $t4: m::Foo [unused] + var $t5: m::Foo [unused] + var $t6: m::Foo [unused] 0: $t0 := move($t0) 1: $t0 := move($t0) 2: $t0 := move($t0) @@ -91,13 +91,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo [unused] - var $t2: 0xc0ffee::m::Foo [unused] - var $t3: 0xc0ffee::m::Foo [unused] - var $t4: 0xc0ffee::m::Foo [unused] - var $t5: 0xc0ffee::m::Foo [unused] - var $t6: 0xc0ffee::m::Foo [unused] +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo [unused] + var $t2: m::Foo [unused] + var $t3: m::Foo [unused] + var $t4: m::Foo [unused] + var $t5: m::Foo [unused] + var $t6: m::Foo [unused] 0: return $t0 } diff --git a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp index d07e8b35bdcd3..ef5799020a8ac 100644 --- a/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp +++ b/third_party/move/move-compiler-v2/tests/variable-coalescing/sequential_assign_struct.opt.exp @@ -1,13 +1,13 @@ ============ initial bytecode ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := infer($t0) 1: $t3 := infer($t2) 2: $t4 := infer($t3) @@ -20,13 +20,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo 0: $t2 := move($t0) 1: $t3 := move($t2) 2: $t4 := move($t3) @@ -39,13 +39,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after VariableCoalescingAnnotator: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo - var $t2: 0xc0ffee::m::Foo - var $t3: 0xc0ffee::m::Foo - var $t4: 0xc0ffee::m::Foo - var $t5: 0xc0ffee::m::Foo - var $t6: 0xc0ffee::m::Foo +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo + var $t2: m::Foo + var $t3: m::Foo + var $t4: m::Foo + var $t5: m::Foo + var $t6: m::Foo # live vars: $t0 # events: b:$t0, e:$t0, b:$t2 0: $t2 := move($t0) @@ -72,13 +72,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after VariableCoalescingTransformer: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo [unused] - var $t2: 0xc0ffee::m::Foo [unused] - var $t3: 0xc0ffee::m::Foo [unused] - var $t4: 0xc0ffee::m::Foo [unused] - var $t5: 0xc0ffee::m::Foo [unused] - var $t6: 0xc0ffee::m::Foo [unused] +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo [unused] + var $t2: m::Foo [unused] + var $t3: m::Foo [unused] + var $t4: m::Foo [unused] + var $t5: m::Foo [unused] + var $t6: m::Foo [unused] 0: $t0 := move($t0) 1: $t0 := move($t0) 2: $t0 := move($t0) @@ -91,13 +91,13 @@ fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { ============ after DeadStoreElimination: ================ [variant baseline] -fun m::sequential($t0: 0xc0ffee::m::Foo): 0xc0ffee::m::Foo { - var $t1: 0xc0ffee::m::Foo [unused] - var $t2: 0xc0ffee::m::Foo [unused] - var $t3: 0xc0ffee::m::Foo [unused] - var $t4: 0xc0ffee::m::Foo [unused] - var $t5: 0xc0ffee::m::Foo [unused] - var $t6: 0xc0ffee::m::Foo [unused] +fun m::sequential($t0: m::Foo): m::Foo { + var $t1: m::Foo [unused] + var $t2: m::Foo [unused] + var $t3: m::Foo [unused] + var $t4: m::Foo [unused] + var $t5: m::Foo [unused] + var $t6: m::Foo [unused] 0: return $t0 } diff --git a/third_party/move/move-compiler/src/expansion/ast.rs b/third_party/move/move-compiler/src/expansion/ast.rs index 47db86f2654ba..8a241a6091ae3 100644 --- a/third_party/move/move-compiler/src/expansion/ast.rs +++ b/third_party/move/move-compiler/src/expansion/ast.rs @@ -6,8 +6,8 @@ use crate::{ expansion::translate::is_valid_struct_constant_or_schema_name, parser::ast::{ self as P, Ability, Ability_, BinOp, CallKind, ConstantName, Field, FunctionName, Label, - ModuleName, QuantKind, SpecApplyPattern, StructName, UnaryOp, UseDecl, Var, VariantName, - ENTRY_MODIFIER, + LambdaCaptureKind, ModuleName, QuantKind, SpecApplyPattern, StructName, UnaryOp, UseDecl, + Var, VariantName, ENTRY_MODIFIER, }, shared::{ ast_debug::*, @@ -401,7 +401,7 @@ pub enum Type_ { Multiple(Vec), Apply(ModuleAccess, Vec), Ref(bool, Box), - Fun(Vec, Box), + Fun(Vec, Box, AbilitySet), UnresolvedError, } pub type Type = Spanned; @@ -498,6 +498,7 @@ pub enum Exp_ { Name(ModuleAccess, Option>), Call(ModuleAccess, CallKind, Option>, Spanned>), + ExpCall(Box, Spanned>), Pack(ModuleAccess, Option>, Fields), Vector(Loc, Option>, Spanned>), @@ -506,7 +507,7 @@ pub enum Exp_ { While(Option