Skip to content

Commit a905f15

Browse files
authored
Fix the tests for forward declared union pointer as return type by making the return type pointer _Nonnull (#5878)
Followup of #5773. Part of #5772.
1 parent 800e8fd commit a905f15

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

toolchain/check/testdata/interop/cpp/function/union.carbon

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -394,23 +394,16 @@ fn F() {
394394

395395
union U;
396396

397-
auto foo() -> U*;
397+
auto foo() -> U* _Nonnull;
398398

399-
// --- fail_todo_import_decl_pointer_return_type.carbon
399+
// --- import_decl_pointer_return_type.carbon
400400

401401
library "[[@TEST_NAME]]";
402402

403403
import Cpp library "decl_pointer_return_type.h";
404404

405405
fn F() {
406406
//@dump-sem-ir-begin
407-
// CHECK:STDERR: fail_todo_import_decl_pointer_return_type.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: nullable pointer: U *` [SemanticsTodo]
408-
// CHECK:STDERR: Cpp.foo();
409-
// CHECK:STDERR: ^~~~~~~
410-
// CHECK:STDERR: fail_todo_import_decl_pointer_return_type.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
411-
// CHECK:STDERR: Cpp.foo();
412-
// CHECK:STDERR: ^~~~~~~
413-
// CHECK:STDERR:
414407
Cpp.foo();
415408
//@dump-sem-ir-end
416409
}
@@ -974,9 +967,11 @@ fn F() {
974967
// CHECK:STDOUT: <elided>
975968
// CHECK:STDOUT: }
976969
// CHECK:STDOUT:
977-
// CHECK:STDOUT: --- fail_todo_import_decl_pointer_return_type.carbon
970+
// CHECK:STDOUT: --- import_decl_pointer_return_type.carbon
978971
// CHECK:STDOUT:
979972
// CHECK:STDOUT: constants {
973+
// CHECK:STDOUT: %U: type = class_type @U [concrete]
974+
// CHECK:STDOUT: %ptr: type = ptr_type %U [concrete]
980975
// CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
981976
// CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
982977
// CHECK:STDOUT: }
@@ -997,7 +992,7 @@ fn F() {
997992
// CHECK:STDOUT: !entry:
998993
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
999994
// CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
1000-
// CHECK:STDOUT: %foo.call: init <error> = call %foo.ref()
995+
// CHECK:STDOUT: %foo.call: init %ptr = call %foo.ref()
1001996
// CHECK:STDOUT: <elided>
1002997
// CHECK:STDOUT: }
1003998
// CHECK:STDOUT:

0 commit comments

Comments
 (0)