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

Fix fmt panic for const inside trait and abi #5009

Merged
merged 10 commits into from
Aug 24, 2023
Merged

Fix fmt panic for const inside trait and abi #5009

merged 10 commits into from
Aug 24, 2023

Conversation

sdankel
Copy link
Member

@sdankel sdankel commented Aug 23, 2023

Description

Closes #5008

The panic happened because the formatter was adding two ;s after a constant declaration inside of a trait. It happened for ABI too, so it's fixed for both with tests.

I'm working toward the goal of making it so the formatter never panics, even for sway files that do not compile.

I made it so, when a sway file does not compile, it does not cause the formatter to panic. Now it prints an error message.

I'm checking in this simple bash script that runs the formatter against every sway project in the repo. Fixing these bugs brought the # of panics from ~35 down to 15.

I verified that the CI step that checks the formatting of sway docs is still working.

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.

@sdankel sdankel marked this pull request as ready for review August 23, 2023 23:45
@sdankel sdankel requested a review from a team August 23, 2023 23:45
Copy link
Contributor

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

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

Happy to approve once CI checks pass, nice one @sdankel !

@sdankel sdankel enabled auto-merge (squash) August 24, 2023 00:10
@sdankel sdankel changed the title Fix fmt panic for const inside trait Fix fmt panic for const inside trait and abi Aug 24, 2023
@sdankel sdankel requested a review from a team August 24, 2023 01:29
@sdankel sdankel added bug Something isn't working formatter labels Aug 24, 2023
@sdankel sdankel self-assigned this Aug 24, 2023
@sdankel sdankel removed bug Something isn't working formatter labels Aug 24, 2023
@sdankel sdankel requested a review from eureka-cpu August 24, 2023 03:24
@sdankel sdankel requested a review from tritao August 24, 2023 18:58
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

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

LGTM

@sdankel sdankel merged commit a7da1f2 into master Aug 24, 2023
@sdankel sdankel deleted the sophie/5008 branch August 24, 2023 23:29
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.

forc-fmt associated_const_trait_default results in panic
4 participants