Skip to content

Allow decimal/binary/octal u256 literals#7043

Merged
IGI-111 merged 4 commits intoFuelLabs:masterfrom
saimeunt:feat/u256-literals-in-dec-bin-oct
Apr 2, 2025
Merged

Allow decimal/binary/octal u256 literals#7043
IGI-111 merged 4 commits intoFuelLabs:masterfrom
saimeunt:feat/u256-literals-in-dec-bin-oct

Conversation

@saimeunt
Copy link
Copy Markdown
Contributor

Description

This PR removes the constraint on u256 literals being only expressed in hexadecimal.
The constraint has been removed and the code slightly refactored to remove the unnecessary radix variable in the lex_int_lit function in token.rs.
The corresponding error LexErrorKind::U256NotInHex has been removed from the codebasen as well as the should_fail test looking to raise this error.

The u256 testing suite has been augmented with additional tests to make sure we can express u256 literals in decimal, binary and octal.

Closes #5456

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.

IGI-111
IGI-111 previously approved these changes Mar 28, 2025
Copy link
Copy Markdown
Contributor

@IGI-111 IGI-111 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 to me!

@IGI-111 IGI-111 requested a review from a team March 28, 2025 07:12
@IGI-111
Copy link
Copy Markdown
Contributor

IGI-111 commented Mar 28, 2025

looks like the one CI issue is unrelated to this PR @JoshuaBatty any idea why that utils test is failing?

@IGI-111
Copy link
Copy Markdown
Contributor

IGI-111 commented Mar 28, 2025

Looks like it's just flaky

@xunilrj xunilrj requested a review from IGI-111 April 2, 2025 09:32
@IGI-111 IGI-111 temporarily deployed to fuel-sway-bot April 2, 2025 10:09 — with GitHub Actions Inactive
@IGI-111 IGI-111 merged commit df50ca8 into FuelLabs:master Apr 2, 2025
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

u256 decimal literals

3 participants