Skip to content

Retrieving attributed string attribute values should not use identity casts#1290

Merged
jmschonfeld merged 1 commit intoswiftlang:mainfrom
jmschonfeld:attrstr/identity-cast-crash
May 14, 2025
Merged

Retrieving attributed string attribute values should not use identity casts#1290
jmschonfeld merged 1 commit intoswiftlang:mainfrom
jmschonfeld:attrstr/identity-cast-crash

Conversation

@jmschonfeld
Copy link
Copy Markdown
Contributor

This reverts a small portion of #1287. It's not always possible to use an identity cast here, because in some cases (such as catalyst applications where AttributedStrings interchangeably use both UIKit UIColor and AppKit NSColor attributes) we do rely on dynamic casting behavior. The dynamic cast should attempt an identity cast first so this shouldn't have a strong impact on the overall performance win since we still avoid the optional boxing in __equalAttributes and retain the performance wins from the runs view.

@jmschonfeld jmschonfeld requested a review from itingliu May 14, 2025 16:27
@jmschonfeld
Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@jmschonfeld jmschonfeld requested review from iCharlesHu and parkera May 14, 2025 17:29
@jmschonfeld jmschonfeld merged commit 5164280 into swiftlang:main May 14, 2025
15 checks passed
@jmschonfeld jmschonfeld deleted the attrstr/identity-cast-crash branch May 14, 2025 18:42
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.

2 participants