-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement fromCell
and fromSlice
methods for structs
#418
Conversation
Just realised that I didn't add any negative tests for struct parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need some tests to make sure the following works as expected.
First, the user defines a fromCell
:
extends mutates fun fromCell(self: Cell, _: Cell): MyStruct1 {
return MyStruct1 { ... };
}
And now the user is trying to do something weird:
contract StructsTester {
receive() { }
get fun fromCell1(src: Cell): MyStruct1 {
let MyStruct1: Cell = beginCell().endCell(); // it's a cell here!
let s: MyStruct1 = MyStruct1.fromCell(src);
return s;
}
}
What do you expect to happen in this case?
@anton-trunov do you mean a user-defined function with the same name - I think it should work the same way as it works for all other built-ins such as |
@Gusarich Yep. Because right now this shadowing is allowed and it overrides the generated code. |
Yeah, we do not allow any form of shadowing in Tact. And if we do, it's a bug |
btw, there is some merge conflicts |
In this case maybe we should create a separate issue about that and resolve that in another PR? |
Yeah, there are issues like that, for instance #307. There is a special tag for those
scope: var-scope
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some minor tweaks in the suggested changes
Closes #344