[SR-9206] Should literal Characters precondition on single-grapheme check? #51696
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 1b44b077c8642a30055aca2f6e59d9ae
relates to:
Character
ends up accepting invalid emoji flag sequences.Issue Description:
String creation from a literal ends up calling the `unchecked` initializer to allow for better constant-folding, etc. But, the compiler can't be too overly restrictive, as what is and is not truly a grapheme is a runtime consideration, i.e. it has to support time-traveling. Thus, it's overly conservative about rejecting graphemes. The question is, should we keep emergent behavior or pay the cost of a precondition violation here?
See SuperChars.swift benchmark, which has a few multi-grapheme flag Characters in it.
The text was updated successfully, but these errors were encountered: