-
Notifications
You must be signed in to change notification settings - Fork 1.5k
C++ interop: Support importing operators defined in namespaces #6024
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
LGTM. |
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.
Looks good to me too, but I think we should at least add a TODO to use ADL once we can.
@@ -60,9 +78,10 @@ auto BuildUnaryOperator(Context& context, SemIR::LocId loc_id, Operator op, | |||
// the C++ operator. | |||
// TODO: Change impl lookup instead. See | |||
// https://github.com/carbon-language/carbon-lang/blob/db0a00d713015436844c55e7ac190a0f95556499/toolchain/check/operator.cpp#L76 | |||
if (IsOfCppClassType(context, operand_id)) { | |||
auto cpp_parent_scope_id = GetCppClassTypeParentScope(context, operand_id); |
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.
Can we call Sema::ArgumentDependentLookup
here instead of reimplementing something similar? I think we'd need #5891 to land first, so that we have expressions corresponding to the arguments at the point where we do the lookup.
If you'd prefer to do it this way for the time being, I think that's fine, but please add a TODO to replace this with a call to ArgumentDependentLookup
when we can.
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.
Right, waiting for #5891.
Added TODOs for now (similar to the one in import_cpp.cpp
.
Done. |
C++ Interop Demo:
Before this change:
With this change:
Part of #5995.