-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Calldata doc #15533
Calldata doc #15533
Conversation
Thank you for your contribution to the Solidity compiler! A team member will follow up shortly. If you haven't read our contributing guidelines and our review checklist before, please do it now, this makes the reviewing process and accepting your contribution smoother. If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the #solidity-dev channel on Matrix. |
@cameel Hi Kamil, could you help with the review? thx |
@ekpyron Hi Daniel, would you mind helping review this pr? thx |
We discussed this a bit more internally in response to your issue (and also #14021 and the fact that this also came up in the Solidity underhanded contest) and concluded that we will start emitting a warning for this pattern (and with the next breaking release disallow it entirely). Originally, when this pattern was allowed for allowing complex initialization patterns, we did not yet have assembly access to storage or calldata pointers. While discussing this again, we realized that today, complex initialization patterns can also be allowed by an even more explicit and conscious
(or similarly in the storage case)
which makes it absolutely clear what happens at the user's peril. We can't emit an error for the I'd still be fine with merging this as docs improvement for now, but wanted to make it clear that this will become obsolete again soon. |
No problem. When the error handling is done, you can let me know and I will remove this doc. This update is only useful for a while. |
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.
I think this is good now. But we should rebase and squash the commits. Can you do that please, @haoyang9804 ?
438fe17
to
ac13573
Compare
Done. Seems that all redundant commits have been rebased into one. |
@matheusaaguiar , hi, can you help with the merge? |
@haoyang9804 , can you rebase on top of latest develop branch instead of merge, please? |
3691a61
to
5662642
Compare
@matheusaaguiar The rebasing is done and all checks have passed. plz take a look. |
5662642
to
eb7dc21
Compare
Add note about calldata arrays and structs initialization in docs
Reference: #15483 (comment). I found an awkward scenario in using calldata struct/array in function bodies. Daniel pointed out (#15483 (comment)) that this is a workaround to allow complex initialization patterns but may not be well documented. This pr is for enriching the doc to mitigate users' confusion.