Reverse interop support for type aliases. (#7043)

Allow any type that has a mapping from Carbon to C++ to be exposed to
C++ via name lookup. This also exposes the logic to export Carbon
classes to C++ to apply during type mapping, which gives very slight
support for passing Carbon types to C++ functions from Carbon, but not
really enough to sensibly test yet.

Depends on #7042.
This commit is contained in:
Richard Smith
2026-04-14 00:18:33 +00:00
committed by GitHub
parent 5b1de7633c
commit 43867a678b
9 changed files with 135 additions and 46 deletions
+7 -3
View File
@@ -316,9 +316,13 @@ class Derived {
fn F[self: Self]() {
//@dump-sem-ir-begin
// TODO: It should be possible to call protected methods in the base class.
// CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+4]]:5: error: call argument of type `Derived` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: self.instance_fn();
// CHECK:STDERR: ^~~~
// CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE+8]]:22: error: no matching function for call to 'instance_fn' [CppInteropParseError]
// CHECK:STDERR: 19 | self.instance_fn();
// CHECK:STDERR: | ^
// CHECK:STDERR: fail_todo_import_function_member_protected_extend_call_instance_in_member.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
// CHECK:STDERR: ./function_member_protected.h:4:8: note: candidate function not viable: cannot convert argument of incomplete type 'const Carbon::Derived' to 'C' for object argument [CppInteropParseNote]
// CHECK:STDERR: 4 | auto instance_fn() -> void;
// CHECK:STDERR: | ^
// CHECK:STDERR:
self.instance_fn();
//@dump-sem-ir-end