-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[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
Conversation
@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. |
ffcae60
to
4e69463
Compare
test/Interop/Cxx/namespace/inline-namespace-function-call.swift
Outdated
Show resolved
Hide resolved
lib/Sema/CSSimplify.cpp
Outdated
auto nominal1 = cast<NominalType>(desugar1); | ||
auto nominal2 = cast<NominalType>(desugar2); | ||
|
||
if (isa<EnumType>(nominal1) && kind == ConstraintKind::Bind) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for posterity: we have discussed this offline and a better approach here might be to - check whether the base type of the lookup is inline namespace or not and based on that adjust the reference type for each found member if it was found in an inline namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented this in the step when we generate the constraints. Unfortunately, I could not push the logic earlier as the lookup itself finds declarations, not types. Let me know if I am missing something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking offline, it turns it it was not sufficient to just update the type in the constraint. I had to update the opened type that was used for the selected overload.
fa14547
to
56d8b6f
Compare
56d8b6f
to
07f0d52
Compare
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. rdar://158401346
07f0d52
to
0e56809
Compare
@swift-ci please smoke test |
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