accounts/abi: resolve name conflict for methods starting with a number#26999
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.
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.
Damn now I see it, thanks will add a test
If you had written a test you'd know that wasn't true :p |
Oops? |
Co-authored-by: Martin Holst Swende <martin@swende.se>
|
|
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.
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 <martin@swende.se> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
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 <martin@swende.se> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
… 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 <martin@swende.se> Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
Its a very edge case, but this PR allows abigen to generate bindings for methods starting with a number
closes #26972