Skip to content

Commit b7251ef

Browse files
committed
Update to latest.
1 parent 7950d90 commit b7251ef

File tree

8 files changed

+146
-145
lines changed

8 files changed

+146
-145
lines changed

sway-core/src/abi_generation/abi_str.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ impl TypeId {
2121
resolved_type_id: TypeId,
2222
) -> Result<String, ErrorEmitted> {
2323
let type_engine = engines.te();
24+
// let self_abi_str = if let TypeInfo::Alias { .. } = &*type_engine.get(*self) {
25+
// String::default()
26+
// } else {
27+
// type_engine
28+
// .get(*self)
29+
// .abi_str(handler, ctx, engines, true)?
30+
// };
2431
let self_abi_str = type_engine
25-
.get(*self)
26-
.abi_str(handler, ctx, engines, true)?;
32+
.get(*self)
33+
.abi_str(handler, ctx, engines, true)?;
2734
if self.is_generic_parameter(engines, resolved_type_id) {
2835
Ok(format!("generic {self_abi_str}"))
2936
} else {
@@ -200,10 +207,9 @@ impl TypeInfo {
200207
"__slice {}",
201208
ty.abi_str(handler, ctx, engines, false)?
202209
)),
203-
Alias { .. } => {
204-
// Aliases are handled specially when processing the ABI, so we should never get here.
205-
unreachable!()
206-
}
210+
Alias { name, .. } => {
211+
Ok(name.to_string())
212+
},
207213
TraitType {
208214
name,
209215
implemented_in: _,

test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.release.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
"metadataTypeId": 0,
1010
"type": "(bool, u64)"
1111
},
12+
{
13+
"aliasOf": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b",
14+
"concreteTypeId": "22e190db53f32bb3ef6abe65c77f9f16b783eadc491786e5c9aa367853a9507b",
15+
"type": "AnotherU8"
16+
},
1217
{
1318
"concreteTypeId": "4926d35d1a5157936b0a29bc126b8aace6d911209a5c130e9b716b0c73643ea6",
1419
"metadataTypeId": 1,
@@ -72,7 +77,7 @@
7277
"offset": 5104
7378
},
7479
{
75-
"concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b",
80+
"concreteTypeId": "22e190db53f32bb3ef6abe65c77f9f16b783eadc491786e5c9aa367853a9507b",
7681
"indirect": false,
7782
"name": "ANOTHER_U8",
7883
"offset": 4840

test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.debug.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"concreteTypeId": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
55
"metadataTypeId": 0,
66
"type": "(struct TwoGenerics<u64,u32>, struct OneGeneric<u8>)"
7+
},
8+
{
9+
"aliasOf": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
10+
"concreteTypeId": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd",
11+
"type": "A"
712
}
813
],
914
"configurables": [],
@@ -14,12 +19,12 @@
1419
"attributes": null,
1520
"inputs": [
1621
{
17-
"concreteTypeId": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
22+
"concreteTypeId": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd",
1823
"name": "input"
1924
}
2025
],
2126
"name": "main",
22-
"output": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080"
27+
"output": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd"
2328
}
2429
],
2530
"loggedTypes": [],

test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.release.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"concreteTypeId": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
55
"metadataTypeId": 0,
66
"type": "(struct TwoGenerics<u64,u32>, struct OneGeneric<u8>)"
7+
},
8+
{
9+
"aliasOf": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
10+
"concreteTypeId": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd",
11+
"type": "A"
712
}
813
],
914
"configurables": [],
@@ -14,12 +19,12 @@
1419
"attributes": null,
1520
"inputs": [
1621
{
17-
"concreteTypeId": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080",
22+
"concreteTypeId": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd",
1823
"name": "input"
1924
}
2025
],
2126
"name": "main",
22-
"output": "f0ea9e428f47d8b233443fc8f7d3bb5ad2ae35d5175e8c15f0f76b3459c9c080"
27+
"output": "559aead08264d5795d3909718cdd05abd49572e84fe55590eef31a88a08fdffd"
2328
}
2429
],
2530
"loggedTypes": [],

