Skip to content

[5.5][Runtime] Fix protocol conformance checks on pure ObjC classes. #38319

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

mikeash
Copy link
Contributor

@mikeash mikeash commented Jul 8, 2021

Cherry-pick #38318 to 5.5.

The getSuperclassForMaybeIncompleteMetadata function assumes Swift metadata, and can malfunction strangely when given a pure ObjC class. This is rare, as we usually get the Swift wrapper metadata instead, but possible when using calls like objc_copyClassList.

Fix this by checking for isTypeMetadata before doing anything that assumes Swift-metadata-ness.

rdar://80336030

The getSuperclassForMaybeIncompleteMetadata function assumes Swift metadata, and can malfunction strangely when given a pure ObjC class. This is rare, as we usually get the Swift wrapper metadata instead, but possible when using calls like objc_copyClassList.

Fix this by checking for isTypeMetadata before doing anything that assumes Swift-metadata-ness.

rdar://80336030
(cherry picked from commit 06ff648)
@mikeash mikeash requested review from al45tair and tbkka July 8, 2021 21:50
@mikeash mikeash requested a review from a team as a code owner July 8, 2021 21:50
@mikeash
Copy link
Contributor Author

mikeash commented Jul 8, 2021

@swift-ci please test

Copy link
Contributor

@al45tair al45tair left a comment

Choose a reason for hiding this comment

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

LGTM

@DougGregor DougGregor merged commit aecbd80 into swiftlang:release/5.5 Jul 9, 2021
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