Skip to content

[cxx-interop] Support calling functions in inline namespaces #83752

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: main
Choose a base branch
from

Conversation

Xazax-hun
Copy link
Contributor

The overload resolution generated a constraint that tried to bind outer.inline_inner to outer. This constraint failed. This PR attempts to recognize this scenario and make the constraint succeed, inserting a MetatypeConversionExpr that is later ignored by SILGen.

rdar://158401346

@Xazax-hun
Copy link
Contributor Author

@xedin could you take a look? This is just a first stab and I am not sure at all if this is the right approach here.

The overload resolution generated a constraint that tried to bind
outer.inline_inner to outer. This constraint failed. This PR attempts to
recognize this scenario and make the constraint succeed, inserting a
MetatypeConversionExpr that is later ignored by SILGen.

rdar://158401346
@Xazax-hun Xazax-hun force-pushed the fix-inline-namespaces branch from ffcae60 to 4e69463 Compare August 15, 2025 13:18
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@@ -22,5 +22,5 @@ import namespaces;

// Swift's typechecker currently doesn't allow calling a function from inline namespace when it's referenced through the parent namespace.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: remove this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant