You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Error codes in the report are now formatted as a list: PR [#1051](https://github.com/tact-lang/tact/pull/1051)
37
+
- Clarify error message for bounced types from which accessed a field that does not fit in 224 bytes: PR [#1111](https://github.com/tact-lang/tact/pull/1111)
37
38
- Docs: note that `compilables/` can sometimes be used over `wrappers/` in Blueprint projects: PR [#1112](https://github.com/tact-lang/tact/pull/1112)
Copy file name to clipboardexpand all lines: src/types/__snapshots__/resolveStatements.spec.ts.snap
+31-1
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ Line 10, col 5:
81
81
`;
82
82
83
83
exports[`resolveStatements should fail statements for bounced-type-is-smaller 1`] = `
84
-
"<unknown>:23:22: Type bounced<"A"> does not have a field named "c"
84
+
"<unknown>:23:22: Maximum size of the bounced message is 224 bytes, but the "c" field of type "A" cannot fit into it due to the size of previous fields or its own size, so it cannot be accessed. Make the type of the fields before this one smaller, or reduce the type of this field so that it fits into 224 bytes
85
85
Line 23, col 22:
86
86
22 | let y: Bool = src.b;
87
87
> 23 | let z: Int = src.c;
@@ -1238,6 +1238,36 @@ Line 9, col 5:
1238
1238
"
1239
1239
`;
1240
1240
1241
+
exports[`resolveStatements should fail statements for usage-of-bounced-field-in-type-that-is-too-big 1`] = `
1242
+
"<unknown>:14:29: Maximum size of the bounced message is 224 bytes, but the "amount" field of type "Withdraw" cannot fit into it due to the size of previous fields or its own size, so it cannot be accessed. Make the type of the fields before this one smaller, or reduce the type of this field so that it fits into 224 bytes
1243
+
Line 14, col 29:
1244
+
13 | self.balance += msg.data; // ok
1245
+
> 14 | self.balance += msg.amount;
1246
+
^~~~~~
1247
+
15 | }
1248
+
"
1249
+
`;
1250
+
1251
+
exports[`resolveStatements should fail statements for usage-of-bounced-field-in-type-that-is-too-big-2 1`] = `
1252
+
"<unknown>:26:29: Maximum size of the bounced message is 224 bytes, but the "amount" field of type "Withdraw" cannot fit into it due to the size of previous fields or its own size, so it cannot be accessed. Make the type of the fields before this one smaller, or reduce the type of this field so that it fits into 224 bytes
1253
+
Line 26, col 29:
1254
+
25 |
1255
+
> 26 | self.balance += msg.amount;
1256
+
^~~~~~
1257
+
27 | }
1258
+
"
1259
+
`;
1260
+
1261
+
exports[`resolveStatements should fail statements for usage-of-bounced-field-that-is-too-big 1`] = `
1262
+
"<unknown>:12:29: Maximum size of the bounced message is 224 bytes, but the "amount" field of type "Withdraw" cannot fit into it because its too big, so it cannot be accessed. Reduce the type of this field so that it fits into 224 bytes
1263
+
Line 12, col 29:
1264
+
11 | bounced(msg: bounced<Withdraw>){
1265
+
> 12 | self.balance += msg.amount;
1266
+
^~~~~~
1267
+
13 | }
1268
+
"
1269
+
`;
1270
+
1241
1271
exports[`resolveStatements should fail statements for var-does-not-exist 1`] = `
1242
1272
"<unknown>:5:9: Unable to resolve id 'nonExistentVariable'
// If we found a field of bounced<T>, check if the field doesn't fit in 224 bytes and cannot be accessed
423
+
if(
424
+
src.kind==="ref_bounced"&&
425
+
field&&
426
+
fieldIndex>=srcT.partialFieldCount
427
+
){
428
+
if(srcT.fields.length===1){
429
+
throwCompilationError(
430
+
`Maximum size of the bounced message is 224 bytes, but the ${idTextErr(exp.field)} field of type ${idTextErr(src.name)} cannot fit into it because its too big, so it cannot be accessed. Reduce the type of this field so that it fits into 224 bytes`,
431
+
exp.field.loc,
432
+
);
433
+
}
434
+
435
+
throwCompilationError(
436
+
`Maximum size of the bounced message is 224 bytes, but the ${idTextErr(exp.field)} field of type ${idTextErr(src.name)} cannot fit into it due to the size of previous fields or its own size, so it cannot be accessed. Make the type of the fields before this one smaller, or reduce the type of this field so that it fits into 224 bytes`,
0 commit comments