Refactor function return type representation (#6463)

This separates the return type from the return pattern, and replaces the
return pattern with a block of return patterns. This is a step toward
support for `ref` returns (where there's no corresponding return
pattern) and compund-form returns (where there may be multiple return
patterns).
This commit is contained in:
Geoff Romer
2025-12-10 18:34:23 +00:00
committed by GitHub
parent 77918d023b
commit bf45b1cbf5
57 changed files with 1668 additions and 1532 deletions
+3 -3
View File
@@ -452,9 +452,9 @@ fn F() {
// CHECK:STDERR: class C;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:1: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: auto foo() -> C;
// CHECK:STDERR: ^
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: class C;
// CHECK:STDERR: ^
// CHECK:STDERR:
Cpp.foo();
}
@@ -451,9 +451,9 @@ fn F() {
// CHECK:STDERR: struct S;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:1: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: auto foo() -> S;
// CHECK:STDERR: ^
// CHECK:STDERR: ./decl_value_return_type.h:2:8: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: struct S;
// CHECK:STDERR: ^
// CHECK:STDERR:
Cpp.foo();
}
+3 -3
View File
@@ -413,9 +413,9 @@ fn F() {
// CHECK:STDERR: union U;
// CHECK:STDERR: ^
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-14]]:10: in file included here [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:1: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: auto foo() -> U;
// CHECK:STDERR: ^
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: union U;
// CHECK:STDERR: ^
// CHECK:STDERR:
Cpp.foo();
}