-
Notifications
You must be signed in to change notification settings - Fork 440
Make sure we convert the source to a native UTF-8 string before parsing #251
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
Conversation
@swift-ci Please test |
@milseman do you maybe have another recommendation for forcing a native UTF8 string?
|
Are you able to use Swift 5.1? SE-0247 Contiguous Strings provides the preferred API on String: |
If you cannot use Swift 5.1, let's come up with a solution that doesn't assemble and then disassemble grapheme clusters. Have you tried something like |
We can use Swift 5.1, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the String APIs that are provided for this kind of functionality.
It appears like the compiler is now optimizing the `self += ""` away in release builds. Furthermore, we didn't catch the issue since the assertion checking for a native UTF-8 string also gets optimized away in release builds. Fix the issue in two ways: 1. Make the assertion a precondition that also fails in release builds 2. Use the newly (as of Swift 5.1) provided standard library APIs to make the String a contiguous UTF-8 string
Build failed |
Build failed |
It appears like the compiler is now optimizing the
self += ""
away in release builds. Furthermore, we didn't catch the issue since the assertion checking for a native UTF-8 string also gets optimized away in release builds.Fix the issue in two ways:
rdar://71863757