Skip to content
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

Resolve #99: Fix abigen with int expression template arguments #100

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

nathanielhourt
Copy link
Contributor

Change Description

Resolve #99
In my contracts, I use several template arguments which are expressions which resolve to integral values (such as an eosio::name) but are not literal integer values. This works great in my contracts, but causes abigen to fail.

This PReq fixes abigen in such cases where a template argument is an expression that resolves to an integer, but isn't an integer literal.

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

Copy link
Contributor

@ScottBailey ScottBailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small style request, otherwise LGTM.

Copy link
Contributor

@dimas1185 dimas1185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. please add a test to tests/abigen-pass directory. look at other examples, there are small *.json, *.abi and *.cpp to demonstrate how this works

@nathanielhourt
Copy link
Contributor Author

Good call. Added a test which fails before the fix, and passes after.

nathanielhourt and others added 3 commits March 20, 2023 01:10
In my contracts, I use several template arguments which are expressions
which resolve to integral values (such as an eosio::name) but are
not literal integer values. This works great in my contracts, but
causes abigen to fail.

Fix abigen in cases where a template argument is an expression that
resolves to an integer, but isn't an integer literal.
Add braces

Co-authored-by: Scott B <[email protected]>
This test fails without the fix to issue AntelopeIO#99, and passes with it.
The failure is a bit odd -- it doesn't fail because cdt-cpp crashes;
rather, it fails because the crashed cdt-cpp did not output an abi
file and therefore it cannot match the golden record... But hey, it
does test the issue, just rather indirectly. =)
@ScottBailey ScottBailey merged commit d89ea1d into AntelopeIO:main Mar 20, 2023
@nathanielhourt nathanielhourt deleted the fix-abigen-templates branch March 21, 2023 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

abigen fails on int-expression template arguments
3 participants