Skip to content

Conversation

@tbkka
Copy link
Contributor

@tbkka tbkka commented Dec 12, 2025

The new FP parsing code inadvertently used the entire backing string, even when the substring referred to just a portion.

@tbkka tbkka requested a review from a team as a code owner December 12, 2025 20:33
@tbkka
Copy link
Contributor Author

tbkka commented Dec 12, 2025

@milseman I would appreciate if someone could double-check my use of internal String APIs here. In particular, I've not made any effort to test cases where a string is not "fast UTF8" capable; advice appreciated.

@tbkka
Copy link
Contributor Author

tbkka commented Dec 12, 2025

This is a follow-on to #85797

} else {
// Otherwise, make a copy so we have contiguous UTF8...
let string = String(text)
parsed = unsafe string._guts.withFastUTF8 { chars -> ${Self}? in
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In particular, can I reliably assume that a copied string will always support withFastUTF8?

expectNotNil(parsed)
expectEqual(parsed!.bitPattern, (2.0).bitPattern)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I need to test bridged strings specially here?

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.

1 participant