From a050828ce516eede1b487cce2d614459c71d0e66 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Wed, 2 Oct 2024 21:40:33 -0700 Subject: [PATCH] add type param list for struct in dump --- .../bug_14471_receiver_inference.exp | 2 +- .../tests/bytecode-generator/fields.exp | 2 +- .../tests/bytecode-generator/matching_ok.exp | 2 +- .../abilities/v1/ability_constraints.exp | 16 +++++------ .../v1/phantom_param_op_abilities.exp | 10 +++---- .../phantom_params_constraint_abilities.exp | 14 +++++----- .../v1/phantom_params_field_abilities.exp | 8 +++--- .../checking/access_specifiers/access_ok.exp | 2 +- .../acquires_list_generic.exp | 4 +-- .../tests/checking/dotdot/dotdot_valid.exp | 6 ++-- .../checking/inlining/resources_valid.exp | 2 +- .../naming/unused_type_parameter_struct.exp | 12 ++++---- .../checking/naming/warning_dependency.exp | 12 ++++---- .../checking/positional_fields/decl_ok.exp | 2 +- .../named_tuple_ability_decl_ok.exp | 10 +++---- .../named_tuple_construct_ok.exp | 4 +-- .../variant_ability_decl_ok.exp | 4 +-- .../tests/checking/receiver/decl_errors.exp | 2 +- .../tests/checking/receiver/generic_calls.exp | 2 +- .../checking/receiver/generic_calls_typed.exp | 2 +- .../checking/specs/intrinsic_decl_ok.exp | 4 +-- .../tests/checking/specs/schemas_ok.exp | 2 +- .../tests/checking/specs/structs_ok.exp | 2 +- .../tests/checking/typing/eq.exp | 2 +- .../tests/checking/typing/exp_list.exp | 2 +- .../typing/main_arguments_various_caes.exp | 2 +- .../tests/checking/typing/neq.exp | 2 +- .../checking/typing/nested_post_process.exp | 4 +-- .../typing/phantom_param_struct_decl.exp | 10 +++---- .../typing/type_variable_join_single_pack.exp | 2 +- .../type_variable_join_single_unpack.exp | 2 +- ...ype_variable_join_single_unpack_assign.exp | 2 +- .../type_variable_join_threaded_pack.exp | 4 +-- .../multi_pool_money_market_token.exp | 12 ++++---- .../v1-examples/simple_money_market_token.exp | 10 +++---- .../variants_test_no_parenthesis_ok.exp | 2 +- .../checking/variants/variants_test_ok.exp | 2 +- ...mutually_recursive_non_generic_type_ok.exp | 2 +- .../infinite_instantiations_valid.exp | 2 +- .../tests/lambda-lifting/pattern.exp | 28 +++++++++---------- .../tests/op-equal/valid0.exp | 4 +-- .../tests/op-equal/valid1.exp | 4 +-- third_party/move/move-model/src/model.rs | 26 +++++++++++++++-- 43 files changed, 136 insertions(+), 114 deletions(-) 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 9a7714eaeae4c3..fa7bd1a001f77c 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 @@ -3,7 +3,7 @@ module 0x815::m { struct MyMap { table: m::Table, } - struct Table { + struct Table { x: T1, y: T2, } 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 54c0d2bf6f939e..cac8ff02deb8f2 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 @@ -3,7 +3,7 @@ module 0x42::fields { struct T { h: u64, } - struct G { + struct G { f: X, } struct S { 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 016fcc4ac5beec..779a0c11095fd0 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 @@ -39,7 +39,7 @@ module 0xc0ffee::m { y: u64, } } - enum Option { + enum Option { None, Some { value: A, diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp index d6fff4b1fb6bf7..62b08ae7566842 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/ability_constraints.exp @@ -1,9 +1,9 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct Box { + struct Box { f: T, } - struct Pair { + struct Pair { f1: T1, f2: T2, } @@ -13,22 +13,22 @@ module 0x42::M { struct S { dummy_field: bool, } - struct Sc { + struct Sc { dummy_field: bool, } - struct Scds { + struct Scds { dummy_field: bool, } - struct Sd { + struct Sd { dummy_field: bool, } - struct Sk { + struct Sk { dummy_field: bool, } - struct Ss { + struct Ss { dummy_field: bool, } - struct Ssk { + struct Ssk { dummy_field: bool, } private fun c() { diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp index d5ccb52b48d21a..8a439bc744e492 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_param_op_abilities.exp @@ -1,21 +1,21 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct HasCopy { + struct HasCopy { a: T2, } - struct HasDrop { + struct HasDrop { a: T2, } - struct HasKey { + struct HasKey { a: T2, } - struct HasStore { + struct HasStore { a: T2, } struct NoAbilities { dummy_field: bool, } - struct RequireStore { + struct RequireStore { a: T, } private fun f1(ref: &mut M::HasDrop) { diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp index 4b1929b32c2aed..e136d82b4cd85b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_constraint_abilities.exp @@ -1,30 +1,30 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct HasAbilities { + struct HasAbilities { a: T2, } - struct HasCopy { + struct HasCopy { a: T2, } - struct HasDrop { + struct HasDrop { a: T2, } - struct HasKey { + struct HasKey { a: T2, } - struct HasStore { + struct HasStore { a: T2, } struct NoAbilities { a: bool, } - struct S1 { + struct S1 { a: T, } struct S2 { a: M::S1>, } - struct S3 { + struct S3 { a: T1, b: T2, c: T3, diff --git a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp index c989623b114ba6..1621aa3e84955d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp +++ b/third_party/move/move-compiler-v2/tests/checking/abilities/v1/phantom_params_field_abilities.exp @@ -1,15 +1,15 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct HasCopy { + struct HasCopy { a: T2, } - struct HasDrop { + struct HasDrop { a: T2, } - struct HasKey { + struct HasKey { a: T2, } - struct HasStore { + struct HasStore { a: T2, } struct NoAbilities { diff --git a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp index b2e3bc22312804..4573572559a9be 100644 --- a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/access_ok.exp @@ -23,7 +23,7 @@ module 0x42::m { struct T { dummy_field: bool, } - struct G { + struct G { dummy_field: bool, } struct R { diff --git a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp index fa0d50a8ea13df..62e92ce103c89d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp +++ b/third_party/move/move-compiler-v2/tests/checking/access_specifiers/acquires_list_generic.exp @@ -1,9 +1,9 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct B { + struct B { dummy_field: bool, } - struct CupC { + struct CupC { dummy_field: bool, } struct R { diff --git a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp index 87b52a3c44aecd..2cb2919397a4c0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/dotdot/dotdot_valid.exp @@ -27,15 +27,15 @@ module 0x42::test { x: bool, y: u8, } - struct S4 { + struct S4 { x: T, y: test::S3, } - struct S5 { + struct S5 { 0: T, 1: U, } - struct S6 { + struct S6 { x: T, y: U, } diff --git a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp index cf71f9d1297c0b..dfe206a5cb395a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/inlining/resources_valid.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::objects { - struct ReaderRef { + struct ReaderRef { addr: address, } public fun get_addr(ref: &objects::ReaderRef<#0>): address { diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp index 24c92c36b428be..c8e32c98bb468b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/unused_type_parameter_struct.exp @@ -42,22 +42,22 @@ warning: unused type parameter // -- Model dump before bytecode pipeline module 0x42::test { - struct S0 { + struct S0 { dummy_field: bool, } - struct S1 { + struct S1 { dummy_field: bool, } - struct S2 { + struct S2 { f: test::S3, } - struct S3 { + struct S3 { dummy_field: bool, } - struct S4 { + struct S4 { f: vector, } - struct S5 { + struct S5 { f: vector, g: vector, } diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp index 0bed925598e109..6b74efa96e56b0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/warning_dependency.exp @@ -11,22 +11,22 @@ module 0x42::dependency { use 0x42::test::{S0}; } // end 0x42::dependency module 0x42::test { - struct S0 { + struct S0 { dummy_field: bool, } - struct S1 { + struct S1 { dummy_field: bool, } - struct S2 { + struct S2 { f: test::S3, } - struct S3 { + struct S3 { dummy_field: bool, } - struct S4 { + struct S4 { f: vector, } - struct S5 { + struct S5 { f: vector, g: vector, } diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp index 456ba4a877dccf..ee300128991a82 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/decl_ok.exp @@ -15,7 +15,7 @@ module 0x42::test { 0: u8, 1: bool, } - struct S3 { + struct S3 { 0: T2, 1: u8, 2: T1, diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp index 19444714c67658..cab88fc1be7564 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_ability_decl_ok.exp @@ -6,23 +6,23 @@ module 0x42::test { struct S1 { 0: u8, } - struct S2 { + struct S2 { 0: T, 1: u8, } - struct S3 { + struct S3 { 0: T, 1: u8, } - struct S4 { + struct S4 { x: u8, y: T, } - struct S5 { + struct S5 { 0: T, 1: test::S3, } - struct S6 { + struct S6 { dummy_field: bool, } } // end 0x42::test diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp index 286130d5412c08..1ae6cd8dce220f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/named_tuple_construct_ok.exp @@ -18,14 +18,14 @@ module 0x42::test { 0: u8, 1: bool, } - struct S3 { + struct S3 { 0: T, 1: u8, } struct S4 { dummy_field: bool, } - struct S5 { + struct S5 { x: T, y: u8, } diff --git a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp index 82b91830ecb21b..f4fe20f1daa53b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/positional_fields/variant_ability_decl_ok.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::test { - enum Bar { + enum Bar { A { 0: T, } @@ -9,7 +9,7 @@ module 0x42::test { 1: bool, } } - enum Foo { + enum Foo { A { 0: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp index 701b2269dd3ee5..403423cc2cb14a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/decl_errors.exp @@ -38,7 +38,7 @@ module 0x42::n { } // end 0x42::n module 0x42::m { use 0x42::n::{T}; // resolved as: 0x42::n - struct G { + struct G { x: T, y: R, } diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp index 045df0a1576389..c8a4fc3995a119 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::m { - struct S { + struct S { x: T, } private fun id(self: m::S<#0>): m::S<#0> { diff --git a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp index 045df0a1576389..c8a4fc3995a119 100644 --- a/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp +++ b/third_party/move/move-compiler-v2/tests/checking/receiver/generic_calls_typed.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::m { - struct S { + struct S { x: T, } private fun id(self: m::S<#0>): m::S<#0> { diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp index 6b81d226f41509..8c29c3dcb316f9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/intrinsic_decl_ok.exp @@ -1,12 +1,12 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct MyTable1 { + struct MyTable1 { dummy_field: bool, } spec { } - struct MyTable2 { + struct MyTable2 { dummy_field: bool, } spec { diff --git a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp index 18adeb54b8b68c..69d9abc5e68591 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/schemas_ok.exp @@ -52,7 +52,7 @@ note: unused schema M::SchemaExp // -- Model dump before bytecode pipeline module 0x42::M { - struct S { + struct S { x: X, } private fun add(x: u64): u64 { 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 9212527bc1ea88..ef815b21057781 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 @@ -3,7 +3,7 @@ module 0x42::M { struct T { x: u64, } - struct G { + struct G { x: T, y: bool, } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp index 0d20bff8595b67..53e78550f1e83e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct G { + struct G { f: T, } struct R { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp index 5bf0a3e5f29eef..700b4f69ad3bcb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/exp_list.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct R { + struct R { f: T, } struct S { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp index 3b0b0935d3d287..5e214bf14b1ec2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/main_arguments_various_caes.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct Cup { + struct Cup { f1: T, } struct R { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp index b2e5e4ab469387..572d8f8c8c3648 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/neq.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct G { + struct G { f: T, } struct R { 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 8710d11f47b252..b164d67d766b46 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 @@ -3,11 +3,11 @@ module 0x42::simple_map { use std::error; use std::option; use std::vector; - struct Element { + struct Element { key: Key, value: Value, } - struct SimpleMap { + struct SimpleMap { data: vector>, } public fun borrow(map: &simple_map::SimpleMap<#0, #1>,key: �):  { diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp index 7002b18f808e94..febcd988b655d9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/phantom_param_struct_decl.exp @@ -1,20 +1,20 @@ // -- Model dump before bytecode pipeline module 0x42::M1 { - struct S1 { + struct S1 { a: u64, } - struct S2 { + struct S2 { a: M1::S1, b: vector>, } - struct S3 { + struct S3 { a: T2, b: T4, } - struct S4 { + struct S4 { a: u64, } - struct S5 { + struct S5 { a: M1::S4, } } // end 0x42::M1 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp index c006b28884c9f7..d0f925e1e9427c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct Box { + struct Box { f1: T, f2: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp index 0c41fd90aff731..886e560d3a47f0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct Box { + struct Box { f1: T, f2: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp index d638034ca2547d..0a6ab458576b4f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_unpack_assign.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct Box { + struct Box { f1: T, f2: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp index 0369a3da12beb1..66168dbbdcd4a1 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x2::Container { - struct T { + struct T { f: V, } public fun get(_self: &Container::T<#0>): #0 { @@ -15,7 +15,7 @@ module 0x2::Container { } // end 0x2::Container module 0x2::M { use 0x2::Container; // resolved as: 0x2::Container - struct Box { + struct Box { f1: T, f2: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp index f02b528d318407..8e7c9054a6de98 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/multi_pool_money_market_token.exp @@ -18,7 +18,7 @@ warning: unused type parameter // -- Model dump before bytecode pipeline module 0x2::Token { - struct Coin { + struct Coin { type: AssetType, value: u64, } @@ -71,7 +71,7 @@ module 0x2::Token { } } // end 0x2::Token module 0x2::Map { - struct T { + struct T { } public native fun empty(): Map::T<#0, #1>; public native fun remove(m: &Map::T<#0, #1>,k: �): #1; @@ -84,16 +84,16 @@ module 0x3::OneToOneMarket { use std::signer; use 0x2::Map; // resolved as: 0x2::Map use 0x2::Token; // resolved as: 0x2::Token - struct BorrowRecord { + struct BorrowRecord { record: Map::T, } - struct DepositRecord { + struct DepositRecord { record: Map::T, } - struct Pool { + struct Pool { coin: Token::Coin, } - struct Price { + struct Price { price: u64, } public fun borrow(account: &signer,pool_owner: address,amount: u64): Token::Coin<#1> diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp index 454ba0a69976fa..ab4fc0df722d34 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/v1-examples/simple_money_market_token.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x2::Token { - struct Coin { + struct Coin { type: AssetType, value: u64, } @@ -86,16 +86,16 @@ module 0x70dd::ToddNickels { module 0xb055::OneToOneMarket { use std::signer; use 0x2::Token; // resolved as: 0x2::Token - struct BorrowRecord { + struct BorrowRecord { record: u64, } - struct DepositRecord { + struct DepositRecord { record: u64, } - struct Pool { + struct Pool { coin: Token::Coin, } - struct Price { + struct Price { price: u64, } public fun borrow(account: &signer,amount: u64): Token::Coin<#1> diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp index 75510f9e497356..464d007f25e3b2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_no_parenthesis_ok.exp @@ -9,7 +9,7 @@ module 0x815::m { Red, Blue, } - enum Generic { + enum Generic { Foo { 0: T, } diff --git a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp index 75510f9e497356..464d007f25e3b2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp +++ b/third_party/move/move-compiler-v2/tests/checking/variants/variants_test_ok.exp @@ -9,7 +9,7 @@ module 0x815::m { Red, Blue, } - enum Generic { + enum Generic { Foo { 0: T, } diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp index cade5cdd100439..ea9ce8980f05c8 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-tests/mutually_recursive_non_generic_type_ok.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x8675309::M { - struct S { + struct S { f: T, } private fun f() { diff --git a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp index f0995c038ecd25..c42b1c462acf98 100644 --- a/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp +++ b/third_party/move/move-compiler-v2/tests/cyclic-instantiation-checker/v1-typing/infinite_instantiations_valid.exp @@ -1,6 +1,6 @@ // -- Model dump before bytecode pipeline module 0x42::M { - struct Box { + struct Box { f: T, } public fun t0() { diff --git a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp index e62a7f7bcb71e6..ff2bfcb9e0aef9 100644 --- a/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp +++ b/third_party/move/move-compiler-v2/tests/lambda-lifting/pattern.exp @@ -1,6 +1,6 @@ // -- Model dump before env processor pipeline: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -17,7 +17,7 @@ module 0xcafe::m { // -- Model dump after env processor unused checks: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -34,7 +34,7 @@ module 0xcafe::m { // -- Model dump after env processor type parameter check: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -51,7 +51,7 @@ module 0xcafe::m { // -- Model dump after env processor check recursive struct definition: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -68,7 +68,7 @@ module 0xcafe::m { // -- Model dump after env processor check cyclic type instantiation: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -85,7 +85,7 @@ module 0xcafe::m { // -- Model dump after env processor unused struct params check: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -102,7 +102,7 @@ module 0xcafe::m { // -- Model dump after env processor access and use check before inlining: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -119,7 +119,7 @@ module 0xcafe::m { // -- Model dump after env processor inlining: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -136,7 +136,7 @@ module 0xcafe::m { // -- Model dump after env processor access and use check after inlining: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -153,7 +153,7 @@ module 0xcafe::m { // -- Model dump after env processor acquires check: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -170,7 +170,7 @@ module 0xcafe::m { // -- Model dump after env processor simplifier: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -187,7 +187,7 @@ module 0xcafe::m { // -- Model dump after env processor lambda-lifting: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -210,7 +210,7 @@ module 0xcafe::m { // -- Model dump after env processor specification checker: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { @@ -233,7 +233,7 @@ module 0xcafe::m { // -- Model dump after env processor specification rewriter: module 0xcafe::m { - struct S { + struct S { x: T, } private fun consume(s: m::S<#0>,x: #0,f: |(m::S<#0>, #0)|#0): #0 { 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 f8abe9f33a24bf..ae5cd540efc81a 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 @@ -3,8 +3,8 @@ module 0x42::test { struct Coin { 0: u256, } - struct Wrapper { - 0: #0, + struct Wrapper { + 0: T, } private fun add1_new(x: u256): u256 { x: u256 = Add(x, 1); 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 e6a3ff288eab3c..14aae5ba05fdef 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 @@ -3,8 +3,8 @@ module 0x42::test { struct Coin { 0: u256, } - struct Wrapper { - 0: #0, + struct Wrapper { + 0: T, } private fun bitand_vec_coin_new(x: vector,index: u64) { { diff --git a/third_party/move/move-model/src/model.rs b/third_party/move/move-model/src/model.rs index b5545f670cb51f..fc1818df3e33e7 100644 --- a/third_party/move/move-model/src/model.rs +++ b/third_party/move/move-model/src/model.rs @@ -2425,8 +2425,25 @@ impl GlobalEnv { } for str in module.get_structs() { let tctx = str.get_type_display_ctx(); + let type_params = str.get_type_parameters(); + let type_params_str = if !type_params.is_empty() { + format!( + "<{}>", + type_params + .iter() + .map(|p| p.0.display(spool).to_string()) + .join(",") + ) + } else { + "".to_owned() + }; if str.has_variants() { - emitln!(writer, "enum {} {{", str.get_name().display(spool)); + emitln!( + writer, + "enum {}{} {{", + str.get_name().display(spool), + type_params_str + ); writer.indent(); for variant in str.get_variants() { emit!(writer, "{}", variant.display(spool)); @@ -2444,7 +2461,12 @@ impl GlobalEnv { } } } else { - emitln!(writer, "struct {} {{", str.get_name().display(spool)); + emitln!( + writer, + "struct {}{} {{", + str.get_name().display(spool), + type_params_str + ); writer.indent(); for fld in str.get_fields() { emitln!(writer, "{},", self.dump_field(&tctx, &fld))