Skip to content
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

[SR-9206] Should literal Characters precondition on single-grapheme check? #51696

Open
milseman mannequin opened this issue Nov 7, 2018 · 3 comments
Open

[SR-9206] Should literal Characters precondition on single-grapheme check? #51696

milseman mannequin opened this issue Nov 7, 2018 · 3 comments
Assignees
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

Comments

@milseman
Copy link
Mannequin

milseman mannequin commented Nov 7, 2018

Previous ID SR-9206
Radar rdar://problem/52193112
Original Reporter @milseman
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler, Standard Library
Labels Bug
Assignee @milseman
Priority Medium

md5: 1b44b077c8642a30055aca2f6e59d9ae

relates to:

  • SR-6077 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.

@milseman
Copy link
Mannequin Author

milseman mannequin commented Nov 7, 2018

@eeckstein, what do you think here?

@milseman
Copy link
Mannequin Author

milseman mannequin commented Nov 7, 2018

@swift-ci create

@milseman
Copy link
Mannequin Author

milseman mannequin commented Nov 7, 2018

Chatted with @eeckstein. We think we'll add a single-scalar path that can be constant folded, and do a precondition check on multi-scalar Characters. We will also fix the benchmark to be correct. This will pollute history here a bit, but that's ok.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

0 participants