test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle_new_encoding.debug.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
99
"metadataTypeId": 0,
1010
"type": "(u64, u64)"
11+
},
12+
{
13+
"aliasOf": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
14+
"concreteTypeId": "0c549b98c3db49207607c6f5f063b081b1a724bc479a2a1b353ff2c60f3f1d49",
15+
"type": "AliasedTuple"
1116
}
1217
],
1318
"configurables": [],
@@ -18,7 +23,7 @@
1823
"attributes": null,
1924
"inputs": [
2025
{
21-
"concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
26+
"concreteTypeId": "0c549b98c3db49207607c6f5f063b081b1a724bc479a2a1b353ff2c60f3f1d49",
2227
"name": "arg1"
2328
}
2429
],

test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle_new_encoding.release.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
"concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
99
"metadataTypeId": 0,
1010
"type": "(u64, u64)"
11+
},
12+
{
13+
"aliasOf": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
14+
"concreteTypeId": "0c549b98c3db49207607c6f5f063b081b1a724bc479a2a1b353ff2c60f3f1d49",
15+
"type": "AliasedTuple"
1116
}
1217
],
1318
"configurables": [],
@@ -18,7 +23,7 @@
1823
"attributes": null,
1924
"inputs": [
2025
{
21-
"concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0",
26+
"concreteTypeId": "0c549b98c3db49207607c6f5f063b081b1a724bc479a2a1b353ff2c60f3f1d49",
2227
"name": "arg1"
2328
}
2429
],

test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_with_type_aliases/json_abi_oracle_new_encoding.debug.json

Lines changed: 51 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,34 @@
11
{
22
"concreteTypes": [
33
{
4-
"concreteTypeId": "a28cf4bd3deddbee8bde0daa7b4534d37db682c73dc398fd720c75f3775a3df0",
4+
"concreteTypeId": "e9133707b9a5964870ad23e86be4f17604dcc01a7f1aa3c29c89bc00bf826150",
5+
"metadataTypeId": 0,
6+
"type": "(SubId, SubId)"
7+
},
8+
{
9+
"concreteTypeId": "6dc857ccc5450dd9656c41075b5f827d26b117e08f6a7aeb27c83eddb7eb46c2",
510
"metadataTypeId": 1,
6-
"type": "(b256, [enum std::identity::Identity; 2], struct contract_with_type_aliases_abi::IdentityAliasWrapper, struct contract_with_type_aliases_abi::Generic<struct contract_with_type_aliases_abi::IdentityAliasWrapper>, (b256, b256), str[9])"
11+
"type": "(SubId, [IdentityAlias; 2], IdentityAliasWrapperAlias, struct contract_with_type_aliases_abi::Generic<IdentityAliasWrapperAlias>, (SubId, SubId), StringTy)"
712
},
813
{
9-
"concreteTypeId": "bc42ec26f2a17c5b23fc007d96b96bf35f8949ee156afdd789064210d881f7e0",
10-
"metadataTypeId": 0,
11-
"type": "(b256, b256)"
14+
"aliasOf": "1567acc73497bb83e04c376e2c8d3997d0207f0b9b8fa17b0192ee62e1c7a60b",
15+
"concreteTypeId": "ec8b64f449a0a882a300f033518b1d36d4d86ae5fb56a2f73bee536991354f8c",
16+
"type": "IdentityAliasWrapperAlias"
1217
},
1318
{
14-
"concreteTypeId": "2771ee6889dff227342d90c5f1ea6019ad8c8de50880048f823e1b926b26c13e",
15-
"metadataTypeId": 2,
16-
"type": "[enum std::identity::Identity; 2]"
19+
"aliasOf": "bc5b9d5b85b9fb6e78bbb779cc67a95e60d6f291cd256a4c7dba66308dc7dfb8",
20+
"concreteTypeId": "ad6cdbd8e07b2c3d4b95f6b4ba8e5eeb6106b604fb4dfc6ccb8274ee194aadf0",
21+
"type": "StringTy"
22+
},
23+
{
24+
"aliasOf": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
25+
"concreteTypeId": "ed5a69f3ec26a28dea9c502e4de03d3c9da64d76a6cafee4348d8f090db3f1ba",
26+
"type": "SubId"
27+
},
28+
{
29+
"concreteTypeId": "51e03ee1e6f7b7c928eab4ea7bd4f5140eb25216646a3742afbe75a753b0bce3",
30+
"metadataTypeId": 4,
31+
"type": "[IdentityAlias; 2]"
1732
},
1833
{
1934
"concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
@@ -24,11 +39,11 @@
2439
"type": "str[9]"
2540
},
2641
{
27-
"concreteTypeId": "3981e3d30e52d053c35da213685243d8c82ef363f58bfc2d14986c393254c450",
42+
"concreteTypeId": "7587b556083bd8ec430f2588f6b8aaeba231743f84761b1d8955e125f2527ef2",
2843
"metadataTypeId": 5,
29-
"type": "struct contract_with_type_aliases_abi::Generic<struct contract_with_type_aliases_abi::IdentityAliasWrapper>",
44+
"type": "struct contract_with_type_aliases_abi::Generic<IdentityAliasWrapperAlias>",
3045
"typeArguments": [
31-
"1567acc73497bb83e04c376e2c8d3997d0207f0b9b8fa17b0192ee62e1c7a60b"
46+
"ec8b64f449a0a882a300f033518b1d36d4d86ae5fb56a2f73bee536991354f8c"
3247
]
3348
},
3449
{
@@ -45,32 +60,32 @@
4560
"attributes": null,
4661
"inputs": [
4762
{
48-
"concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b",
63+
"concreteTypeId": "ed5a69f3ec26a28dea9c502e4de03d3c9da64d76a6cafee4348d8f090db3f1ba",
4964
"name": "x"
5065
},
5166
{
52-
"concreteTypeId": "2771ee6889dff227342d90c5f1ea6019ad8c8de50880048f823e1b926b26c13e",
67+
"concreteTypeId": "51e03ee1e6f7b7c928eab4ea7bd4f5140eb25216646a3742afbe75a753b0bce3",
5368
"name": "y"
5469
},
5570
{
56-
"concreteTypeId": "1567acc73497bb83e04c376e2c8d3997d0207f0b9b8fa17b0192ee62e1c7a60b",
71+
"concreteTypeId": "ec8b64f449a0a882a300f033518b1d36d4d86ae5fb56a2f73bee536991354f8c",
5772
"name": "z"
5873
},
5974
{
60-
"concreteTypeId": "3981e3d30e52d053c35da213685243d8c82ef363f58bfc2d14986c393254c450",
75+
"concreteTypeId": "7587b556083bd8ec430f2588f6b8aaeba231743f84761b1d8955e125f2527ef2",
6176
"name": "w"
6277
},
6378
{
64-
"concreteTypeId": "bc42ec26f2a17c5b23fc007d96b96bf35f8949ee156afdd789064210d881f7e0",
79+
"concreteTypeId": "e9133707b9a5964870ad23e86be4f17604dcc01a7f1aa3c29c89bc00bf826150",
6580
"name": "u"
6681
},
6782
{
68-
"concreteTypeId": "bc5b9d5b85b9fb6e78bbb779cc67a95e60d6f291cd256a4c7dba66308dc7dfb8",
83+
"concreteTypeId": "ad6cdbd8e07b2c3d4b95f6b4ba8e5eeb6106b604fb4dfc6ccb8274ee194aadf0",
6984
"name": "s"
7085
}
7186
],
7287
"name": "foo",
73-
"output": "a28cf4bd3deddbee8bde0daa7b4534d37db682c73dc398fd720c75f3775a3df0"
88+
"output": "6dc857ccc5450dd9656c41075b5f827d26b117e08f6a7aeb27c83eddb7eb46c2"
7489
}
7590
],
7691
"loggedTypes": [],
@@ -80,11 +95,11 @@
8095
"components": [
8196
{
8297
"name": "__tuple_element",
83-
"typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
98+
"typeId": "ed5a69f3ec26a28dea9c502e4de03d3c9da64d76a6cafee4348d8f090db3f1ba"
8499
},
85100
{
86101
"name": "__tuple_element",
87-
"typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
102+
"typeId": "ed5a69f3ec26a28dea9c502e4de03d3c9da64d76a6cafee4348d8f090db3f1ba"
88103
}
89104
],
90105
"metadataTypeId": 0,
@@ -94,22 +109,22 @@
94109
"components": [
95110
{
96111
"name": "__tuple_element",
97-
"typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
112+
"typeId": "ed5a69f3ec26a28dea9c502e4de03d3c9da64d76a6cafee4348d8f090db3f1ba"
98113
},
99114
{
100115
"name": "__tuple_element",
101-
"typeId": 2
116+
"typeId": 4
102117
},
103118
{
104119
"name": "__tuple_element",
105-
"typeId": 6
120+
"typeId": "ec8b64f449a0a882a300f033518b1d36d4d86ae5fb56a2f73bee536991354f8c"
106121
},
107122
{
108123
"name": "__tuple_element",
109124
"typeArguments": [
110125
{
111126
"name": "",
112-
"typeId": 6
127+
"typeId": "ec8b64f449a0a882a300f033518b1d36d4d86ae5fb56a2f73bee536991354f8c"
113128
}
114129
],
115130
"typeId": 5
@@ -120,82 +135,52 @@
120135
},
121136
{
122137
"name": "__tuple_element",
123-
"typeId": "bc5b9d5b85b9fb6e78bbb779cc67a95e60d6f291cd256a4c7dba66308dc7dfb8"
138+
"typeId": "ad6cdbd8e07b2c3d4b95f6b4ba8e5eeb6106b604fb4dfc6ccb8274ee194aadf0"
124139
}
125140
],
126141
"metadataTypeId": 1,
127142
"type": "(_, _, _, _, _, _)"
128143
},
129144
{
130-
"components": [
131-
{
132-
"name": "__array_element",
133-
"typeId": 3
134-
}
135-
],
136145
"metadataTypeId": 2,
137-
"type": "[_; 2]"
146+
"type": "IdentityAlias"
147+
},
148+
{
149+
"metadataTypeId": 3,
150+
"type": "T"
138151
},
139152
{
140153
"components": [
141154
{
142-
"name": "Address",
143-
"typeId": 7
144-
},
145-
{
146-
"name": "ContractId",
147-
"typeId": 8
155+
"name": "__array_element",
156+
"typeId": 2
148157
}
149158
],
150-
"metadataTypeId": 3,
151-
"type": "enum std::identity::Identity"
152-
},
153-
{
154159
"metadataTypeId": 4,
155-
"type": "generic T"
160+
"type": "[_; 2]"
156161
},
157162
{
158163
"components": [
159164
{
160165
"name": "f",
161-
"typeId": 4
166+
"typeId": 3
162167
}
163168
],
164169
"metadataTypeId": 5,
165170
"type": "struct contract_with_type_aliases_abi::Generic",
166171
"typeParameters": [
167-
4
172+
3
168173
]
169174
},
170175
{
171176
"components": [
172177
{
173178
"name": "i",
174-
"typeId": 3
179+
"typeId": 2
175180
}
176181
],
177182
"metadataTypeId": 6,
178183
"type": "struct contract_with_type_aliases_abi::IdentityAliasWrapper"
179-
},
180-
{
181-
"components": [
182-
{
183-
"name": "bits",
184-
"typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
185-
}
186-
],
187-
"metadataTypeId": 7,
188-
"type": "struct std::address::Address"
189-
},
190-
{
191-
"components": [
192-
{
193-
"name": "bits",
194-
"typeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b"
195-
}
196-
],
197-
"metadataTypeId": 8,
198-
"type": "struct std::contract_id::ContractId"
199184
}
200185
],
201186
"panickingCalls": {},

0 commit comments

Comments
 (0)