-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Code Generator: treat abi.encodeCall as no-op when referenced as a bare member
#16726
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -2050,7 +2050,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess) | |||
| solAssert(false, "min/max not available for the given type."); | ||||
|
|
||||
| } | ||||
| else if ((std::set<std::string>{"encode", "encodePacked", "encodeWithSelector", "encodeWithSignature", "decode"}).count(member)) | ||||
| else if ((std::set<std::string>{"encode", "encodePacked", "encodeCall", "encodeWithSelector", "encodeWithSignature", "decode"}).count(member)) | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fixes the issue at hand, but it would be good to also prevent it from happening in the future. We do have the list already under We could refactor Alternatively, we could assert that it produces the same set. This would fail when we add a new member, but the advantage would be that we'd force them to have a look at this place and decide what to do. This would also make things more fool-proof by not excluding non-function members.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that we have the same code in
So that refactor should be done also there.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you check why this assert is not triggered when the function is actually called? I'd expect that to enter here too. |
||||
| { | ||||
| // no-op | ||||
| } | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| contract C { | ||
| function f() public pure { | ||
| abi.encodeCall; | ||
| } | ||
| } | ||
| // ---- | ||
| // Warning 6133: (52-66): Statement has no effect. |
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.
The PR needs a changelog entry. Something like: