Skip to content

[stdlib] Fix backwards iteration of word breaking #69728

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

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

Azoy
Copy link
Contributor

@Azoy Azoy commented Nov 8, 2023

We were accidently hanging when rounding word indices for some concoctions of strings. In particular, where we had a pair of scalars create a constraint for the preceeding pair, but the preceeding extend rules were not taking the constraint into consideration.

@Azoy Azoy requested a review from a team as a code owner November 8, 2023 21:27
@stephentyrone
Copy link
Contributor

Please clone for 5.10

@Azoy
Copy link
Contributor Author

Azoy commented Nov 8, 2023

@swift-ci please test

Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

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

We really need exhaustive tests for all possible paths through these state machines (grapheme breaking, word breaking), verifying that backwards/forwards iteration and rounding operations are all fully consistent with each other.

We don't even need an oracle for the expected results -- the actual break positions seem less important than that we give consistent results in finite time (preferably proportional to the distance to the break we're returning), on all possible strings of representative code points, up to some small(ish) fixed length.

@Azoy Azoy merged commit 2ef2659 into swiftlang:main Nov 9, 2023
@Azoy Azoy deleted the fix-word-breaking-bug branch November 9, 2023 02:57
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