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
The absence of errors in redefining the variable and the strange bugs associated with it
💻 Environment
node version:
~/D/p/f/d/Test (master)> node --version
v18.19.0
npm version:
~/D/p/f/d/Test (master)> npm --version
10.9.0
The project was created using the following npm command(i.e. blueprint framework):
npm create ton@latest
FunC is compiled by the npx blueprint build command.
🔢 Code to reproduce bug
Redefinition
To begin with, this code compiles successfully and there are no errors in redefining the var1 variable.
#include"imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
int var1 = 1;
int var1 = 5;
return ();
}
output
Using file: Test
Build script running, compiling Test
✅ Compiled successfully! Cell BOC result:
{
"hash": "6ef6e4084167bca1464f9d2ddc8448bbd66df303c4014af50aeb5a109fdfb8cc",
"hashBase64": "bvbkCEFnvKFGT50t3IRIu9Zt8wPEAUr1CutaEJ/fuMw=",
"hex": "b5ee9c72410102010012000114ff00f4a413f4bcf2c80b010006d35f04109b75d3"
}
✅ Wrote compilation artifact to build/Test.compiled.json
Dictionary traversal
Next, let's look at the code where a completely legitimate dictionary bypass is added.
This code compiles with a very strange error for this situation.
#include"imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
int var1 = 1;
cell some_dict = new_dict();
;; bypassing the dictionary
int pivot = -1;
do {
(pivot, slice info, int success) = some_dict.udict_get_next?(256, pivot);
} until( ~ success )
;; I want to write a different value to the var variable
var1 = 5;
return ();
}
output
Error: FunC compilation error: contracts/test.fc:15:10: error: cannot apply expression of type int to an expression of type int: cannot unify type int -> ??69 with int
var1 = 5;
Dictionary traversal with redefinition
But if we just add a redefinition of the var1 variable, then suddenly there will be no compilation errors.
#include"imports/stdlib.fc";
() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure {
int var1 = 1;
cell some_dict = new_dict();
;; bypassing the dictionary
int pivot = -1;
do {
(pivot, slice info, int success) = some_dict.udict_get_next?(256, pivot);
} until( ~ success )
;; I want to write a different value to the var variable
int var1 = 5;
return ();
}
Using file: Test
Build script running, compiling Test
✅ Compiled successfully! Cell BOC result:
{
"hash": "0ce211bdd661f08273452996c83e2489c0f2d875d173cba08b0d7cc129eacd05",
"hashBase64": "DOIRvdZh8IJzRSmWyD4kicDy2HXRc8ugiw18wSnqzQU=",
"hex": "b5ee9c72410102010021000114ff00f4a413f4bcf2c80b010024d35f046d7f9a218307f47c6fa56c12b3e65b0058ae68"
}
✅ Wrote compilation artifact to build/Test.compiled.json
The text was updated successfully, but these errors were encountered:
🐞 Describe the bug
The absence of errors in redefining the variable and the strange bugs associated with it
💻 Environment
node version:
npm version:
The project was created using the following npm command(i.e. blueprint framework):
FunC is compiled by the npx blueprint build command.
🔢 Code to reproduce bug
Redefinition
To begin with, this code compiles successfully and there are no errors in redefining the var1 variable.
output
Dictionary traversal
Next, let's look at the code where a completely legitimate dictionary bypass is added.
This code compiles with a very strange error for this situation.
output
Dictionary traversal with redefinition
But if we just add a redefinition of the var1 variable, then suddenly there will be no compilation errors.
The text was updated successfully, but these errors were encountered: