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

Implement associated consts for ABIs #4425

Merged
merged 9 commits into from Apr 20, 2023

Conversation

tritao
Copy link
Contributor

@tritao tritao commented Apr 11, 2023

Description

This PR adds support for associated consts to ABIs.

It extends ABIs code to be able to insert its interface surface in the trait map, which is later used to support looking up consts.

It then changes impl trait semantic analysis to insert the interface surface of its implemented trait/ abi so the interface surface constant/methods can be self-referenced.

Additionally the Self type of Contract inside a Contract impl is now the actual ABI type instead of just being hardcoded to Contract.

Finally it fixes IR gen to support non-global consts so that we are able to generate correct code for consts.

Closes #4290.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@tritao tritao added enhancement New feature or request compiler General compiler. Should eventually become more specific as the issue is triaged compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen labels Apr 11, 2023
@tritao tritao self-assigned this Apr 11, 2023
@tritao tritao force-pushed the associated-consts-abis branch 9 times, most recently from 439a506 to e976cb7 Compare April 17, 2023 19:01
@tritao tritao requested a review from a team April 17, 2023 19:06
@tritao tritao marked this pull request as ready for review April 17, 2023 19:06
@tritao tritao force-pushed the associated-consts-abis branch 2 times, most recently from 6d996d1 to bfefc76 Compare April 18, 2023 08:07
JoshuaBatty
JoshuaBatty previously approved these changes Apr 18, 2023
@JoshuaBatty JoshuaBatty requested a review from a team April 18, 2023 08:10
@JoshuaBatty JoshuaBatty requested a review from a team April 18, 2023 21:57
@mohammadfawaz mohammadfawaz enabled auto-merge (squash) April 20, 2023 22:19
@mohammadfawaz mohammadfawaz merged commit e77749e into FuelLabs:master Apr 20, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler General compiler. Should eventually become more specific as the issue is triaged enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement associated consts for ABIs
4 participants