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

Type arguments in JSON ABI and the function selector #2218

Merged
merged 10 commits into from
Jul 6, 2022

Conversation

mohammadfawaz
Copy link
Contributor

@mohammadfawaz mohammadfawaz commented Jul 4, 2022

Closes #1993

Spec change in FuelLabs/fuel-specs#382

Mostly similar to how components work.

I had to switch to using copies of Property and Function from fuels-types to local versions in sway-types because type_arguments still need to be added in fuels-types. This is temporary until fuels-types is ready.

@mohammadfawaz mohammadfawaz self-assigned this Jul 4, 2022
@mohammadfawaz mohammadfawaz added enhancement New feature or request ABI Everything to do the ABI, especially the JSON representation compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Jul 4, 2022
@mohammadfawaz mohammadfawaz marked this pull request as ready for review July 5, 2022 13:39
@mohammadfawaz mohammadfawaz requested a review from a team July 5, 2022 13:39
otrho
otrho previously approved these changes Jul 5, 2022
@otrho otrho requested a review from a team July 5, 2022 13:56
@adlerjohn
Copy link
Contributor

Is there an issue in fuels-rs to track adding that to fuels-types?

@mohammadfawaz
Copy link
Contributor Author

Is there an issue in fuels-rs to track adding that to fuels-types?

I created an issue for the full feature here: FuelLabs/fuels-rs#448.

@mohammadfawaz mohammadfawaz enabled auto-merge (squash) July 6, 2022 01:02
@otrho otrho requested a review from a team July 6, 2022 01:42
@mohammadfawaz mohammadfawaz merged commit 2943258 into master Jul 6, 2022
@mohammadfawaz mohammadfawaz deleted the mohammadfawaz/1993 branch July 6, 2022 10:57
r-sitko pushed a commit to r-sitko/sway that referenced this pull request Jul 6, 2022
type_arguments: self
.type_id
.get_type_parameters()
.map(|v| v.iter().map(|param| param.generate_json_abi()).collect()),
Copy link
Contributor

Choose a reason for hiding this comment

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

code golf: .map(TypeParameter::generate_json_abi)

type_arguments: x
.type_id
.get_type_parameters()
.map(|v| v.iter().map(|param| param.generate_json_abi()).collect()),
Copy link
Contributor

Choose a reason for hiding this comment

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

similar golf can be played here

type_arguments: self
.type_id
.get_type_parameters()
.map(|v| v.iter().map(|param| param.generate_json_abi()).collect()),
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm running out of creativity but the same code golf could apply here

type_arguments: self
.return_type
.get_type_parameters()
.map(|v| v.iter().map(|param| param.generate_json_abi()).collect()),
Copy link
Contributor

Choose a reason for hiding this comment

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

why go for par when you can go for a birdie?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ABI Everything to do the ABI, especially the JSON representation compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen enhancement New feature or request
Projects
Archived in project
5 participants