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

Move define_udt! decl macro to sol! proc macro #39

Closed
Tracked by #74
DaniPopes opened this issue May 15, 2023 · 7 comments · Fixed by #471
Closed
Tracked by #74

Move define_udt! decl macro to sol! proc macro #39

DaniPopes opened this issue May 15, 2023 · 7 comments · Fixed by #471
Labels
good first issue Good for newcomers

Comments

@DaniPopes
Copy link
Member

DaniPopes commented May 15, 2023

macro_rules! define_udt {

@DaniPopes DaniPopes added the good first issue Good for newcomers label May 15, 2023
@DaniPopes
Copy link
Member Author

UDVTs in Solidity are just type aliases, so this should be the case in sol! too. This means that it should expand to type #name = #solidity_type; and any reference to it anywhere in the macro should be interpreted as the internal solidity type.

@prestwich
Copy link
Member

same disagreement as Address vs FixedBytes<20>. In solidity its barely more than an alias, but it really isn't the same type. Suppose the user wants to add a custom impl block the way we do for Address. If UDTs are aliases, they can't do that. It also fails to prevent type confusion

@DaniPopes DaniPopes mentioned this issue Jun 14, 2023
12 tasks
@mahmudsudo
Copy link

can i take this ?

@mahmudsudo
Copy link

can some extra details of the usage be given ?

@DaniPopes
Copy link
Member Author

can i take this ?

Sure, go ahead!

It's mostly just porting the macro_rules! to proc macro code using quote! in here:

pub(super) fn expand(cx: &ExpCtxt<'_>, udt: &ItemUdt) -> Result<TokenStream> {

You can look at the other files in the expand module for examples

@mahmudsudo
Copy link

would start on it immediately

@fgimenez
Copy link
Contributor

fgimenez commented Dec 5, 2023

@mahmudsudo are you working on this? if not I'd like to give it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants