Skip to content

Conversation

peter-jerry-ye
Copy link
Collaborator

and replace the string slice by string view.

TODO : Update the FromStr trait to accept the @string.View as well.

@peter-jerry-ye peter-jerry-ye requested a review from bobzhang July 22, 2025 03:23
@peter-jerry-ye peter-jerry-ye force-pushed the zihang/update-strconv branch from b26b52d to 8313e2c Compare July 22, 2025 03:24
@coveralls
Copy link
Collaborator

coveralls commented Jul 22, 2025

Pull Request Test Coverage Report for Build 498

Details

  • 29 of 32 (90.63%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 89.95%

Changes Missing Coverage Covered Lines Changed/Added Lines %
strconv/string_view.mbt 10 11 90.91%
strconv/number.mbt 18 20 90.0%
Totals Coverage Status
Change from base Build 497: -0.03%
Covered Lines: 8503
Relevant Lines: 9453

💛 - Coveralls

Comment on lines +40 to +48
loop s {
['0'..='9' as ch, .. rest] if x < min_19digit_int => {
len += 1
x = x * 10UL +
UInt64::extend_uint((ch.to_int() - '0').reinterpret_as_uint()) // no overflows here
continue rest
}
len += 1
x = x * 10UL + UInt64::extend_uint(to_digit(s[0]).reinterpret_as_uint()) // no overflows here
s = s.step_1_unchecked()
['_', .. rest] => continue rest
s => return (s, x, len)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only place where the new implementation differs from the original, as the original one looks like a bug to me where it didn't check again whether the first char is still a digit after having consumed a -. The test coverage suggests that such behavior was never tested.

@peter-jerry-ye peter-jerry-ye marked this pull request as ready for review July 22, 2025 03:32
@bobzhang bobzhang force-pushed the zihang/update-strconv branch from 245f622 to 37d5f45 Compare July 24, 2025 00:33
@peter-jerry-ye peter-jerry-ye merged commit 5608fbf into main Jul 24, 2025
11 checks passed
@peter-jerry-ye peter-jerry-ye deleted the zihang/update-strconv branch July 24, 2025 02:03
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.

3 participants