-
Notifications
You must be signed in to change notification settings - Fork 21.6k
accounts/abi: resolve name conflict for methods starting with a number #26999
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
Conversation
Isn't this just pushing the edgecase a bit further away? What if we already have a method called EDIT: Ah then we'd get |
|
The edge case is variables starting with a number, this will crash the abigen. This PR fixes that, so a contract with |
| } | ||
| ok := used(name) | ||
| for idx := 0; ok; idx++ { | ||
| name = fmt.Sprintf("%s%d", rawName, idx) |
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.
This would also need to use the m-prefixed version. So maybe you need to set rawName to name
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.
Damn now I see it, thanks will add a test
If you had written a test you'd know that wasn't true :p |
holiman
left a comment
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!
Oops? |
Co-authored-by: Martin Holst Swende <[email protected]>
|
s1na
left a comment
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
|
Wait, I'm confused: |
|
Aha so as @jsvisa mentioned, the problematic pattern is first |
|
Seems we need to convert |
|
I pushed a commit to rather than names starting with digits catch names starting with |
MariusVanDerWijden
left a comment
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, I've removed the now obsolete test
ethereum#26999) This adds logic to prepend 'M' or 'E' to Solidity identifiers when they would otherwise violate Go identifier naming rules. Closes ethereum#26972 --------- Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]>
ethereum#26999) This adds logic to prepend 'M' or 'E' to Solidity identifiers when they would otherwise violate Go identifier naming rules. Closes ethereum#26972 --------- Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]>
… a number (ethereum#26999)" This reverts commit 5b6fa97.
… a number (ethereum#26999)" This reverts commit 5b6fa97.
ethereum#26999) This adds logic to prepend 'M' or 'E' to Solidity identifiers when they would otherwise violate Go identifier naming rules. Closes ethereum#26972 --------- Co-authored-by: Martin Holst Swende <[email protected]> Co-authored-by: Sina Mahmoodi <[email protected]>
Its a very edge case, but this PR allows abigen to generate bindings for methods starting with a number
closes #26972