From a905f15bf9e919a37a7ff008458667ac943da0d1 Mon Sep 17 00:00:00 2001 From: Boaz Brickner Date: Wed, 30 Jul 2025 22:20:30 +0200 Subject: [PATCH] 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. --- .../testdata/interop/cpp/function/union.carbon | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/toolchain/check/testdata/interop/cpp/function/union.carbon b/toolchain/check/testdata/interop/cpp/function/union.carbon index 80371f9763e1..e2f8cd8564a6 100644 --- a/toolchain/check/testdata/interop/cpp/function/union.carbon +++ b/toolchain/check/testdata/interop/cpp/function/union.carbon @@ -394,9 +394,9 @@ fn F() { union U; -auto foo() -> U*; +auto foo() -> U* _Nonnull; -// --- fail_todo_import_decl_pointer_return_type.carbon +// --- import_decl_pointer_return_type.carbon library "[[@TEST_NAME]]"; @@ -404,13 +404,6 @@ import Cpp library "decl_pointer_return_type.h"; fn F() { //@dump-sem-ir-begin - // CHECK:STDERR: fail_todo_import_decl_pointer_return_type.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: nullable pointer: U *` [SemanticsTodo] - // CHECK:STDERR: Cpp.foo(); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: fail_todo_import_decl_pointer_return_type.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup] - // CHECK:STDERR: Cpp.foo(); - // CHECK:STDERR: ^~~~~~~ - // CHECK:STDERR: Cpp.foo(); //@dump-sem-ir-end } @@ -974,9 +967,11 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: --- fail_todo_import_decl_pointer_return_type.carbon +// CHECK:STDOUT: --- import_decl_pointer_return_type.carbon // CHECK:STDOUT: // CHECK:STDOUT: constants { +// CHECK:STDOUT: %U: type = class_type @U [concrete] +// CHECK:STDOUT: %ptr: type = ptr_type %U [concrete] // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete] // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete] // CHECK:STDOUT: } @@ -997,7 +992,7 @@ fn F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Cpp.ref: = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp] // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo] -// CHECK:STDOUT: %foo.call: init = call %foo.ref() +// CHECK:STDOUT: %foo.call: init %ptr = call %foo.ref() // CHECK:STDOUT: // CHECK:STDOUT: } // CHECK:STDOUT: