Skip to content

[6.2][IRGen] Emit null check before swift_conformsToProtocol for nullable metatypes #82241

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

Open
wants to merge 1 commit into
base: release/6.2
Choose a base branch
from

Conversation

drexin
Copy link
Contributor

@drexin drexin commented Jun 13, 2025

  • Explanation: swift_conformsToProtocol does not properly handle nullptr values, which can currently be passed if the source type is an optional metatype. This change adds emission of a null check before calling the runtime function in these cases.
  • Scope: IRGen for checked casts
  • Issues: rdar://149882902
  • Original PRs: [IRGen] Emit null check before swift_conformsToProtocol for nullable … #82240
  • Risk: Low. This change only affects the specific case that currently causes issues. Other instances should not be affected.
  • Testing: Added a regression test
  • Reviewers: @aschwaighofer @mikeash

@drexin drexin requested a review from a team as a code owner June 13, 2025 20:32
@drexin drexin changed the title [IRGen] Emit null check before swift_conformsToProtocol for nullable metatypes [6.2][IRGen] Emit null check before swift_conformsToProtocol for nullable metatypes Jun 13, 2025
@drexin drexin added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Jun 13, 2025
@drexin
Copy link
Contributor Author

drexin commented Jun 13, 2025

@swift-ci test

…metatypes

rdar://149882902

swift_conformsToProtocol does not properly handle nullptr values, which can currently be passed if the source type is an optional metatype. This change adds emission of a null check before calling the runtime function in these cases.
@drexin drexin force-pushed the wip-149882902-6.2 branch from 327722c to 533e215 Compare June 14, 2025 00:01
@drexin
Copy link
Contributor Author

drexin commented Jun 14, 2025

@swift-ci test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants