Skip to content

Cherry-pick [ClangImporter] Look through bounds attributes for template matching #82076 #82193

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

Merged

Conversation

hnrklssn
Copy link
Contributor

  • Explanation:
    When instantiating templated functions with pointers to the templated type, the ClangImporter does not strip type sugar. This strips type sugar for bounds attributes, to make sure that they import the same regardless of whether they are parsed or not.
  • Scope:
    This affects code compiled with SafeInteropWrappers, as that enables parsing bounds safety attributes. Only templated functions are affected. These functions do not get safe interop wrappers, as that currently does not support templated functions, but without this change even the original function cannot be called, which is a regression compared to when bounds attributes are ignored.
  • Issues:
    rdar://151041990
  • Original PRs:
    [ClangImporter] Look through bounds attributes for template matching #82076
  • Risk:
    Low - although the template instantiation logic should very likely strip all sugar types, this change minimises risk by only stripping the bounds attribute sugar.
  • Testing:
    Added regression tests
  • Reviewers:
    @Xazax-hun

…ypes2

When instantiating templated functions with pointers to the templated type, the ClangImporter does not strip type sugar. This strips type sugar for bounds attributes, to make sure that they import the same regardless of whether they are parsed or not.

rdar://151041990
(cherry picked from commit 00afb8b)
@hnrklssn hnrklssn requested a review from a team as a code owner June 11, 2025 19:52
@hnrklssn
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@Xazax-hun Xazax-hun left a comment

Choose a reason for hiding this comment

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

LG! Could you update the title of the PR to match the one you cherry-picking?

@hnrklssn hnrklssn changed the title Merge pull request #82076 from hnrklssn/skip-bounds-safety-types2 Cherry-pick [ClangImporter] Look through bounds attributes for template matching #82076 Jun 12, 2025
@devincoughlin devincoughlin merged commit 1507bcd into swiftlang:release/6.2 Jun 13, 2025
5 checks passed
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