Skip to content

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

@drexin drexin merged commit dc71b7e into swiftlang:release/6.2 Jun 18, 2025
5 checks passed
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