Skip to content

[SE-0458] Unify escapability inference for AST and Interop #79434

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
merged 1 commit into from
Feb 17, 2025

Conversation

Xazax-hun
Copy link
Contributor

Interop is injecting escapability annotations for the STL and doing a limited inference for aggregates. Let's reuse the same facilities in the AST when we calculate the safety of the foreign types.

Interop is injecting escapability annotations for the STL and doing a
limited inference for aggregates. Let's reuse the same facilities in the
AST when we calculate the safety of the foreign types.
@Xazax-hun Xazax-hun requested a review from DougGregor February 17, 2025 13:43
@Xazax-hun Xazax-hun changed the title [SE-0458] Unify escapibility inference for AST and Interop [SE-0458] Unify escapability inference for AST and Interop Feb 17, 2025
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Thank you for doing this.

argToCheck.second);
if (nonPackArg.getKind() != clang::TemplateArgument::Type &&
desc.impl) {
desc.impl->diagnose(loc, diag::type_template_parameter_expected,
Copy link
Member

Choose a reason for hiding this comment

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

If we're okay with disabling these diagnostics when we don't have the impl on hand, should we just remove them entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should refactor this code at some point. When we import these types we will always have the impl at hand. After they are imported, we no longer need to emit diagnostics about these types so we don't really need the impl. That being said a better design would be to return some information about the diagnostics that needs to be emitted (instead of having a side effect) and only consume those in the importer and ignore them in other parts of the compiler.

@Xazax-hun Xazax-hun merged commit 07b8f0a into main Feb 17, 2025
3 checks passed
@Xazax-hun Xazax-hun deleted the gaborh/escapibility-lookup branch February 17, 2025 20:04
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