You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title states, hex literals have their optional suffix counted as part of their digits. This causes the following error, and related errors for types aside from b256:
--> /Users/camden/Source/charcoal/out/ds_auth/src/main.sw:69:75
|
67 | } else if src == storage.owner.read() {
68 | return true;
69 | } else if storage.authority.read() == Identity::Address(Address::from(0x0000000000000000000000000000000000000000000000000000000000000000b256)) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hex literals must have 1..16 or 64 digits
70 | return false;
71 | } else {
If we count the zeroes, logically we can deduce that there is in fact exactly 64 digits in the following:
camden-smallwood
changed the title
Sway hex literals have their suffix counted as a digit
Sway hex literals have their suffix counted as digits
Nov 16, 2024
Related Component
compiler
Problem
As the title states, hex literals have their optional suffix counted as part of their digits. This causes the following error, and related errors for types aside from b256:
If we count the zeroes, logically we can deduce that there is in fact exactly 64 digits in the following:
But there is no attempt made to strip the
b256
before counting.Steps
0x0000000000000000000000000000000000000000000000000000000000000000b256
constant.forc build
Possible Solution(s)
Maybe strip the suffix before this point:
sway/sway-core/src/transform/to_parsed_lang/convert_parse_tree.rs
Lines 3388 to 3402 in 73e1a7a
Notes
Should be an easy fix, but it should be done ASAP.
Installed components
The text was updated successfully, but these errors were encountered: