From f72846fa63678a0cfb7ea0c682b1aa9c4fa2b48b 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 +-
.../tests/checking/typing/lambda3.exp | 7 +++++
.../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 | 2 +-
.../tests/op-equal/valid1.exp | 2 +-
third_party/move/move-model/src/model.rs | 26 +++++++++++++++--
44 files changed, 141 insertions(+), 112 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 23007e7bf4d5e..693daacb1ff71 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: 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 4c2478d70c7e5..72ad2c417ca09 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 a271791a51a0b..a49fde8a4b9a3 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 55f8fe820c1e2..f749653a7f251 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 01ca296b54601..0e83fb52e54e8 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 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 278c608e4dbf9..ff67e3db96804 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: 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 2631fcfd257a1..b7bc1372321de 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 1d58dcea66e0f..8298da9baae10 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 d6f4603030fd1..82e8a78a2518a 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 e0c1f7c341512..6b25517efe372 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: 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 67888d34bf208..36dc07fcb1f05 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: &ReaderRef): 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 26343bf96eaf1..68d6effb7bd3f 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: 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 406c3d29e1725..2c4e4059c504f 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: 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 28e3ab2edd260..69f0be3a2e1ee 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 16d650a1c6cb3..5b6703568a6ab 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: 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 f92c198d33961..faaf3481933e0 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 bb7c323f0c533..ee8fd6fdb431b 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 4042ecbb69c1e..4cbfc158da8cb 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 51a0d9cb03185..765d427973c0e 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: S): S {
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 51a0d9cb03185..765d427973c0e 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: S): S {
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 04ca7c2e62df2..c6ba5637c6bcf 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 6f6473ed8e14c..efd869ab6d011 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 ad89e14bcd352..69ded91a3a375 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 4b6348bd2482d..66f11852a5790 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 59bda651fd09c..4cc3f57c1d1fe 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/lambda3.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda3.exp
index a629fb8ec36d9..f89935a0c3358 100644
--- a/third_party/move/move-compiler-v2/tests/checking/typing/lambda3.exp
+++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda3.exp
@@ -8,6 +8,13 @@ module 0x8675309::M {
}
} // end 0x8675309::M
+// -- Sourcified model before bytecode pipeline
+module 0x8675309::M {
+ public fun lambda_not_allowed() {
+ let _x = |i| i + 1;
+ }
+}
+
Diagnostics:
error: Function-typed values not yet supported except as parameters to calls to inline functions
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 95f64c5db9620..96d0c3ab89dd8 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 17f2f53d747ed..00367877ed612 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 716b2a43d829e..302baa8097a2f 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: &SimpleMap,key: &Key): &Value {
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 d905413abacbd..478578a6eacaf 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: S1,
b: vector>,
}
- struct S3 {
+ struct S3 {
a: T2,
b: T4,
}
- struct S4 {
+ struct S4 {
a: u64,
}
- struct S5 {
+ struct S5 {
a: 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 97821d320fdd9..fa31994614be4 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 70569d59c43d5..fd5056c8e617a 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 34faa633aadeb..e1f2fc3e1a998 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 5d4c04ccafe73..66848a8d97a42 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: &T): V {
@@ -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 ba2cb34b4ef5d..438c492d624f6 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(): T;
public native fun remove(m: &T,k: &K): V;
@@ -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
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 249b9cfb67776..3749e13a8d819 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
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 2c1d803d68857..da04961916c62 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 2c1d803d68857..da04961916c62 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 2df7cde6d2f7c..fe2891c695b11 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 0d98ba2f0f67f..62dc89568b814 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 8aa1ebc4aa0a9..9b6c76f186bb0 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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
@@ -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: S,x: T,f: |(S, T)|T): T {
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 398c192cb062b..e3a00fa6e9edf 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,7 +3,7 @@ module 0x42::test {
struct Coin {
0: u256,
}
- struct Wrapper {
+ struct Wrapper {
0: T,
}
private fun add1_new(x: u256): u256 {
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 a4c1156bf0a66..d75c575a32c78 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,7 +3,7 @@ module 0x42::test {
struct Coin {
0: u256,
}
- struct Wrapper {
+ 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 ba2f65c96b995..752f6da29f2ba 100644
--- a/third_party/move/move-model/src/model.rs
+++ b/third_party/move/move-model/src/model.rs
@@ -2431,8 +2431,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));
@@ -2450,7 +2467,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))