Switch tests to use the rendered form of diagnostics (#8070)

Historically, we disabled the rendered form in tests outside of
`toolchain/diagnostics`. The idea was to keep tests shorter and avoid
very long chains of autoupdate before stabilizing due to all the line
numbers and other artifacts in the rendered form.

This PR adds `--diagnostic-line-numbers=[all|first]` and defaults to
`first` in tests. This keeps the rendered form so that we can easily
code review that form and the visual cues it does or doesn't provide.
But it removes all but the first location's line numbers to provide
significantly more stability in tests.

By default, tests get the full unicode line-drawing form of diagnostics
so we can ensure all of the artifacts there make sense with the specific
case being diagnosed, but we do retain some focused ASCII-rendering
tests to ensure that fallback remains usable.

There are some issues here that will be fixed in subsequent PRs.
Notably, we try to keep the frame together in the check lines, and so
force some parts to use the first location. This largely works, but
fails in some edge cases, causing the entire frame to be located
incorrectly. There is a TODO about this that we need to fix, and it only
occurs 6 times across the test suite, so it didn't seem worth
front-loading a fix for here.

Assisted-by: Claude Code
This commit is contained in:
Chandler Carruth authored and GitHub committed 2026-11-05 07:19:59 +00:00
1 parent 0b7059a360
commit d0badecd2a
888 files changed
+39731 -12799

No files matched your search

@@ -16,15 +16,19 @@
// --- one_error.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./one_error.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// --- fail_import_cpp_file_with_one_error.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./one_error.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
import Cpp library "one_error.h";
// ============================================================================
@@ -33,19 +37,27 @@ import Cpp library "one_error.h";
// --- multiple_errors.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error2"
// --- fail_import_cpp_file_with_multiple_errors.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors.h:3:2: error: "error2" [CppInteropParseError]
// CHECK:STDERR:
import Cpp library "multiple_errors.h";
// ============================================================================
@@ -54,6 +66,13 @@ import Cpp library "multiple_errors.h";
// --- one_warning.h
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_one_warning.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- import_cpp_file_with_one_warning.carbon
@@ -61,9 +80,6 @@ import Cpp library "multiple_errors.h";
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
// CHECK:STDERR: included from: import_cpp_file_with_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "one_warning.h";
//@dump-sem-ir-end
@@ -73,8 +89,29 @@ import Cpp library "one_warning.h";
// --- multiple_warnings.h
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning2"
// CHECK:STDERR: ╷ ╭── included from: import_cpp_file_with_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning3"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning3"
// --- import_cpp_file_with_multiple_warnings.carbon
@@ -82,15 +119,6 @@ import Cpp library "one_warning.h";
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_cpp_file_with_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multiple_warnings.h";
//@dump-sem-ir-end
@@ -100,19 +128,27 @@ import Cpp library "multiple_warnings.h";
// --- one_error_and_one_warning.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./one_error_and_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- fail_import_cpp_file_with_one_error_and_one_warning.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_one_error_and_one_warning.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "one_error_and_one_warning.h";
// ============================================================================
@@ -121,31 +157,51 @@ import Cpp library "one_error_and_one_warning.h";
// --- multiple_errors_and_multiple_warnings.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error2"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning2"
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning3"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning3"
// --- fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+15]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+12]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_cpp_file_with_multiple_errors_and_multiple_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multiple_errors_and_multiple_warnings.h";
// ============================================================================
@@ -154,12 +210,40 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
// --- multi_one_warning.h
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- multi_multiple_warnings.h
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning2"
// CHECK:STDERR: ╷ ╭── included from: import_multiple_cpp_files_with_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning3"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning3"
// --- import_multiple_cpp_files_with_warnings.carbon
@@ -167,19 +251,7 @@ import Cpp library "multiple_errors_and_multiple_warnings.h";
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multi_one_warning.h";
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_warnings.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_warnings.h:3:2: warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_multiple_cpp_files_with_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_warnings.h:4:2: warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multi_multiple_warnings.h";
//@dump-sem-ir-end
@@ -189,43 +261,71 @@ import Cpp library "multi_multiple_warnings.h";
// --- multi_one_error_and_one_warning.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_one_error_and_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- multi_multiple_errors_and_multiple_warnings.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error2" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error2"
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning2"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning2"
// CHECK:STDERR: ╷ ╭── included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./multi_multiple_errors_and_multiple_warnings.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning3"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning3"
// --- fail_import_multiple_cpp_files_with_errors_and_warnings.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_one_error_and_one_warning.h:3:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multi_one_error_and_one_warning.h";
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+15]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+12]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:3:2: error: "error2" [CppInteropParseError]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+9]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:4:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:5:2: warning: "warning2" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_multiple_cpp_files_with_errors_and_warnings.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./multi_multiple_errors_and_multiple_warnings.h:6:2: warning: "warning3" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
// ============================================================================
@@ -234,6 +334,14 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
// --- indirect_one_error.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_indirect_error.carbon [InCppInclude]
// CHECK:STDERR: │ ├── included from: ./indirect_error.h [InCppInclude]
// CHECK:STDERR: ├─┤ ./indirect_one_error.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #error "error1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: "error1" [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#error "error1"
// --- indirect_error.h
@@ -244,10 +352,6 @@ import Cpp library "multi_multiple_errors_and_multiple_warnings.h";
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_indirect_error.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: included from: ./indirect_error.h:2:10 [InCppInclude]
// CHECK:STDERR: ./indirect_one_error.h:2:2: error: "error1" [CppInteropParseError]
// CHECK:STDERR:
import Cpp library "indirect_error.h";
// ============================================================================
@@ -256,6 +360,14 @@ import Cpp library "indirect_error.h";
// --- indirect_one_warning.h
// CHECK:STDERR: ╷ ╭── included from: import_indirect_warning.carbon [InCppInclude]
// CHECK:STDERR: │ ├── included from: ./indirect_warning.h [InCppInclude]
// CHECK:STDERR: ├─┤ ./indirect_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- indirect_warning.h
@@ -267,10 +379,6 @@ import Cpp library "indirect_error.h";
library "[[@TEST_NAME]]";
//@dump-sem-ir-begin
// CHECK:STDERR: included from: import_indirect_warning.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: included from: ./indirect_warning.h:2:10 [InCppInclude]
// CHECK:STDERR: ./indirect_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "indirect_warning.h";
//@dump-sem-ir-end
@@ -280,20 +388,29 @@ import Cpp library "indirect_warning.h";
// --- lexer_error_one_warning.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_cpp_library_lexer_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./lexer_error_one_warning.h:[[@LINE+6]]:2
// CHECK:STDERR: -> │ #warning "warning1"
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#warning "warning1"
// --- fail_import_cpp_library_lexer_error.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_lexer_error.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ //!Lexer error: whitespace is required after the comment introducer.
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace is required after '//'
// CHECK:STDERR: · ┃ [NoWhitespaceAfterCommentIntroducer]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
//!Lexer error: whitespace is required after the comment introducer.
// TODO: Move this warning to be after the lexer error.
// CHECK:STDERR: included from: fail_import_cpp_library_lexer_error.carbon:[[@LINE+5]]:10 [InCppInclude]
// CHECK:STDERR: ./lexer_error_one_warning.h:2:2: warning: "warning1" [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_cpp_library_lexer_error.carbon:[[@LINE-6]]:3: error: whitespace is required after '//' [NoWhitespaceAfterCommentIntroducer]
// CHECK:STDERR:
import Cpp library "lexer_error_one_warning.h";
// ============================================================================
@@ -302,20 +419,30 @@ import Cpp library "lexer_error_one_warning.h";
// --- fix_it_hints.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_fix_it_hints.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./fix_it_hints.h:[[@LINE+8]]:19
// CHECK:STDERR: -> │ double score = 0.1
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected ';' after top level declarator
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ insert `;` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
double score = 0.1
// --- fail_import_fix_it_hints.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_fix_it_hints.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./fix_it_hints.h:2:19: error: expected ';' after top level declarator [CppInteropParseError]
// CHECK:STDERR: ./fix_it_hints.h:2:19: note: insert `;` here [CppInteropFixItInsertion]
// CHECK:STDERR:
import Cpp library "fix_it_hints.h";
fn F() {
// CHECK:STDERR: fail_import_fix_it_hints.carbon:[[@LINE+2]]:3-9: error: member name `foo` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_fix_it_hints.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo();
}
@@ -329,6 +456,20 @@ fn F() {
void foobar(int);
inline void call_foobar() {
// CHECK:STDERR: ╷ ╭── included from: fail_with_notes.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_notes.h:[[@LINE+13]]:3
// CHECK:STDERR: │ void foobar(int);
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰──────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires 1 argument, but 2 were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ foobar(1, 2);
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'foobar'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
foobar(1, 2);
}
@@ -336,11 +477,6 @@ inline void call_foobar() {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_with_notes.carbon:[[@LINE+5]]:10 [InCppInclude]
// CHECK:STDERR: ./with_notes.h:5:3-8: error: no matching function for call to 'foobar' [CppInteropParseError]
// CHECK:STDERR: ./with_notes.h:2:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./with_notes.h:2:13-15: note: requires 1 argument, but 2 were provided [CppInteropParseNoteReason]
// CHECK:STDERR:
import Cpp library "with_notes.h";
fn F() {
@@ -356,6 +492,17 @@ fn F() {
#define FOO BAR
#define BAZ void f(error);
// CHECK:STDERR: ╷ ╭── included from: fail_use_context_stack.carbon [InCppInclude]
// CHECK:STDERR: │ ├── included from: ./direct_include.h [InCppInclude]
// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion]
// CHECK:STDERR: │ ├── expanded from macro defined at: ./direct_include.h [InCppMacroExpansion]
// CHECK:STDERR: │ ├── expanded from macro defined at: ./indirect_include.h [InCppMacroExpansion]
// CHECK:STDERR: ├─┤ ./indirect_include.h:[[@LINE+6]]:1
// CHECK:STDERR: -> │ #define BAZ void f(error);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'error' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
FOO
// --- direct_include.h
@@ -368,13 +515,6 @@ FOO
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_use_context_stack.carbon:[[@LINE+7]]:10 [InCppInclude]
// CHECK:STDERR: included from: ./direct_include.h:4:10 [InCppInclude]
// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:2:13 [InCppMacroExpansion]
// CHECK:STDERR: expanded from macro defined at: ./direct_include.h:2:13 [InCppMacroExpansion]
// CHECK:STDERR: expanded from macro defined at: ./indirect_include.h:3:20 [InCppMacroExpansion]
// CHECK:STDERR: ./indirect_include.h:5:1: error: unknown type name 'error' [CppInteropParseError]
// CHECK:STDERR:
import Cpp library "direct_include.h";
// ============================================================================
@@ -385,7 +525,12 @@ import Cpp library "direct_include.h";
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_loc_in_inline_simple.carbon:[[@LINE+2]]:9-14: error: use of undeclared identifier 'banana' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_loc_in_inline_simple.carbon:[[@LINE+7]]:9
// CHECK:STDERR: -> │ int n = banana;
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'banana'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp inline "int n = banana;";
@@ -393,8 +538,17 @@ import Cpp inline "int n = banana;";
import Cpp inline '''c++
void f(const int n) {
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE+3]]:3: error: cannot assign to variable 'n' with const-qualified type 'const int' [CppInteropParseError]
// CHECK:STDERR: fail_loc_in_inline_block.carbon:[[@LINE-2]]:8-18: note: variable 'n' declared const here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_loc_in_inline_block.carbon:[[@LINE+12]]:3
// CHECK:STDERR: │ void f(const int n) {
// CHECK:STDERR: · ─────┬─────
// CHECK:STDERR: · ╰──┤ variable 'n' declared const here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ ++n;
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┗━━┫ error: cannot assign to variable 'n' with const-qualified type 'const
// CHECK:STDERR: · ┃ int'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
++n;
}
@@ -10,6 +10,14 @@
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/fail_import_fix_its.carbon
// CHECK:STDERR: ╭─┤ <carbon Cpp imports>:1:1
// CHECK:STDERR: -> │ ;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// Covers the three shapes a Clang fix-it comes in, each of which becomes a
// label saying what to do rather than the inline rendering Clang would draw.
@@ -21,52 +29,80 @@
// --- replacement.h
int variable_name;
// CHECK:STDERR: ╷ ╭── included from: fail_import_replacement.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./replacement.h:[[@LINE+21]]:13
// CHECK:STDERR: │ int variable_name;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'variable_name' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ int other = varable_name;
// CHECK:STDERR: · ┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'varable_name'; did you
// CHECK:STDERR: · │ ┃ mean 'variable_name'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ replace with `variable_name` [CppInteropFixItReplacement]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ <carbon Cpp imports>:1:1
// CHECK:STDERR: -> │ ;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int other = varable_name;
// --- fail_import_replacement.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: <carbon Cpp imports>:1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: remove this [CppInteropFixItRemoval]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_replacement.carbon:[[@LINE+5]]:10 [InCppInclude]
// CHECK:STDERR: ./replacement.h:3:13-24: error: use of undeclared identifier 'varable_name'; did you mean 'variable_name'? [CppInteropParseError]
// CHECK:STDERR: ./replacement.h:3:13-24: note: replace with `variable_name` [CppInteropFixItReplacement]
// CHECK:STDERR: ./replacement.h:2:5: note: 'variable_name' declared here [CppInteropParseNote]
// CHECK:STDERR:
import Cpp library "replacement.h";
// --- removal.h
// CHECK:STDERR: ╷ ╭── included from: import_removal.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./removal.h:[[@LINE+17]]:25
// CHECK:STDERR: -> │ struct WithExtraSemi {};;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is
// CHECK:STDERR: · │ ┃ incompatible with C++98
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ <carbon Cpp imports>:1:1
// CHECK:STDERR: -> │ ;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: extra ';' outside of a function is incompatible with C++98
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ remove this [CppInteropFixItRemoval]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
struct WithExtraSemi {};;
// --- import_removal.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: <carbon Cpp imports>:1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: remove this [CppInteropFixItRemoval]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_removal.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./removal.h:2:25: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning]
// CHECK:STDERR: ./removal.h:2:25: note: remove this [CppInteropFixItRemoval]
// CHECK:STDERR:
import Cpp library "removal.h";
// --- insertion.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_insertion.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./insertion.h:[[@LINE+9]]:31
// CHECK:STDERR: -> │ double missing_semicolon = 0.1
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected ';' after top level
// CHECK:STDERR: · │ ┃ declarator
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ insert `;` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
double missing_semicolon = 0.1
// --- fail_import_insertion.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: <carbon Cpp imports>:1:1: warning: extra ';' outside of a function is incompatible with C++98 [CppInteropParseWarning]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: remove this [CppInteropFixItRemoval]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_insertion.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./insertion.h:2:31: error: expected ';' after top level declarator [CppInteropParseError]
// CHECK:STDERR: ./insertion.h:2:31: note: insert `;` here [CppInteropFixItInsertion]
// CHECK:STDERR:
import Cpp library "insertion.h";
@@ -9,20 +9,32 @@
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon
// CHECK:STDERR: ╭─┤ <carbon Cpp imports>:1:2
// CHECK:STDERR: -> │ ;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected '}' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_unterminated_import_inline.carbon
// CHECK:STDERR: │ void f() {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ to match this '{' [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// --- fail_unterminated_import_inline.carbon
library "[[@TEST_NAME]]";
import Cpp inline '''c++
// CHECK:STDERR: <carbon Cpp imports>:1:2: error: expected '}' [CppInteropParseError]
// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:10: note: to match this '{' [CppInteropParseNote]
// CHECK:STDERR:
void f() {
''';
import Cpp inline '''c++
// CHECK:STDERR: fail_unterminated_import_inline.carbon:[[@LINE+2]]:1: error: extraneous closing brace ('}') [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unterminated_import_inline.carbon:[[@LINE+6]]:1
// CHECK:STDERR: -> │ }
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: extraneous closing brace ('}') [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
}
''';
@@ -31,9 +43,21 @@ import Cpp inline '''c++
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+4]]:19: error: expected a string literal to specify the library name [ExpectedLibraryName]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+16]]:19
// CHECK:STDERR: -> │ import Cpp library inline;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the library
// CHECK:STDERR: · ┃ name
// CHECK:STDERR: · ┃ [ExpectedLibraryName]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_without_content.carbon:[[@LINE+8]]:20
// CHECK:STDERR: -> │ import Cpp library inline;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library inline;
@@ -41,9 +65,19 @@ import Cpp library inline;
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+4]]:27: error: `import` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+14]]:27
// CHECK:STDERR: -> │ import Cpp library "foo.h" inline;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+2]]:1-34: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_without_content.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ import Cpp library "foo.h" inline;
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "foo.h" inline;
@@ -51,9 +85,21 @@ import Cpp library "foo.h" inline;
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+4]]:19: error: expected a string literal to specify the library name [ExpectedLibraryName]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+16]]:19
// CHECK:STDERR: -> │ import Cpp library inline "";
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected a string literal to specify the library
// CHECK:STDERR: · ┃ name
// CHECK:STDERR: · ┃ [ExpectedLibraryName]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+2]]:20-25: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_without_name_and_inline_with_content.carbon:[[@LINE+8]]:20
// CHECK:STDERR: -> │ import Cpp library inline "";
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library inline "";
@@ -61,8 +107,18 @@ import Cpp library inline "";
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+4]]:27: error: `import` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+14]]:27
// CHECK:STDERR: -> │ import Cpp library "foo.h" inline "";
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `import` declarations must end with a `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+2]]:1-37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_with_name_and_inline_with_content.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ import Cpp library "foo.h" inline "";
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "foo.h" inline "";
@@ -18,6 +18,10 @@
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+2]]:10: error: empty filename [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_import_cpp_library_empty.carbon:[[@LINE+6]]:10
// CHECK:STDERR: -> │ #include ""
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: empty filename [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "";
@@ -20,12 +20,27 @@ library "[[@TEST_NAME]]";
// TODO: Translate the file to a `#include` that includes the named file
// properly. `\` escapes aren't processed in regular `#include`s.
// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+8]]:10-12: error: '\' file not found [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+23]]:10
// CHECK:STDERR: -> │ #include "\"foo.h\""
// CHECK:STDERR: · ━┳━
// CHECK:STDERR: · ┗━━┫ error: '\' file not found [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+6]]:13: error: invalid suffix on literal; C++11 requires a space between literal and identifier [CppInteropParseError]
// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:13: note: insert ` ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+17]]:13
// CHECK:STDERR: -> │ #include "\"foo.h\""
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: invalid suffix on literal; C++11 requires a space
// CHECK:STDERR: · │ ┃ between literal and identifier
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ insert ` ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+3]]:13: warning: extra tokens at end of #include directive [CppInteropParseWarning]
// CHECK:STDERR: fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+2]]:13: note: insert `//` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╭─┤ fail_todo_import_cpp_library_file_with_quotes.carbon:[[@LINE+8]]:13
// CHECK:STDERR: -> │ #include "\"foo.h\""
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: extra tokens at end of #include directive
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ insert `//` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "\"foo.h\"";
@@ -18,6 +18,10 @@
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_cpp_file_not_found.carbon:[[@LINE+2]]:10-22: error: 'not_found.h' file not found [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_cpp_file_not_found.carbon:[[@LINE+6]]:10
// CHECK:STDERR: -> │ #include "not_found.h"
// CHECK:STDERR: · ━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 'not_found.h' file not found [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "not_found.h";
@@ -20,7 +20,13 @@ library "[[@TEST_NAME]]";
import Cpp library "header.h";
// CHECK:STDERR: fail_duplicate_cpp_name.carbon:[[@LINE+2]]:11-13: error: `namespace` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName]
// CHECK:STDERR: ╭─┤ fail_duplicate_cpp_name.carbon:[[@LINE+8]]:11
// CHECK:STDERR: -> │ namespace Cpp;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: `namespace` introducer should be followed by a name;
// CHECK:STDERR: · ┃ prefix reserved word with `r#` to form a valid identifier
// CHECK:STDERR: · ┃ [ExpectedDeclName]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
namespace Cpp;
@@ -31,7 +37,13 @@ library "[[@TEST_NAME]]";
import Cpp library "header.h";
namespace N;
// CHECK:STDERR: fail_cpp_in_inner_namespace.carbon:[[@LINE+2]]:13-15: error: `.` should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclNameAfterPeriod]
// CHECK:STDERR: ╭─┤ fail_cpp_in_inner_namespace.carbon:[[@LINE+8]]:13
// CHECK:STDERR: -> │ namespace N.Cpp;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: `.` should be followed by a name; prefix reserved word
// CHECK:STDERR: · ┃ with `r#` to form a valid identifier
// CHECK:STDERR: · ┃ [ExpectedDeclNameAfterPeriod]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
namespace N.Cpp;
@@ -51,9 +63,19 @@ library "[[@TEST_NAME]]";
import Cpp library "header.h";
// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+4]]:7-9: error: `class` introducer should be followed by a name; prefix reserved word with `r#` to form a valid identifier [ExpectedDeclName]
// CHECK:STDERR: ╭─┤ fail_add_name_to_cpp_namespace.carbon:[[@LINE+14]]:7
// CHECK:STDERR: -> │ class Cpp.C {};
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: `class` introducer should be followed by a name; prefix
// CHECK:STDERR: · ┃ reserved word with `r#` to form a valid identifier
// CHECK:STDERR: · ┃ [ExpectedDeclName]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_add_name_to_cpp_namespace.carbon:[[@LINE+2]]:7-9: error: name `r#Cpp` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_add_name_to_cpp_namespace.carbon:[[@LINE+6]]:7
// CHECK:STDERR: -> │ class Cpp.C {};
// CHECK:STDERR: · ━┳━
// CHECK:STDERR: · ┗━━┫ error: name `r#Cpp` not found [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class Cpp.C {};
@@ -11,6 +11,10 @@
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon
// CHECK:STDERR: fail_fuzzing.carbon:[[@LINE+2]]:1-28: error: `Cpp` import found during fuzzing [CppInteropFuzzing]
// CHECK:STDERR: ╭─┤ fail_fuzzing.carbon:[[@LINE+6]]:1
// CHECK:STDERR: -> │ import Cpp library "file.h";
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: `Cpp` import found during fuzzing [CppInteropFuzzing]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "file.h";
@@ -16,6 +16,17 @@
// --- struct.h
// CHECK:STDERR: ╷ ╭── imported from: fail_todo_import_struct_api.carbon [InImport]
// CHECK:STDERR: │ ├── included from: struct_api.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./struct.h:[[@LINE+9]]:8
// CHECK:STDERR: -> │ struct MyStruct { void Foo(); };
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `indirect import of C++ declaration with no direct Cpp import`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
struct MyStruct { void Foo(); };
// --- struct_api.carbon
@@ -30,10 +41,6 @@ alias MyStructAlias = Cpp.MyStruct;
library "[[@TEST_NAME]]";
// CHECK:STDERR: imported from: fail_todo_import_struct_api.carbon:[[@LINE+4]]:1 [InImport]
// CHECK:STDERR: included from: struct_api.carbon:4:10 [InCppInclude]
// CHECK:STDERR: ./struct.h:2:8: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo]
// CHECK:STDERR:
import library "struct_api";
fn F() {
@@ -89,9 +89,19 @@ namespace A {
fn TryToUseNotLeaked() {
// TODO: Clang's diagnostic for using a class whose definition is not
// reachable is confusing.
// CHECK:STDERR: fail_not_leaked.carbon:[[@LINE+4]]:17-23: error: binding pattern has incomplete type `X` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: direct_import.carbon:4:10 [InCppInclude]
// CHECK:STDERR: ./shared.h:3:10: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_not_leaked.carbon:[[@LINE+14]]:17
// CHECK:STDERR: -> │ var unused x: Cpp.A.X = 0;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `X` in name
// CHECK:STDERR: · ┃ binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: direct_import.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./shared.h
// CHECK:STDERR: │ struct X {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused x: Cpp.A.X = 0;
}
@@ -45,8 +45,15 @@ void f() {}
''';
inline Cpp '''
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE+3]]:6: error: redefinition of 'f' [CppInteropParseError]
// CHECK:STDERR: fail_redefinition.carbon:[[@LINE-5]]:6: note: previous definition is here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_redefinition.carbon:[[@LINE+10]]:6
// CHECK:STDERR: │ void f() {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ previous definition is here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ void f() {}
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: redefinition of 'f' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
void f() {}
''';
@@ -57,13 +64,23 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:12-21: error: use of undeclared identifier 'undeclared' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_diag_location.carbon:[[@LINE+7]]:12
// CHECK:STDERR: -> │ void f() { undeclared = 0; }
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'undeclared'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "void f() { undeclared = 0; }";
inline Cpp '''
void g() {
// CHECK:STDERR: fail_diag_location.carbon:[[@LINE+2]]:3-12: error: use of undeclared identifier 'undeclared' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_diag_location.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ undeclared = 0;
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: use of undeclared identifier 'undeclared'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
undeclared = 0;
}
@@ -73,7 +90,11 @@ void g() {
library "[[@TEST_NAME]]";
// CHECK:STDERR: fail_inline_no_import.carbon:[[@LINE+2]]:8-10: error: name `Cpp` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_inline_no_import.carbon:[[@LINE+6]]:8
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━┳━
// CHECK:STDERR: · ┗━━┫ error: name `Cpp` not found [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
@@ -84,25 +105,45 @@ library "[[@TEST_NAME]]";
import Cpp;
class C {
// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope
// CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
}
interface I {
// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope
// CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
}
constraint N {
// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope
// CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
}
impl C as I {
// CHECK:STDERR: fail_nested.carbon:[[@LINE+2]]:3-16: error: `inline Cpp` declaration not at file scope [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╭─┤ fail_nested.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: `inline Cpp` declaration not at file scope
// CHECK:STDERR: · ┃ [InlineDeclNotAtFileScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
}
@@ -111,9 +152,18 @@ impl C as I {
fn F() {
// TODO: Should this be a check error rather than a parse error?
// CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+4]]:3-8: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_nested_fn.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_nested_fn.carbon:[[@LINE+2]]:3-8: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_nested_fn.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ inline Cpp "";
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline Cpp "";
}
@@ -17,11 +17,28 @@ library "[[@TEST_NAME]]";
// TODO: This diagnostic isn't very good.
import Cpp inline '''
// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+6]]:8-18: error: module declaration must not come from an #include directive [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_export_module_in_inline_cpp.carbon:[[@LINE+23]]:8
// CHECK:STDERR: -> │ export module Foo;
// CHECK:STDERR: · ━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_export_module_in_inline_cpp.carbon:[[@LINE+4]]:8: error: module declaration must occur at the start of the translation unit [CppInteropParseError]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╭─┤ fail_export_module_in_inline_cpp.carbon:[[@LINE+16]]:8
// CHECK:STDERR: -> │ export module Foo;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation
// CHECK:STDERR: · ┃ unit
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ <carbon Cpp imports>
// CHECK:STDERR: │ ;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module
// CHECK:STDERR: · │ │ fragment
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
export module Foo;
''';
@@ -32,13 +49,35 @@ library "[[@TEST_NAME]]";
// TODO: This diagnostic isn't very good.
import Cpp inline '''
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+30]]:1
// CHECK:STDERR: -> │ module Bar;
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+23]]:1
// CHECK:STDERR: -> │ module Bar;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation unit
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ <carbon Cpp imports>
// CHECK:STDERR: │ ;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module
// CHECK:STDERR: · │ │ fragment
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_module_in_inline_cpp.carbon:[[@LINE+8]]:8
// CHECK:STDERR: -> │ module Bar;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: module name 'Foo' specified on command line does not match
// CHECK:STDERR: · ┃ name of module
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
module Bar;
''';
@@ -49,21 +88,54 @@ library "[[@TEST_NAME]]";
// TODO: This diagnostic isn't very good.
import Cpp inline '''
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+4]]:1-7: error: module declaration must not come from an #include directive [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+15]]:1
// CHECK:STDERR: -> │ module;
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:1-7: error: 'module;' introducing a global module fragment can appear only at the start of the translation unit [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ module;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 'module;' introducing a global module fragment can appear only at
// CHECK:STDERR: · ┃ the start of the translation unit
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
module;
int n;
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:1-11: error: module declaration must not come from an #include directive [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+30]]:1
// CHECK:STDERR: -> │ module Baz;
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: module declaration must not come from an #include directive
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+6]]:1: error: module declaration must occur at the start of the translation unit [CppInteropParseError]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: add 'module;' to the start of the file to introduce a global module fragment [CppInteropParseNote]
// CHECK:STDERR: <carbon Cpp imports>:1:1: note: insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+23]]:1
// CHECK:STDERR: -> │ module Baz;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: module declaration must occur at the start of the translation unit
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ <carbon Cpp imports>
// CHECK:STDERR: │ ;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ add 'module;' to the start of the file to introduce a global module
// CHECK:STDERR: · │ │ fragment
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ insert `module; ` here [CppInteropFixItInsertion]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_global_module_in_inline_cpp.carbon:[[@LINE+2]]:8-10: error: module name 'Foo' specified on command line does not match name of module [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_global_module_in_inline_cpp.carbon:[[@LINE+8]]:8
// CHECK:STDERR: -> │ module Baz;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: module name 'Foo' specified on command line does not match
// CHECK:STDERR: · ┃ name of module
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
module Baz;
''';
@@ -74,7 +146,12 @@ library "[[@TEST_NAME]]";
// TODO: Also test that a valid module import works.
import Cpp inline '''
// CHECK:STDERR: fail_import_in_inline_cpp.carbon:[[@LINE+2]]:8-35: error: 'file_that_does_not_exist.h' file not found [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_import_in_inline_cpp.carbon:[[@LINE+7]]:8
// CHECK:STDERR: -> │ import "file_that_does_not_exist.h";
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 'file_that_does_not_exist.h' file not found
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import "file_that_does_not_exist.h";
''';
@@ -38,7 +38,12 @@ import Cpp;
fn CallLeakedA() -> i32 {
// This should not be found as we have not imported "a.h".
// CHECK:STDERR: fail_a_does_not_leak.carbon:[[@LINE+2]]:10-17: error: member name `GetA` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_a_does_not_leak.carbon:[[@LINE+7]]:10
// CHECK:STDERR: -> │ return Cpp.GetA();
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `GetA` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return Cpp.GetA();
}
@@ -143,13 +148,30 @@ import Cpp;
namespace N;
inline Cpp '''
// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:23: error: no type named 'ExportedClass' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:23
// CHECK:STDERR: -> │ using Leak1 = Carbon::ExportedClass;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedClass' in namespace
// CHECK:STDERR: · ┃ 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using Leak1 = Carbon::ExportedClass;
// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:26: error: no type named 'ExportedNested' in namespace 'Carbon::N' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+8]]:26
// CHECK:STDERR: -> │ using Leak2 = Carbon::N::ExportedNested;
// CHECK:STDERR: · ──────────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'ExportedNested' in namespace
// CHECK:STDERR: · ┃ 'Carbon::N'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using Leak2 = Carbon::N::ExportedNested;
// CHECK:STDERR: fail_carbon_export_does_not_leak.carbon:[[@LINE+2]]:23: error: no member named 'PkgA' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_carbon_export_does_not_leak.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ using Leak3 = Carbon::PkgA::SameName;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'PkgA' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using Leak3 = Carbon::PkgA::SameName;
''';
@@ -13,20 +13,29 @@
// --- structured_binding.h
struct X { int a, b; };
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_structured_binding.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./structured_binding.h:[[@LINE+12]]:7
// CHECK:STDERR: -> │ auto [a, b] = X{};
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: Declaration type Binding`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_structured_binding.carbon
// CHECK:STDERR: │ return Cpp.a;
// CHECK:STDERR: · ──┬──
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `a` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto [a, b] = X{};
// --- fail_todo_use_structured_binding.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./structured_binding.h:3:7: error: semantics TODO: `Unsupported: Declaration type Binding` [SemanticsTodo]
import Cpp library "structured_binding.h";
fn F() -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_structured_binding.carbon:[[@LINE+2]]:10-14: note: in `Cpp` name lookup for `a` [InCppNameLookup]
// CHECK:STDERR:
return Cpp.a;
//@dump-sem-ir-end
}
@@ -16,10 +16,18 @@
library "[[@TEST_NAME]]";
import Cpp inline '''c++
// CHECK:STDERR: unused.carbon:[[@LINE+2]]:12: warning: unused variable 'n' [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ unused.carbon:[[@LINE+6]]:12
// CHECK:STDERR: -> │ static int n = 0;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: unused variable 'n' [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
static int n = 0;
// CHECK:STDERR: unused.carbon:[[@LINE+2]]:13: warning: unused function 'f' [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ unused.carbon:[[@LINE+6]]:13
// CHECK:STDERR: -> │ static void f() {}
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: unused function 'f' [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
static void f() {}
''';
@@ -24,10 +24,22 @@ class B {
inline Cpp '''
void F() {
auto b = Carbon::B::Make();
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+17]]:5
// CHECK:STDERR: │ private var a: A = {};
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_access_exported_private_var.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.a;
}
@@ -47,8 +59,16 @@ class B {
inline Cpp '''
void G() {
auto b = Carbon::B::Make();
// CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE+3]]:5: error: 'F' is a private member of 'Carbon::Main::B' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_method.carbon:[[@LINE-7]]:18: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_method.carbon:[[@LINE+11]]:5
// CHECK:STDERR: │ private fn F() {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.F();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'F' is a private member of 'Carbon::Main::B'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.F();
}
@@ -71,10 +91,22 @@ fn MakeB() -> B(A) {
inline Cpp '''
void F() {
auto b = Carbon::MakeB();
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+5]]:5: error: 'a' is a private member of 'Carbon::Main::B<Carbon::Main::A>' [CppInteropParseError]
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE-11]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+17]]:5
// CHECK:STDERR: │ private var a: A = {};
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'a' is a private member of 'Carbon::Main::B<Carbon::Main::A>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_access_exported_private_var_in_generic.carbon:[[@LINE+2]]:5: warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ fail_access_exported_private_var_in_generic.carbon:[[@LINE+6]]:5
// CHECK:STDERR: -> │ b.a;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ warning: expression result unused [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.a;
}
@@ -88,7 +120,12 @@ class A {}
class B(T: type) {
// TODO: exporting of methods in generics is not yet supported.
// CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:3-18: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ private fn F() {}
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
private fn F() {}
}
@@ -101,7 +138,12 @@ inline Cpp '''
void F() {
auto b = Carbon::MakeB();
// TODO: this error should be that `F` is a private member of `B`.
// CHECK:STDERR: fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+2]]:5: error: no member named 'F' in 'Carbon::Main::B<Carbon::Main::A>' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_access_exported_private_method_in_generic.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ b.F();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'F' in 'Carbon::Main::B<Carbon::Main::A>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.F();
}
+113 -17
View File
@@ -62,8 +62,16 @@ import Cpp;
class FinalClass {}
inline Cpp '''
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+3]]:12: error: base 'FinalClass' is marked 'final' [CppInteropParseError]
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE-4]]:18: note: 'FinalClass' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+11]]:12
// CHECK:STDERR: │ class FinalClass {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'FinalClass' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ struct A : Carbon::FinalClass {};
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: base 'FinalClass' is marked 'final'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
struct A : Carbon::FinalClass {};
''';
@@ -80,16 +88,40 @@ struct VirtualDestructor {
};
''';
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:1-34: error: cannot convert type `AbstractWithVdtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithVdtor {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithVdtor` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithVdtor {
extend base: Cpp.VirtualDestructor;
}
inline Cpp '''
// CHECK:STDERR: fail_abstract.carbon:[[@LINE+3]]:27: error: variable type 'Carbon::AbstractWithVdtor' (aka 'Carbon::Main::AbstractWithVdtor') is an abstract class [CppInteropParseError]
// CHECK:STDERR: fail_abstract.carbon:[[@LINE-6]]:34: note: unimplemented pure virtual method '~AbstractWithVdtor' in 'AbstractWithVdtor' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_abstract.carbon:[[@LINE+16]]:27
// CHECK:STDERR: │ abstract class AbstractWithVdtor {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method
// CHECK:STDERR: · │ '~AbstractWithVdtor' in
// CHECK:STDERR: · │ 'AbstractWithVdtor'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::AbstractWithVdtor x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable type 'Carbon::AbstractWithVdtor'
// CHECK:STDERR: · ┃ (aka 'Carbon::Main::AbstractWithVdtor') is
// CHECK:STDERR: · ┃ an abstract class
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AbstractWithVdtor x;
''';
@@ -101,10 +133,28 @@ import Cpp;
// TODO: Find a way to export this to C++ as an abstract class, despite not
// having a vptr.
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+5]]:1-39: error: semantics TODO: `exporting abstract class with no abstract methods and non-virtual destructor to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+23]]:1
// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `exporting abstract class with no abstract methods and non-virtual destructor to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+3]]:1-39: error: cannot convert type `AbstractNonvirtualDtor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractNonvirtualDtor {}
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractNonvirtualDtor` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractNonvirtualDtor {}
@@ -120,8 +170,19 @@ import Cpp;
// TODO: We should support generating a base subobject destructor for an
// abstract class, even though we refuse to generate a complete object
// destructor.
// CHECK:STDERR: fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+3]]:1-41: error: cannot convert type `AbstractWithMethodNoVptr` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_nonvirtual_dtor_but_virtual_fns.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithMethodNoVptr {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethodNoVptr` into type
// CHECK:STDERR: · ┃ implementing `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethodNoVptr {
abstract fn F(self);
@@ -140,16 +201,40 @@ import Cpp;
// TODO: We should support generating a base subobject destructor for an
// abstract class, even though we refuse to generate a complete object
// destructor.
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:1-35: error: cannot convert type `AbstractWithMethod` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractWithMethod {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractWithMethod` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractWithMethod {
abstract fn F(self);
}
inline Cpp '''
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE+3]]:28: error: variable type 'Carbon::AbstractWithMethod' (aka 'Carbon::Main::AbstractWithMethod') is an abstract class [CppInteropParseError]
// CHECK:STDERR: fail_variable_with_abstract_method.carbon:[[@LINE-5]]:22: note: unimplemented pure virtual method 'F' in 'AbstractWithMethod' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_variable_with_abstract_method.carbon:[[@LINE+16]]:28
// CHECK:STDERR: │ abstract fn F(self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ unimplemented pure virtual method 'F' in
// CHECK:STDERR: · │ 'AbstractWithMethod'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::AbstractWithMethod x_abstract;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable type
// CHECK:STDERR: · ┃ 'Carbon::AbstractWithMethod' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::AbstractWithMethod') is an
// CHECK:STDERR: · ┃ abstract class
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AbstractWithMethod x_abstract;
''';
@@ -162,8 +247,19 @@ import Cpp;
// TODO: We should support generating a base subobject destructor for an
// abstract class, even though we refuse to generate a complete object
// destructor.
// CHECK:STDERR: fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+3]]:1-35: error: cannot convert type `AbstractToOverride` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_abstract_method_overridden_in_cpp.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ abstract class AbstractToOverride {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `AbstractToOverride` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
abstract class AbstractToOverride {
abstract fn F(ref self);
@@ -59,13 +59,30 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+2]]:1-26: error: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class IncompleteConcreteA;
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: class was forward declared here
// CHECK:STDERR: · ┃ [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class IncompleteConcreteA;
inline Cpp '''
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE+3]]:29: error: variable has incomplete type 'Carbon::IncompleteConcreteA' (aka 'Carbon::Main::IncompleteConcreteA') [CppInteropParseError]
// CHECK:STDERR: fail_incomplete_concrete.carbon:[[@LINE-4]]:26: note: forward declaration of 'Carbon::Main::IncompleteConcreteA' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_incomplete_concrete.carbon:[[@LINE+15]]:29
// CHECK:STDERR: │ class IncompleteConcreteA;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of
// CHECK:STDERR: · │ 'Carbon::Main::IncompleteConcreteA'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::IncompleteConcreteA incomplete_concrete_a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: variable has incomplete type
// CHECK:STDERR: · ┃ 'Carbon::IncompleteConcreteA' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::IncompleteConcreteA')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::IncompleteConcreteA incomplete_concrete_a;
''';
@@ -75,7 +92,12 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:1-17: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class B(N: i32) {
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `binding maps to a non-type template parameter`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class B(N: i32) {
var a: array(i8, N);
@@ -86,9 +108,18 @@ class B(N: i32) {
alias T = B(-1);
inline Cpp '''
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+4]]:1: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+13]]:1
// CHECK:STDERR: -> │ Carbon::T t;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_monomorphization_failure.carbon:[[@LINE+2]]:9: error: no type named 'T' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_monomorphization_failure.carbon:[[@LINE+7]]:9
// CHECK:STDERR: -> │ Carbon::T t;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'T' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::T t;
''';
@@ -75,10 +75,20 @@ class EmptyClass {}
inline Cpp '''
void AccessNonexistentField() {
Carbon::EmptyClass a;
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::EmptyClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x = 12;
// CHECK:STDERR: fail_nonexistent_field.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::EmptyClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_nonexistent_field.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y = 34;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::EmptyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.y = 34;
}
@@ -89,10 +99,20 @@ library "[[@TEST_NAME]]";
import Cpp;
class UnsupportedFieldType {
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7
// CHECK:STDERR: -> │ var x: ();
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: ();
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:7-11: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:7
// CHECK:STDERR: -> │ var y: ();
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var y: ();
}
@@ -100,10 +120,20 @@ class UnsupportedFieldType {
inline Cpp '''
void AccessUnsupportedField() {
Carbon::UnsupportedFieldType a;
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x;
// CHECK:STDERR: fail_unsupported_field_type.carbon:[[@LINE+2]]:5: error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_field_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.y;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'y' in 'Carbon::Main::UnsupportedFieldType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.y;
}
@@ -120,7 +150,12 @@ class AdaptedClass {
inline Cpp '''
void AccessAdaptedField() {
Carbon::AdaptedClass a;
// CHECK:STDERR: fail_adapter.carbon:[[@LINE+2]]:5: error: no member named 'x' in 'Carbon::Main::AdaptedClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_adapter.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ a.x = 12;
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'x' in 'Carbon::Main::AdaptedClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a.x = 12;
}
@@ -132,7 +167,11 @@ import Cpp;
// This should not cause a crash.
class InvalidBaseClass {
// CHECK:STDERR: fail_invalid.carbon:[[@LINE+2]]:16-21: error: name `Whoops` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_invalid.carbon:[[@LINE+6]]:16
// CHECK:STDERR: -> │ extend base: Whoops;
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: name `Whoops` not found [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Whoops;
}
@@ -156,8 +195,17 @@ class ClassWithPrivateField {
inline Cpp '''
int AccessPrivateField() {
auto c = Carbon::ClassWithPrivateField::Make();
// CHECK:STDERR: fail_private_field.carbon:[[@LINE+3]]:12: error: 'x' is a private member of 'Carbon::Main::ClassWithPrivateField' [CppInteropParseError]
// CHECK:STDERR: fail_private_field.carbon:[[@LINE-7]]:16: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_private_field.carbon:[[@LINE+12]]:12
// CHECK:STDERR: │ private var x: i32;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return c.x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of
// CHECK:STDERR: · ┃ 'Carbon::Main::ClassWithPrivateField'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c.x;
}
@@ -45,7 +45,12 @@ void FSpecific() {
library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:1-33: error: semantics TODO: `failed to map specific type arg to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ class UnsupportedClass(T: type) {
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map specific type arg to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class UnsupportedClass(T: type) {
var t: T;
@@ -54,9 +59,19 @@ alias AliasEmptyTuple = UnsupportedClass(());
inline Cpp '''
void FUnsupported() {
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+4]]:11: error: semantics TODO: `interop with unsupported type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+14]]:11
// CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with unsupported type`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_unsupported_specific_arg.carbon:[[@LINE+2]]:11: error: no type named 'AliasEmptyTuple' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_unsupported_specific_arg.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::AliasEmptyTuple a;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no type named 'AliasEmptyTuple' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::AliasEmptyTuple a;
a.t = 123;
@@ -68,7 +83,12 @@ library "[[@TEST_NAME]]";
import Cpp;
class ClassWithMethod(T: type) {
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:3-25: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ fn M(unused ref self) {}
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn M(unused ref self) {}
}
@@ -76,7 +96,12 @@ class ClassWithMethod(T: type) {
inline Cpp '''
void FMethodCall() {
Carbon::ClassWithMethod<int> c;
// CHECK:STDERR: fail_todo_generic_class_method_call.carbon:[[@LINE+2]]:5: error: no member named 'M' in 'Carbon::Main::ClassWithMethod<int>' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_generic_class_method_call.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ c.M();
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'M' in 'Carbon::Main::ClassWithMethod<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.M();
}
@@ -92,8 +92,17 @@ class RefMethodRValueClass {
inline Cpp '''
void RefMethodRValue() {
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' is an rvalue, but function has non-const lvalue ref-qualifier [CppInteropParseError]
// CHECK:STDERR: fail_ref_method_rvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ref_method_rvalue.carbon:[[@LINE+12]]:3
// CHECK:STDERR: │ fn M(ref self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::RefMethodRValueClass().M();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' is an rvalue, but function
// CHECK:STDERR: · ┃ has non-const lvalue ref-qualifier
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::RefMethodRValueClass().M();
}
@@ -109,8 +118,19 @@ class RefMethodConstLValueClass {
inline Cpp '''
void RefMethodConstLValue(const Carbon::RefMethodConstLValueClass& c) {
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE+3]]:3: error: 'this' argument to member function 'M' has type 'const Carbon::RefMethodConstLValueClass' (aka 'const Carbon::Main::RefMethodConstLValueClass'), but function is not marked const [CppInteropParseError]
// CHECK:STDERR: fail_ref_method_const_lvalue.carbon:[[@LINE-6]]:17: note: 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ref_method_const_lvalue.carbon:[[@LINE+14]]:3
// CHECK:STDERR: │ fn M(ref self);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'M' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c.M();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'this' argument to member function 'M' has type 'const
// CHECK:STDERR: · ┃ Carbon::RefMethodConstLValueClass' (aka 'const
// CHECK:STDERR: · ┃ Carbon::Main::RefMethodConstLValueClass'), but function is not
// CHECK:STDERR: · ┃ marked const
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.M();
}
@@ -72,7 +72,13 @@ struct VBase {
class A {}
// CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+2]]:1-25: error: semantics TODO: `generic class overriding methods from a C++ virtual class` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_generic.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ class GenericZ(T: type) {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `generic class overriding methods from a C++ virtual class`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class GenericZ(T: type) {
extend base: Cpp.VBase;
@@ -34,8 +34,18 @@ class PrivateClass {
inline Cpp '''
int PrivateStatic() {
// CHECK:STDERR: fail_static_private.carbon:[[@LINE+3]]:32: error: 'x' is a private member of 'Carbon::Main::PrivateClass' [CppInteropParseError]
// CHECK:STDERR: fail_static_private.carbon:[[@LINE-6]]:23: note: implicitly declared private here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_static_private.carbon:[[@LINE+13]]:32
// CHECK:STDERR: │ private static var x: i32 = 123;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ implicitly declared private here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::PrivateClass::x;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: 'x' is a private member of
// CHECK:STDERR: · ┃ 'Carbon::Main::PrivateClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return Carbon::PrivateClass::x;
}
@@ -57,7 +57,12 @@ import Cpp library "abstract.h";
class C {
extend base: Cpp.A;
// CHECK:STDERR: fail_impl_mismatch_member.carbon:[[@LINE+2]]:3-40: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╭─┤ fail_impl_mismatch_member.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ override fn invalid(unused ref self) {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn invalid(unused ref self) {}
}
@@ -76,7 +81,13 @@ library "[[@TEST_NAME]]";
import Cpp library "abstract_final.h";
class C {
// CHECK:STDERR: fail_derive_from_abstract_final.carbon:[[@LINE+2]]:16-32: error: deriving from final type `AbstractFinal`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_abstract_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.AbstractFinal;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `AbstractFinal`; base type
// CHECK:STDERR: · ┃ must be an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.AbstractFinal;
}
File diff suppressed because it is too large. Load diff
+200 -40
View File
@@ -156,71 +156,147 @@ library "[[@TEST_NAME]]";
import Cpp library "multiple_inheritance.h";
fn ConvertA(p: Cpp.C*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertB(p: Cpp.C*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `C*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `C*` to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.C*` does not implement interface `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty1(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOneNonEmptyBaseToEmpty2(p: Cpp.OneNonEmptyBase*) -> Cpp.Empty2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OneNonEmptyBase*` to `Cpp.Empty2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OneNonEmptyBase*` does not implement interface `Core.ImplicitAs(Cpp.Empty2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OneNonEmptyBase*` to
// CHECK:STDERR: · │ ┃ `Cpp.Empty2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OneNonEmptyBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Empty2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToA(p: Cpp.TwoNonEmptyBases*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoNonEmptyBasesToB(p: Cpp.TwoNonEmptyBases*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoNonEmptyBases*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoNonEmptyBases*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `TwoNonEmptyBases*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoNonEmptyBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToA(p: Cpp.OnePolymorphicBase*) -> Cpp.A* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.A*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.A*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.A*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.A*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertOnePolymorphicBaseToB(p: Cpp.OnePolymorphicBase*) -> Cpp.B* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `OnePolymorphicBase*` to `Cpp.B*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.OnePolymorphicBase*` does not implement interface `Core.ImplicitAs(Cpp.B*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `OnePolymorphicBase*`
// CHECK:STDERR: · │ ┃ to `Cpp.B*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.OnePolymorphicBase*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.B*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic1(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic1* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic1*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic1*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic1*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic1*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertTwoPolymorphicBasesToPolymorphic2(p: Cpp.TwoPolymorphicBases*) -> Cpp.Polymorphic2* {
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `TwoPolymorphicBases*` to `Cpp.Polymorphic2*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_multiple_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.TwoPolymorphicBases*` does not implement interface `Core.ImplicitAs(Cpp.Polymorphic2*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_multiple_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `TwoPolymorphicBases*` to `Cpp.Polymorphic2*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.TwoPolymorphicBases*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Polymorphic2*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -268,8 +344,16 @@ library "[[@TEST_NAME]]";
import Cpp library "virtual_inheritance.h";
fn Convert(p: Cpp.VirtB*) -> Cpp.VirtA* {
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `VirtB*` to `Cpp.VirtA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_virtual_inheritance.carbon:[[@LINE+2]]:3-11: note: type `Cpp.VirtB*` does not implement interface `Core.ImplicitAs(Cpp.VirtA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_virtual_inheritance.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `VirtB*` to
// CHECK:STDERR: · │ ┃ `Cpp.VirtA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.VirtB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.VirtA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
@@ -299,57 +383,121 @@ library "[[@TEST_NAME]]";
import Cpp library "diamond.h";
fn ConvertBA(p: Cpp.DiamondB*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondB*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondB*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondB*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondB*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertCA(p: Cpp.DiamondC*) -> Cpp.DiamondA* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondC*` to `Cpp.DiamondA*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondC*` does not implement interface `Core.ImplicitAs(Cpp.DiamondA*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondC*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondA*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondC*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondA*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDB(p: Cpp.DiamondD*) -> Cpp.DiamondB* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondB*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondB*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn ConvertDC(p: Cpp.DiamondD*) -> Cpp.DiamondC* {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `DiamondD*` to `Cpp.DiamondC*` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:3-11: note: type `Cpp.DiamondD*` does not implement interface `Core.ImplicitAs(Cpp.DiamondC*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ return p;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD*` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC*`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return p;
}
fn AccessBA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondB` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondB).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondB).b;
}
fn AccessCA(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:11-27: error: cannot convert expression of type `DiamondD` to `Cpp.DiamondC` with `as` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:11-27: note: type `Cpp.DiamondD` does not implement interface `Core.As(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:11
// CHECK:STDERR: -> │ return (d as Cpp.DiamondC).b;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return (d as Cpp.DiamondC).b;
}
fn AccessDB(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondB` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondB)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.b;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondB`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondB)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.b;
}
fn AccessDC(d: Cpp.DiamondD) -> i32 {
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+3]]:10-12: error: cannot implicitly convert expression of type `DiamondD` to `Cpp.DiamondC` [ConversionFailure]
// CHECK:STDERR: fail_todo_use_diamond.carbon:[[@LINE+2]]:10-12: note: type `Cpp.DiamondD` does not implement interface `Core.ImplicitAs(Cpp.DiamondC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_use_diamond.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ return d.c;
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `DiamondD` to
// CHECK:STDERR: · │ ┃ `Cpp.DiamondC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DiamondD` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DiamondC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return d.c;
}
@@ -365,7 +513,13 @@ library "[[@TEST_NAME]]";
import Cpp library "final.h";
class B {
// CHECK:STDERR: fail_derive_from_final.carbon:[[@LINE+2]]:16-25: error: deriving from final type `FinalA`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_final.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.FinalA;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `FinalA`; base type must be
// CHECK:STDERR: · ┃ an `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.FinalA;
}
@@ -381,7 +535,13 @@ library "[[@TEST_NAME]]";
import Cpp library "union.h";
class V {
// CHECK:STDERR: fail_derive_from_union.carbon:[[@LINE+2]]:16-20: error: deriving from final type `U`; base type must be an `abstract` or `base` class [BaseIsFinal]
// CHECK:STDERR: ╭─┤ fail_derive_from_union.carbon:[[@LINE+8]]:16
// CHECK:STDERR: -> │ extend base: Cpp.U;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: deriving from final type `U`; base type must be an
// CHECK:STDERR: · ┃ `abstract` or `base` class
// CHECK:STDERR: · ┃ [BaseIsFinal]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
extend base: Cpp.U;
}
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ class DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}
@@ -231,11 +241,28 @@ class Class1;
class Generic(x: Core.Copy) {
}
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:19-37: error: argument to C++ call has incomplete type `Cpp.Class1` [IncompleteTypeInCopyWitness]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-7]]:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE-5]]:15-26: note: initializing generic parameter `x` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+23]]:19
// CHECK:STDERR: │ class Class1;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ class Generic(x: Core.Copy) {
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `x` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: argument to C++ call has incomplete type
// CHECK:STDERR: · ┃ `Cpp.Class1`
// CHECK:STDERR: · ┃ [IncompleteTypeInCopyWitness]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_copy_witness_of_incomplete_class.carbon:[[@LINE+2]]:15-37: warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_copy_witness_of_incomplete_class.carbon:[[@LINE+6]]:15
// CHECK:STDERR: -> │ fn GenericUse(p2: Generic(Cpp.Class1)) {
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `p2` unused [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn GenericUse(p2: Generic(Cpp.Class1)) {
}
@@ -80,8 +80,18 @@ fn G(generic T: Core.Default & Core.Destroy) {
}
fn CallG() {
// CHECK:STDERR: fail_no_default.carbon:[[@LINE+3]]:3-18: error: cannot convert type `NoDefault` into type implementing `Core.Default & Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_no_default.carbon:[[@LINE-6]]:14-43: note: initializing generic parameter `T` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_no_default.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn G(generic T: Core.Default & Core.Destroy) {
// CHECK:STDERR: · ──────────────┬───────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `T` declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ G(Cpp.NoDefault);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `NoDefault` into type implementing
// CHECK:STDERR: · ┃ `Core.Default & Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
G(Cpp.NoDefault);
}
@@ -208,13 +218,33 @@ library "[[@TEST_NAME]]";
import Cpp library "deleted.h";
fn F() {
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+3]]:32-52: error: call to deleted function 'DeletedC' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:4:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+12]]:32
// CHECK:STDERR: -> │ let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedC'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedC() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.DeletedC = Cpp.DeletedC.DeletedC();
// CHECK:STDERR: fail_import_deleted.carbon:[[@LINE+4]]:32-52: error: call to deleted function 'DeletedD' [CppInteropParseError]
// CHECK:STDERR: ./deleted.h:9:3: note: candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ./deleted.h:10:3: note: candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted.carbon:[[@LINE+15]]:32
// CHECK:STDERR: -> │ let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'DeletedD'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted.h
// CHECK:STDERR: │ DeletedD(int) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ DeletedD(short);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused d: Cpp.DeletedD = Cpp.DeletedD.DeletedD(0);
}
@@ -283,9 +313,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:4-30: error: member access into incomplete class `Cpp.IncompleteC` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:4
// CHECK:STDERR: -> │ Cpp.IncompleteC.IncompleteC();
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteC`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class IncompleteC;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.IncompleteC.IncompleteC();
}
@@ -95,11 +95,39 @@ fn GetF(a: Cpp.A) -> i32 { return a.f_4; }
struct BitfieldStruct {
int a;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int b : 2;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.b;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int b : 2;
};
union BitfieldUnion {
int c;
// CHECK:STDERR: ╷ ╭── included from: fail_todo_use_bitfields.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./with_bitfields.h:[[@LINE+13]]:7
// CHECK:STDERR: -> │ int d : 3;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_use_bitfields.carbon
// CHECK:STDERR: │ return s.d;
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int d : 3;
};
@@ -125,24 +153,16 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:4:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "with_bitfields.h";
fn F(s: Cpp.BitfieldStruct) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+4]]:10-12: note: in `Cpp` name lookup for `b` [InCppNameLookup]
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_todo_use_bitfields.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./with_bitfields.h:9:7: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
return s.b;
//@dump-sem-ir-end
}
fn G(s: Cpp.BitfieldUnion) -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_use_bitfields.carbon:[[@LINE+2]]:10-12: note: in `Cpp` name lookup for `d` [InCppNameLookup]
// CHECK:STDERR:
return s.d;
//@dump-sem-ir-end
}
@@ -151,6 +171,22 @@ fn G(s: Cpp.BitfieldUnion) -> i32 {
struct UnsupportedMembers {
// Volatile is not supported.
// CHECK:STDERR: ╷ ╭── included from: fail_use_unsupported_members.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./unsupported_members.h:[[@LINE+15]]:16
// CHECK:STDERR: -> │ volatile int is_volatile;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: field declaration has unhandled type or kind`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_use_unsupported_members.carbon
// CHECK:STDERR: │ let unused a: i32 = m->is_volatile;
// CHECK:STDERR: · ───────┬──────
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `is_volatile`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
volatile int is_volatile;
// But this should be fine.
int integer;
@@ -175,13 +211,9 @@ fn Test(m: Cpp.UnsupportedMembers*) {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_use_unsupported_members.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./unsupported_members.h:4:16: error: semantics TODO: `Unsupported: field declaration has unhandled type or kind` [SemanticsTodo]
import Cpp library "unsupported_members.h";
fn Test(m: Cpp.UnsupportedMembers*) {
// CHECK:STDERR: fail_use_unsupported_members.carbon:[[@LINE+2]]:23-36: note: in `Cpp` name lookup for `is_volatile` [InCppNameLookup]
// CHECK:STDERR:
let unused a: i32 = m->is_volatile;
}
@@ -16,7 +16,11 @@ library "[[@TEST_NAME]]";
import Cpp inline '''
struct Base {
// CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+2]]:3: error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_invalid_base.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ no_such_type invalid;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
no_such_type invalid;
};
@@ -59,24 +59,67 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Value(v: Cpp.HasQualifiers) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-9: error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:3:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ v.plain();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'plain' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void plain();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.plain();
// TODO: This should remain invalid once we support `volatile`.
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-17: error: no matching function for call to 'volatile_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:5:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.volatile_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'volatile_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void volatile_this() volatile;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.volatile_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-12: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_this();
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+3]]:3-16: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable: 'this' argument has type 'const HasQualifiers', but method is not marked const [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_by_value.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ v.ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function not viable: 'this' argument has type 'const
// CHECK:STDERR: · │ HasQualifiers', but method is not marked const
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
v.ref_ref_this();
}
@@ -89,7 +132,13 @@ import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// TODO: This should eventually be accepted if we support `volatile`.
// CHECK:STDERR: fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+2]]:3-20: error: semantics TODO: `Unsupported: parameter type: volatile struct HasQualifiers &` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_bad_object_param_qualifiers_by_ref.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ p->volatile_this();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: parameter type: volatile struct HasQualifiers &`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->volatile_this();
}
@@ -101,15 +150,36 @@ library "[[@TEST_NAME]]";
import Cpp library "object_param_qualifiers.h";
fn Ref(p: Cpp.HasQualifiers*) {
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:10:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:10:20-21: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ p->ref_ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_ref_this() &&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->ref_ref_this();
// CHECK:STDERR: fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+4]]:3-23: error: no matching function for call to 'const_ref_ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:11:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:11:26-27: note: expects an rvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_ref_ref.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ p->const_ref_ref_this();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'const_ref_ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void const_ref_ref_this() const&&;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
p->const_ref_ref_this();
}
@@ -123,9 +193,19 @@ import Cpp library "object_param_qualifiers.h";
fn Make() -> Cpp.HasQualifiers;
fn F() {
// CHECK:STDERR: fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'ref_this' [CppInteropParseError]
// CHECK:STDERR: ./object_param_qualifiers.h:7:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./object_param_qualifiers.h:7:16-17: note: expects an lvalue for object argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_bad_object_param_qualifiers_for_temporary.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Make().ref_this();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'ref_this'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./object_param_qualifiers.h
// CHECK:STDERR: │ void ref_this() &;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an lvalue for object argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Make().ref_this();
}
@@ -200,7 +280,12 @@ struct ExplicitObjectParamUnsupported {
''';
fn Call(e: Cpp.ExplicitObjectParamUnsupported) {
// CHECK:STDERR: fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+2]]:3-45: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_call_explicit_object_param_with_unsupported_type_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
e.(Cpp.ExplicitObjectParamUnsupported.F)(1);
}
@@ -29,8 +29,14 @@ library "[[@TEST_NAME]]";
import Cpp library "non_aggregate.h";
fn Make() {
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+3]]:3-14: error: cannot implicitly convert expression of type `{}` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_init.carbon:[[@LINE+2]]:3-14: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_init.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ var _: Cpp.X = {};
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to `Cpp.X`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: Cpp.X = {};
}
@@ -41,10 +41,29 @@ import Cpp library "overload.h";
class Overload0Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-22: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has more parameters (1 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has more parameters (2 vs 0 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (1 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has more parameters (2 vs 0 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self);
}
@@ -52,10 +71,29 @@ class Overload0Params {
class Overload3Params {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_no_matching_arity.carbon:[[@LINE+5]]:3-52: error: override without compatible virtual in base class [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ./overload.h:6:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:7:16: note: base class function has fewer parameters (1 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ./overload.h:8:16: note: base class function has fewer parameters (2 vs 3 excluding `self`) [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╭─┤ fail_overload_no_matching_arity.carbon:[[@LINE+24]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: override without compatible virtual in base class
// CHECK:STDERR: · ┃ [OverrideWithoutVirtualInBase]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (1 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: │ virtual void f(X x, Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ base class function has fewer parameters (2 vs 3 excluding
// CHECK:STDERR: · │ `self`)
// CHECK:STDERR: · │ [OverrideCandidateArityMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X, y: Cpp.Y, z: Cpp.X);
}
@@ -70,14 +108,37 @@ import Cpp library "overload.h";
class OverloadX {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.Y` to `Cpp.X` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.Y` does not implement interface `Core.ImplicitAs(Cpp.X)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:7:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, x: Cpp.X);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.Y` to `Cpp.X`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.Y` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.X)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(Y y);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, x: Cpp.X);
}
@@ -85,14 +146,37 @@ class OverloadX {
class OverloadY {
extend base: Cpp.OverloadedBase;
//
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+9]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+8]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+7]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+5]]:3-32: error: cannot implicitly convert expression of type `Cpp.X` to `Cpp.Y` [ConversionFailure]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+4]]:3-32: note: type `Cpp.X` does not implement interface `Core.ImplicitAs(Cpp.Y)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: fail_overload_type.carbon:[[@LINE+3]]:23-30: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ./overload.h:6:16: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_overload_type.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ override fn f(self, y: Cpp.Y);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━┯━━━━━━━━━
// CHECK:STDERR: · ┗━━━━━━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ │ ┃ `Cpp.X` to `Cpp.Y`
// CHECK:STDERR: · │ │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰─────────┤ type `Cpp.X` does not implement interface
// CHECK:STDERR: · │ │ `Core.ImplicitAs(Cpp.Y)`
// CHECK:STDERR: · │ │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: · ╰──────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./overload.h
// CHECK:STDERR: │ virtual void f(X x);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
override fn f(self, y: Cpp.Y);
}
@@ -65,10 +65,25 @@ import Cpp library "instantiation_error.h";
//@dump-sem-ir-begin
var x: Cpp.XY.r#type = 0;
// CHECK:STDERR: fail_use_instantiation_error.carbon:[[@LINE+5]]:8-22: error: member access into incomplete class `Cpp.X` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_use_instantiation_error.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./instantiation_error.h:3:25: note: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: ./instantiation_error.h:2:29: note: in instantiation of template class 'X<int>' requested here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_use_instantiation_error.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ var y: Cpp.Xint.r#type = 0;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.X`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_instantiation_error.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./instantiation_error.h
// CHECK:STDERR: │ template<typename T> struct X {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'X<int>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │ using type = typename T::member;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ type 'int' cannot be used prior to '::' because it
// CHECK:STDERR: · │ has no members
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var y: Cpp.Xint.r#type = 0;
//@dump-sem-ir-end
@@ -289,11 +304,11 @@ fn G() {
// CHECK:STDOUT: %x.var_patt: %pattern_type.d94 = var_pattern %x.patt [concrete = constants.%x.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y.var: ref %i32 = var_storage %y.var_patt [concrete]
// CHECK:STDOUT: %.loc14: type = splice_block %type.ref.loc14 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc29: type = splice_block %type.ref.loc29 [concrete = constants.%i32] {
// CHECK:STDOUT: %Cpp.ref.loc29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Xint.ref: type = name_ref Xint, imports.%X.decl.b67 [concrete = constants.%X.c92]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %type.ref.loc14: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: %type.ref.loc29: type = name_ref r#type, %i32.2 [concrete = constants.%i32]
// CHECK:STDOUT: }
// CHECK:STDOUT: %y: ref %i32 = wrapper_binding y, %y.var [concrete = %y.var]
// CHECK:STDOUT: name_binding_decl {
@@ -312,14 +327,14 @@ fn G() {
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_1.2(%int_0.loc7) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc7: init %i32 = converted %int_0.loc7, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc7 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%x.var, %.loc7
// CHECK:STDOUT: %int_0.loc14: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc14: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc14_1.1: <bound method> = bound_method %int_0.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc14_1.2: <bound method> = bound_method %int_0.loc14, %specific_fn.loc14 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i32 = call %bound_method.loc14_1.2(%int_0.loc14) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc14: init %i32 = converted %int_0.loc14, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc14
// CHECK:STDOUT: %int_0.loc29: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0.loc29: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc29_1.1: <bound method> = bound_method %int_0.loc29, %impl.elem0.loc29 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc29: <specific function> = specific_function %impl.elem0.loc29, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc29_1.2: <bound method> = bound_method %int_0.loc29, %specific_fn.loc29 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29: init %i32 = call %bound_method.loc29_1.2(%int_0.loc29) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc29: init %i32 = converted %int_0.loc29, %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc29 [concrete = constants.%int_0.753]
// CHECK:STDOUT: assign file.%y.var, %.loc29
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -35,9 +35,19 @@ library "[[@TEST_NAME]]";
import Cpp library "declaration.h";
fn MyF() {
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:19-29: error: binding pattern has incomplete type `DeclBar` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ var unused bar: Cpp.DeclBar;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `DeclBar` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ union DeclBar;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused bar: Cpp.DeclBar;
}
+20 -4
View File
@@ -37,10 +37,22 @@ const S& Get();
''';
fn F() {
// CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+5]]:3-13: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+17]]:3
// CHECK:STDERR: -> │ Cpp.Get().x = 123;
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+3]]:3-19: error: cannot implicitly convert expression of type `Core.IntLiteral` to `const i32` [ConversionFailure]
// CHECK:STDERR: fail_const_member_assign.carbon:[[@LINE+2]]:3-19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(const i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_const_member_assign.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ Cpp.Get().x = 123;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `const i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(const i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Get().x = 123;
}
@@ -57,7 +69,11 @@ const S& Get();
''';
fn F() {
// CHECK:STDERR: fail_const_member_assign_cast.carbon:[[@LINE+2]]:3-13: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_const_member_assign_cast.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ Cpp.Get().x = 123 as i32;
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Get().x = 123 as i32;
}
+42 -10
View File
@@ -39,28 +39,60 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-18: error: cannot convert expression of type `Cpp.Enum` to `i8` with `as` [ConversionFailure]
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-18: note: type `Cpp.Enum` does not implement interface `Core.As(i8)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ Cpp.Enum.a as i8;
// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i8` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i8)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Enum.a as i8;
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-19: error: cannot convert expression of type `Cpp.Enum` to `i32` with `as` [ConversionFailure]
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-19: note: type `Cpp.Enum` does not implement interface `Core.As(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ Cpp.Enum.a as i32;
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to `i32` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface `Core.As(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Enum.a as i32;
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-24: error: cannot convert expression of type `i8` to `Cpp.Enum` with `as` [ConversionFailure]
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-24: note: type `i8` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ (42 as i8) as Cpp.Enum;
// CHECK:STDERR: · ━━━━┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i8` to `Cpp.Enum` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i8` does not implement interface `Core.As(Cpp.Enum)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
(42 as i8) as Cpp.Enum;
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-25: error: cannot convert expression of type `i32` to `Cpp.Enum` with `as` [ConversionFailure]
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-25: note: type `i32` does not implement interface `Core.As(Cpp.Enum)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+9]]:3
// CHECK:STDERR: -> │ (42 as i32) as Cpp.Enum;
// CHECK:STDERR: · ━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `i32` to `Cpp.Enum` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.As(Cpp.Enum)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
(42 as i32) as Cpp.Enum;
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+3]]:3-28: error: cannot convert expression of type `Cpp.Enum` to `Cpp.DifferentSize` with `as` [ConversionFailure]
// CHECK:STDERR: fail_wrong_type.carbon:[[@LINE+2]]:3-28: note: type `Cpp.Enum` does not implement interface `Core.As(Cpp.DifferentSize)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_type.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ Cpp.a as Cpp.DifferentSize;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `Cpp.Enum` to
// CHECK:STDERR: · │ ┃ `Cpp.DifferentSize` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.DifferentSize)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.a as Cpp.DifferentSize;
}
+12 -2
View File
@@ -76,8 +76,18 @@ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool {
}
fn CompareHeterogeneousFail(x: Cpp.Scoped, y: Cpp.Unscoped) -> bool {
// CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE+3]]:10-29: error: cannot convert type `Cpp.Scoped` into type implementing `Core.EqWith(Cpp.Unscoped)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_heterogeneous.carbon:[[@LINE-6]]:1-67: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_heterogeneous.carbon:[[@LINE+13]]:10
// CHECK:STDERR: │ fn CompareGeneric[U: type, T: Core.EqWith(U)](x: T, y: U) -> bool {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return CompareGeneric(x, y);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.Scoped` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.Unscoped)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return CompareGeneric(x, y);
}
+30 -10
View File
@@ -15,15 +15,28 @@
// This is not valid in standard C++, but MSVC allows it as an extension, and so
// Clang allows it in MSVC compatibility mode.
// CHECK:STDERR: ╷ ╭── included from: import_declaration.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h:[[@LINE+15]]:6
// CHECK:STDERR: -> │ enum UnsizedEnum;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: forward references to 'enum' types are a Microsoft extension
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╷ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h:[[@LINE+7]]:6
// CHECK:STDERR: -> │ enum UnsizedEnum;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: forward references to 'enum' types are a Microsoft extension
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
enum UnsizedEnum;
// --- import_declaration.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: import_declaration.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "declaration.h";
//@dump-sem-ir-begin
@@ -34,17 +47,24 @@ fn F(e: Cpp.UnsizedEnum);
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:4:6: warning: forward references to 'enum' types are a Microsoft extension [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "declaration.h";
fn MyF() {
// TODO: It's a bit surprising to refer to this type as a class, even though
// we model it as a class in Carbon. Consider customizing the diagnostic.
// CHECK:STDERR: fail_use_declaration_as_definition.carbon:[[@LINE+4]]:17-31: error: binding pattern has incomplete type `UnsizedEnum` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_use_declaration_as_definition.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./declaration.h:4:6: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_use_declaration_as_definition.carbon:[[@LINE+14]]:17
// CHECK:STDERR: -> │ var unused e: Cpp.UnsizedEnum;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type `UnsizedEnum` in
// CHECK:STDERR: · ┃ name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_declaration_as_definition.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./declaration.h
// CHECK:STDERR: │ enum UnsizedEnum;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused e: Cpp.UnsizedEnum;
}
@@ -75,7 +95,7 @@ fn MyF() {
// CHECK:STDOUT: %e.patt: %pattern_type = wrapper_binding_pattern e, %e.param_patt [concrete = constants.%e.patt]
// CHECK:STDOUT: } {
// CHECK:STDOUT: %e.param: %UnsizedEnum = value_param call_param0
// CHECK:STDOUT: %.loc10: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] {
// CHECK:STDOUT: %.loc7: type = splice_block %UnsizedEnum.ref [concrete = constants.%UnsizedEnum] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %UnsizedEnum.ref: type = name_ref UnsizedEnum, imports.%UnsizedEnum.decl [concrete = constants.%UnsizedEnum]
// CHECK:STDOUT: }
+6 -1
View File
@@ -15,7 +15,12 @@
library "[[@TEST_NAME]]";
import Cpp inline '''
// CHECK:STDERR: fail_invalid_underlying_type.carbon:[[@LINE+2]]:20: error: unknown type name 'no_such_type' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_invalid_underlying_type.carbon:[[@LINE+7]]:20
// CHECK:STDERR: -> │ enum InvalidEnum : no_such_type {};
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'no_such_type'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
enum InvalidEnum : no_such_type {};
''';
+6 -1
View File
@@ -33,7 +33,12 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: fail_name_without_scope.carbon:[[@LINE+2]]:28-32: error: member name `b` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_name_without_scope.carbon:[[@LINE+7]]:28
// CHECK:STDERR: -> │ let unused b: Cpp.Enum = Cpp.b;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: member name `b` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused b: Cpp.Enum = Cpp.b;
}
+26 -5
View File
@@ -36,13 +36,29 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:29-38: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure]
// CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:29-38: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:29
// CHECK:STDERR: -> │ let unused c: Cpp.Other = Cpp.Enum.c;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.Other = Cpp.Enum.c;
// CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+3]]:30-34: error: cannot implicitly convert expression of type `Cpp.Enum` to `Cpp.Other` [ConversionFailure]
// CHECK:STDERR: fail_wrong_enum.carbon:[[@LINE+2]]:30-34: note: type `Cpp.Enum` does not implement interface `Core.ImplicitAs(Cpp.Other)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_wrong_enum.carbon:[[@LINE+11]]:30
// CHECK:STDERR: -> │ let unused c2: Cpp.Other = Cpp.c;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `Cpp.Enum` to `Cpp.Other`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Enum` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Other)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c2: Cpp.Other = Cpp.c;
}
@@ -54,7 +70,12 @@ library "[[@TEST_NAME]]";
import Cpp library "enum.h";
fn F() {
// CHECK:STDERR: fail_non_enum_member.carbon:[[@LINE+2]]:29-38: error: member name `d` not found in `Cpp.Enum` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_non_enum_member.carbon:[[@LINE+7]]:29
// CHECK:STDERR: -> │ let unused c: Cpp.Other = Cpp.Enum.d;
// CHECK:STDERR: · ━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `d` not found in `Cpp.Enum`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.Other = Cpp.Enum.d;
}
+37 -27
View File
@@ -15,6 +15,14 @@
enum class Color {Red, Blue, Green};
// CHECK:STDERR: ╷ ╭── included from: import_enum.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./enum.h:[[@LINE+7]]:7
// CHECK:STDERR: -> │ using enum Color;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: using enum declaration is a C++20 extension
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using enum Color;
class Zoo {
@@ -22,18 +30,20 @@ public:
enum class Animal { Cat, Dog, Horse };
};
// CHECK:STDERR: ╷ ╭── included from: import_enum.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./enum.h:[[@LINE+7]]:7
// CHECK:STDERR: -> │ using enum Zoo::Animal;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: using enum declaration is a C++20 extension
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using enum Zoo::Animal;
// --- import_enum.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+6]]:10 [InCppInclude]
// CHECK:STDERR: ./enum.h:5:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning]
// CHECK:STDERR:
// CHECK:STDERR: included from: import_enum.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./enum.h:12:7: warning: using enum declaration is a C++20 extension [CppInteropParseWarning]
// CHECK:STDERR:
import Cpp library "enum.h";
//@dump-sem-ir-begin
@@ -89,46 +99,46 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc14_32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc14_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %Cpp.ref.loc8_32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc8_35: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %Red.ref: %Color = name_ref Red, imports.%int_0.59e [concrete = constants.%int_0.59e]
// CHECK:STDOUT: %.loc14: type = splice_block %Color.ref.loc14_23 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc14_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc14_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %.loc8: type = splice_block %Color.ref.loc8_23 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc8_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc8_23: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %col: %Color = wrapper_binding col, %Red.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %col.patt: %pattern_type.732 = value_binding_pattern col [concrete = constants.%col.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc15_33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc9_33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Blue.ref: %Color = name_ref Blue, imports.%int_1.b76 [concrete = constants.%int_1.b76]
// CHECK:STDOUT: %.loc15: type = splice_block %Color.ref.loc15 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc15_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc15: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: %.loc9: type = splice_block %Color.ref.loc9 [concrete = constants.%Color] {
// CHECK:STDOUT: %Cpp.ref.loc9_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Color.ref.loc9: type = name_ref Color, imports.%Color.decl [concrete = constants.%Color]
// CHECK:STDOUT: }
// CHECK:STDOUT: %colb: %Color = wrapper_binding colb, %Blue.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %colb.patt: %pattern_type.732 = value_binding_pattern colb [concrete = constants.%colb.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc16_37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc16_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc16_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %Cpp.ref.loc10_37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc10_40: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc10_44: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %Cat.ref: %Animal = name_ref Cat, imports.%int_0.648 [concrete = constants.%int_0.648]
// CHECK:STDOUT: %.loc16: type = splice_block %Animal.ref.loc16_27 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc16_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc16_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc16_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %.loc10: type = splice_block %Animal.ref.loc10_27 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc10_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc10_23: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc10_27: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: }
// CHECK:STDOUT: %pet: %Animal = wrapper_binding pet, %Cat.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %pet.patt: %pattern_type.8cd = value_binding_pattern pet [concrete = constants.%pet.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc17_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc11_38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dog.ref: %Animal = name_ref Dog, imports.%int_1.e7b [concrete = constants.%int_1.e7b]
// CHECK:STDOUT: %.loc17: type = splice_block %Animal.ref.loc17 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc17_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc17: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc17: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: %.loc11: type = splice_block %Animal.ref.loc11 [concrete = constants.%Animal] {
// CHECK:STDOUT: %Cpp.ref.loc11_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Zoo.ref.loc11: type = name_ref Zoo, imports.%Zoo.decl [concrete = constants.%Zoo]
// CHECK:STDOUT: %Animal.ref.loc11: type = name_ref Animal, imports.%Animal.decl [concrete = constants.%Animal]
// CHECK:STDOUT: }
// CHECK:STDOUT: %pet2: %Animal = wrapper_binding pet2, %Dog.ref
// CHECK:STDOUT: name_binding_decl {
@@ -43,21 +43,49 @@ import Cpp;
// HLSL extension, or by mapping to a `std::array` parameter.
// TODO: These diagnostics are very bad.
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+4]]:1-48: error: semantics TODO: `by-var array parameter` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+14]]:1
// CHECK:STDERR: -> │ fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `by-var array parameter`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+2]]:1-48: error: semantics TODO: `failed to map C++ type to Carbon` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map C++ type to Carbon`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn FArrayVarParam(var a: array(i32, 5)) -> i32 { return a[2]; }
inline Cpp '''
int GArrayVarParam() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+7]]:10: error: no member named 'FArrayVarParam' in namespace 'Carbon'; did you mean 'GArrayVarParam'? [CppInteropParseError]
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+6]]:10-31: note: replace with `GArrayVarParam` [CppInteropFixItReplacement]
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-4]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+25]]:10
// CHECK:STDERR: │ int GArrayVarParam() {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
// CHECK:STDERR: · ┳─────────────────────
// CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayVarParam' in namespace 'Carbon'; did
// CHECK:STDERR: · │ ┃ you mean 'GArrayVarParam'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ replace with `GArrayVarParam` [CppInteropFixItReplacement]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE+3]]:33-47: error: too many arguments to function call, expected 0, have 1 [CppInteropParseError]
// CHECK:STDERR: fail_todo_array_var_param.carbon:[[@LINE-7]]:5: note: 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_todo_array_var_param.carbon:[[@LINE+12]]:33
// CHECK:STDERR: │ int GArrayVarParam() {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'GArrayVarParam' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
// CHECK:STDERR: · ────────────── ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: too many arguments to function call,
// CHECK:STDERR: · ┃ expected 0, have 1
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return Carbon::FArrayVarParam({1, 2, 3, 4, 5});
//@dump-sem-ir-end
@@ -73,7 +101,12 @@ import Cpp;
// types, as C++ does not have such return types.
// TODO: Support this, perhaps by returning a `std::array`.
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:1-36: error: semantics TODO: `array return type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ fn FArrayReturn() -> array(i32, 5) {
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `array return type`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn FArrayReturn() -> array(i32, 5) {
return (1, 2, 3, 4, 5);
@@ -81,12 +114,26 @@ fn FArrayReturn() -> array(i32, 5) {
inline Cpp '''
int GArrayReturn() {
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+4]]:16: error: no member named 'FArrayReturn' in namespace 'Carbon'; did you mean 'GArrayReturn'? [CppInteropParseError]
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+3]]:16-35: note: replace with `GArrayReturn` [CppInteropFixItReplacement]
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE-3]]:5: note: 'GArrayReturn' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+13]]:16
// CHECK:STDERR: │ int GArrayReturn() {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'GArrayReturn' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto &&arr = Carbon::FArrayReturn();
// CHECK:STDERR: · ┳───────────────────
// CHECK:STDERR: · ┗━━┫ error: no member named 'FArrayReturn' in namespace 'Carbon';
// CHECK:STDERR: · │ ┃ did you mean 'GArrayReturn'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ replace with `GArrayReturn` [CppInteropFixItReplacement]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto &&arr = Carbon::FArrayReturn();
// CHECK:STDERR: fail_todo_array_return.carbon:[[@LINE+2]]:13: error: subscripted value is not an array, pointer, or vector [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_array_return.carbon:[[@LINE+7]]:13
// CHECK:STDERR: -> │ return arr[0];
// CHECK:STDERR: · ──╴╻╶
// CHECK:STDERR: · ┗━━┫ error: subscripted value is not an array, pointer, or vector
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return arr[0];
}
@@ -36,10 +36,29 @@ class FactoryIsMethod {
inline Cpp '''
void CallFactoryIsMethod() {
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE+5]]:27: error: no matching constructor for initialization of 'Carbon::FactoryIsMethod' (aka 'Carbon::Main::FactoryIsMethod') [CppInteropParseError]
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-7]]:23: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryIsMethod' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-8]]:23: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryIsMethod' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_is_method.carbon:[[@LINE-9]]:23: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_factory_is_method.carbon:[[@LINE+24]]:27
// CHECK:STDERR: │ class FactoryIsMethod {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy constructor)
// CHECK:STDERR: · │ │ not viable: no known conversion from 'int' to 'const
// CHECK:STDERR: · │ │ FactoryIsMethod' for 1st argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion from
// CHECK:STDERR: · │ │ 'int' to 'FactoryIsMethod' for 1st argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default
// CHECK:STDERR: · │ constructor) not viable: requires 0 arguments,
// CHECK:STDERR: · │ but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryIsMethod a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for initialization
// CHECK:STDERR: · ┃ of 'Carbon::FactoryIsMethod' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::FactoryIsMethod')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::FactoryIsMethod a(42);
}
@@ -56,10 +75,32 @@ class FactoryDoesntReturnSelf {
inline Cpp '''
void CallFactoryDoesntReturnSelf() {
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE+5]]:35: error: no matching constructor for initialization of 'Carbon::FactoryDoesntReturnSelf' (aka 'Carbon::Main::FactoryDoesntReturnSelf') [CppInteropParseError]
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-7]]:31: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-8]]:31: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryDoesntReturnSelf' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_doesnt_return_self.carbon:[[@LINE-9]]:31: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_factory_doesnt_return_self.carbon:[[@LINE+27]]:35
// CHECK:STDERR: │ class FactoryDoesntReturnSelf {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion
// CHECK:STDERR: · │ │ from 'int' to 'const FactoryDoesntReturnSelf'
// CHECK:STDERR: · │ │ for 1st argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move
// CHECK:STDERR: · │ │ constructor) not viable: no known
// CHECK:STDERR: · │ │ conversion from 'int' to
// CHECK:STDERR: · │ │ 'FactoryDoesntReturnSelf' for 1st argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit
// CHECK:STDERR: · │ default constructor) not viable: requires
// CHECK:STDERR: · │ 0 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryDoesntReturnSelf a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: no matching constructor for initialization of
// CHECK:STDERR: · ┃ 'Carbon::FactoryDoesntReturnSelf' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::FactoryDoesntReturnSelf')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::FactoryDoesntReturnSelf a(42);
}
@@ -76,10 +117,32 @@ class FactoryReturnsByRef {
inline Cpp '''
void CallFactoryReturnsByRef() {
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE+5]]:31: error: no matching constructor for initialization of 'Carbon::FactoryReturnsByRef' (aka 'Carbon::Main::FactoryReturnsByRef') [CppInteropParseError]
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-7]]:27: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const FactoryReturnsByRef' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-8]]:27: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'FactoryReturnsByRef' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_factory_returns_by_ref.carbon:[[@LINE-9]]:27: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_factory_returns_by_ref.carbon:[[@LINE+27]]:31
// CHECK:STDERR: │ class FactoryReturnsByRef {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion from
// CHECK:STDERR: · │ │ 'int' to 'const FactoryReturnsByRef' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion
// CHECK:STDERR: · │ │ from 'int' to 'FactoryReturnsByRef' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default
// CHECK:STDERR: · │ constructor) not viable: requires 0
// CHECK:STDERR: · │ arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::FactoryReturnsByRef a(42);
// CHECK:STDERR: · ┳ ──
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::FactoryReturnsByRef' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::FactoryReturnsByRef')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::FactoryReturnsByRef a(42);
}
@@ -91,7 +154,12 @@ library "[[@TEST_NAME]]";
import Cpp;
class GenericConstructor {
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+2]]:3-48: error: semantics TODO: `support exporting generic member functions` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_call_generic_constructor.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ fn GenericConstructor[T: type](_: T) -> Self {
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `support exporting generic member functions`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn GenericConstructor[T: type](_: T) -> Self {
return {};
@@ -100,10 +168,32 @@ class GenericConstructor {
inline Cpp '''
void CallGenericConstructor() {
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE+5]]:30: error: no matching constructor for initialization of 'Carbon::GenericConstructor' (aka 'Carbon::Main::GenericConstructor') [CppInteropParseError]
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-11]]:26: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericConstructor' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-12]]:26: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericConstructor' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_todo_call_generic_constructor.carbon:[[@LINE-13]]:26: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_todo_call_generic_constructor.carbon:[[@LINE+27]]:30
// CHECK:STDERR: │ class GenericConstructor {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion from
// CHECK:STDERR: · │ │ 'int' to 'const GenericConstructor' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion
// CHECK:STDERR: · │ │ from 'int' to 'GenericConstructor' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default
// CHECK:STDERR: · │ constructor) not viable: requires 0 arguments,
// CHECK:STDERR: · │ but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::GenericConstructor b(0);
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::GenericConstructor' (aka
// CHECK:STDERR: · ┃ 'Carbon::Main::GenericConstructor')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::GenericConstructor b(0);
}
@@ -115,7 +205,12 @@ library "[[@TEST_NAME]]";
import Cpp;
class GenericClass(T: type) {
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+2]]:3-33: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_call_generic_class_constructor.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ fn GenericClass(_: T) -> Self {
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn GenericClass(_: T) -> Self {
return {};
@@ -124,10 +219,31 @@ class GenericClass(T: type) {
inline Cpp '''
void CallGenericClass() {
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE+5]]:29: error: no matching constructor for initialization of 'Carbon::GenericClass<int>' [CppInteropParseError]
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-11]]:29: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const GenericClass<int>' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-12]]:29: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'GenericClass<int>' for 1st argument [CppInteropParseNote]
// CHECK:STDERR: fail_todo_call_generic_class_constructor.carbon:[[@LINE-13]]:29: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_todo_call_generic_class_constructor.carbon:[[@LINE+26]]:29
// CHECK:STDERR: │ class GenericClass(T: type) {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate constructor (the implicit copy
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion
// CHECK:STDERR: · │ │ from 'int' to 'const GenericClass<int>' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ candidate constructor (the implicit move
// CHECK:STDERR: · │ │ constructor) not viable: no known conversion
// CHECK:STDERR: · │ │ from 'int' to 'GenericClass<int>' for 1st
// CHECK:STDERR: · │ │ argument
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ candidate constructor (the implicit default
// CHECK:STDERR: · │ constructor) not viable: requires 0
// CHECK:STDERR: · │ arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::GenericClass<int> c(0);
// CHECK:STDERR: · ┳ ─
// CHECK:STDERR: · ┗━━┫ error: no matching constructor for
// CHECK:STDERR: · ┃ initialization of
// CHECK:STDERR: · ┃ 'Carbon::GenericClass<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::GenericClass<int> c(0);
}
@@ -89,16 +89,21 @@ void CallUsingF() { UsingF(); }
// --- other_generic.carbon
package OtherGeneric;
// CHECK:STDERR: ╷ ╭── imported from: fail_todo_generic.carbon [InImport]
// CHECK:STDERR: ├─┤ other_generic.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ fn HasGenericArg(generic T: type, a: T) { a; }
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 2 arguments
// CHECK:STDERR: · │ ┃ [CallArgCountMismatch]
// CHECK:STDERR: · ╰────┤ calling function declared here [InCallToEntity]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn HasGenericArg(generic T: type, a: T) { a; }
// --- fail_todo_generic.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: imported from: fail_todo_generic.carbon:[[@LINE+4]]:1 [InImport]
// CHECK:STDERR: other_generic.carbon:3:1-41: error: 1 argument passed to function expecting 2 arguments [CallArgCountMismatch]
// CHECK:STDERR: other_generic.carbon:3:1-41: note: calling function declared here [InCallToEntity]
// CHECK:STDERR:
import OtherGeneric;
import Cpp inline '''
void CallHasGenericArg() {
@@ -75,15 +75,29 @@ Carbon::B CallInterfaceF() {
library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:1-30: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ fn NonTypeF[unused N: i32]() {}
// CHECK:STDERR: · ━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `binding maps to a non-type template parameter`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn NonTypeF[unused N: i32]() {}
inline Cpp '''
void CallNonTypeF() {
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+4]]:11-18: error: no member named 'NonTypeF' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+13]]:11
// CHECK:STDERR: -> │ Carbon::NonTypeF<3>();
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'NonTypeF' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_non_type_generic.carbon:[[@LINE+2]]:23: error: expected expression [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_non_type_generic.carbon:[[@LINE+6]]:23
// CHECK:STDERR: -> │ Carbon::NonTypeF<3>();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected expression [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::NonTypeF<3>();
}
@@ -108,7 +122,12 @@ library "[[@TEST_NAME]]";
import Cpp;
class EnclosingA(T: type) {
// CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:3-34: error: semantics TODO: `non-class non-namespace name scope` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_enclosing_generic.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ fn MemberF[U: type](x: T, y: U);
// CHECK:STDERR: · ━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `non-class non-namespace name scope`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn MemberF[U: type](x: T, y: U);
}
@@ -120,7 +139,12 @@ void CallEnclosingF() {
// is to test a generic function within an enclosing generic scope.
//
Carbon::EnclosingB b;
// CHECK:STDERR: fail_todo_enclosing_generic.carbon:[[@LINE+2]]:5: error: no member named 'MemberF' in 'Carbon::Main::EnclosingA<int>' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_enclosing_generic.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ b.MemberF(1, 2);
// CHECK:STDERR: · ─ ┳
// CHECK:STDERR: · ┗━━┫ error: no member named 'MemberF' in 'Carbon::Main::EnclosingA<int>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b.MemberF(1, 2);
}
@@ -130,15 +154,31 @@ void CallEnclosingF() {
library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+2]]:1-39: error: semantics TODO: `failed to import C++ type` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_generic_unsupported_type.carbon:[[@LINE+7]]:1
// CHECK:STDERR: -> │ fn UnsupportedF[T: type](unused t: T) {}
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to import C++ type`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn UnsupportedF[T: type](unused t: T) {}
inline Cpp '''
void CallUnsupportedF() {
volatile int x;
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE+3]]:3-22: error: no matching function for call to 'UnsupportedF' [CppInteropParseError]
// CHECK:STDERR: fail_generic_unsupported_type.carbon:[[@LINE-6]]:39: note: candidate template ignored: substitution failure [with T = volatile int] [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_generic_unsupported_type.carbon:[[@LINE+14]]:3
// CHECK:STDERR: │ fn UnsupportedF[T: type](unused t: T) {}
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate template ignored:
// CHECK:STDERR: · │ substitution failure [with T =
// CHECK:STDERR: · │ volatile int]
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::UnsupportedF(x);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'UnsupportedF'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::UnsupportedF(x);
}
@@ -123,7 +123,12 @@ import Cpp library "wchar_t_param.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_wchar_t_param.carbon:[[@LINE+2]]:3-14: error: semantics TODO: `Unsupported: parameter type: wchar_t` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_wchar_t_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo('X');
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: wchar_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo('X');
//@dump-sem-ir-end
@@ -135,15 +140,19 @@ fn F() {
// --- char8_t_param.h
// CHECK:STDERR: ╷ ╭── included from: fail_todo_import_char8_t_param.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./char8_t_param.h:[[@LINE+6]]:10
// CHECK:STDERR: -> │ auto foo(char8_t c) -> void;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'char8_t' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo(char8_t c) -> void;
// --- fail_todo_import_char8_t_param.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_import_char8_t_param.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./char8_t_param.h:2:10: error: unknown type name 'char8_t' [CppInteropParseError]
// CHECK:STDERR:
import Cpp library "char8_t_param.h";
fn F() {
@@ -168,7 +177,12 @@ import Cpp library "char16_t_param.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_char16_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char16_t` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_char16_t_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo(1);
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: char16_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(1);
//@dump-sem-ir-end
@@ -190,7 +204,12 @@ import Cpp library "char32_t_param.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_char32_t_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: char32_t` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_char32_t_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo(1);
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: char32_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(1);
//@dump-sem-ir-end
@@ -234,8 +253,17 @@ library "[[@TEST_NAME]]";
import Cpp library "short_param.h";
fn F() {
// CHECK:STDERR: fail_import_short_param_overflow_max.carbon:[[@LINE+3]]:11-16: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
// CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_short_param_overflow_max.carbon:[[@LINE+12]]:11
// CHECK:STDERR: -> │ Cpp.foo(0x8000);
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: integer value 32768 too large for type `i16`
// CHECK:STDERR: · ┃ [IntTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./short_param.h
// CHECK:STDERR: │ auto foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(0x8000);
}
@@ -259,8 +287,17 @@ library "[[@TEST_NAME]]";
import Cpp library "short_param.h";
fn F() {
// CHECK:STDERR: fail_import_short_param_overflow_min.carbon:[[@LINE+3]]:11-17: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
// CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_short_param_overflow_min.carbon:[[@LINE+12]]:11
// CHECK:STDERR: -> │ Cpp.foo(-0x8001);
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: integer value -32769 too large for type `i16`
// CHECK:STDERR: · ┃ [IntTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./short_param.h
// CHECK:STDERR: │ auto foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(-0x8001);
}
@@ -272,9 +309,20 @@ library "[[@TEST_NAME]]";
import Cpp library "short_param.h";
fn F() {
// CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+4]]:11-18: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
// CHECK:STDERR: fail_import_short_param_int32_arg.carbon:[[@LINE+3]]:11-18: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./short_param.h:2:16: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_short_param_int32_arg.carbon:[[@LINE+15]]:11
// CHECK:STDERR: -> │ Cpp.foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to
// CHECK:STDERR: · │ ┃ `i16`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(i16)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./short_param.h
// CHECK:STDERR: │ auto foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(1 as i32);
}
@@ -502,7 +550,12 @@ import Cpp library "bit_int_24_param.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_bit_int_24_param.carbon:[[@LINE+2]]:3-12: error: semantics TODO: `Unsupported: parameter type: bit_int_24` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_bit_int_24_param.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo(1);
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: bit_int_24`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(1);
//@dump-sem-ir-end
@@ -1021,7 +1074,7 @@ fn F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
// CHECK:STDOUT: %.loc10: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16]
// CHECK:STDOUT: %.loc15: Core.CharLiteral = char_value U+0058 [concrete = constants.%.d16]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1074,13 +1127,13 @@ fn F() {
// CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
// CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc11_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc11_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc11_11.2(%int_1) [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc11_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc11_11.2: %i32 = converted %int_1, %.loc11_11.1 [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc11_11.2)
// CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.68a]
// CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc8_11.2)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -54,8 +54,17 @@ library "[[@TEST_NAME]]";
import Cpp library "int_param.h";
fn F() {
// CHECK:STDERR: fail_import_int_param_overflow_max.carbon:[[@LINE+3]]:11-21: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_int_param_overflow_max.carbon:[[@LINE+12]]:11
// CHECK:STDERR: -> │ Cpp.foo(0x8000_0000);
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: integer value 2147483648 too large for type `i32`
// CHECK:STDERR: · ┃ [IntTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_param.h
// CHECK:STDERR: │ auto foo(int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(0x8000_0000);
}
@@ -79,8 +88,17 @@ library "[[@TEST_NAME]]";
import Cpp library "int_param.h";
fn F() {
// CHECK:STDERR: fail_import_int_param_overflow_min.carbon:[[@LINE+3]]:11-22: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType]
// CHECK:STDERR: ./int_param.h:2:14: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_int_param_overflow_min.carbon:[[@LINE+12]]:11
// CHECK:STDERR: -> │ Cpp.foo(-0x8000_0001);
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: integer value -2147483649 too large for type `i32`
// CHECK:STDERR: · ┃ [IntTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_param.h
// CHECK:STDERR: │ auto foo(int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(-0x8000_0001);
}
@@ -154,15 +172,35 @@ import Cpp library "unsigned_int_param.h";
fn F() {
Cpp.foo(0);
// CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+3]]:11-12: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
// CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_unsigned_int_param_overflow.carbon:[[@LINE+13]]:11
// CHECK:STDERR: -> │ Cpp.foo(-1);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to unsigned type `u32`
// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./unsigned_int_param.h
// CHECK:STDERR: │ auto foo(unsigned int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(-1);
Cpp.foo(0x0_FFFF_FFFF);
// CHECK:STDERR: fail_import_unsigned_int_param_overflow.carbon:[[@LINE+3]]:11-23: error: integer value 4294967296 too large for type `u32` [IntTooLargeForType]
// CHECK:STDERR: ./unsigned_int_param.h:2:23: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_unsigned_int_param_overflow.carbon:[[@LINE+13]]:11
// CHECK:STDERR: -> │ Cpp.foo(0x1_0000_0000);
// CHECK:STDERR: · ━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: integer value 4294967296 too large for type `u32`
// CHECK:STDERR: · ┃ [IntTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./unsigned_int_param.h
// CHECK:STDERR: │ auto foo(unsigned int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(0x1_0000_0000);
}
@@ -18,36 +18,88 @@
class ForwardDeclaredClass;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_decl_param1(ForwardDeclaredClass) -> void;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredClass' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo_decl_param1(*p);
// CHECK:STDERR: · ───────────┬───────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_decl_param1(ForwardDeclaredClass) -> void;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_decl_param2(ForwardDeclaredClass) -> void;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredClass' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo_decl_param2(*p);
// CHECK:STDERR: · ───────────┬───────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_decl_param2(ForwardDeclaredClass) -> void;
// --- fail_import_decl_value_param_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:4:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote]
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredClass*) {
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-25: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23
// CHECK:STDERR: -> │ Cpp.foo_decl_param1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo_decl_param1(ForwardDeclaredClass) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:5:6-20: error: argument type 'ForwardDeclaredClass' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredClass' [CppInteropParseNote]
Cpp.foo_decl_param1(*p);
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-25: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:4:42: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:23-24: error: forming value of incomplete type `Cpp.ForwardDeclaredClass` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:5:42: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:23
// CHECK:STDERR: -> │ Cpp.foo_decl_param2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ class ForwardDeclaredClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo_decl_param2(ForwardDeclaredClass) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo_decl_param2(*p);
}
@@ -84,22 +136,39 @@ class NonCopyableClass {
NonCopyableClass(const NonCopyableClass&) = delete;
};
// CHECK:STDERR: ╷ ╭── included from: fail_import_non_copyable_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./non_copyable_param_type.h:[[@LINE+22]]:6
// CHECK:STDERR: │ NonCopyableClass(const NonCopyableClass&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'NonCopyableClass' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_non_copyable_param(NonCopyableClass) -> void;
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to deleted
// CHECK:STDERR: · │ ┃ constructor of
// CHECK:STDERR: · │ ┃ 'NonCopyableClass'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ passing argument to parameter
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_non_copyable_param_type.carbon
// CHECK:STDERR: │ Cpp.foo_non_copyable_param(c);
// CHECK:STDERR: · ──────────────┬──────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_non_copyable_param(NonCopyableClass) -> void;
// --- fail_import_non_copyable_param_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./non_copyable_param_type.h:6:6-27: error: call to deleted constructor of 'NonCopyableClass' [CppInteropParseError]
// CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableClass' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: ./non_copyable_param_type.h:6:45: note: passing argument to parameter here [CppInteropParseNote]
import Cpp library "non_copyable_param_type.h";
fn F(c: Cpp.NonCopyableClass) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-31: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
Cpp.foo_non_copyable_param(c);
//@dump-sem-ir-end
}
@@ -114,6 +183,75 @@ struct MoveOnlyClass {
MoveOnlyClass(MoveOnlyClass&&);
};
// CHECK:STDERR: ╷ ╭── included from: fail_pass_move_only_param_value.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+68]]:6
// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a
// CHECK:STDERR: · │ user-declared move constructor
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void;
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted
// CHECK:STDERR: · │ ┃ copy constructor of
// CHECK:STDERR: · │ ┃ 'MoveOnlyClass'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ passing argument to parameter here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_pass_move_only_param_value.carbon
// CHECK:STDERR: │ Cpp.foo_move_only_param(c);
// CHECK:STDERR: · ─────────────┬────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╷ ╭── included from: fail_pass_move_only_param_ref.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+45]]:6
// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a
// CHECK:STDERR: · │ user-declared move constructor
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void;
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted
// CHECK:STDERR: · │ ┃ copy constructor of
// CHECK:STDERR: · │ ┃ 'MoveOnlyClass'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ passing argument to parameter here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_pass_move_only_param_ref.carbon
// CHECK:STDERR: │ Cpp.foo_move_only_param(c);
// CHECK:STDERR: · ─────────────┬────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╷ ╭── included from: fail_todo_pass_move_only_param_ref_by_move.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./move_only_param_type.h:[[@LINE+22]]:6
// CHECK:STDERR: │ MoveOnlyClass(MoveOnlyClass&&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnlyClass' has a
// CHECK:STDERR: · │ user-declared move constructor
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_move_only_param(MoveOnlyClass) -> void;
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to implicitly-deleted
// CHECK:STDERR: · │ ┃ copy constructor of
// CHECK:STDERR: · │ ┃ 'MoveOnlyClass'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ passing argument to parameter here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_pass_move_only_param_ref_by_move.carbon
// CHECK:STDERR: │ Cpp.foo_move_only_param(Cpp.move_move_only(ref c));
// CHECK:STDERR: · ─────────────────────────┬────────────────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_move_only_param(MoveOnlyClass) -> void;
auto make_move_only() -> MoveOnlyClass;
auto move_move_only(MoveOnlyClass&) -> MoveOnlyClass&&;
@@ -134,15 +272,9 @@ fn F() {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_pass_move_only_param_value.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError]
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote]
// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote]
import Cpp library "move_only_param_type.h";
fn F(c: Cpp.MoveOnlyClass) {
// CHECK:STDERR: fail_pass_move_only_param_value.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
Cpp.foo_move_only_param(c);
}
@@ -150,15 +282,9 @@ fn F(c: Cpp.MoveOnlyClass) {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_pass_move_only_param_ref.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError]
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote]
// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote]
import Cpp library "move_only_param_type.h";
fn F(ref c: Cpp.MoveOnlyClass) {
// CHECK:STDERR: fail_pass_move_only_param_ref.carbon:[[@LINE+2]]:3-28: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
Cpp.foo_move_only_param(c);
}
@@ -166,15 +292,9 @@ fn F(ref c: Cpp.MoveOnlyClass) {
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./move_only_param_type.h:6:6-24: error: call to implicitly-deleted copy constructor of 'MoveOnlyClass' [CppInteropParseError]
// CHECK:STDERR: ./move_only_param_type.h:3:3: note: copy constructor is implicitly deleted because 'MoveOnlyClass' has a user-declared move constructor [CppInteropParseNote]
// CHECK:STDERR: ./move_only_param_type.h:6:39: note: passing argument to parameter here [CppInteropParseNote]
import Cpp library "move_only_param_type.h";
fn F(ref c: Cpp.MoveOnlyClass) {
// CHECK:STDERR: fail_todo_pass_move_only_param_ref_by_move.carbon:[[@LINE+2]]:3-52: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
Cpp.foo_move_only_param(Cpp.move_move_only(ref c));
}
@@ -359,9 +479,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-20: error: member access into incomplete class `Cpp.Incomplete` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ Cpp.Incomplete.foo();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Incomplete.foo();
}
@@ -418,25 +547,51 @@ fn F(c: Cpp.DefPointerParamClass*) {
class DeclValueReturnClass;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6
// CHECK:STDERR: │ class DeclValueReturnClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnClass' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnClass;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type
// CHECK:STDERR: · │ ┃ 'DeclValueReturnClass'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon
// CHECK:STDERR: │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_decl_value_return() -> DeclValueReturnClass;
// --- fail_import_decl_value_return_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnClass' [CppInteropParseError]
// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnClass' [CppInteropParseNote]
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnClass` [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnClass`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ class DeclValueReturnClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnClass;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ return type declared here
// CHECK:STDERR: · │ [IncompleteReturnTypeHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo_decl_value_return();
}
@@ -575,7 +730,7 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%c.param: %NonCopyableClass) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %foo_non_copyable_param.ref: %foo_non_copyable_param.cpp_overload_set.type = name_ref foo_non_copyable_param, imports.%foo_non_copyable_param.cpp_overload_set.value [concrete = constants.%foo_non_copyable_param.cpp_overload_set.value]
// CHECK:STDOUT: %c.ref: %NonCopyableClass = name_ref c, %c
// CHECK:STDOUT: %foo_non_copyable_param.call: init %empty_tuple.type = call imports.%foo_non_copyable_param.decl(%c.ref)
@@ -72,7 +72,12 @@ constexpr int invalid_const_fn(int a) {
}
''';
// CHECK:STDERR: fail_invalid_constant_eval.carbon:[[@LINE+2]]:19-41: error: array bound is not a constant [InvalidArrayExpr]
// CHECK:STDERR: ╭─┤ fail_invalid_constant_eval.carbon:[[@LINE+7]]:19
// CHECK:STDERR: -> │ let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3);
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: array bound is not a constant
// CHECK:STDERR: · ┃ [InvalidArrayExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let a: array(i32, Cpp.invalid_const_fn(5)) = (1, 2, 3);
@@ -101,16 +106,36 @@ var a: i32 = 0;
// TODO: This is failing when building the thunk, not when calling it.
inline Cpp '''
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:15: error: call to consteval function 'nonconst_consteval_fn' is not a constant expression [CppInteropParseError]
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+2]]:15: note: function parameter 'r' with unknown value cannot be used in a constant expression [CppInteropParseNote]
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+1]]:15: note: declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_nonconstant_consteval_call.carbon:[[@LINE+16]]:15
// CHECK:STDERR: -> │ consteval int nonconst_consteval_fn(const int &r) { return r; }
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: call to consteval function 'nonconst_consteval_fn' is
// CHECK:STDERR: · │ ┃ not a constant expression
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ function parameter 'r' with unknown value cannot be used in
// CHECK:STDERR: · │ │ a constant expression
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰──────┤ declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ var b: i32 = Cpp.nonconst_consteval_fn(a);
// CHECK:STDERR: · ──────────────┬─────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
consteval int nonconst_consteval_fn(const int &r) { return r; }
''';
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+5]]:14-41: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE+3]]:14-41: error: non-constant call to compile-time-only function [NonConstantCallToCompTimeOnlyFunction]
// CHECK:STDERR: fail_nonconstant_consteval_call.carbon:[[@LINE-6]]:15: note: compile-time-only function declared here [CompTimeOnlyFunctionHere]
// CHECK:STDERR: ╭─┤ fail_nonconstant_consteval_call.carbon:[[@LINE+12]]:14
// CHECK:STDERR: │ consteval int nonconst_consteval_fn(const int &r) { return r; }
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ compile-time-only function declared here
// CHECK:STDERR: · │ [CompTimeOnlyFunctionHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ var b: i32 = Cpp.nonconst_consteval_fn(a);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: non-constant call to compile-time-only function
// CHECK:STDERR: · ┃ [NonConstantCallToCompTimeOnlyFunction]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var b: i32 = Cpp.nonconst_consteval_fn(a);
@@ -130,14 +155,22 @@ struct ConstexprC {
// TODO: This should probably be allowed.
eval fn F() -> i32 {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+1]]:27: error: expression is runtime; expected constant [EvalRequiresConstantValue]
// CHECK:STDERR: ╭─┤ fail_todo_constructor.carbon:[[@LINE+11]]:27
// CHECK:STDERR: -> │ let c: Cpp.ConstexprC = 3;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expression is runtime; expected constant
// CHECK:STDERR: · ┃ [EvalRequiresConstantValue]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ let a: array(i32, F()) = (1, 2, 3);
// CHECK:STDERR: · ─┬─
// CHECK:STDERR: · ╰──┤ in call to F here [InCallToEvalFn]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let c: Cpp.ConstexprC = 3;
return c.a;
//@dump-sem-ir-end
}
// CHECK:STDERR: fail_todo_constructor.carbon:[[@LINE+2]]:19-21: note: in call to F here [InCallToEvalFn]
// CHECK:STDERR:
let a: array(i32, F()) = (1, 2, 3);
// CHECK:STDOUT: --- fail_todo_constructor.carbon
@@ -215,43 +248,43 @@ let a: array(i32, F()) = (1, 2, 3);
// CHECK:STDOUT: fn @F() -> out %return.param: %i32 {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
// CHECK:STDOUT: %.loc17_27.1: ref %ConstexprC = temporary_storage
// CHECK:STDOUT: %impl.elem0.loc17: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc17_27.1: <bound method> = bound_method %int_3, %impl.elem0.loc17 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc17: <specific function> = specific_function %impl.elem0.loc17, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc17_27.2: <bound method> = bound_method %int_3, %specific_fn.loc17 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc17_27.2(%int_3) [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %.loc17_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %.loc17_27.3: %i32 = converted %int_3, %.loc17_27.2 [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc17_27.1
// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc17_27.3, %addr)
// CHECK:STDOUT: %.loc17_27.4: init %ConstexprC to %.loc17_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call
// CHECK:STDOUT: %.loc17_27.5: init %ConstexprC = converted %int_3, %.loc17_27.4
// CHECK:STDOUT: %.loc17_27.6: ref %ConstexprC = temporary %.loc17_27.1, %.loc17_27.5
// CHECK:STDOUT: %.loc17_27.7: %ConstexprC = acquire_value %.loc17_27.6
// CHECK:STDOUT: %.loc17_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] {
// CHECK:STDOUT: %.loc27_27.1: ref %ConstexprC = temporary_storage
// CHECK:STDOUT: %impl.elem0.loc27: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc27_27.1: <bound method> = bound_method %int_3, %impl.elem0.loc27 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn.loc27: <specific function> = specific_function %impl.elem0.loc27, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc27_27.2: <bound method> = bound_method %int_3, %specific_fn.loc27 [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc27_27.2(%int_3) [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %.loc27_27.2: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %.loc27_27.3: %i32 = converted %int_3, %.loc27_27.2 [concrete = constants.%int_3.9f3]
// CHECK:STDOUT: %addr: %ptr.0b8 = addr_of %.loc27_27.1
// CHECK:STDOUT: %ConstexprC__carbon_thunk.call: init %empty_tuple.type = call imports.%ConstexprC__carbon_thunk.decl(%.loc27_27.3, %addr)
// CHECK:STDOUT: %.loc27_27.4: init %ConstexprC to %.loc27_27.1 = mark_in_place_init %ConstexprC__carbon_thunk.call
// CHECK:STDOUT: %.loc27_27.5: init %ConstexprC = converted %int_3, %.loc27_27.4
// CHECK:STDOUT: %.loc27_27.6: ref %ConstexprC = temporary %.loc27_27.1, %.loc27_27.5
// CHECK:STDOUT: %.loc27_27.7: %ConstexprC = acquire_value %.loc27_27.6
// CHECK:STDOUT: %.loc27_13: type = splice_block %ConstexprC.ref [concrete = constants.%ConstexprC] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %ConstexprC.ref: type = name_ref ConstexprC, imports.%ConstexprC.decl [concrete = constants.%ConstexprC]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc17_27.7
// CHECK:STDOUT: %c: %ConstexprC = wrapper_binding c, %.loc27_27.7
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %c.patt: %pattern_type.3cc = value_binding_pattern c [concrete = constants.%c.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c.ref: %ConstexprC = name_ref c, %c
// CHECK:STDOUT: %a.ref: %ConstexprC.elem = name_ref a, @ConstexprC.%field_decl [concrete = @ConstexprC.%field_decl]
// CHECK:STDOUT: %.loc18_11.1: ref %i32 = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc18_11.2: %i32 = acquire_value %.loc18_11.1
// CHECK:STDOUT: %impl.elem0.loc18: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
// CHECK:STDOUT: %bound_method.loc18_11.1: <bound method> = bound_method %.loc18_11.2, %impl.elem0.loc18
// CHECK:STDOUT: %specific_fn.loc18: <specific function> = specific_function %impl.elem0.loc18, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc18_11.2: <bound method> = bound_method %.loc18_11.2, %specific_fn.loc18
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc18_11.2(%.loc18_11.2)
// CHECK:STDOUT: %Destroy.facet.loc17_27.1: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc17_27.8: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc17_27.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc17_27.2: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc17_27.9: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc17_27.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_11.1: ref %i32 = class_element_access %c.ref, element0
// CHECK:STDOUT: %.loc28_11.2: %i32 = acquire_value %.loc28_11.1
// CHECK:STDOUT: %impl.elem0.loc28: %.2b9 = impl_witness_access constants.%Copy.impl_witness.8af, element0 [concrete = constants.%Int.as.Copy.impl.Op.cae]
// CHECK:STDOUT: %bound_method.loc28_11.1: <bound method> = bound_method %.loc28_11.2, %impl.elem0.loc28
// CHECK:STDOUT: %specific_fn.loc28: <specific function> = specific_function %impl.elem0.loc28, @Int.as.Copy.impl.Op(constants.%int_32) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc28_11.2: <bound method> = bound_method %.loc28_11.2, %specific_fn.loc28
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc28_11.2(%.loc28_11.2)
// CHECK:STDOUT: %Destroy.facet.loc27_27.1: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc27_27.8: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc27_27.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc27_27.2: %Destroy.type = facet_value constants.%ConstexprC, (constants.%DestroyImpl.impl_witness.a0d, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc27_27.9: %Destroy.type = converted constants.%ConstexprC, %Destroy.facet.loc27_27.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_27.6)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc27_27.6)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -46,20 +46,50 @@ fn G(n: i32) -> i32;
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+2]]:21-32: error: call argument of type `<type of Cpp.Function>` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ Cpp.TakesFunction(Cpp.Function);
// CHECK:STDERR: · ┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call argument of type `<type of Cpp.Function>`
// CHECK:STDERR: · ┃ is not supported
// CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesFunction(Cpp.Function);
var n: array(i32, 42);
// CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:3-19: error: no matching function for call to 'TakesFunction' [CppInteropParseError]
// CHECK:STDERR: ./params.h:3:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./params.h:3:20-29: note: no known conversion from 'int * _Nonnull' to 'int (*)(int)' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.TakesFunction(&n[0]);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesFunction'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./params.h
// CHECK:STDERR: │ void TakesFunction(int f(int));
// CHECK:STDERR: · ┬ ┬─────────
// CHECK:STDERR: · ╰────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'int * _Nonnull' to 'int
// CHECK:STDERR: · │ (*)(int)' for 1st argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesFunction(&n[0]);
// CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+4]]:21-31: error: cannot implicitly convert expression of type `Cpp.nullptr_t` to `<C++ type int (*)(int)>` [ConversionFailure]
// CHECK:STDERR: fail_todo_call_params_2.carbon:[[@LINE+3]]:21-31: note: type `Cpp.nullptr_t` does not implement interface `Core.ImplicitAs(<C++ type int (*)(int)>)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./params.h:3:24: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_call_params_2.carbon:[[@LINE+17]]:21
// CHECK:STDERR: -> │ Cpp.TakesFunction(Cpp.nullptr);
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Cpp.nullptr_t` to `<C++ type int (*)(int)>`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.nullptr_t` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(<C++ type int (*)(int)>)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./params.h
// CHECK:STDERR: │ void TakesFunction(int f(int));
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesFunction(Cpp.nullptr);
//@dump-sem-ir-end
@@ -771,10 +801,10 @@ fn F() {
// CHECK:STDOUT: %.659: type = cpp_fn_ptr_type clang_function_pointer_type61000000 [concrete]
// CHECK:STDOUT: %TakesFunction.type: type = fn_type @TakesFunction [concrete]
// CHECK:STDOUT: %TakesFunction: %TakesFunction.type = struct_value () [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc14_3.1 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_3.1 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc14_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc20_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete]
// CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.49a: %SubobjectDestroy.type = facet_value %i32, (%custom_witness.b80ef6.2) [concrete]
@@ -851,20 +881,20 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc12_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc12: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc12_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc18_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc18: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc18_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Function.ref: %Function.cpp_overload_set.type = name_ref Function, imports.%Function.cpp_overload_set.value [concrete = constants.%Function.cpp_overload_set.value]
// CHECK:STDOUT: %n.var: ref %Array.3b5 = var_storage %n.var_patt
// CHECK:STDOUT: %DefaultOrUnformed.facet: %DefaultOrUnformed.type = facet_value constants.%Array.3b5, (constants.%DefaultOrUnformed.impl_witness.4bc) [concrete = constants.%DefaultOrUnformed.facet]
// CHECK:STDOUT: %.loc14_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet]
// CHECK:STDOUT: %as_type: type = facet_access_type %.loc14_24.1 [concrete = constants.%Array.3b5]
// CHECK:STDOUT: %.loc14_24.2: type = converted %.loc14_24.1, %as_type [concrete = constants.%Array.3b5]
// CHECK:STDOUT: %.loc20_24.1: %DefaultOrUnformed.type = converted constants.%Array.3b5, %DefaultOrUnformed.facet [concrete = constants.%DefaultOrUnformed.facet]
// CHECK:STDOUT: %as_type: type = facet_access_type %.loc20_24.1 [concrete = constants.%Array.3b5]
// CHECK:STDOUT: %.loc20_24.2: type = converted %.loc20_24.1, %as_type [concrete = constants.%Array.3b5]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc14_3.1: ref %Array.3b5 = splice_block %n.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc14_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn()
// CHECK:STDOUT: %.loc20_3.1: ref %Array.3b5 = splice_block %n.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call: init %Array.3b5 to %.loc20_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn()
// CHECK:STDOUT: assign %n.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call
// CHECK:STDOUT: %.loc14_23: type = splice_block %Array [concrete = constants.%Array.3b5] {
// CHECK:STDOUT: %.loc20_23: type = splice_block %Array [concrete = constants.%Array.3b5] {
// CHECK:STDOUT: %i32: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: %int_42: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
// CHECK:STDOUT: %Array: type = class_type @Array, @Array(constants.%i32, constants.%int_42) [concrete = constants.%Array.3b5]
@@ -874,375 +904,375 @@ fn F() {
// CHECK:STDOUT: %n.patt: %pattern_type.9c3 = ref_binding_pattern n [concrete = constants.%n.patt.368]
// CHECK:STDOUT: %n.var_patt: %pattern_type.9c3 = var_pattern %n.patt [concrete = constants.%n.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc19: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc36: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %n.ref: ref %Array.3b5 = name_ref n, %n
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %impl.elem0: %.33a = impl_witness_access constants.%ImplicitAs.impl_witness.d73, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.f60]
// CHECK:STDOUT: %bound_method.loc19_24.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %bound_method.loc36_24.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc19_24.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc19_24.2(%int_0) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc19_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc19_24.2: %i32 = converted %int_0, %.loc19_24.1 [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc19_25: ref %i32 = array_index %n.ref, %.loc19_24.2
// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc19_25
// CHECK:STDOUT: %Cpp.ref.loc25_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc25: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc25_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %bound_method.loc36_24.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc36_24.2(%int_0) [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc36_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc36_24.2: %i32 = converted %int_0, %.loc36_24.1 [concrete = constants.%int_0.753]
// CHECK:STDOUT: %.loc36_25: ref %i32 = array_index %n.ref, %.loc36_24.2
// CHECK:STDOUT: %addr: %ptr.a17 = addr_of %.loc36_25
// CHECK:STDOUT: %Cpp.ref.loc55_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesFunction.ref.loc55: %TakesFunction.cpp_overload_set.type = name_ref TakesFunction, imports.%TakesFunction.cpp_overload_set.value [concrete = constants.%TakesFunction.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc55_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %nullptr.ref: %Cpp.nullptr_t = name_ref nullptr, %uninit [concrete = constants.%uninit]
// CHECK:STDOUT: %.loc25: %.659 = converted %nullptr.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc55: %.659 = converted %nullptr.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %TakesFunction.call: init %empty_tuple.type = call imports.%TakesFunction.decl(<error>)
// CHECK:STDOUT: %Destroy.facet.loc14_3.1: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %.loc14_3.2: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc14_3.1 [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %Destroy.facet.loc14_3.2: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %.loc14_3.3: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc14_3.2 [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %Destroy.facet.loc20_3.1: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %.loc20_3.2: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc20_3.1 [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %Destroy.facet.loc20_3.2: %Destroy.type = facet_value constants.%Array.3b5, (constants.%DestroyImpl.impl_witness.be3, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: %.loc20_3.3: %Destroy.type = converted constants.%Array.3b5, %Destroy.facet.loc20_3.2 [concrete = constants.%Destroy.facet.843]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%n.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc14_3.1(%self.param: ref %i32) = "no_op";
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_3.1(%self.param: ref %i32) = "no_op";
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc14_3.2(%self.param: ref %Array.3b5) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc20_3.2(%self.param: ref %Array.3b5) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %int_41: Core.IntLiteral = int_value 41 [concrete = constants.%int_41]
// CHECK:STDOUT: %.loc14_3.1: ref %i32 = array_index %self.param, %int_41
// CHECK:STDOUT: %Destroy.facet.loc14_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.1 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.2 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.1: ref %i32 = array_index %self.param, %int_41
// CHECK:STDOUT: %Destroy.facet.loc20_3.1: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.2: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.1 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.2: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.3: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.2 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc14_3.1)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.1: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc20_3.1)
// CHECK:STDOUT: %int_40: Core.IntLiteral = int_value 40 [concrete = constants.%int_40]
// CHECK:STDOUT: %.loc14_3.4: ref %i32 = array_index %self.param, %int_40
// CHECK:STDOUT: %Destroy.facet.loc14_3.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.3 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.4 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.4: ref %i32 = array_index %self.param, %int_40
// CHECK:STDOUT: %Destroy.facet.loc20_3.3: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.5: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.3 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.4: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.6: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.4 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc14_3.4)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.2: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc20_3.4)
// CHECK:STDOUT: %int_39: Core.IntLiteral = int_value 39 [concrete = constants.%int_39]
// CHECK:STDOUT: %.loc14_3.7: ref %i32 = array_index %self.param, %int_39
// CHECK:STDOUT: %Destroy.facet.loc14_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.5 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.6 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.7: ref %i32 = array_index %self.param, %int_39
// CHECK:STDOUT: %Destroy.facet.loc20_3.5: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.8: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.5 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.6: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.9: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.6 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc14_3.7)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.3: init %empty_tuple.type = call %SelfDestruct.specific_fn.3(%.loc20_3.7)
// CHECK:STDOUT: %int_38: Core.IntLiteral = int_value 38 [concrete = constants.%int_38]
// CHECK:STDOUT: %.loc14_3.10: ref %i32 = array_index %self.param, %int_38
// CHECK:STDOUT: %Destroy.facet.loc14_3.7: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.11: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.7 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.8: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.12: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.8 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.10: ref %i32 = array_index %self.param, %int_38
// CHECK:STDOUT: %Destroy.facet.loc20_3.7: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.11: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.7 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.8: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.12: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.8 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%.loc14_3.10)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.4: init %empty_tuple.type = call %SelfDestruct.specific_fn.4(%.loc20_3.10)
// CHECK:STDOUT: %int_37: Core.IntLiteral = int_value 37 [concrete = constants.%int_37]
// CHECK:STDOUT: %.loc14_3.13: ref %i32 = array_index %self.param, %int_37
// CHECK:STDOUT: %Destroy.facet.loc14_3.9: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.14: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.9 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.10: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.15: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.10 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.13: ref %i32 = array_index %self.param, %int_37
// CHECK:STDOUT: %Destroy.facet.loc20_3.9: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.14: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.9 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.10: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.15: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.10 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.5: init %empty_tuple.type = call %SelfDestruct.specific_fn.5(%.loc14_3.13)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.5: init %empty_tuple.type = call %SelfDestruct.specific_fn.5(%.loc20_3.13)
// CHECK:STDOUT: %int_36: Core.IntLiteral = int_value 36 [concrete = constants.%int_36]
// CHECK:STDOUT: %.loc14_3.16: ref %i32 = array_index %self.param, %int_36
// CHECK:STDOUT: %Destroy.facet.loc14_3.11: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.17: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.11 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.12: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.18: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.12 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.16: ref %i32 = array_index %self.param, %int_36
// CHECK:STDOUT: %Destroy.facet.loc20_3.11: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.17: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.11 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.12: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.18: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.12 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.6: init %empty_tuple.type = call %SelfDestruct.specific_fn.6(%.loc14_3.16)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.6: init %empty_tuple.type = call %SelfDestruct.specific_fn.6(%.loc20_3.16)
// CHECK:STDOUT: %int_35: Core.IntLiteral = int_value 35 [concrete = constants.%int_35]
// CHECK:STDOUT: %.loc14_3.19: ref %i32 = array_index %self.param, %int_35
// CHECK:STDOUT: %Destroy.facet.loc14_3.13: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.20: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.13 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.14: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.21: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.14 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.19: ref %i32 = array_index %self.param, %int_35
// CHECK:STDOUT: %Destroy.facet.loc20_3.13: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.20: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.13 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.14: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.21: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.14 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.7: init %empty_tuple.type = call %SelfDestruct.specific_fn.7(%.loc14_3.19)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.7: init %empty_tuple.type = call %SelfDestruct.specific_fn.7(%.loc20_3.19)
// CHECK:STDOUT: %int_34: Core.IntLiteral = int_value 34 [concrete = constants.%int_34]
// CHECK:STDOUT: %.loc14_3.22: ref %i32 = array_index %self.param, %int_34
// CHECK:STDOUT: %Destroy.facet.loc14_3.15: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.23: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.15 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.16: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.24: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.16 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.22: ref %i32 = array_index %self.param, %int_34
// CHECK:STDOUT: %Destroy.facet.loc20_3.15: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.23: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.15 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.16: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.24: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.16 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.8: init %empty_tuple.type = call %SelfDestruct.specific_fn.8(%.loc14_3.22)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.8: init %empty_tuple.type = call %SelfDestruct.specific_fn.8(%.loc20_3.22)
// CHECK:STDOUT: %int_33: Core.IntLiteral = int_value 33 [concrete = constants.%int_33]
// CHECK:STDOUT: %.loc14_3.25: ref %i32 = array_index %self.param, %int_33
// CHECK:STDOUT: %Destroy.facet.loc14_3.17: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.26: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.17 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.18: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.27: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.18 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.25: ref %i32 = array_index %self.param, %int_33
// CHECK:STDOUT: %Destroy.facet.loc20_3.17: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.26: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.17 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.18: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.27: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.18 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.9: init %empty_tuple.type = call %SelfDestruct.specific_fn.9(%.loc14_3.25)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.9: init %empty_tuple.type = call %SelfDestruct.specific_fn.9(%.loc20_3.25)
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
// CHECK:STDOUT: %.loc14_3.28: ref %i32 = array_index %self.param, %int_32
// CHECK:STDOUT: %Destroy.facet.loc14_3.19: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.29: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.19 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.20: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.30: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.20 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.28: ref %i32 = array_index %self.param, %int_32
// CHECK:STDOUT: %Destroy.facet.loc20_3.19: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.29: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.19 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.20: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.30: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.20 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.10: init %empty_tuple.type = call %SelfDestruct.specific_fn.10(%.loc14_3.28)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.10: init %empty_tuple.type = call %SelfDestruct.specific_fn.10(%.loc20_3.28)
// CHECK:STDOUT: %int_31: Core.IntLiteral = int_value 31 [concrete = constants.%int_31]
// CHECK:STDOUT: %.loc14_3.31: ref %i32 = array_index %self.param, %int_31
// CHECK:STDOUT: %Destroy.facet.loc14_3.21: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.32: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.21 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.22: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.33: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.22 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.31: ref %i32 = array_index %self.param, %int_31
// CHECK:STDOUT: %Destroy.facet.loc20_3.21: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.32: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.21 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.22: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.33: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.22 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.11: init %empty_tuple.type = call %SelfDestruct.specific_fn.11(%.loc14_3.31)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.11: init %empty_tuple.type = call %SelfDestruct.specific_fn.11(%.loc20_3.31)
// CHECK:STDOUT: %int_30: Core.IntLiteral = int_value 30 [concrete = constants.%int_30]
// CHECK:STDOUT: %.loc14_3.34: ref %i32 = array_index %self.param, %int_30
// CHECK:STDOUT: %Destroy.facet.loc14_3.23: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.35: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.23 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.24: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.36: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.24 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.34: ref %i32 = array_index %self.param, %int_30
// CHECK:STDOUT: %Destroy.facet.loc20_3.23: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.35: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.23 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.24: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.36: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.24 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.12: init %empty_tuple.type = call %SelfDestruct.specific_fn.12(%.loc14_3.34)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.12: init %empty_tuple.type = call %SelfDestruct.specific_fn.12(%.loc20_3.34)
// CHECK:STDOUT: %int_29: Core.IntLiteral = int_value 29 [concrete = constants.%int_29]
// CHECK:STDOUT: %.loc14_3.37: ref %i32 = array_index %self.param, %int_29
// CHECK:STDOUT: %Destroy.facet.loc14_3.25: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.38: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.25 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.26: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.39: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.26 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.37: ref %i32 = array_index %self.param, %int_29
// CHECK:STDOUT: %Destroy.facet.loc20_3.25: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.38: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.25 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.26: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.39: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.26 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.13: init %empty_tuple.type = call %SelfDestruct.specific_fn.13(%.loc14_3.37)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.13: init %empty_tuple.type = call %SelfDestruct.specific_fn.13(%.loc20_3.37)
// CHECK:STDOUT: %int_28: Core.IntLiteral = int_value 28 [concrete = constants.%int_28]
// CHECK:STDOUT: %.loc14_3.40: ref %i32 = array_index %self.param, %int_28
// CHECK:STDOUT: %Destroy.facet.loc14_3.27: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.41: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.27 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.28: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.42: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.28 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.40: ref %i32 = array_index %self.param, %int_28
// CHECK:STDOUT: %Destroy.facet.loc20_3.27: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.41: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.27 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.28: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.42: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.28 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.14: init %empty_tuple.type = call %SelfDestruct.specific_fn.14(%.loc14_3.40)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.14: init %empty_tuple.type = call %SelfDestruct.specific_fn.14(%.loc20_3.40)
// CHECK:STDOUT: %int_27: Core.IntLiteral = int_value 27 [concrete = constants.%int_27]
// CHECK:STDOUT: %.loc14_3.43: ref %i32 = array_index %self.param, %int_27
// CHECK:STDOUT: %Destroy.facet.loc14_3.29: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.44: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.29 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.30: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.45: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.30 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.43: ref %i32 = array_index %self.param, %int_27
// CHECK:STDOUT: %Destroy.facet.loc20_3.29: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.44: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.29 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.30: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.45: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.30 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.15: init %empty_tuple.type = call %SelfDestruct.specific_fn.15(%.loc14_3.43)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.15: init %empty_tuple.type = call %SelfDestruct.specific_fn.15(%.loc20_3.43)
// CHECK:STDOUT: %int_26: Core.IntLiteral = int_value 26 [concrete = constants.%int_26]
// CHECK:STDOUT: %.loc14_3.46: ref %i32 = array_index %self.param, %int_26
// CHECK:STDOUT: %Destroy.facet.loc14_3.31: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.47: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.31 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.32: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.48: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.32 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.46: ref %i32 = array_index %self.param, %int_26
// CHECK:STDOUT: %Destroy.facet.loc20_3.31: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.47: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.31 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.32: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.48: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.32 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.16: init %empty_tuple.type = call %SelfDestruct.specific_fn.16(%.loc14_3.46)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.16: init %empty_tuple.type = call %SelfDestruct.specific_fn.16(%.loc20_3.46)
// CHECK:STDOUT: %int_25: Core.IntLiteral = int_value 25 [concrete = constants.%int_25]
// CHECK:STDOUT: %.loc14_3.49: ref %i32 = array_index %self.param, %int_25
// CHECK:STDOUT: %Destroy.facet.loc14_3.33: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.50: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.33 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.34: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.51: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.34 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.49: ref %i32 = array_index %self.param, %int_25
// CHECK:STDOUT: %Destroy.facet.loc20_3.33: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.50: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.33 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.34: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.51: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.34 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.17: init %empty_tuple.type = call %SelfDestruct.specific_fn.17(%.loc14_3.49)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.17: init %empty_tuple.type = call %SelfDestruct.specific_fn.17(%.loc20_3.49)
// CHECK:STDOUT: %int_24: Core.IntLiteral = int_value 24 [concrete = constants.%int_24]
// CHECK:STDOUT: %.loc14_3.52: ref %i32 = array_index %self.param, %int_24
// CHECK:STDOUT: %Destroy.facet.loc14_3.35: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.53: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.35 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.36: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.54: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.36 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.52: ref %i32 = array_index %self.param, %int_24
// CHECK:STDOUT: %Destroy.facet.loc20_3.35: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.53: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.35 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.36: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.54: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.36 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.18: init %empty_tuple.type = call %SelfDestruct.specific_fn.18(%.loc14_3.52)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.18: init %empty_tuple.type = call %SelfDestruct.specific_fn.18(%.loc20_3.52)
// CHECK:STDOUT: %int_23: Core.IntLiteral = int_value 23 [concrete = constants.%int_23]
// CHECK:STDOUT: %.loc14_3.55: ref %i32 = array_index %self.param, %int_23
// CHECK:STDOUT: %Destroy.facet.loc14_3.37: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.56: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.37 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.38: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.57: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.38 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.55: ref %i32 = array_index %self.param, %int_23
// CHECK:STDOUT: %Destroy.facet.loc20_3.37: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.56: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.37 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.38: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.57: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.38 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.19: init %empty_tuple.type = call %SelfDestruct.specific_fn.19(%.loc14_3.55)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.19: init %empty_tuple.type = call %SelfDestruct.specific_fn.19(%.loc20_3.55)
// CHECK:STDOUT: %int_22: Core.IntLiteral = int_value 22 [concrete = constants.%int_22]
// CHECK:STDOUT: %.loc14_3.58: ref %i32 = array_index %self.param, %int_22
// CHECK:STDOUT: %Destroy.facet.loc14_3.39: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.59: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.39 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.40: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.60: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.40 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.58: ref %i32 = array_index %self.param, %int_22
// CHECK:STDOUT: %Destroy.facet.loc20_3.39: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.59: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.39 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.40: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.60: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.40 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.20: init %empty_tuple.type = call %SelfDestruct.specific_fn.20(%.loc14_3.58)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.20: init %empty_tuple.type = call %SelfDestruct.specific_fn.20(%.loc20_3.58)
// CHECK:STDOUT: %int_21: Core.IntLiteral = int_value 21 [concrete = constants.%int_21]
// CHECK:STDOUT: %.loc14_3.61: ref %i32 = array_index %self.param, %int_21
// CHECK:STDOUT: %Destroy.facet.loc14_3.41: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.62: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.41 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.42: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.63: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.42 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.61: ref %i32 = array_index %self.param, %int_21
// CHECK:STDOUT: %Destroy.facet.loc20_3.41: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.62: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.41 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.42: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.63: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.42 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.21: init %empty_tuple.type = call %SelfDestruct.specific_fn.21(%.loc14_3.61)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.21: init %empty_tuple.type = call %SelfDestruct.specific_fn.21(%.loc20_3.61)
// CHECK:STDOUT: %int_20: Core.IntLiteral = int_value 20 [concrete = constants.%int_20]
// CHECK:STDOUT: %.loc14_3.64: ref %i32 = array_index %self.param, %int_20
// CHECK:STDOUT: %Destroy.facet.loc14_3.43: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.65: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.43 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.44: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.66: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.44 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.64: ref %i32 = array_index %self.param, %int_20
// CHECK:STDOUT: %Destroy.facet.loc20_3.43: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.65: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.43 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.44: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.66: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.44 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.22: init %empty_tuple.type = call %SelfDestruct.specific_fn.22(%.loc14_3.64)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.22: init %empty_tuple.type = call %SelfDestruct.specific_fn.22(%.loc20_3.64)
// CHECK:STDOUT: %int_19: Core.IntLiteral = int_value 19 [concrete = constants.%int_19]
// CHECK:STDOUT: %.loc14_3.67: ref %i32 = array_index %self.param, %int_19
// CHECK:STDOUT: %Destroy.facet.loc14_3.45: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.68: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.45 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.46: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.69: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.46 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.67: ref %i32 = array_index %self.param, %int_19
// CHECK:STDOUT: %Destroy.facet.loc20_3.45: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.68: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.45 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.46: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.69: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.46 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.23: init %empty_tuple.type = call %SelfDestruct.specific_fn.23(%.loc14_3.67)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.23: init %empty_tuple.type = call %SelfDestruct.specific_fn.23(%.loc20_3.67)
// CHECK:STDOUT: %int_18: Core.IntLiteral = int_value 18 [concrete = constants.%int_18]
// CHECK:STDOUT: %.loc14_3.70: ref %i32 = array_index %self.param, %int_18
// CHECK:STDOUT: %Destroy.facet.loc14_3.47: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.71: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.47 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.48: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.72: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.48 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.70: ref %i32 = array_index %self.param, %int_18
// CHECK:STDOUT: %Destroy.facet.loc20_3.47: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.71: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.47 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.48: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.72: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.48 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.24: init %empty_tuple.type = call %SelfDestruct.specific_fn.24(%.loc14_3.70)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.24: init %empty_tuple.type = call %SelfDestruct.specific_fn.24(%.loc20_3.70)
// CHECK:STDOUT: %int_17: Core.IntLiteral = int_value 17 [concrete = constants.%int_17]
// CHECK:STDOUT: %.loc14_3.73: ref %i32 = array_index %self.param, %int_17
// CHECK:STDOUT: %Destroy.facet.loc14_3.49: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.74: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.49 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.50: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.75: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.50 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.73: ref %i32 = array_index %self.param, %int_17
// CHECK:STDOUT: %Destroy.facet.loc20_3.49: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.74: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.49 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.50: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.75: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.50 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.25: init %empty_tuple.type = call %SelfDestruct.specific_fn.25(%.loc14_3.73)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.25: init %empty_tuple.type = call %SelfDestruct.specific_fn.25(%.loc20_3.73)
// CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
// CHECK:STDOUT: %.loc14_3.76: ref %i32 = array_index %self.param, %int_16
// CHECK:STDOUT: %Destroy.facet.loc14_3.51: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.77: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.51 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.52: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.78: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.52 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.76: ref %i32 = array_index %self.param, %int_16
// CHECK:STDOUT: %Destroy.facet.loc20_3.51: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.77: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.51 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.52: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.78: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.52 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.26: init %empty_tuple.type = call %SelfDestruct.specific_fn.26(%.loc14_3.76)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.26: init %empty_tuple.type = call %SelfDestruct.specific_fn.26(%.loc20_3.76)
// CHECK:STDOUT: %int_15: Core.IntLiteral = int_value 15 [concrete = constants.%int_15]
// CHECK:STDOUT: %.loc14_3.79: ref %i32 = array_index %self.param, %int_15
// CHECK:STDOUT: %Destroy.facet.loc14_3.53: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.80: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.53 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.54: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.81: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.54 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.79: ref %i32 = array_index %self.param, %int_15
// CHECK:STDOUT: %Destroy.facet.loc20_3.53: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.80: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.53 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.54: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.81: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.54 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.27: init %empty_tuple.type = call %SelfDestruct.specific_fn.27(%.loc14_3.79)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.27: init %empty_tuple.type = call %SelfDestruct.specific_fn.27(%.loc20_3.79)
// CHECK:STDOUT: %int_14: Core.IntLiteral = int_value 14 [concrete = constants.%int_14]
// CHECK:STDOUT: %.loc14_3.82: ref %i32 = array_index %self.param, %int_14
// CHECK:STDOUT: %Destroy.facet.loc14_3.55: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.83: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.55 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.56: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.84: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.56 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.82: ref %i32 = array_index %self.param, %int_14
// CHECK:STDOUT: %Destroy.facet.loc20_3.55: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.83: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.55 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.56: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.84: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.56 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.28: init %empty_tuple.type = call %SelfDestruct.specific_fn.28(%.loc14_3.82)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.28: init %empty_tuple.type = call %SelfDestruct.specific_fn.28(%.loc20_3.82)
// CHECK:STDOUT: %int_13: Core.IntLiteral = int_value 13 [concrete = constants.%int_13]
// CHECK:STDOUT: %.loc14_3.85: ref %i32 = array_index %self.param, %int_13
// CHECK:STDOUT: %Destroy.facet.loc14_3.57: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.86: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.57 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.58: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.87: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.58 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.85: ref %i32 = array_index %self.param, %int_13
// CHECK:STDOUT: %Destroy.facet.loc20_3.57: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.86: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.57 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.58: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.87: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.58 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.29: init %empty_tuple.type = call %SelfDestruct.specific_fn.29(%.loc14_3.85)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.29: init %empty_tuple.type = call %SelfDestruct.specific_fn.29(%.loc20_3.85)
// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12]
// CHECK:STDOUT: %.loc14_3.88: ref %i32 = array_index %self.param, %int_12
// CHECK:STDOUT: %Destroy.facet.loc14_3.59: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.89: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.59 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.60: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.90: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.60 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.88: ref %i32 = array_index %self.param, %int_12
// CHECK:STDOUT: %Destroy.facet.loc20_3.59: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.89: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.59 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.60: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.90: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.60 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.30: init %empty_tuple.type = call %SelfDestruct.specific_fn.30(%.loc14_3.88)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.30: init %empty_tuple.type = call %SelfDestruct.specific_fn.30(%.loc20_3.88)
// CHECK:STDOUT: %int_11: Core.IntLiteral = int_value 11 [concrete = constants.%int_11]
// CHECK:STDOUT: %.loc14_3.91: ref %i32 = array_index %self.param, %int_11
// CHECK:STDOUT: %Destroy.facet.loc14_3.61: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.92: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.61 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.62: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.93: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.62 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.91: ref %i32 = array_index %self.param, %int_11
// CHECK:STDOUT: %Destroy.facet.loc20_3.61: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.92: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.61 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.62: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.93: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.62 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.31: init %empty_tuple.type = call %SelfDestruct.specific_fn.31(%.loc14_3.91)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.31: init %empty_tuple.type = call %SelfDestruct.specific_fn.31(%.loc20_3.91)
// CHECK:STDOUT: %int_10: Core.IntLiteral = int_value 10 [concrete = constants.%int_10]
// CHECK:STDOUT: %.loc14_3.94: ref %i32 = array_index %self.param, %int_10
// CHECK:STDOUT: %Destroy.facet.loc14_3.63: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.95: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.63 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.64: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.96: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.64 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.94: ref %i32 = array_index %self.param, %int_10
// CHECK:STDOUT: %Destroy.facet.loc20_3.63: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.95: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.63 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.64: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.96: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.64 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.32: init %empty_tuple.type = call %SelfDestruct.specific_fn.32(%.loc14_3.94)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.32: init %empty_tuple.type = call %SelfDestruct.specific_fn.32(%.loc20_3.94)
// CHECK:STDOUT: %int_9: Core.IntLiteral = int_value 9 [concrete = constants.%int_9]
// CHECK:STDOUT: %.loc14_3.97: ref %i32 = array_index %self.param, %int_9
// CHECK:STDOUT: %Destroy.facet.loc14_3.65: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.98: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.65 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.66: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.99: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.66 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.97: ref %i32 = array_index %self.param, %int_9
// CHECK:STDOUT: %Destroy.facet.loc20_3.65: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.98: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.65 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.66: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.99: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.66 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.33: init %empty_tuple.type = call %SelfDestruct.specific_fn.33(%.loc14_3.97)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.33: init %empty_tuple.type = call %SelfDestruct.specific_fn.33(%.loc20_3.97)
// CHECK:STDOUT: %int_8: Core.IntLiteral = int_value 8 [concrete = constants.%int_8]
// CHECK:STDOUT: %.loc14_3.100: ref %i32 = array_index %self.param, %int_8
// CHECK:STDOUT: %Destroy.facet.loc14_3.67: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.101: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.67 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.68: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.102: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.68 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.100: ref %i32 = array_index %self.param, %int_8
// CHECK:STDOUT: %Destroy.facet.loc20_3.67: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.101: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.67 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.68: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.102: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.68 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.34: init %empty_tuple.type = call %SelfDestruct.specific_fn.34(%.loc14_3.100)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.34: init %empty_tuple.type = call %SelfDestruct.specific_fn.34(%.loc20_3.100)
// CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7]
// CHECK:STDOUT: %.loc14_3.103: ref %i32 = array_index %self.param, %int_7
// CHECK:STDOUT: %Destroy.facet.loc14_3.69: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.104: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.69 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.70: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.105: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.70 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.103: ref %i32 = array_index %self.param, %int_7
// CHECK:STDOUT: %Destroy.facet.loc20_3.69: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.104: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.69 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.70: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.105: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.70 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.35: init %empty_tuple.type = call %SelfDestruct.specific_fn.35(%.loc14_3.103)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.35: init %empty_tuple.type = call %SelfDestruct.specific_fn.35(%.loc20_3.103)
// CHECK:STDOUT: %int_6: Core.IntLiteral = int_value 6 [concrete = constants.%int_6]
// CHECK:STDOUT: %.loc14_3.106: ref %i32 = array_index %self.param, %int_6
// CHECK:STDOUT: %Destroy.facet.loc14_3.71: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.107: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.71 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.72: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.108: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.72 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.106: ref %i32 = array_index %self.param, %int_6
// CHECK:STDOUT: %Destroy.facet.loc20_3.71: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.107: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.71 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.72: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.108: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.72 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.36: init %empty_tuple.type = call %SelfDestruct.specific_fn.36(%.loc14_3.106)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.36: init %empty_tuple.type = call %SelfDestruct.specific_fn.36(%.loc20_3.106)
// CHECK:STDOUT: %int_5: Core.IntLiteral = int_value 5 [concrete = constants.%int_5]
// CHECK:STDOUT: %.loc14_3.109: ref %i32 = array_index %self.param, %int_5
// CHECK:STDOUT: %Destroy.facet.loc14_3.73: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.110: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.73 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.74: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.111: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.74 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.109: ref %i32 = array_index %self.param, %int_5
// CHECK:STDOUT: %Destroy.facet.loc20_3.73: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.110: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.73 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.74: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.111: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.74 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.37: init %empty_tuple.type = call %SelfDestruct.specific_fn.37(%.loc14_3.109)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.37: init %empty_tuple.type = call %SelfDestruct.specific_fn.37(%.loc20_3.109)
// CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4]
// CHECK:STDOUT: %.loc14_3.112: ref %i32 = array_index %self.param, %int_4
// CHECK:STDOUT: %Destroy.facet.loc14_3.75: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.113: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.75 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.76: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.114: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.76 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.112: ref %i32 = array_index %self.param, %int_4
// CHECK:STDOUT: %Destroy.facet.loc20_3.75: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.113: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.75 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.76: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.114: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.76 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.38: init %empty_tuple.type = call %SelfDestruct.specific_fn.38(%.loc14_3.112)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.38: init %empty_tuple.type = call %SelfDestruct.specific_fn.38(%.loc20_3.112)
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
// CHECK:STDOUT: %.loc14_3.115: ref %i32 = array_index %self.param, %int_3
// CHECK:STDOUT: %Destroy.facet.loc14_3.77: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.116: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.77 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.78: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.117: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.78 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.115: ref %i32 = array_index %self.param, %int_3
// CHECK:STDOUT: %Destroy.facet.loc20_3.77: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.116: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.77 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.78: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.117: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.78 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.39: init %empty_tuple.type = call %SelfDestruct.specific_fn.39(%.loc14_3.115)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.39: init %empty_tuple.type = call %SelfDestruct.specific_fn.39(%.loc20_3.115)
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc14_3.118: ref %i32 = array_index %self.param, %int_2
// CHECK:STDOUT: %Destroy.facet.loc14_3.79: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.119: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.79 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.80: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.120: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.80 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.118: ref %i32 = array_index %self.param, %int_2
// CHECK:STDOUT: %Destroy.facet.loc20_3.79: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.119: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.79 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.80: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.120: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.80 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.40: init %empty_tuple.type = call %SelfDestruct.specific_fn.40(%.loc14_3.118)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.40: init %empty_tuple.type = call %SelfDestruct.specific_fn.40(%.loc20_3.118)
// CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc14_3.121: ref %i32 = array_index %self.param, %int_1
// CHECK:STDOUT: %Destroy.facet.loc14_3.81: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.122: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.81 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.82: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.123: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.82 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.121: ref %i32 = array_index %self.param, %int_1
// CHECK:STDOUT: %Destroy.facet.loc20_3.81: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.122: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.81 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.82: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.123: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.82 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.41: init %empty_tuple.type = call %SelfDestruct.specific_fn.41(%.loc14_3.121)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.41: init %empty_tuple.type = call %SelfDestruct.specific_fn.41(%.loc20_3.121)
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
// CHECK:STDOUT: %.loc14_3.124: ref %i32 = array_index %self.param, %int_0
// CHECK:STDOUT: %Destroy.facet.loc14_3.83: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.125: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.83 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc14_3.84: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc14_3.126: %Destroy.type = converted constants.%i32, %Destroy.facet.loc14_3.84 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.124: ref %i32 = array_index %self.param, %int_0
// CHECK:STDOUT: %Destroy.facet.loc20_3.83: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.125: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.83 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %Destroy.facet.loc20_3.84: %Destroy.type = facet_value constants.%i32, (constants.%DestroyImpl.impl_witness.077, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: %.loc20_3.126: %Destroy.type = converted constants.%i32, %Destroy.facet.loc20_3.84 [concrete = constants.%Destroy.facet.c2b]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc14_3.42: init %empty_tuple.type = call %SelfDestruct.specific_fn.42(%.loc14_3.124)
// CHECK:STDOUT: %SelfDestruct.call.loc20_3.42: init %empty_tuple.type = call %SelfDestruct.specific_fn.42(%.loc20_3.124)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -63,45 +63,114 @@ import Cpp library "functions.h";
fn Call() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.GlobalNoReturn(1);
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalNoReturn'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void;
// CHECK:STDERR: · ┬ ────┬─────────────────────────────
// CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.GlobalNoReturn(1);
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-20: error: no matching function for call to 'GlobalNoReturn' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:2:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:2:21-54: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.GlobalNoReturn();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalNoReturn'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ auto GlobalNoReturn(int a, int b, int c = 1, int d = 2) -> void;
// CHECK:STDERR: · ┬ ───┬──────────────────────────────
// CHECK:STDERR: · ╰────────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 0 were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.GlobalNoReturn();
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 1 was provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.GlobalReturnInt(1);
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalReturnInt'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int;
// CHECK:STDERR: · ┬ ───┬──────────────────────────────
// CHECK:STDERR: · ╰─────────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.GlobalReturnInt(1);
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'GlobalReturnInt' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:3:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:3:22-55: note: requires at least 2 arguments, but 0 were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.GlobalReturnInt();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'GlobalReturnInt'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ auto GlobalReturnInt(int a, int b, int c = 1, int d = 2) -> int;
// CHECK:STDERR: · ┬ ──┬───────────────────────────────
// CHECK:STDERR: · ╰────────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least 2 arguments, but 0 were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.GlobalReturnInt();
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'B' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:6:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:6:10-25: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ ({} as Cpp.X).B();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'B' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ void B(int a, int b = 1);
// CHECK:STDERR: · ┬ ──┬─────────────
// CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least argument 'a', but no arguments were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
({} as Cpp.X).B();
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-9: error: no matching function for call to 'C' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:7:15: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:7:17-32: note: requires at least argument 'a', but no arguments were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.X.C();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'C' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ static void C(int a, int b = 1);
// CHECK:STDERR: · ┬ ┬───────────────
// CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least argument 'a', but no arguments were
// CHECK:STDERR: · │ provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.X.C();
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'D' [CppInteropParseError]
// CHECK:STDERR: ./functions.h:8:8: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./functions.h:8:10-33: note: requires at least non-object argument 'a', but no arguments were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ ({} as Cpp.X).D();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'D' [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./functions.h
// CHECK:STDERR: │ void D(this X, int a, int b = 1);
// CHECK:STDERR: · ┬ ┬───────────────────────
// CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires at least non-object argument 'a', but no arguments were
// CHECK:STDERR: · │ provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
({} as Cpp.X).D();
//@dump-sem-ir-end
@@ -921,49 +990,49 @@ fn Call() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Call() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalNoReturn.ref.loc12: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.loc12: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %Cpp.ref.loc18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalNoReturn.ref.loc18: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalReturnInt.ref.loc24: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.loc24: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %Cpp.ref.loc30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalReturnInt.ref.loc30: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value]
// CHECK:STDOUT: %.loc36_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %Cpp.ref.loc36: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc36: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %.loc36_5.2: ref %X = temporary_storage
// CHECK:STDOUT: %.loc36_5.3: init %X to %.loc36_5.2 = class_init () [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc36_7.1: init %X = converted %.loc36_5.1, %.loc36_5.3 [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc36_7.2: ref %X = temporary %.loc36_5.2, %.loc36_7.1 [concrete = constants.%.414]
// CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalNoReturn.ref.loc22: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.loc22: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalNoReturn.ref.loc38: %GlobalNoReturn.cpp_overload_set.type = name_ref GlobalNoReturn, imports.%GlobalNoReturn.cpp_overload_set.value [concrete = constants.%GlobalNoReturn.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc54: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalReturnInt.ref.loc54: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value]
// CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %Cpp.ref.loc70: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalReturnInt.ref.loc70: %GlobalReturnInt.cpp_overload_set.type = name_ref GlobalReturnInt, imports.%GlobalReturnInt.cpp_overload_set.value [concrete = constants.%GlobalReturnInt.cpp_overload_set.value]
// CHECK:STDOUT: %.loc85_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %Cpp.ref.loc85: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc85: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %.loc85_5.2: ref %X = temporary_storage
// CHECK:STDOUT: %.loc85_5.3: init %X to %.loc85_5.2 = class_init () [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc85_7.1: init %X = converted %.loc85_5.1, %.loc85_5.3 [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc85_7.2: ref %X = temporary %.loc85_5.2, %.loc85_7.1 [concrete = constants.%.414]
// CHECK:STDOUT: %B.ref: %X.B.cpp_overload_set.type = name_ref B, imports.%X.B.cpp_overload_set.value [concrete = constants.%X.B.cpp_overload_set.value]
// CHECK:STDOUT: %bound_method.loc36: <bound method> = bound_method %.loc36_7.2, %B.ref [concrete = constants.%bound_method.f8c]
// CHECK:STDOUT: %Destroy.facet.loc36_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc36_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc36_7.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc36_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc36_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc36_7.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %bound_method.loc85: <bound method> = bound_method %.loc85_7.2, %B.ref [concrete = constants.%bound_method.f8c]
// CHECK:STDOUT: %Destroy.facet.loc85_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc85_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc85_7.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc85_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc85_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc85_7.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc36: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc36_7.2)
// CHECK:STDOUT: %Cpp.ref.loc42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc42: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %SelfDestruct.call.loc85: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc85_7.2)
// CHECK:STDOUT: %Cpp.ref.loc101: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc101: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %C.ref: %X.C.cpp_overload_set.type = name_ref C, imports.%X.C.cpp_overload_set.value [concrete = constants.%X.C.cpp_overload_set.value]
// CHECK:STDOUT: %.loc48_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %Cpp.ref.loc48: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc48: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %.loc48_5.2: ref %X = temporary_storage
// CHECK:STDOUT: %.loc48_5.3: init %X to %.loc48_5.2 = class_init () [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc48_7.1: init %X = converted %.loc48_5.1, %.loc48_5.3 [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc48_7.2: ref %X = temporary %.loc48_5.2, %.loc48_7.1 [concrete = constants.%.414]
// CHECK:STDOUT: %.loc117_5.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %Cpp.ref.loc117: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %X.ref.loc117: type = name_ref X, imports.%X.decl [concrete = constants.%X]
// CHECK:STDOUT: %.loc117_5.2: ref %X = temporary_storage
// CHECK:STDOUT: %.loc117_5.3: init %X to %.loc117_5.2 = class_init () [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc117_7.1: init %X = converted %.loc117_5.1, %.loc117_5.3 [concrete = constants.%X.val]
// CHECK:STDOUT: %.loc117_7.2: ref %X = temporary %.loc117_5.2, %.loc117_7.1 [concrete = constants.%.414]
// CHECK:STDOUT: %D.ref: %X.D.cpp_overload_set.type = name_ref D, imports.%X.D.cpp_overload_set.value [concrete = constants.%X.D.cpp_overload_set.value]
// CHECK:STDOUT: %bound_method.loc48: <bound method> = bound_method %.loc48_7.2, %D.ref [concrete = constants.%bound_method.9a8]
// CHECK:STDOUT: %Destroy.facet.loc48_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc48_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc48_7.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc48_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc48_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc48_7.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %bound_method.loc117: <bound method> = bound_method %.loc117_7.2, %D.ref [concrete = constants.%bound_method.9a8]
// CHECK:STDOUT: %Destroy.facet.loc117_7.1: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc117_7.3: %Destroy.type = converted constants.%X, %Destroy.facet.loc117_7.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc117_7.2: %Destroy.type = facet_value constants.%X, (constants.%DestroyImpl.impl_witness.a05, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc117_7.4: %Destroy.type = converted constants.%X, %Destroy.facet.loc117_7.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc48: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc48_7.2)
// CHECK:STDOUT: %SelfDestruct.call.loc117: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%.loc117_7.2)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -37,7 +37,12 @@ library "[[@TEST_NAME]]";
import Cpp library "global.h";
fn MyF() {
// CHECK:STDERR: fail_import_global_use_different_name.carbon:[[@LINE+2]]:3-9: error: member name `bar` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_global_use_different_name.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.bar();
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.bar();
}
@@ -57,7 +62,12 @@ library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
// CHECK:STDERR: fail_import_special_name_call_unescaped.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_special_name_call_unescaped.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.base();
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `base` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.base();
}
@@ -81,9 +91,19 @@ library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
// CHECK:STDERR: fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+4]]:3-12: error: no matching function for call to 'base' [CppInteropParseError]
// CHECK:STDERR: ./special_name.h:2:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./special_name.h:2:10-11: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_import_special_name_call_escaped_no_match.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.r#base(1);
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'base'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./special_name.h
// CHECK:STDERR: │ auto base() -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires 0 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.r#base(1);
}
@@ -125,7 +145,12 @@ import Cpp library "variadic.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_variadic.carbon:[[@LINE+2]]:3-21: error: semantics TODO: `Unsupported: Variadic function` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_variadic.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.variadic_foo(8);
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: Variadic function`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.variadic_foo(8);
//@dump-sem-ir-end
@@ -138,7 +163,19 @@ fn F() {
// --- static.h
// TODO: Promote this warning to an error by default.
// CHECK:STDERR: ./static.h:[[@LINE+1]]:13: warning: function 'static_foo' has internal linkage but is not defined [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ ./static.h:[[@LINE+13]]:13
// CHECK:STDERR: -> │ static auto static_foo() -> void;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: function 'static_foo' has internal linkage but is not
// CHECK:STDERR: · ┃ defined
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ todo_fail_import_static.carbon
// CHECK:STDERR: │ Cpp.static_foo();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ used here [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
static auto static_foo() -> void;
// --- todo_fail_import_static.carbon
@@ -149,8 +186,6 @@ import Cpp library "static.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: todo_fail_import_static.carbon:[[@LINE+2]]:18: note: used here [CppInteropParseNote]
// CHECK:STDERR:
Cpp.static_foo();
//@dump-sem-ir-end
}
@@ -126,8 +126,22 @@ fn F() {
// --- forward_decl.h
// CHECK:STDERR: error: calling function with incomplete return type 'Incomplete' [CppInteropParseError]
// CHECK:STDERR: ./forward_decl.h:[[@LINE+1]]:7: note: forward declaration of 'Incomplete' [CppInteropParseNote]
// CHECK:STDERR: -> ╭─┤ <no location>
// CHECK:STDERR: · ┗━━┫ error: calling function with incomplete return type 'Incomplete'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./forward_decl.h:[[@LINE+12]]:7
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'Incomplete' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_use_forward_decl.carbon
// CHECK:STDERR: │ Cpp.ReturnCallback()();
// CHECK:STDERR: · ───────────┬──────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function pointer type used here
// CHECK:STDERR: · │ [InCppFunctionPointerThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class Incomplete;
using CallbackType = Incomplete (*)();
@@ -151,12 +165,21 @@ library "[[@TEST_NAME]]";
import Cpp library "forward_decl.h";
fn F() {
// CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+7]]:3-24: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_use_forward_decl.carbon:[[@LINE+5]]:3-24: error: function returns incomplete type `Cpp.Incomplete` [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: included from: fail_use_forward_decl.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./forward_decl.h:4:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: ╭─┤ fail_use_forward_decl.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.ReturnCallback()();
// CHECK:STDERR: · ━━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_use_forward_decl.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./forward_decl.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ <no location>
// CHECK:STDERR: · ╰──┤ return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.ReturnCallback()();
}
@@ -171,7 +194,13 @@ using MyCallbackType = void(*)(int);
fn MyCallback(generic arg: i32);
fn F() {
// CHECK:STDERR: fail_convert_generic_arg.carbon:[[@LINE+2]]:43-52: error: semantics TODO: `binding maps to a non-type template parameter` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_convert_generic_arg.carbon:[[@LINE+8]]:43
// CHECK:STDERR: -> │ var unused fn_ptr: Cpp.MyCallbackType = MyCallback;
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `binding maps to a non-type template parameter`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused fn_ptr: Cpp.MyCallbackType = MyCallback;
}
@@ -186,8 +215,19 @@ using MyCallbackType = void(*)(int);
fn MyCallback(arg: i32) -> i32;
fn F() {
// CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE+3]]:43-52: error: can't convert exported function pointer to `void (*)(int)` [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: fail_convert_type_mismatch.carbon:[[@LINE-4]]:1-31: note: function exported with pointer type `int (*)(int)` [ExportedFromFunction]
// CHECK:STDERR: ╭─┤ fail_convert_type_mismatch.carbon:[[@LINE+14]]:43
// CHECK:STDERR: │ fn MyCallback(arg: i32) -> i32;
// CHECK:STDERR: · ───────────────┬───────────────
// CHECK:STDERR: · ╰──┤ function exported with pointer type `int (*)(int)`
// CHECK:STDERR: · │ [ExportedFromFunction]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ var unused fn_ptr: Cpp.MyCallbackType = MyCallback;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: can't convert exported
// CHECK:STDERR: · ┃ function pointer to
// CHECK:STDERR: · ┃ `void (*)(int)`
// CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused fn_ptr: Cpp.MyCallbackType = MyCallback;
}
@@ -37,7 +37,18 @@ fn MyF() {
// --- without_definition.h
// TODO: Promote this warning to an error by default.
// CHECK:STDERR: ./without_definition.h:[[@LINE+1]]:13: warning: inline function 'inline_without_def' is not defined [CppInteropParseWarning]
// CHECK:STDERR: ╭─┤ ./without_definition.h:[[@LINE+12]]:13
// CHECK:STDERR: -> │ inline void inline_without_def();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: inline function 'inline_without_def' is not defined
// CHECK:STDERR: · ┃ [CppInteropParseWarning]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ todo_fail_import_without_definition.carbon
// CHECK:STDERR: │ Cpp.inline_without_def();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ used here [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
inline void inline_without_def();
// --- todo_fail_import_without_definition.carbon
@@ -48,8 +59,6 @@ import Cpp library "without_definition.h";
fn MyF() {
//@dump-sem-ir-begin
// CHECK:STDERR: todo_fail_import_without_definition.carbon:[[@LINE+2]]:26: note: used here [CppInteropParseNote]
// CHECK:STDERR:
Cpp.inline_without_def();
// Don't error on repeated calls.
@@ -131,12 +140,12 @@ fn MyF() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @MyF() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %inline_without_def.ref.loc10: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
// CHECK:STDOUT: %inline_without_def.call.loc10: init %empty_tuple.type = call imports.%inline_without_def.decl()
// CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %inline_without_def.ref.loc13: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
// CHECK:STDOUT: %inline_without_def.call.loc13: init %empty_tuple.type = call imports.%inline_without_def.decl()
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %inline_without_def.ref.loc8: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
// CHECK:STDOUT: %inline_without_def.call.loc8: init %empty_tuple.type = call imports.%inline_without_def.decl()
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %inline_without_def.ref.loc11: %inline_without_def.cpp_overload_set.type = name_ref inline_without_def, imports.%inline_without_def.cpp_overload_set.value [concrete = constants.%inline_without_def.cpp_overload_set.value]
// CHECK:STDOUT: %inline_without_def.call.loc11: init %empty_tuple.type = call imports.%inline_without_def.decl()
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -75,15 +75,44 @@ library "[[@TEST_NAME]]";
import Cpp library "method_ptr.h";
fn F(c: Cpp.C) {
// CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3-24: error: member name of type `<C++ type void (C::*)(void) const>` in compound member access is not an instance member or an interface member [CompoundMemberAccessDoesNotUseBase]
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+39]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name of type `<C++ type void (C::*)(void) const>` in
// CHECK:STDERR: · ┃ compound member access is not an instance member or an interface
// CHECK:STDERR: · ┃ member
// CHECK:STDERR: · ┃ [CompoundMemberAccessDoesNotUseBase]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+8]]:3-28: error: semantics TODO: `invoking a C++ member function pointer is unsupported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+30]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `invoking a C++ member function pointer is unsupported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: error: called object type 'void (C::*)() const' is not a function or function pointer [CppInteropParseError]
// CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+5]]:3-28: note: in thunk for C++ function pointer type used here [InCppFunctionPointerThunk]
// CHECK:STDERR: -> ╭─┤ <no location>
// CHECK:STDERR: · ┗━━┫ error: called object type 'void (C::*)() const' is not a function or
// CHECK:STDERR: · ┃ function pointer
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon:[[@LINE+17]]:3
// CHECK:STDERR: │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ─────────────┬────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function pointer type used here
// CHECK:STDERR: · │ [InCppFunctionPointerThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_call_method_ptr.carbon:[[@LINE+3]]:3-28: error: 1 argument passed to function expecting 0 arguments [CallArgCountMismatch]
// CHECK:STDERR: fail_todo_call_method_ptr.carbon: note: calling function declared here [InCallToEntity]
// CHECK:STDERR: ╭─┤ fail_todo_call_method_ptr.carbon:[[@LINE+10]]:3
// CHECK:STDERR: -> │ c.(Cpp.GetMethodPtr())(42);
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: 1 argument passed to function expecting 0 arguments
// CHECK:STDERR: · ┃ [CallArgCountMismatch]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_todo_call_method_ptr.carbon
// CHECK:STDERR: · ╰──┤ calling function declared here [InCallToEntity]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c.(Cpp.GetMethodPtr())(42);
}
@@ -96,8 +125,19 @@ import Cpp library "method_ptr.h";
fn F(ref c: Cpp.C);
fn G() {
// CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE+3]]:39: error: can't convert exported function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: fail_pass_function_for_method.carbon:[[@LINE-4]]:1-19: note: function exported with pointer type `void (*)(class C &)` [ExportedFromFunction]
// CHECK:STDERR: ╭─┤ fail_pass_function_for_method.carbon:[[@LINE+14]]:39
// CHECK:STDERR: │ fn F(ref c: Cpp.C);
// CHECK:STDERR: · ─────────┬─────────
// CHECK:STDERR: · ╰──┤ function exported with pointer type `void (*)(class C &)`
// CHECK:STDERR: · │ [ExportedFromFunction]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = F;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: can't convert exported
// CHECK:STDERR: · ┃ function pointer to
// CHECK:STDERR: · ┃ `void (C::*)(void) const`
// CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused ptr: Cpp.MethodPtrType = F;
}
@@ -112,8 +152,20 @@ class C {
}
fn F() {
// CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (C::*)(void) const` [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: fail_wrong_parent_type.carbon:[[@LINE-5]]:3-18: note: function exported with pointer type `void (Carbon::Main::C::*)(void) const` [ExportedFromFunction]
// CHECK:STDERR: ╭─┤ fail_wrong_parent_type.carbon:[[@LINE+15]]:39
// CHECK:STDERR: │ fn Method(self);
// CHECK:STDERR: · ┬───────────────
// CHECK:STDERR: · ╰──┤ function exported with pointer type
// CHECK:STDERR: · │ `void (Carbon::Main::C::*)(void) const`
// CHECK:STDERR: · │ [ExportedFromFunction]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = C.Method;
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: can't convert exported member
// CHECK:STDERR: · ┃ function pointer to
// CHECK:STDERR: · ┃ `void (C::*)(void) const`
// CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused ptr: Cpp.MethodPtrType = C.Method;
}
@@ -133,8 +185,20 @@ using MethodPtrType = void(Carbon::C::*)(float) const;
fn G() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:39-46: error: can't convert exported member function pointer to `void (Carbon::Main::C::*)(float) const` [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE-10]]:3-26: note: function exported with pointer type `void (Carbon::Main::C::*)(int) const` [ExportedFromFunction]
// CHECK:STDERR: ╭─┤ fail_type_mismatch.carbon:[[@LINE+15]]:39
// CHECK:STDERR: │ fn Method(self, i: i32);
// CHECK:STDERR: · ┬───────────────────────
// CHECK:STDERR: · ╰──┤ function exported with pointer type
// CHECK:STDERR: · │ `void (Carbon::Main::C::*)(int) const`
// CHECK:STDERR: · │ [ExportedFromFunction]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ var unused ptr: Cpp.MethodPtrType = C.Method;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: can't convert exported member function pointer to
// CHECK:STDERR: · ┃ `void (Carbon::Main::C::*)(float) const`
// CHECK:STDERR: · ┃ [ExportedFunctionPtrTypeMismatch]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused ptr: Cpp.MethodPtrType = C.Method;
//@dump-sem-ir-end
@@ -415,7 +479,7 @@ fn G() {
// CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc18 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.3: type = fn_type @SubobjectDestroy.WithSelf.Op.loc30 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.3: %SubobjectDestroy.WithSelf.Op.type.6870fd.3 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.3: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.3), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.886: %SubobjectDestroy.type = facet_value %.659, (%custom_witness.b80ef6.3) [concrete]
@@ -438,7 +502,7 @@ fn G() {
// CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %Method.ref: %C.Method.type = name_ref Method, @C.%C.Method.decl [concrete = constants.%C.Method]
// CHECK:STDOUT: assign %ptr.var, <error>
// CHECK:STDOUT: %.loc18_22: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] {
// CHECK:STDOUT: %.loc30_22: type = splice_block %MethodPtrType.ref [concrete = constants.%.659] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %MethodPtrType.ref: type = name_ref MethodPtrType, constants.%.659 [concrete = constants.%.659]
// CHECK:STDOUT: }
@@ -447,10 +511,10 @@ fn G() {
// CHECK:STDOUT: %ptr.patt: %pattern_type.4b7 = ref_binding_pattern ptr [concrete = constants.%ptr.patt]
// CHECK:STDOUT: %ptr.var_patt: %pattern_type.4b7 = var_pattern %ptr.patt [concrete = constants.%ptr.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc18_3.1: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %.loc18_3.1: %Destroy.type = converted constants.%.659, %Destroy.facet.loc18_3.1 [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %Destroy.facet.loc18_3.2: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %.loc18_3.2: %Destroy.type = converted constants.%.659, %Destroy.facet.loc18_3.2 [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %Destroy.facet.loc30_3.1: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %.loc30_3.1: %Destroy.type = converted constants.%.659, %Destroy.facet.loc30_3.1 [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %Destroy.facet.loc30_3.2: %Destroy.type = facet_value constants.%.659, (constants.%DestroyImpl.impl_witness.381, constants.%custom_witness.b80ef6.3) [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: %.loc30_3.2: %Destroy.type = converted constants.%.659, %Destroy.facet.loc30_3.2 [concrete = constants.%Destroy.facet.f79]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%ptr.var)
// CHECK:STDOUT: <elided>
@@ -459,10 +523,10 @@ fn G() {
// CHECK:STDOUT: fn @C.Method__carbon_thunk(%self.param: ref %C, %_.param: ref %i32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc18_40.1: %C = acquire_value %self.param
// CHECK:STDOUT: %.loc18_40.2: %i32 = acquire_value %_.param
// CHECK:STDOUT: %.loc30_40.1: %C = acquire_value %self.param
// CHECK:STDOUT: %.loc30_40.2: %i32 = acquire_value %_.param
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc18(%self.param: ref %.659) = "no_op";
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc30(%self.param: ref %.659) = "no_op";
// CHECK:STDOUT:
@@ -22,14 +22,30 @@ void F2(X x);
fn Call() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F1' [CppInteropParseError]
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-7]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-8]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+12]]:3
// CHECK:STDERR: │ void F1(X x);
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires single argument 'x', but no arguments were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.F1();
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F1' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.F1();
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE+4]]:3-8: error: no matching function for call to 'F2' [CppInteropParseError]
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-11]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_call_too_few_args.carbon:[[@LINE-12]]:9-11: note: requires single argument 'x', but no arguments were provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_too_few_args.carbon:[[@LINE+12]]:3
// CHECK:STDERR: │ void F2(X x);
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰──────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires single argument 'x', but no arguments were provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.F2();
// CHECK:STDERR: · ━━━┳━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F2' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.F2();
//@dump-sem-ir-end
@@ -57,9 +73,9 @@ fn Call() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @Call() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %F1.ref: %F1.cpp_overload_set.type = name_ref F1, imports.%F1.cpp_overload_set.value [concrete = constants.%F1.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc37: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %F2.ref: %F2.cpp_overload_set.type = name_ref F2, imports.%F2.cpp_overload_set.value [concrete = constants.%F2.cpp_overload_set.value]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
@@ -140,9 +140,23 @@ import Cpp library "int_literal.h";
fn F() {
// TODO: get rid of the second error message here.
// i128_max + 1
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:44-82: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType]
// CHECK:STDERR: ╭─┤ fail_import_large_int_literal.carbon:[[@LINE+18]]:44
// CHECK:STDERR: -> │ ...ed h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: integer value 170141183460469231731687303715884105728 too large to fit
// CHECK:STDERR: · ┃ in a signed C++ integer type; requires 129 bits, but max is 128
// CHECK:STDERR: · ┃ [IntTooLargeForCppType]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+2]]:44-82: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╭─┤ fail_import_large_int_literal.carbon:[[@LINE+9]]:44
// CHECK:STDERR: -> │ ...ed h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call argument of type
// CHECK:STDERR: · ┃ `Core.IntLiteral` is not
// CHECK:STDERR: · ┃ supported
// CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused h: i128 = Cpp.int_literal_foo(170141183460469231731687303715884105728);
}
@@ -174,8 +188,19 @@ library "[[@TEST_NAME]]";
import Cpp library "negative_literal_passed_to_unsigned.h";
fn F() {
// CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+3]]:27-28: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
// CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:39: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+14]]:27
// CHECK:STDERR: -> │ Cpp.neg_to_unsigned_foo(-1);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: negative integer value -1 converted to
// CHECK:STDERR: · ┃ unsigned type `u32`
// CHECK:STDERR: · ┃ [NegativeIntInUnsignedType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./negative_literal_passed_to_unsigned.h
// CHECK:STDERR: │ auto neg_to_unsigned_foo(unsigned int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.neg_to_unsigned_foo(-1);
}
@@ -202,8 +227,19 @@ library "[[@TEST_NAME]]";
import Cpp library "floating_point_literal.h";
fn F() {
// CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+3]]:25-32: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
// CHECK:STDERR: ./floating_point_literal.h:3:31: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_large_floating_point_literal.carbon:[[@LINE+14]]:25
// CHECK:STDERR: -> │ Cpp.float_literal_foo(1.8e+308);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: value 18*10^307 too large for floating-point
// CHECK:STDERR: · ┃ type `f64`
// CHECK:STDERR: · ┃ [FloatLiteralTooLargeForType]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./floating_point_literal.h
// CHECK:STDERR: │ auto float_literal_foo(double a) -> double;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.float_literal_foo(1.8e+308);
}
@@ -247,33 +283,110 @@ import Cpp library "struct_init.h";
fn MakeThreeFields() -> {.a: i32, .b: i32, .c: i32};
fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: i32, .c: i32}) {
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: error: cannot implicitly convert expression of type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-46: note: type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `{.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral}` does
// CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-27: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-27: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(value);
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-31: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(reference);
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-39: error: cannot implicitly convert expression of type `{.a: i32, .b: i32, .c: i32}` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-39: note: type `{.a: i32, .b: i32, .c: i32}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+19]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{.a: i32, .b: i32, .c: i32}` to
// CHECK:STDERR: · │ ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.a: i32, .b: i32, .c: i32}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+4]]:23-46: error: cannot implicitly convert expression of type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+3]]:23-46: note: type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_struct_init_nonempty.carbon:[[@LINE+20]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `{.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral}` does
// CHECK:STDERR: · │ not implement interface `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3});
}
@@ -285,15 +398,37 @@ library "[[@TEST_NAME]]";
import Cpp library "struct_init.h";
fn F() {
// CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError]
// CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_struct_init_field_mismatch.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4});
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'PassThreeFields'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬ ┬────────────
// CHECK:STDERR: · ╰──────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to
// CHECK:STDERR: · │ 'ThreeFields'
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4});
// CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+4]]:3-21: error: no matching function for call to 'PassThreeFields' [CppInteropParseError]
// CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./struct_init.h:10:22-34: note: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_struct_init_field_mismatch.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3});
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'PassThreeFields'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬ ┬────────────
// CHECK:STDERR: · ╰──────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to
// CHECK:STDERR: · │ 'ThreeFields'
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3});
}
@@ -305,7 +440,12 @@ library "[[@TEST_NAME]]";
import Cpp library "struct_init.h";
fn F() {
// CHECK:STDERR: fail_struct_init_unsupported_field_name.carbon:[[@LINE+2]]:23-33: error: field name `base` cannot be mapped into C++ [CppCallFieldNameNotSupported]
// CHECK:STDERR: ╭─┤ fail_struct_init_unsupported_field_name.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields({.base = 1});
// CHECK:STDERR: · ━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: field name `base` cannot be mapped into C++
// CHECK:STDERR: · ┃ [CppCallFieldNameNotSupported]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields({.base = 1});
}
@@ -322,27 +462,79 @@ import Cpp library "struct_init.h";
fn MakeEmpty() -> ();
fn Empty(value: (), ref reference: ()) {
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-21: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-21: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassNoFields(());
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-24: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-24: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassNoFields(value);
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-28: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-28: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassNoFields(reference);
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:20-30: error: cannot implicitly convert expression of type `()` to `Cpp.NoFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:20-30: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.NoFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:20
// CHECK:STDERR: -> │ Cpp.PassNoFields(MakeEmpty());
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()`
// CHECK:STDERR: · │ ┃ to `Cpp.NoFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NoFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassNoFields(NoFields s) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassNoFields(MakeEmpty());
}
@@ -350,27 +542,83 @@ fn Empty(value: (), ref reference: ()) {
fn MakeThreeFields() -> (i32, i32, i32);
fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-31: note: type `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+21]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields((1, 2, 3));
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)` to
// CHECK:STDERR: · ┃ `Cpp.ThreeFields`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type
// CHECK:STDERR: · │ `(Core.IntLiteral, Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields((1, 2, 3));
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-27: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-27: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(value);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(value);
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-31: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-31: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(reference);
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(reference);
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+4]]:23-39: error: cannot implicitly convert expression of type `(i32, i32, i32)` to `Cpp.ThreeFields` [ConversionFailure]
// CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+3]]:23-39: note: type `(i32, i32, i32)` does not implement interface `Core.ImplicitAs(Cpp.ThreeFields)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_struct_init_from_tuple.carbon:[[@LINE+17]]:23
// CHECK:STDERR: -> │ Cpp.PassThreeFields(MakeThreeFields());
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `(i32, i32, i32)` to `Cpp.ThreeFields`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(i32, i32, i32)` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ThreeFields)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./struct_init.h
// CHECK:STDERR: │ auto PassThreeFields(ThreeFields t) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassThreeFields(MakeThreeFields());
}
@@ -393,15 +641,39 @@ import Cpp library "int_from_struct.h";
fn F() {
// C++ permits `{}` to be used to initialize an int, but Carbon does not.
// CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+3]]:15-16: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15
// CHECK:STDERR: -> │ Cpp.PassInt({});
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `{}` to
// CHECK:STDERR: · │ ┃ `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassInt(int n) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassInt({});
// CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+4]]:15-16: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+3]]:15-16: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_int_from_struct.carbon:[[@LINE+16]]:15
// CHECK:STDERR: -> │ Cpp.PassInt(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `()` to
// CHECK:STDERR: · │ ┃ `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassInt(int n) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassInt(());
}
@@ -416,15 +688,41 @@ fn F() {
// C++ overload resolution prefers to convert `{}` to `int` rather than to an
// empty struct. So that's the overload we pick, even though we can't call it.
// CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+3]]:22-23: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22
// CHECK:STDERR: -> │ Cpp.PassOverloaded({});
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `{}` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassOverloaded(int n) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassOverloaded({});
// CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+4]]:22-23: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+3]]:22-23: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_int_from_struct_overloaded.carbon:[[@LINE+17]]:22
// CHECK:STDERR: -> │ Cpp.PassOverloaded(());
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `()` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./int_from_struct.h
// CHECK:STDERR: │ auto PassOverloaded(int n) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.PassOverloaded(());
}
@@ -449,9 +747,19 @@ library "[[@TEST_NAME]]";
import Cpp library "nested_structs.h";
fn F() {
// CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+4]]:3-11: error: no matching function for call to 'TakeB' [CppInteropParseError]
// CHECK:STDERR: ./nested_structs.h:11:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./nested_structs.h:11:12: note: cannot convert initializer list argument to 'B' [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3});
// CHECK:STDERR: · ━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakeB'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./nested_structs.h
// CHECK:STDERR: │ void TakeB(B);
// CHECK:STDERR: · ┬ ┬
// CHECK:STDERR: · ╰────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ cannot convert initializer list argument to 'B'
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3});
}
@@ -463,9 +771,24 @@ library "[[@TEST_NAME]]";
import Cpp library "nested_structs.h";
fn F() {
// CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+4]]:13-43: error: cannot implicitly convert expression of type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` to `Cpp.B` [ConversionFailure]
// CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+3]]:13-43: note: type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.B)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./nested_structs.h:11:13: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_pass_nested_structs.carbon:[[@LINE+19]]:13
// CHECK:STDERR: -> │ Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3});
// CHECK:STDERR: · ━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}`
// CHECK:STDERR: · ┃ to `Cpp.B`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭──────────────────────────╯
// CHECK:STDERR: · │ type `{.a: {.x: Core.IntLiteral, .y: Core.IntLiteral}, .n: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface `Core.ImplicitAs(Cpp.B)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./nested_structs.h
// CHECK:STDERR: │ void TakeB(B);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3});
}
@@ -499,9 +822,22 @@ library "[[@TEST_NAME]]";
import Cpp library "signedness_change.h";
fn F() {
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+4]]:22-29: error: cannot implicitly convert expression of type `i32` to `u32` [ConversionFailure]
// CHECK:STDERR: fail_signedness_change_rejected.carbon:[[@LINE+3]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./signedness_change.h:2:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_signedness_change_rejected.carbon:[[@LINE+17]]:22
// CHECK:STDERR: -> │ Cpp.signedness_foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `i32` to `u32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(u32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./signedness_change.h
// CHECK:STDERR: │ auto signedness_foo(unsigned int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.signedness_foo(1 as i32);
}
@@ -517,9 +853,22 @@ library "[[@TEST_NAME]]";
import Cpp library "downsizing_rejected.h";
fn F() {
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+4]]:22-29: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
// CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+3]]:22-29: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./downsizing_rejected.h:2:27: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_downsizing_rejected.carbon:[[@LINE+17]]:22
// CHECK:STDERR: -> │ Cpp.downsizing_foo(1 as i32);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `i32` to `i16`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i16)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./downsizing_rejected.h
// CHECK:STDERR: │ auto downsizing_foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.downsizing_foo(1 as i32);
}
@@ -539,9 +888,20 @@ library "[[@TEST_NAME]]";
import Cpp library "no_viable_function.h";
fn F() {
// CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+4]]:3-19: error: no matching function for call to 'no_viable_foo' [CppInteropParseError]
// CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./no_viable_function.h:2:20-33: note: requires 2 arguments, but 1 was provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_import_no_viable_function.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.no_viable_foo(1 as i64);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'no_viable_foo'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./no_viable_function.h
// CHECK:STDERR: │ auto no_viable_foo(short a, int b) -> void;
// CHECK:STDERR: · ┬ ───────┬──────
// CHECK:STDERR: · ╰───────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires 2 arguments, but 1 was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.no_viable_foo(1 as i64);
}
@@ -562,9 +922,20 @@ library "[[@TEST_NAME]]";
import Cpp library "ambiguous_overload.h";
fn F() {
// CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+4]]:3-19: error: call to 'ambiguous_foo' is ambiguous [CppInteropParseError]
// CHECK:STDERR: ./ambiguous_overload.h:2:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ./ambiguous_overload.h:3:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_ambiguous_overload.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.ambiguous_foo(1 as i64);
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to 'ambiguous_foo' is ambiguous
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./ambiguous_overload.h
// CHECK:STDERR: │ auto ambiguous_foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ auto ambiguous_foo(int a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.ambiguous_foo(1 as i64);
}
@@ -585,9 +956,20 @@ library "[[@TEST_NAME]]";
import Cpp library "deleted_function.h";
fn F() {
// CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+4]]:3-17: error: call to deleted function 'deleted_foo' [CppInteropParseError]
// CHECK:STDERR: ./deleted_function.h:3:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ./deleted_function.h:2:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_import_deleted_function.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.deleted_foo(1 as i32);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: call to deleted function 'deleted_foo'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./deleted_function.h
// CHECK:STDERR: │ auto deleted_foo(short a) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ auto deleted_foo(int a) -> void = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.deleted_foo(1 as i32);
}
@@ -605,8 +987,18 @@ interface I {}
fn EchoValue[ValueT: I](unused generic value: ValueT) {}
fn F() {
// CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+3]]:3-33: error: cannot convert type `<type of Cpp.missing_impl_foo>` into type implementing `I` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-4]]:1-55: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_missing_impl.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EchoValue[ValueT: I](unused generic value: ValueT) {}
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EchoValue(Cpp.missing_impl_foo);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `<type of Cpp.missing_impl_foo>` into type
// CHECK:STDERR: · ┃ implementing `I`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EchoValue(Cpp.missing_impl_foo);
}
@@ -26,7 +26,12 @@ import Cpp library "unsupported_primitive_type.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+2]]:3-13: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_primitive_type.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo(11);
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(11);
//@dump-sem-ir-end
@@ -48,7 +53,12 @@ import Cpp library "unsupported_primitive_type_among_params.h";
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+2]]:3-16: error: semantics TODO: `Unsupported: parameter type: _BitInt(23)` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_primitive_type_among_params.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.foo(1, 20);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: parameter type: _BitInt(23)`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(1, 20);
//@dump-sem-ir-end
@@ -70,9 +80,19 @@ import Cpp library "int_param.h";
// This doesn't have a direct type mapping in `getIntTypeForBitwidth`.
fn F(x: i512) {
// CHECK:STDERR: fail_large_int.carbon:[[@LINE+4]]:11: error: call argument of type `i512` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╭─┤ fail_large_int.carbon:[[@LINE+14]]:11
// CHECK:STDERR: -> │ Cpp.foo(x);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: call argument of type `i512` is not supported
// CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: min_prelude/parts/int.carbon:10:1-26: error: semantics TODO: `interop with non-identifier package name` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ min_prelude/parts/int.carbon:10:1
// CHECK:STDERR: -> │ class Int(N: IntLiteral) {
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with non-identifier package name`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(x);
}
@@ -85,7 +105,12 @@ import Cpp library "int_param.h";
// This doesn't fit as an embedded `IntId` value.
fn F(x: i8388608) {
// CHECK:STDERR: fail_very_large_int.carbon:[[@LINE+2]]:11: error: call argument of type `i8388608` is not supported [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╭─┤ fail_very_large_int.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Cpp.foo(x);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: call argument of type `i8388608` is not supported
// CHECK:STDERR: · ┃ [CppCallArgTypeNotSupported]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo(x);
}
@@ -43,9 +43,21 @@ fn G() -> const Cpp.NonNullableParamS;
fn F() {
var s: const Cpp.NonNullableParamS = G();
// CHECK:STDERR: fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+4]]:3-28: error: no matching function for call to 'non_nullable_param_foo' [CppInteropParseError]
// CHECK:STDERR: ./non_nullable_pointer_param.h:4:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./non_nullable_pointer_param.h:4:29-55: note: 1st argument ('const NonNullableParamS * _Nonnull') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_import_non_nullable_pointer_param_using_const_value.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.non_nullable_param_foo(&s);
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'non_nullable_param_foo'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./non_nullable_pointer_param.h
// CHECK:STDERR: │ auto non_nullable_param_foo(NonNullableParamS* _Nonnull) -> void;
// CHECK:STDERR: · ┬ ┬──────────────────────────
// CHECK:STDERR: · ╰─────────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const NonNullableParamS *
// CHECK:STDERR: · │ _Nonnull') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.non_nullable_param_foo(&s);
}
@@ -413,8 +425,19 @@ import Cpp library "deduced_pointer_param.h";
fn F() {
// This could return a null pointer, so should not be given the type `Cpp.DeducedPointerS*`.
// CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+3]]:40-78: error: cannot implicitly convert expression of type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to `Cpp.DeducedPointerS*` [ConversionFailure]
// CHECK:STDERR: fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+2]]:40-78: note: type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_import_deduced_pointer_param_as_optional_pointer.carbon:[[@LINE+14]]:40
// CHECK:STDERR: -> │ let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS);
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` to
// CHECK:STDERR: · ┃ `Cpp.DeducedPointerS*`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────────────────────────────╯
// CHECK:STDERR: · │ type `Core.Optional(Cpp.DeducedPointerS* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(Cpp.DeducedPointerS*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: Cpp.DeducedPointerS* = Cpp.Indirect({} as Cpp.DeducedPointerS);
}
@@ -44,29 +44,69 @@ fn F() {
//@dump-sem-ir-begin
var v: Cpp.S;
let s: Cpp.S = v;
// CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError]
// CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesLValue(s);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_lvalue_ref.h
// CHECK:STDERR: │ auto TakesLValue(S&) -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesLValue(s);
// CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError]
// CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesLValue(s as const Cpp.S);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_lvalue_ref.h
// CHECK:STDERR: │ auto TakesLValue(S&) -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesLValue(s as const Cpp.S);
var t: Cpp.T;
// CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError]
// CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: no known conversion from 'T' to 'S &' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesLValue(t);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_lvalue_ref.h
// CHECK:STDERR: │ auto TakesLValue(S&) -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'S &' for 1st argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesLValue(t);
var u: Cpp.S;
// CHECK:STDERR: fail_param_lvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesLValue' [CppInteropParseError]
// CHECK:STDERR: ./param_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_lvalue_ref.h:5:18-19: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesLValue(u as const Cpp.S);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesLValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_lvalue_ref.h
// CHECK:STDERR: │ auto TakesLValue(S&) -> void;
// CHECK:STDERR: · ┬ ─┬
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesLValue(u as const Cpp.S);
//@dump-sem-ir-end
@@ -119,9 +159,19 @@ import Cpp library "param_rvalue_ref.h";
fn F() {
let s: Cpp.S = {};
// CHECK:STDERR: fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_value_arg_for_rvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesRValue(s);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_rvalue_ref.h
// CHECK:STDERR: │ auto TakesRValue(S&&) -> void;
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesRValue(s);
}
@@ -135,22 +185,52 @@ import Cpp library "param_rvalue_ref.h";
fn F() {
//@dump-sem-ir-begin
var s: Cpp.S;
// CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: expects an rvalue for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesRValue(s);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_rvalue_ref.h
// CHECK:STDERR: │ auto TakesRValue(S&&) -> void;
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for 1st argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesRValue(s);
var t: Cpp.T;
// CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: no known conversion from 'T' to 'S' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesRValue(t);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_rvalue_ref.h
// CHECK:STDERR: │ auto TakesRValue(S&&) -> void;
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'S' for 1st argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesRValue(t);
// CHECK:STDERR: fail_param_rvalue_ref.carbon:[[@LINE+4]]:3-17: error: no matching function for call to 'TakesRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_rvalue_ref.h:5:18-20: note: 1st argument ('const S') would lose const qualifier [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_rvalue_ref.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S);
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_rvalue_ref.h
// CHECK:STDERR: │ auto TakesRValue(S&&) -> void;
// CHECK:STDERR: · ┬ ─┬─
// CHECK:STDERR: · ╰───────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ 1st argument ('const S') would lose const qualifier
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesRValue(({} as Cpp.S) as const Cpp.S);
//@dump-sem-ir-end
@@ -205,9 +285,20 @@ import Cpp library "param_const_lvalue_ref.h";
fn F() {
var t: Cpp.T;
// CHECK:STDERR: fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstLValue' [CppInteropParseError]
// CHECK:STDERR: ./param_const_lvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_const_lvalue_ref.h:5:23-30: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_call_param_const_lvalue_ref_with_wrong_type.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.TakesConstLValue(t);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstLValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_const_lvalue_ref.h
// CHECK:STDERR: │ auto TakesConstLValue(const S&) -> void;
// CHECK:STDERR: · ┬ ┬───────
// CHECK:STDERR: · ╰───────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'const S' for 1st
// CHECK:STDERR: · │ argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesConstLValue(t);
}
@@ -260,16 +351,38 @@ import Cpp library "param_const_rvalue_ref.h";
fn F() {
//@dump-sem-ir-begin
var s: Cpp.S;
// CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: expects an rvalue for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.TakesConstRValue(s);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_const_rvalue_ref.h
// CHECK:STDERR: │ auto TakesConstRValue(const S&&) -> void;
// CHECK:STDERR: · ┬ ────┬────
// CHECK:STDERR: · ╰───────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ expects an rvalue for 1st argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesConstRValue(s);
var t: Cpp.T;
// CHECK:STDERR: fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+4]]:3-22: error: no matching function for call to 'TakesConstRValue' [CppInteropParseError]
// CHECK:STDERR: ./param_const_rvalue_ref.h:5:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: ./param_const_rvalue_ref.h:5:23-31: note: no known conversion from 'T' to 'const S' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_param_lvalue_ref_arg_const_rvalue_ref.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.TakesConstRValue(t);
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'TakesConstRValue'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./param_const_rvalue_ref.h
// CHECK:STDERR: │ auto TakesConstRValue(const S&&) -> void;
// CHECK:STDERR: · ┬ ┬────────
// CHECK:STDERR: · ╰───────────────────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'T' to 'const S' for 1st
// CHECK:STDERR: · │ argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakesConstRValue(t);
//@dump-sem-ir-end
@@ -348,8 +461,16 @@ library "[[@TEST_NAME]]";
import Cpp library "return_const_lvalue_ref.h";
fn F() {
// CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+3]]:29-51: error: cannot implicitly convert expression of type `const Cpp.S` to `Cpp.S` [ConversionFailure]
// CHECK:STDERR: fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+2]]:29-51: note: type `const Cpp.S` does not implement interface `Core.ImplicitAs(Cpp.S)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_call_return_const_lvalue_ref_const_correctness.carbon:[[@LINE+11]]:29
// CHECK:STDERR: -> │ let unused ref s: Cpp.S = Cpp.ReturnConstLValue();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `const Cpp.S` to `Cpp.S`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `const Cpp.S` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.S)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused ref s: Cpp.S = Cpp.ReturnConstLValue();
}
@@ -423,8 +544,19 @@ template<typename T> void TakeAnything_ExpectConstLRef_ByRef(T&&) {
''';
fn PassConstRef(ref x: const XByRef) {
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+3]]:42-46: error: `ref` tag is not an argument to a `ref` parameter [RefTagNoRefParam]
// CHECK:STDERR: fail_todo_forwarding_reference_by_ref.carbon:[[@LINE-7]]:65: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_todo_forwarding_reference_by_ref.carbon:[[@LINE+14]]:42
// CHECK:STDERR: │ template<typename T> void TakeAnything_ExpectConstLRef_ByRef(T&&) {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╭───────────────────────────────────────────────────────────────╯
// CHECK:STDERR: · │ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: `ref` tag is not an
// CHECK:STDERR: · ┃ argument to a `ref`
// CHECK:STDERR: · ┃ parameter
// CHECK:STDERR: · ┃ [RefTagNoRefParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.TakeAnything_ExpectConstLRef_ByRef(ref x);
}
@@ -607,28 +739,28 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %s.patt: %pattern_type.0f5 = value_binding_pattern s [concrete = constants.%s.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc14: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref.loc14: %S = name_ref s, %s
// CHECK:STDOUT: %Cpp.ref.loc20_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc20: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref.loc20: %S = name_ref s, %s
// CHECK:STDOUT: %Cpp.ref.loc20_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc20: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const.loc20: type = const_type %S.ref.loc20 [concrete = constants.%const]
// CHECK:STDOUT: %.loc20_21.1: %const = as_compatible %s.ref.loc20
// CHECK:STDOUT: %.loc20_21.2: %const = converted %s.ref.loc20, %.loc20_21.1
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc24: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref.loc24: %S = name_ref s, %s
// CHECK:STDOUT: %Cpp.ref.loc40_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc40: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref.loc40: %S = name_ref s, %s
// CHECK:STDOUT: %Cpp.ref.loc40_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc40: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const.loc40: type = const_type %S.ref.loc40 [concrete = constants.%const]
// CHECK:STDOUT: %.loc40_21.1: %const = as_compatible %s.ref.loc40
// CHECK:STDOUT: %.loc40_21.2: %const = converted %s.ref.loc40, %.loc40_21.1
// CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc22: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc22_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc22 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc22: type = facet_access_type %.loc22_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc22_15.2: type = converted %.loc22_15.1, %as_type.loc22 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc42: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc42_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc42 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc42: type = facet_access_type %.loc42_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc42_15.2: type = converted %.loc42_15.1, %as_type.loc42 [concrete = constants.%T.ed0]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc22_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc22: init %T.ed0 to %.loc22_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc22
// CHECK:STDOUT: %.loc22_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc42_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc42: init %T.ed0 to %.loc42_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc42
// CHECK:STDOUT: %.loc42_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0]
// CHECK:STDOUT: }
// CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var
@@ -636,47 +768,47 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420]
// CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc27: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc27: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc57: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc57: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t
// CHECK:STDOUT: %u.var: ref %S = var_storage %u.var_patt
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc29: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb]
// CHECK:STDOUT: %.loc29_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc29 [concrete = constants.%DefaultOrUnformed.facet.cbb]
// CHECK:STDOUT: %as_type.loc29: type = facet_access_type %.loc29_15.1 [concrete = constants.%S]
// CHECK:STDOUT: %.loc29_15.2: type = converted %.loc29_15.1, %as_type.loc29 [concrete = constants.%S]
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc59: %DefaultOrUnformed.type = facet_value constants.%S, (constants.%DefaultOrUnformed.impl_witness.e4a) [concrete = constants.%DefaultOrUnformed.facet.cbb]
// CHECK:STDOUT: %.loc59_15.1: %DefaultOrUnformed.type = converted constants.%S, %DefaultOrUnformed.facet.loc59 [concrete = constants.%DefaultOrUnformed.facet.cbb]
// CHECK:STDOUT: %as_type.loc59: type = facet_access_type %.loc59_15.1 [concrete = constants.%S]
// CHECK:STDOUT: %.loc59_15.2: type = converted %.loc59_15.1, %as_type.loc59 [concrete = constants.%S]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc29_3.1: ref %S = splice_block %u.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc29: init %S to %.loc29_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3()
// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc29
// CHECK:STDOUT: %.loc29_13: type = splice_block %S.ref.loc29 [concrete = constants.%S] {
// CHECK:STDOUT: %Cpp.ref.loc29: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc29: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %.loc59_3.1: ref %S = splice_block %u.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc59: init %S to %.loc59_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.3()
// CHECK:STDOUT: assign %u.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc59
// CHECK:STDOUT: %.loc59_13: type = splice_block %S.ref.loc59 [concrete = constants.%S] {
// CHECK:STDOUT: %Cpp.ref.loc59: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc59: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: }
// CHECK:STDOUT: %u: ref %S = wrapper_binding u, %u.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %u.patt: %pattern_type.0f5 = ref_binding_pattern u [concrete = constants.%u.patt]
// CHECK:STDOUT: %u.var_patt: %pattern_type.0f5 = var_pattern %u.patt [concrete = constants.%u.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc34_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc34: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc74_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesLValue.ref.loc74: %TakesLValue.cpp_overload_set.type = name_ref TakesLValue, imports.%TakesLValue.cpp_overload_set.value [concrete = constants.%TakesLValue.cpp_overload_set.value]
// CHECK:STDOUT: %u.ref: ref %S = name_ref u, %u
// CHECK:STDOUT: %Cpp.ref.loc34_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc34: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const.loc34: type = const_type %S.ref.loc34 [concrete = constants.%const]
// CHECK:STDOUT: %.loc34_21.1: ref %const = as_compatible %u.ref
// CHECK:STDOUT: %.loc34_21.2: ref %const = converted %u.ref, %.loc34_21.1
// CHECK:STDOUT: %Destroy.facet.loc29_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc29_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc29_3.1 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Destroy.facet.loc29_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc29_3.3: %Destroy.type = converted constants.%S, %Destroy.facet.loc29_3.2 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Cpp.ref.loc74_30: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc74: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const.loc74: type = const_type %S.ref.loc74 [concrete = constants.%const]
// CHECK:STDOUT: %.loc74_21.1: ref %const = as_compatible %u.ref
// CHECK:STDOUT: %.loc74_21.2: ref %const = converted %u.ref, %.loc74_21.1
// CHECK:STDOUT: %Destroy.facet.loc59_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc59_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc59_3.1 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Destroy.facet.loc59_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc59_3.3: %Destroy.type = converted constants.%S, %Destroy.facet.loc59_3.2 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc29: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%u.var)
// CHECK:STDOUT: %Destroy.facet.loc22_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc22_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc22_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc22_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc22_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc22_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %SelfDestruct.call.loc59: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%u.var)
// CHECK:STDOUT: %Destroy.facet.loc42_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc42_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc42_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc42_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc42_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc42_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc22: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%t.var)
// CHECK:STDOUT: %SelfDestruct.call.loc42: init %empty_tuple.type = call %SelfDestruct.specific_fn.2(%t.var)
// CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.580]
@@ -825,20 +957,20 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt]
// CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc13: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc23: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s
// CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc15: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc15_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc15 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc15: type = facet_access_type %.loc15_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, %as_type.loc15 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc25: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc25_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc25 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc25: type = facet_access_type %.loc25_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc25_15.2: type = converted %.loc25_15.1, %as_type.loc25 [concrete = constants.%T.ed0]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc15_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15: init %T.ed0 to %.loc15_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15
// CHECK:STDOUT: %.loc15_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc25_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc25: init %T.ed0 to %.loc25_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc25
// CHECK:STDOUT: %.loc25_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc25: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0]
// CHECK:STDOUT: }
// CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var
@@ -846,28 +978,28 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420]
// CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc20: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc40: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc40: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t
// CHECK:STDOUT: %Cpp.ref.loc26_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc26: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %.loc26_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %Cpp.ref.loc26_26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc26_29: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %.loc26_21.2: ref %S = temporary_storage
// CHECK:STDOUT: %.loc26_21.3: init %S to %.loc26_21.2 = class_init () [concrete = constants.%S.val]
// CHECK:STDOUT: %.loc26_23: init %S = converted %.loc26_21.1, %.loc26_21.3 [concrete = constants.%S.val]
// CHECK:STDOUT: %Cpp.ref.loc26_42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc26_45: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const: type = const_type %S.ref.loc26_45 [concrete = constants.%const]
// CHECK:STDOUT: %.loc26_33.1: init %const = as_compatible %.loc26_23 [concrete = constants.%empty_struct.674]
// CHECK:STDOUT: %.loc26_33.2: init %const = converted %.loc26_23, %.loc26_33.1 [concrete = constants.%empty_struct.674]
// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc15_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Cpp.ref.loc56_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesRValue.ref.loc56: %TakesRValue.cpp_overload_set.type = name_ref TakesRValue, imports.%TakesRValue.cpp_overload_set.value [concrete = constants.%TakesRValue.cpp_overload_set.value]
// CHECK:STDOUT: %.loc56_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %Cpp.ref.loc56_26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc56_29: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %.loc56_21.2: ref %S = temporary_storage
// CHECK:STDOUT: %.loc56_21.3: init %S to %.loc56_21.2 = class_init () [concrete = constants.%S.val]
// CHECK:STDOUT: %.loc56_23: init %S = converted %.loc56_21.1, %.loc56_21.3 [concrete = constants.%S.val]
// CHECK:STDOUT: %Cpp.ref.loc56_42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc56_45: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %const: type = const_type %S.ref.loc56_45 [concrete = constants.%const]
// CHECK:STDOUT: %.loc56_33.1: init %const = as_compatible %.loc56_23 [concrete = constants.%empty_struct.674]
// CHECK:STDOUT: %.loc56_33.2: init %const = converted %.loc56_23, %.loc56_33.1 [concrete = constants.%empty_struct.674]
// CHECK:STDOUT: %Destroy.facet.loc25_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc25_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc25_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc25_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc25_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc25_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc15: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var)
// CHECK:STDOUT: %SelfDestruct.call.loc25: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var)
// CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580]
@@ -1213,20 +1345,20 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: %s.patt: %pattern_type.0f5 = ref_binding_pattern s [concrete = constants.%s.patt]
// CHECK:STDOUT: %s.var_patt: %pattern_type.0f5 = var_pattern %s.patt [concrete = constants.%s.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesConstRValue.ref.loc13: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc24: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesConstRValue.ref.loc24: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref: ref %S = name_ref s, %s
// CHECK:STDOUT: %t.var: ref %T.ed0 = var_storage %t.var_patt
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc15: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc15_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc15 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc15: type = facet_access_type %.loc15_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, %as_type.loc15 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %DefaultOrUnformed.facet.loc26: %DefaultOrUnformed.type = facet_value constants.%T.ed0, (constants.%DefaultOrUnformed.impl_witness.307) [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %.loc26_15.1: %DefaultOrUnformed.type = converted constants.%T.ed0, %DefaultOrUnformed.facet.loc26 [concrete = constants.%DefaultOrUnformed.facet.d8b]
// CHECK:STDOUT: %as_type.loc26: type = facet_access_type %.loc26_15.1 [concrete = constants.%T.ed0]
// CHECK:STDOUT: %.loc26_15.2: type = converted %.loc26_15.1, %as_type.loc26 [concrete = constants.%T.ed0]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %.loc15_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15: init %T.ed0 to %.loc15_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc15
// CHECK:STDOUT: %.loc15_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc26_3.1: ref %T.ed0 = splice_block %t.var {}
// CHECK:STDOUT: %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc26: init %T.ed0 to %.loc26_3.1 = call %T.as_type.as.DefaultOrUnformed.impl.Op.specific_fn.2()
// CHECK:STDOUT: assign %t.var, %T.as_type.as.DefaultOrUnformed.impl.Op.call.loc26
// CHECK:STDOUT: %.loc26_13: type = splice_block %T.ref [concrete = constants.%T.ed0] {
// CHECK:STDOUT: %Cpp.ref.loc26: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %T.ref: type = name_ref T, imports.%T.decl [concrete = constants.%T.ed0]
// CHECK:STDOUT: }
// CHECK:STDOUT: %t: ref %T.ed0 = wrapper_binding t, %t.var
@@ -1234,15 +1366,15 @@ fn PassConstRef(ref x: const XByRef) {
// CHECK:STDOUT: %t.patt: %pattern_type.5f6 = ref_binding_pattern t [concrete = constants.%t.patt.420]
// CHECK:STDOUT: %t.var_patt: %pattern_type.5f6 = var_pattern %t.patt [concrete = constants.%t.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesConstRValue.ref.loc20: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value]
// CHECK:STDOUT: %Cpp.ref.loc42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %TakesConstRValue.ref.loc42: %TakesConstRValue.cpp_overload_set.type = name_ref TakesConstRValue, imports.%TakesConstRValue.cpp_overload_set.value [concrete = constants.%TakesConstRValue.cpp_overload_set.value]
// CHECK:STDOUT: %t.ref: ref %T.ed0 = name_ref t, %t
// CHECK:STDOUT: %Destroy.facet.loc15_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc15_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc15_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc15_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc15_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc26_3.1: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc26_3.2: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc26_3.1 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %Destroy.facet.loc26_3.2: %Destroy.type = facet_value constants.%T.ed0, (constants.%DestroyImpl.impl_witness.68c, constants.%custom_witness.fe1878.1) [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: %.loc26_3.3: %Destroy.type = converted constants.%T.ed0, %Destroy.facet.loc26_3.2 [concrete = constants.%Destroy.facet.8f8]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc15: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var)
// CHECK:STDOUT: %SelfDestruct.call.loc26: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%t.var)
// CHECK:STDOUT: %Destroy.facet.loc8_3.1: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %.loc8_3.2: %Destroy.type = converted constants.%S, %Destroy.facet.loc8_3.1 [concrete = constants.%Destroy.facet.580]
// CHECK:STDOUT: %Destroy.facet.loc8_3.2: %Destroy.type = facet_value constants.%S, (constants.%DestroyImpl.impl_witness.b60, constants.%custom_witness.fe1878.2) [concrete = constants.%Destroy.facet.580]
@@ -48,7 +48,12 @@ auto UndeducedReturn();
''';
fn Call() {
// CHECK:STDERR: fail_return_undeduced_auto.carbon:[[@LINE+2]]:3-23: error: semantics TODO: `Unsupported: return type: auto` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_return_undeduced_auto.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.UndeducedReturn();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: return type: auto`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.UndeducedReturn();
}
@@ -18,36 +18,88 @@
struct ForwardDeclaredStruct;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo1(ForwardDeclaredStruct) -> void;
// CHECK:STDERR: · ━━┳━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredStruct' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo1(*p);
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo1(ForwardDeclaredStruct) -> void;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo2(ForwardDeclaredStruct) -> void;
// CHECK:STDERR: · ━━┳━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredStruct' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo2(*p);
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo2(ForwardDeclaredStruct) -> void;
// --- fail_import_decl_value_param_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote]
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredStruct*) {
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: -> │ Cpp.foo1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo1(ForwardDeclaredStruct) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredStruct' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:8: note: forward declaration of 'ForwardDeclaredStruct' [CppInteropParseNote]
Cpp.foo1(*p);
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:4:32: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredStruct` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:5:32: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: -> │ Cpp.foo2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ struct ForwardDeclaredStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo2(ForwardDeclaredStruct) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo2(*p);
}
@@ -84,22 +136,37 @@ struct NonCopyableStruct {
NonCopyableStruct(const NonCopyableStruct&) = delete;
};
// CHECK:STDERR: ╷ ╭── included from: fail_import_non_copyable_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./non_copyable_param_type.h:[[@LINE+20]]:6
// CHECK:STDERR: │ NonCopyableStruct(const NonCopyableStruct&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'NonCopyableStruct' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_non_copyable(NonCopyableStruct) -> void;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: call to deleted constructor
// CHECK:STDERR: · │ ┃ of 'NonCopyableStruct'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ passing argument to parameter here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_non_copyable_param_type.carbon
// CHECK:STDERR: │ Cpp.foo_non_copyable(s);
// CHECK:STDERR: · ───────────┬───────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_non_copyable(NonCopyableStruct) -> void;
// --- fail_import_non_copyable_param_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./non_copyable_param_type.h:6:6-21: error: call to deleted constructor of 'NonCopyableStruct' [CppInteropParseError]
// CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'NonCopyableStruct' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: ./non_copyable_param_type.h:6:40: note: passing argument to parameter here [CppInteropParseNote]
import Cpp library "non_copyable_param_type.h";
fn F(s: Cpp.NonCopyableStruct) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+2]]:3-25: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
Cpp.foo_non_copyable(s);
//@dump-sem-ir-end
}
@@ -283,9 +350,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-26: error: member access into incomplete class `Cpp.IncompleteStruct` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ Cpp.IncompleteStruct.foo();
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteStruct`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ struct IncompleteStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.IncompleteStruct.foo();
}
@@ -342,6 +418,25 @@ fn F(s: Cpp.DefPointerParamStruct*) {
struct DeclValueReturnStruct;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6
// CHECK:STDERR: │ struct DeclValueReturnStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnStruct' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnStruct;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type
// CHECK:STDERR: · │ ┃ 'DeclValueReturnStruct'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon
// CHECK:STDERR: │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_decl_value_return() -> DeclValueReturnStruct;
// --- fail_import_decl_value_return_type.carbon
@@ -349,19 +444,26 @@ auto foo_decl_value_return() -> DeclValueReturnStruct;
library "[[@TEST_NAME]]";
// TODO: We should only produce one error here.
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnStruct' [CppInteropParseError]
// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ./decl_value_return_type.h:2:8: note: forward declaration of 'DeclValueReturnStruct' [CppInteropParseNote]
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnStruct` [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnStruct`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ struct DeclValueReturnStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnStruct;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ return type declared here
// CHECK:STDERR: · │ [IncompleteReturnTypeHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo_decl_value_return();
}
@@ -500,7 +602,7 @@ fn F() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @F(%s.param: %NonCopyableStruct) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %foo_non_copyable.ref: %foo_non_copyable.cpp_overload_set.type = name_ref foo_non_copyable, imports.%foo_non_copyable.cpp_overload_set.value [concrete = constants.%foo_non_copyable.cpp_overload_set.value]
// CHECK:STDOUT: %s.ref: %NonCopyableStruct = name_ref s, %s
// CHECK:STDOUT: %foo_non_copyable.call: init %empty_tuple.type = call imports.%foo_non_copyable.decl(%s.ref)
@@ -87,9 +87,21 @@ template<int N> void fn_arg_not_template_arg_f();
fn Call() {
// We treat this as a function argument, even though that makes the call fail.
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE+4]]:3-31: error: no matching function for call to 'fn_arg_not_template_arg_f' [CppInteropParseError]
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-6]]:22: note: candidate function template not viable [CppInteropParseNote]
// CHECK:STDERR: fail_function_arg_not_template_arg.carbon:[[@LINE-7]]:47-48: note: requires 0 arguments, but 1 was provided [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_function_arg_not_template_arg.carbon:[[@LINE+16]]:3
// CHECK:STDERR: │ template<int N> void fn_arg_not_template_arg_f();
// CHECK:STDERR: · ┬ ┬─
// CHECK:STDERR: · ╰───────────────────────────┤ candidate function template
// CHECK:STDERR: · │ │ not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ requires 0 arguments, but 1
// CHECK:STDERR: · │ was provided
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.fn_arg_not_template_arg_f(1);
// CHECK:STDERR: · ━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'fn_arg_not_template_arg_f'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.fn_arg_not_template_arg_f(1);
}
@@ -18,36 +18,88 @@
union ForwardDeclaredUnion;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo1(ForwardDeclaredUnion) -> void;
// CHECK:STDERR: · ━━┳━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredUnion' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo1(*p);
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo1(ForwardDeclaredUnion) -> void;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h:[[@LINE+16]]:6
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo2(ForwardDeclaredUnion) -> void;
// CHECK:STDERR: · ━━┳━
// CHECK:STDERR: · ┗━━┫ error: argument type 'ForwardDeclaredUnion' is incomplete
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_param_type.carbon
// CHECK:STDERR: │ Cpp.foo2(*p);
// CHECK:STDERR: · ──────┬─────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo2(ForwardDeclaredUnion) -> void;
// --- fail_import_decl_value_param_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE+3]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:4:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote]
import Cpp library "decl_value_param_type.h";
fn F(p: Cpp.ForwardDeclaredUnion*) {
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:3-14: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: -> │ Cpp.foo1(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo1(ForwardDeclaredUnion) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-5]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:5:6-9: error: argument type 'ForwardDeclaredUnion' is incomplete [CppInteropParseError]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: forward declaration of 'ForwardDeclaredUnion' [CppInteropParseNote]
Cpp.foo1(*p);
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+12]]:3-14: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-3]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-12]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:4:31: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+5]]:12-13: error: forming value of incomplete type `Cpp.ForwardDeclaredUnion` [IncompleteTypeInValueConversion]
// CHECK:STDERR: included from: fail_import_decl_value_param_type.carbon:[[@LINE-17]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_param_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_param_type.h:5:31: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_param_type.carbon:[[@LINE+19]]:12
// CHECK:STDERR: -> │ Cpp.foo2(*p);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: forming value of incomplete type
// CHECK:STDERR: · ┃ `Cpp.ForwardDeclaredUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInValueConversion]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_param_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_param_type.h
// CHECK:STDERR: │ union ForwardDeclaredUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo2(ForwardDeclaredUnion) -> void;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo2(*p);
}
@@ -254,9 +306,18 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+4]]:3-25: error: member access into incomplete class `Cpp.IncompleteUnion` [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: included from: fail_import_incomplete.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete.carbon:[[@LINE+13]]:3
// CHECK:STDERR: -> │ Cpp.IncompleteUnion.foo();
// CHECK:STDERR: · ━━━━━━━━━┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member access into incomplete class `Cpp.IncompleteUnion`
// CHECK:STDERR: · ┃ [QualifiedExprInIncompleteClassScope]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ union IncompleteUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.IncompleteUnion.foo();
}
@@ -313,25 +374,51 @@ fn F(u: Cpp.DefPointerParamUnion*) {
union DeclValueReturnUnion;
// CHECK:STDERR: ╷ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h:[[@LINE+18]]:6
// CHECK:STDERR: │ union DeclValueReturnUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'DeclValueReturnUnion' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ auto foo_decl_value_return() -> DeclValueReturnUnion;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: calling 'foo_decl_value_return' with incomplete return type
// CHECK:STDERR: · │ ┃ 'DeclValueReturnUnion'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_decl_value_return_type.carbon
// CHECK:STDERR: │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto foo_decl_value_return() -> DeclValueReturnUnion;
// --- fail_import_decl_value_return_type.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:4:6-26: error: calling 'foo_decl_value_return' with incomplete return type 'DeclValueReturnUnion' [CppInteropParseError]
// CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo_decl_value_return' declared here [CppInteropParseNote]
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: forward declaration of 'DeclValueReturnUnion' [CppInteropParseNote]
import Cpp library "decl_value_return_type.h";
fn F() {
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+7]]:3-29: note: in thunk for C++ function used here [InCppThunk]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+5]]:3-29: error: function returns incomplete type `Cpp.DeclValueReturnUnion` [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: included from: fail_import_decl_value_return_type.carbon:[[@LINE-6]]:10 [InCppInclude]
// CHECK:STDERR: ./decl_value_return_type.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ./decl_value_return_type.h:4:33: note: return type declared here [IncompleteReturnTypeHere]
// CHECK:STDERR: ╭─┤ fail_import_decl_value_return_type.carbon:[[@LINE+18]]:3
// CHECK:STDERR: -> │ Cpp.foo_decl_value_return();
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: function returns incomplete type `Cpp.DeclValueReturnUnion`
// CHECK:STDERR: · ┃ [IncompleteTypeInFunctionReturnType]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_decl_value_return_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./decl_value_return_type.h
// CHECK:STDERR: │ union DeclValueReturnUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ auto foo_decl_value_return() -> DeclValueReturnUnion;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ return type declared here
// CHECK:STDERR: · │ [IncompleteReturnTypeHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.foo_decl_value_return();
}
+30 -19
View File
@@ -112,8 +112,19 @@ import Cpp library "conversions.h";
fn ConstructorExplicit(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+3]]:42: error: cannot implicitly convert expression of type `Source` to `Cpp.ConditionallyExplicit` [ConversionFailure]
// CHECK:STDERR: fail_conditionally_explicit_implicit.carbon:[[@LINE+2]]:42: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ConditionallyExplicit)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_conditionally_explicit_implicit.carbon:[[@LINE+14]]:42
// CHECK:STDERR: -> │ let _: Cpp.ConditionallyExplicitTrue = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source`
// CHECK:STDERR: · │ ┃ to
// CHECK:STDERR: · │ ┃ `Cpp.ConditionallyExplicit`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭────────────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ConditionallyExplicit)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ConditionallyExplicitTrue = s;
//@dump-sem-ir-end
@@ -560,9 +571,9 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) {
// CHECK:STDOUT: fn @ConstructorExplicit(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc11_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc22_42: %ConditionallyExplicit.9d4 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc22_13: type = splice_block %ConditionallyExplicitTrue.ref [concrete = constants.%ConditionallyExplicit.9d4] {
// CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %ConditionallyExplicitTrue.ref: type = name_ref ConditionallyExplicitTrue, imports.%ConditionallyExplicit.decl.6ab [concrete = constants.%ConditionallyExplicit.9d4]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %ConditionallyExplicit.9d4 = wrapper_binding _, <error> [concrete = <error>]
@@ -575,27 +586,27 @@ fn ConversionExplicit(s: Cpp.ConditionallyExplicitFalse) {
// CHECK:STDOUT: fn @ConversionExplicit(%s.param: %ConditionallyExplicit.3cd) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %ConditionallyExplicit.3cd = name_ref s, %s
// CHECK:STDOUT: %.loc17_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc17_21.1
// CHECK:STDOUT: %.loc28_21.1: ref %Dest.980 = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc28_21.1
// CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr)
// CHECK:STDOUT: %.loc17_21.2: init %Dest.980 to %.loc17_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc17_21.3: init %Dest.980 = converted %s.ref, %.loc17_21.2
// CHECK:STDOUT: %.loc17_21.4: ref %Dest.980 = temporary %.loc17_21.1, %.loc17_21.3
// CHECK:STDOUT: %.loc17_21.5: %Dest.980 = acquire_value %.loc17_21.4
// CHECK:STDOUT: %.loc17_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc28_21.2: init %Dest.980 to %.loc28_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc28_21.3: init %Dest.980 = converted %s.ref, %.loc28_21.2
// CHECK:STDOUT: %.loc28_21.4: ref %Dest.980 = temporary %.loc28_21.1, %.loc28_21.3
// CHECK:STDOUT: %.loc28_21.5: %Dest.980 = acquire_value %.loc28_21.4
// CHECK:STDOUT: %.loc28_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc28: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc17_21.5
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, %.loc28_21.5
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc17_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc17_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc17_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc17_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc17_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc17_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc28_21.1: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.6: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc28_21.2: %Destroy.type = facet_value constants.%Dest.980, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc28_21.7: %Destroy.type = converted constants.%Dest.980, %Destroy.facet.loc28_21.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_21.4)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc28_21.4)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+76 -14
View File
@@ -83,54 +83,116 @@ library "[[@TEST_NAME]]";
import Cpp library "types.h";
fn CopyDeletedCopy(c: Cpp.DeletedCopy) -> Cpp.DeletedCopy {
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ./types.h:14:3: note: 'DeletedCopy' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+12]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ DeletedCopy(const DeletedCopy&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'DeletedCopy' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyMoveOnly(c: Cpp.MoveOnly) -> Cpp.MoveOnly {
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ./types.h:19:3: note: copy constructor is implicitly deleted because 'MoveOnly' has a user-declared move constructor [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ MoveOnly(MoveOnly&&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'MoveOnly' has a
// CHECK:STDERR: · │ user-declared move constructor
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyDeletedMove(c: Cpp.DeletedMove) -> Cpp.DeletedMove {
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ./types.h:24:3: note: copy constructor is implicitly deleted because 'DeletedMove' has a user-declared move constructor [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ DeletedMove(DeletedMove&&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ copy constructor is implicitly deleted because 'DeletedMove' has a
// CHECK:STDERR: · │ user-declared move constructor
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyNonConstCopy(c: Cpp.NonConstCopy) -> Cpp.NonConstCopy {
// TODO: List candidates here.
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `NonConstCopy` [CopyOfUncopyableType]
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.NonConstCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+9]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `NonConstCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstCopy` does not implement interface `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyAmbiguousCopy(c: Cpp.AmbiguousCopy) -> Cpp.AmbiguousCopy {
// TODO: List candidates here.
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot copy value of type `AmbiguousCopy` [CopyOfUncopyableType]
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+2]]:10: note: type `Cpp.AmbiguousCopy` does not implement interface `Core.Copy` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+10]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot copy value of type `AmbiguousCopy`
// CHECK:STDERR: · │ ┃ [CopyOfUncopyableType]
// CHECK:STDERR: · ╰────┤ type `Cpp.AmbiguousCopy` does not implement interface
// CHECK:STDERR: · │ `Core.Copy`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyPrivateCopy(c: Cpp.PrivateCopy) -> Cpp.PrivateCopy {
// TODO: Note is missing location.
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot access private member `PrivateCopy` of type `Cpp.PrivateCopy` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:40:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `PrivateCopy` of type
// CHECK:STDERR: · ┃ `Cpp.PrivateCopy`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ PrivateCopy(const PrivateCopy&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
fn CopyProtectedCopy(c: Cpp.ProtectedCopy) -> Cpp.ProtectedCopy {
// TODO: Note is missing location.
// CHECK:STDERR: fail_copy_noncopyable.carbon:[[@LINE+3]]:10: error: cannot access protected member `ProtectedCopy` of type `Cpp.ProtectedCopy` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:45:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╭─┤ fail_copy_noncopyable.carbon:[[@LINE+13]]:10
// CHECK:STDERR: -> │ return c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `ProtectedCopy` of type
// CHECK:STDERR: · ┃ `Cpp.ProtectedCopy`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ProtectedCopy(const ProtectedCopy&);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c;
}
@@ -148,16 +148,50 @@ namespace N {
class MutableRange {
struct Iterator {};
public:
// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:34: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+22]]:15
// CHECK:STDERR: -> │ friend auto begin(MutableRange&) -> Iterator;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to
// CHECK:STDERR: · │ ┃ reference parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto begin(MutableRange&) -> Iterator;
// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+4]]:32: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_same_types_mutable.carbon:[[@LINE+22]]:15
// CHECK:STDERR: -> │ friend auto end(MutableRange&) -> Iterator;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to reference
// CHECK:STDERR: · │ ┃ parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
// CHECK:STDERR: · ────────────┬────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto end(MutableRange&) -> Iterator;
};
@@ -198,7 +232,12 @@ import Cpp inline '''c++
namespace N {
class MutableRangeWithSentinel {
struct Iterator {
// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+2]]:31: error: unknown type name 'ValueType' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+7]]:31
// CHECK:STDERR: -> │ auto operator*() const -> ValueType&;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'ValueType'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator*() const -> ValueType&;
auto operator++() -> Iterator&;
@@ -209,16 +248,52 @@ class MutableRangeWithSentinel {
friend auto operator!=(Sentinel, Iterator) -> bool;
};
public:
// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:46: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+23]]:15
// CHECK:STDERR: -> │ friend auto begin(MutableRangeWithSentinel&) -> Iterator;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed
// CHECK:STDERR: · │ ┃ to reference parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function
// CHECK:STDERR: · │ parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto begin(MutableRangeWithSentinel&) -> Iterator;
// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+4]]:44: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_returns_different_types_mutable.carbon:[[@LINE+23]]:15
// CHECK:STDERR: -> │ friend auto end(MutableRangeWithSentinel&) -> Sentinel;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed
// CHECK:STDERR: · │ ┃ to reference parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function
// CHECK:STDERR: · │ parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
// CHECK:STDERR: · ────────────┬────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto end(MutableRangeWithSentinel&) -> Sentinel;
};
@@ -240,16 +315,50 @@ class MutableAndConstRange {
struct Iterator {};
struct ConstIterator {};
public:
// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:42: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:10:3-29: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+22]]:15
// CHECK:STDERR: -> │ friend auto begin(MutableAndConstRange&) -> Iterator;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to
// CHECK:STDERR: · │ ┃ reference parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn Begin(self) -> Iterator;
// CHECK:STDERR: · ─────────────┬─────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto begin(MutableAndConstRange&) -> Iterator;
// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+5]]:15: error: value expression passed to reference parameter [ValueForRefParam]
// CHECK:STDERR: fail_todo_adl_overloads.carbon:[[@LINE+4]]:40: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: cpp_range_for_iterate.carbon:11:3-27: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: cpp_range_for_iterate.carbon:21:33-63: note: initializing generic parameter `R` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_todo_adl_overloads.carbon:[[@LINE+22]]:15
// CHECK:STDERR: -> │ friend auto end(MutableAndConstRange&) -> Iterator;
// CHECK:STDERR: · ┳ ┬
// CHECK:STDERR: · ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ error: value expression passed to
// CHECK:STDERR: · │ ┃ reference parameter
// CHECK:STDERR: · │ ┃ [ValueForRefParam]
// CHECK:STDERR: · ╰────┤ initializing function parameter
// CHECK:STDERR: · │ [InCallToFunctionParam]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn End(self) -> Sentinel;
// CHECK:STDERR: · ────────────┬────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn AssertIsRange(unused generic R: IsRange where .Result = true) {}
// CHECK:STDERR: · ┬──────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `R` declared
// CHECK:STDERR: · │ here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend auto end(MutableAndConstRange&) -> Iterator;
@@ -348,24 +457,87 @@ struct EndFunctionDeleted {
''';
fn Test() {
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:8: note: 'begin' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:47
// CHECK:STDERR: │ auto begin() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'begin' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.BeginMethodDeleted);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a
// CHECK:STDERR: · ┃ deleted function
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {}
// CHECK:STDERR: · ┬───────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `S`
// CHECK:STDERR: · │ declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Core.AssertIsNotRange(Cpp.BeginMethodDeleted);
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:45: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:8: note: 'end' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+19]]:45
// CHECK:STDERR: │ auto end() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'end' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.EndMethodDeleted);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted
// CHECK:STDERR: · ┃ function
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {}
// CHECK:STDERR: · ┬───────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `S`
// CHECK:STDERR: · │ declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Core.AssertIsNotRange(Cpp.EndMethodDeleted);
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:49: error: call to deleted function 'begin' [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-22]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:49
// CHECK:STDERR: │ friend auto begin(const BeginFunctionDeleted&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.BeginFunctionDeleted);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: call to deleted
// CHECK:STDERR: · ┃ function 'begin'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {}
// CHECK:STDERR: · ┬───────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `S`
// CHECK:STDERR: · │ declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Core.AssertIsNotRange(Cpp.BeginFunctionDeleted);
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+4]]:47: error: call to deleted function 'end' [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-21]]:15: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: cpp_range_for_iterate.carbon:22:36-67: note: initializing generic parameter `S` declared here [InitializingGenericParam]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+20]]:47
// CHECK:STDERR: │ friend auto end(const EndFunctionDeleted&) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Core.AssertIsNotRange(Cpp.EndFunctionDeleted);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: call to deleted
// CHECK:STDERR: · ┃ function 'end'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ cpp_range_for_iterate.carbon
// CHECK:STDERR: │ fn AssertIsNotRange(unused generic S: IsRange where .Result = false) {}
// CHECK:STDERR: · ┬───────────────────────────────
// CHECK:STDERR: · ╰──┤ initializing generic parameter `S`
// CHECK:STDERR: · │ declared here
// CHECK:STDERR: · │ [InitializingGenericParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Core.AssertIsNotRange(Cpp.EndFunctionDeleted);
}
+199 -82
View File
@@ -77,9 +77,24 @@ class Derived {
fn DestroyClassWithProtectedBaseDestructor() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access protected member `<C++ destructor>` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_destroy_protected_base_destructor.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ var unused a: Derived = {.base = {}};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `<C++ destructor>` of type
// CHECK:STDERR: · ┃ `Cpp.ProtectedDestructor`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~ProtectedDestructor();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
//@dump-sem-ir-end
@@ -98,9 +113,24 @@ class Derived {
fn DestroyClassWithPrivateBaseDestructor() {
//@dump-sem-ir-begin
// TODO: We should not allow this, as the destructor of the base class is private.
// CHECK:STDERR: fail_destroy_private_base_destructor.carbon:[[@LINE+4]]:3-23: error: cannot access private member `<C++ destructor>` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_destroy_private_base_destructor.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ var unused a: Derived = {.base = {}};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `<C++ destructor>` of type
// CHECK:STDERR: · ┃ `Cpp.PrivateDestructor`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~PrivateDestructor();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Derived = {.base = {}};
//@dump-sem-ir-end
@@ -113,39 +143,112 @@ library "[[@TEST_NAME]]";
import Cpp library "types.h";
fn AmbiguousDestroy() {
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+7]]:17-39: error: binding pattern has incomplete type `AmbiguousDestructor` in name binding declaration [IncompleteTypeInBindingDecl]
// CHECK:STDERR: included from: fail_destroy_nondestroyable.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./types.h:13:7: note: destructor of class 'AmbiguousDestructorT<>' is ambiguous [CppInteropParseError]
// CHECK:STDERR: ./types.h:13:7: note: in instantiation of template class 'AmbiguousDestructorT<>' requested here [CppInteropParseNote]
// CHECK:STDERR: ./types.h:15:3: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ./types.h:16:3: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+25]]:17
// CHECK:STDERR: -> │ var unused a: Cpp.AmbiguousDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has incomplete type
// CHECK:STDERR: · ┃ `AmbiguousDestructor` in name binding declaration
// CHECK:STDERR: · ┃ [IncompleteTypeInBindingDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_destroy_nondestroyable.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ class AmbiguousDestructorT {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'AmbiguousDestructorT<>' requested
// CHECK:STDERR: · │ │ here
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ destructor of class 'AmbiguousDestructorT<>' is ambiguous
// CHECK:STDERR: · │ [CppInteropParseError]
// CHECK:STDERR: │ public:
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 1);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ ~AmbiguousDestructorT() requires (N != 2);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.AmbiguousDestructor = {};
}
fn DeletedDestroy() {
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+7]]:3: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+32]]:3
// CHECK:STDERR: -> │ var unused a: Cpp.DeletedDestructor = {};
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~DeletedDestructor() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ '~DeletedDestructor' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+3]]:3-37: error: cannot convert type `Cpp.DeletedDestructor` into type implementing `Core.Destroy` [ConversionFailureTypeToFacet]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+14]]:3
// CHECK:STDERR: -> │ var unused a: Cpp.DeletedDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.DeletedDestructor` into type implementing
// CHECK:STDERR: · ┃ `Core.Destroy`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.DeletedDestructor = {};
}
fn PrivateDestroy() {
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-37: error: cannot access private member `<C++ destructor>` of type `Cpp.PrivateDestructor` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:28:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ var unused a: Cpp.PrivateDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `<C++ destructor>` of type
// CHECK:STDERR: · ┃ `Cpp.PrivateDestructor`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~PrivateDestructor();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.PrivateDestructor = {};
}
fn ProtectedDestroy() {
// CHECK:STDERR: fail_destroy_nondestroyable.carbon:[[@LINE+4]]:3-39: error: cannot access protected member `<C++ destructor>` of type `Cpp.ProtectedDestructor` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./types.h:33:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_destroy_nondestroyable.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ var unused a: Cpp.ProtectedDestructor = {};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access protected member `<C++ destructor>` of type
// CHECK:STDERR: · ┃ `Cpp.ProtectedDestructor`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~ProtectedDestructor();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused a: Cpp.ProtectedDestructor = {};
}
@@ -183,9 +286,23 @@ class AdaptNoDestroy {
fn Make() -> AdaptNoDestroy;
fn F() {
// CHECK:STDERR: fail_no_destroy.carbon:[[@LINE+4]]:3: error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ./types.h:23:3: note: '~DeletedDestructor' has been explicitly marked deleted here [CppInteropParseNote]
// CHECK:STDERR: min_prelude/parts/destroy.carbon:32:1-39: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_no_destroy.carbon:[[@LINE+18]]:3
// CHECK:STDERR: -> │ var _: AdaptNoDestroy = Make();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: attempt to use a deleted function [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./types.h
// CHECK:STDERR: │ ~DeletedDestructor() = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ '~DeletedDestructor' has been explicitly marked deleted here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ min_prelude/parts/destroy.carbon
// CHECK:STDERR: │ fn SelfDestruct[T: Destroy](ref t: T) {
// CHECK:STDERR: · ───────────────────┬───────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var _: AdaptNoDestroy = Make();
}
@@ -396,7 +513,7 @@ fn F() {
// CHECK:STDOUT: %SubobjectDestroy.facet.e5d: %SubobjectDestroy.type = facet_value %ProtectedDestructor, (%custom_witness.fe1) [concrete]
// CHECK:STDOUT: %DestroyImpl.impl_witness.721: <witness> = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.e5d) [concrete]
// CHECK:STDOUT: %Destroy.facet.fe4: %Destroy.type = facet_value %ProtectedDestructor, (%DestroyImpl.impl_witness.721, %custom_witness.fe1) [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc16_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc31_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete]
@@ -412,52 +529,52 @@ fn F() {
// CHECK:STDOUT: fn @DestroyClassWithProtectedBaseDestructor() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt
// CHECK:STDOUT: %.loc16_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc16_38.1: %struct_type.base.f5e = struct_literal (%.loc16_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc16_38.2: ref %.a6c = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc16_37.2: init %.a6c to %.loc16_38.2 = class_init () [concrete = constants.%empty_struct.ec1]
// CHECK:STDOUT: %.loc16_38.3: init %.a6c = converted %.loc16_37.1, %.loc16_37.2 [concrete = constants.%empty_struct.ec1]
// CHECK:STDOUT: %.loc16_38.4: init %ProtectedDestructor = as_compatible %.loc16_38.3 [concrete = constants.%ProtectedDestructor.val]
// CHECK:STDOUT: %.loc16_38.5: init %Derived to %a.var = class_init (%.loc16_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc16_3.1: init %Derived = converted %.loc16_38.1, %.loc16_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc16_3.1
// CHECK:STDOUT: %.loc31_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc31_38.1: %struct_type.base.f5e = struct_literal (%.loc31_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc31_38.2: ref %.a6c = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc31_37.2: init %.a6c to %.loc31_38.2 = class_init () [concrete = constants.%empty_struct.ec1]
// CHECK:STDOUT: %.loc31_38.3: init %.a6c = converted %.loc31_37.1, %.loc31_37.2 [concrete = constants.%empty_struct.ec1]
// CHECK:STDOUT: %.loc31_38.4: init %ProtectedDestructor = as_compatible %.loc31_38.3 [concrete = constants.%ProtectedDestructor.val]
// CHECK:STDOUT: %.loc31_38.5: init %Derived to %a.var = class_init (%.loc31_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc31_3.1: init %Derived = converted %.loc31_38.1, %.loc31_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc31_3.1
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
// CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt]
// CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.1(%self.param: ref %struct_type.base.454) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_3.1(%self.param: ref %struct_type.base.454) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc16_3.1: ref %ProtectedDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.1: ref %ProtectedDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc16_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc16_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc31_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7]
// CHECK:STDOUT: %.loc16_3.1: ref %ProtectedDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc16_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc16_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.1 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %Destroy.facet.loc16_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc16_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc16_3.2 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.1: ref %ProtectedDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc31_3.1: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.2: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.1 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %Destroy.facet.loc31_3.2: %Destroy.type = facet_value constants.%ProtectedDestructor, (constants.%DestroyImpl.impl_witness.721, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: %.loc31_3.3: %Destroy.type = converted constants.%ProtectedDestructor, %Destroy.facet.loc31_3.2 [concrete = constants.%Destroy.facet.fe4]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc16_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc31_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -492,7 +609,7 @@ fn F() {
// CHECK:STDOUT: %SubobjectDestroy.facet.be1: %SubobjectDestroy.type = facet_value %PrivateDestructor, (%custom_witness.fe1) [concrete]
// CHECK:STDOUT: %DestroyImpl.impl_witness.a8a: <witness> = impl_witness imports.%DestroyImpl.impl_witness_table, @T.as_type.as.DestroyImpl.impl(%SubobjectDestroy.facet.be1) [concrete]
// CHECK:STDOUT: %Destroy.facet.75a: %Destroy.type = facet_value %PrivateDestructor, (%DestroyImpl.impl_witness.a8a, %custom_witness.fe1) [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc17_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.6870fd.2: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32_3.2 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f1ee.2: %SubobjectDestroy.WithSelf.Op.type.6870fd.2 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80ef6.2: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f1ee.2), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.1fc: %SubobjectDestroy.type = facet_value %Derived, (%custom_witness.b80ef6.2) [concrete]
@@ -508,52 +625,52 @@ fn F() {
// CHECK:STDOUT: fn @DestroyClassWithPrivateBaseDestructor() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %a.var: ref %Derived = var_storage %a.var_patt
// CHECK:STDOUT: %.loc17_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc17_38.1: %struct_type.base.f5e = struct_literal (%.loc17_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc17_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc17_37.2: init %.c73 to %.loc17_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc17_38.3: init %.c73 = converted %.loc17_37.1, %.loc17_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc17_38.4: init %PrivateDestructor = as_compatible %.loc17_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc17_38.5: init %Derived to %a.var = class_init (%.loc17_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc17_3.1: init %Derived = converted %.loc17_38.1, %.loc17_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc17_3.1
// CHECK:STDOUT: %.loc32_37.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct.a40]
// CHECK:STDOUT: %.loc32_38.1: %struct_type.base.f5e = struct_literal (%.loc32_37.1) [concrete = constants.%struct]
// CHECK:STDOUT: %.loc32_38.2: ref %.c73 = class_element_access %a.var, element0
// CHECK:STDOUT: %.loc32_37.2: init %.c73 to %.loc32_38.2 = class_init () [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.3: init %.c73 = converted %.loc32_37.1, %.loc32_37.2 [concrete = constants.%empty_struct.d8b]
// CHECK:STDOUT: %.loc32_38.4: init %PrivateDestructor = as_compatible %.loc32_38.3 [concrete = constants.%PrivateDestructor.val]
// CHECK:STDOUT: %.loc32_38.5: init %Derived to %a.var = class_init (%.loc32_38.4) [concrete = constants.%Derived.val]
// CHECK:STDOUT: %.loc32_3.1: init %Derived = converted %.loc32_38.1, %.loc32_38.5 [concrete = constants.%Derived.val]
// CHECK:STDOUT: assign %a.var, %.loc32_3.1
// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
// CHECK:STDOUT: %a: ref %Derived = wrapper_binding a, %a.var
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.746 = ref_binding_pattern a [concrete = constants.%a.patt]
// CHECK:STDOUT: %a.var_patt: %pattern_type.746 = var_pattern %a.patt [concrete = constants.%a.var_patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%Derived, (constants.%DestroyImpl.impl_witness.660, constants.%custom_witness.b80ef6.2) [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%Derived, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.35d]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%a.var)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.1(%self.param: ref %struct_type.base.9aa) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc17_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = struct_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc17_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32_3.2(%self.param: ref %Derived) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %base.ref: %Derived.elem = name_ref base, @Derived.%.loc7 [concrete = @Derived.%.loc7]
// CHECK:STDOUT: %.loc17_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc17_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc17_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc17_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc17_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc17_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.1: ref %PrivateDestructor = class_element_access %self.param, element0
// CHECK:STDOUT: %Destroy.facet.loc32_3.1: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.2: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.1 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %Destroy.facet.loc32_3.2: %Destroy.type = facet_value constants.%PrivateDestructor, (constants.%DestroyImpl.impl_witness.a8a, constants.%custom_witness.fe1) [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: %.loc32_3.3: %Destroy.type = converted constants.%PrivateDestructor, %Destroy.facet.loc32_3.2 [concrete = constants.%Destroy.facet.75a]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc17_3.1)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc32_3.1)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
+331 -170
View File
@@ -92,8 +92,16 @@ import Cpp library "implicit_conversions.h";
fn NonConstConversionTest(s: Cpp.NonConstConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `NonConstConversion` to `Cpp.Dest` [ConversionFailure]
// CHECK:STDERR: fail_expr_category.carbon:[[@LINE+2]]:21: note: type `Cpp.NonConstConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_expr_category.carbon:[[@LINE+11]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `NonConstConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.NonConstConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
//@dump-sem-ir-end
@@ -107,8 +115,20 @@ import Cpp library "implicit_conversions.h";
fn InaccessibleConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_access.carbon:[[@LINE+3]]:40: error: cannot access private member `InaccessibleConstructor` of type `Cpp.InaccessibleConstructor` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./implicit_conversions.h:21:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+15]]:40
// CHECK:STDERR: -> │ let _: Cpp.InaccessibleConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot access private member
// CHECK:STDERR: · ┃ `InaccessibleConstructor` of
// CHECK:STDERR: · ┃ type
// CHECK:STDERR: · ┃ `Cpp.InaccessibleConstructor`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./implicit_conversions.h
// CHECK:STDERR: │ InaccessibleConstructor(Source);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.InaccessibleConstructor = s;
//@dump-sem-ir-end
@@ -116,8 +136,18 @@ fn InaccessibleConstructorTest(s: Cpp.Source) {
fn InaccessibleConversionTest(s: Cpp.InaccessibleConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_access.carbon:[[@LINE+3]]:21: error: cannot access private member `<C++ operator>` of type `Cpp.InaccessibleConversion` [ClassInvalidMemberAccess]
// CHECK:STDERR: ./implicit_conversions.h:26:3: note: declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╭─┤ fail_access.carbon:[[@LINE+13]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot access private member `<C++ operator>` of
// CHECK:STDERR: · ┃ type `Cpp.InaccessibleConversion`
// CHECK:STDERR: · ┃ [ClassInvalidMemberAccess]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./implicit_conversions.h
// CHECK:STDERR: │ operator Dest() const;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ declared here [ClassMemberDeclaration]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
//@dump-sem-ir-end
@@ -131,8 +161,18 @@ import Cpp library "implicit_conversions.h";
fn DeletedConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:35: error: cannot implicitly convert expression of type `Source` to `Cpp.DeletedConstructor` [ConversionFailure]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:35: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.DeletedConstructor)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+13]]:35
// CHECK:STDERR: -> │ let _: Cpp.DeletedConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.DeletedConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭─────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.DeletedConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.DeletedConstructor = s;
//@dump-sem-ir-end
@@ -140,8 +180,16 @@ fn DeletedConstructorTest(s: Cpp.Source) {
fn DeletedConversionTest(s: Cpp.DeletedConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `DeletedConversion` to `Cpp.Dest` [ConversionFailure]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+2]]:21: note: type `Cpp.DeletedConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+11]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `DeletedConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.DeletedConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
//@dump-sem-ir-end
@@ -155,8 +203,18 @@ import Cpp library "implicit_conversions.h";
fn ExplicitConstructorTest(s: Cpp.Source) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:36: error: cannot implicitly convert expression of type `Source` to `Cpp.ExplicitConstructor` [ConversionFailure]
// CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:36: note: type `Cpp.Source` does not implement interface `Core.ImplicitAs(Cpp.ExplicitConstructor)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+13]]:36
// CHECK:STDERR: -> │ let _: Cpp.ExplicitConstructor = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `Source` to
// CHECK:STDERR: · │ ┃ `Cpp.ExplicitConstructor`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╭──────────────────────────────────╯
// CHECK:STDERR: · │ type `Cpp.Source` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.ExplicitConstructor)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.ExplicitConstructor = s;
//@dump-sem-ir-end
@@ -164,8 +222,16 @@ fn ExplicitConstructorTest(s: Cpp.Source) {
fn ExplicitConversionTest(s: Cpp.ExplicitConversion) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_explicit.carbon:[[@LINE+3]]:21: error: cannot implicitly convert expression of type `ExplicitConversion` to `Cpp.Dest` [ConversionFailure]
// CHECK:STDERR: fail_explicit.carbon:[[@LINE+2]]:21: note: type `Cpp.ExplicitConversion` does not implement interface `Core.ImplicitAs(Cpp.Dest)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_explicit.carbon:[[@LINE+11]]:21
// CHECK:STDERR: -> │ let _: Cpp.Dest = s;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `ExplicitConversion` to `Cpp.Dest`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.ExplicitConversion` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Dest)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Dest = s;
//@dump-sem-ir-end
@@ -191,9 +257,21 @@ import Cpp library "implicit_conversions.h";
fn IntConstructorTest(u: u32) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+4]]:31: error: cannot implicitly convert expression of type `u32` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+3]]:31: note: type `u32` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ./implicit_conversions.h:38:21: note: initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╭─┤ fail_no_u32_to_int_conversion_in_carbon.carbon:[[@LINE+16]]:31
// CHECK:STDERR: -> │ let _: Cpp.IntConstructor = u;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `u32` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `u32` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./implicit_conversions.h
// CHECK:STDERR: │ IntConstructor(int);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ initializing function parameter [InCallToFunctionParam]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.IntConstructor = u;
//@dump-sem-ir-end
@@ -263,16 +341,43 @@ import Cpp library "aggregate.h";
fn InitFromTuple() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `()` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-27: note: type `()` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+11]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = ();
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `()` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `()` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = ();
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-29: error: cannot implicitly convert expression of type `(Core.IntLiteral,)` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-29: note: type `(Core.IntLiteral,)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+12]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: · ┳━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral,)` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral,)` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1,);
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+3]]:26-31: error: cannot implicitly convert expression of type `(Core.IntLiteral, Core.IntLiteral)` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_tuple.carbon:[[@LINE+2]]:26-31: note: type `(Core.IntLiteral, Core.IntLiteral)` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_tuple.carbon:[[@LINE+13]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = (1, 2);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `(Core.IntLiteral, Core.IntLiteral)`
// CHECK:STDERR: · │ ┃ to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `(Core.IntLiteral, Core.IntLiteral)` does
// CHECK:STDERR: · │ not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = (1, 2);
//@dump-sem-ir-end
@@ -286,16 +391,43 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `{}` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-27: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+11]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {};
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-33: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-33: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+12]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.Aggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1};
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+3]]:26-41: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate` [ConversionFailure]
// CHECK:STDERR: fail_todo_aggregate_from_struct.carbon:[[@LINE+2]]:26-41: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.Aggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_aggregate_from_struct.carbon:[[@LINE+13]]:26
// CHECK:STDERR: -> │ let _: Cpp.Aggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.Aggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Aggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.Aggregate = {.x = 1, .y = 2};
//@dump-sem-ir-end
@@ -323,16 +455,45 @@ import Cpp library "aggregate.h";
fn InitFromStruct() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-30: error: cannot implicitly convert expression of type `{}` to `Cpp.NonAggregate` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-30: note: type `{}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+11]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{}` to `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{}` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {};
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-36: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-36: note: type `{.x: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+13]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `{.x: Core.IntLiteral}` to
// CHECK:STDERR: · │ ┃ `Cpp.NonAggregate`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `{.x: Core.IntLiteral}` does not
// CHECK:STDERR: · │ implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1};
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+3]]:29-44: error: cannot implicitly convert expression of type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate` [ConversionFailure]
// CHECK:STDERR: fail_non_aggregate_from_struct.carbon:[[@LINE+2]]:29-44: note: type `{.x: Core.IntLiteral, .y: Core.IntLiteral}` does not implement interface `Core.ImplicitAs(Cpp.NonAggregate)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_aggregate_from_struct.carbon:[[@LINE+14]]:29
// CHECK:STDERR: -> │ let _: Cpp.NonAggregate = {.x = 1, .y = 2};
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type
// CHECK:STDERR: · ┃ `{.x: Core.IntLiteral, .y: Core.IntLiteral}` to `Cpp.NonAggregate`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╰──┤ type
// CHECK:STDERR: · │ `{.x: Core.IntLiteral, .y: Core.IntLiteral}`
// CHECK:STDERR: · │ does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.NonAggregate)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.NonAggregate = {.x = 1, .y = 2};
//@dump-sem-ir-end
@@ -519,9 +680,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @NonConstConversionTest(%s.param: %NonConstConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %NonConstConversion = name_ref s, %s
// CHECK:STDOUT: %.loc11_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc19_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -599,56 +760,56 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @InaccessibleConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc11_40.1: ref %InaccessibleConstructor = temporary_storage
// CHECK:STDOUT: %.loc11_40.2: ref %Source = value_as_ref %s.ref
// CHECK:STDOUT: %addr.loc11_40.1: %ptr.5f6 = addr_of %.loc11_40.2
// CHECK:STDOUT: %addr.loc11_40.2: %ptr.859 = addr_of %.loc11_40.1
// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc11_40.1, %addr.loc11_40.2)
// CHECK:STDOUT: %.loc11_40.3: init %InaccessibleConstructor to %.loc11_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc11_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc11_40.3
// CHECK:STDOUT: %.loc11_40.5: ref %InaccessibleConstructor = temporary %.loc11_40.1, %.loc11_40.4
// CHECK:STDOUT: %.loc11_40.6: %InaccessibleConstructor = acquire_value %.loc11_40.5
// CHECK:STDOUT: %.loc11_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc23_40.1: ref %InaccessibleConstructor = temporary_storage
// CHECK:STDOUT: %.loc23_40.2: ref %Source = value_as_ref %s.ref
// CHECK:STDOUT: %addr.loc23_40.1: %ptr.5f6 = addr_of %.loc23_40.2
// CHECK:STDOUT: %addr.loc23_40.2: %ptr.859 = addr_of %.loc23_40.1
// CHECK:STDOUT: %InaccessibleConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%InaccessibleConstructor__carbon_thunk.decl(%addr.loc23_40.1, %addr.loc23_40.2)
// CHECK:STDOUT: %.loc23_40.3: init %InaccessibleConstructor to %.loc23_40.1 = mark_in_place_init %InaccessibleConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc23_40.4: init %InaccessibleConstructor = converted %s.ref, %.loc23_40.3
// CHECK:STDOUT: %.loc23_40.5: ref %InaccessibleConstructor = temporary %.loc23_40.1, %.loc23_40.4
// CHECK:STDOUT: %.loc23_40.6: %InaccessibleConstructor = acquire_value %.loc23_40.5
// CHECK:STDOUT: %.loc23_13: type = splice_block %InaccessibleConstructor.ref [concrete = constants.%InaccessibleConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %InaccessibleConstructor.ref: type = name_ref InaccessibleConstructor, imports.%InaccessibleConstructor.decl [concrete = constants.%InaccessibleConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc11_40.6
// CHECK:STDOUT: %_: %InaccessibleConstructor = wrapper_binding _, %.loc23_40.6
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.824 = value_binding_pattern _ [concrete = constants.%_.patt.f1f]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc11_40.1: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %.loc11_40.7: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc11_40.1 [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %Destroy.facet.loc11_40.2: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %.loc11_40.8: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc11_40.2 [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %Destroy.facet.loc23_40.1: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %.loc23_40.7: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc23_40.1 [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %Destroy.facet.loc23_40.2: %Destroy.type = facet_value constants.%InaccessibleConstructor, (constants.%DestroyImpl.impl_witness.8e4, constants.%custom_witness.5760f4.1) [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: %.loc23_40.8: %Destroy.type = converted constants.%InaccessibleConstructor, %Destroy.facet.loc23_40.2 [concrete = constants.%Destroy.facet.8e3]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc11_40.5)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc23_40.5)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InaccessibleConversionTest(%s.param: %InaccessibleConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %InaccessibleConversion = name_ref s, %s
// CHECK:STDOUT: %.loc20_21.1: ref %Dest = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc20_21.1
// CHECK:STDOUT: %.loc42_21.1: ref %Dest = temporary_storage
// CHECK:STDOUT: %addr: %ptr.ca8 = addr_of %.loc42_21.1
// CHECK:STDOUT: %Dest__carbon_thunk.call: init %empty_tuple.type = call imports.%Dest__carbon_thunk.decl(%s.ref, %addr)
// CHECK:STDOUT: %.loc20_21.2: init %Dest to %.loc20_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc20_21.3: init %Dest = converted %s.ref, %.loc20_21.2
// CHECK:STDOUT: %.loc20_21.4: ref %Dest = temporary %.loc20_21.1, %.loc20_21.3
// CHECK:STDOUT: %.loc20_21.5: %Dest = acquire_value %.loc20_21.4
// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest] {
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc42_21.2: init %Dest to %.loc42_21.1 = mark_in_place_init %Dest__carbon_thunk.call
// CHECK:STDOUT: %.loc42_21.3: init %Dest = converted %s.ref, %.loc42_21.2
// CHECK:STDOUT: %.loc42_21.4: ref %Dest = temporary %.loc42_21.1, %.loc42_21.3
// CHECK:STDOUT: %.loc42_21.5: %Dest = acquire_value %.loc42_21.4
// CHECK:STDOUT: %.loc42_13: type = splice_block %Dest.ref [concrete = constants.%Dest] {
// CHECK:STDOUT: %Cpp.ref.loc42: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc20_21.5
// CHECK:STDOUT: %_: %Dest = wrapper_binding _, %.loc42_21.5
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.b72 = value_binding_pattern _ [concrete = constants.%_.patt.664]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc20_21.1: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %.loc20_21.6: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc20_21.1 [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %Destroy.facet.loc20_21.2: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %.loc20_21.7: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc20_21.2 [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %Destroy.facet.loc42_21.1: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %.loc42_21.6: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc42_21.1 [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %Destroy.facet.loc42_21.2: %Destroy.type = facet_value constants.%Dest, (constants.%DestroyImpl.impl_witness.771, constants.%custom_witness.5760f4.2) [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: %.loc42_21.7: %Destroy.type = converted constants.%Dest, %Destroy.facet.loc42_21.2 [concrete = constants.%Destroy.facet.bbf]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc20_21.4)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc42_21.4)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -683,9 +844,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc11_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc21_35: %DeletedConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %DeletedConstructor.ref [concrete = constants.%DeletedConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %DeletedConstructor.ref: type = name_ref DeletedConstructor, imports.%DeletedConstructor.decl [concrete = constants.%DeletedConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %DeletedConstructor = wrapper_binding _, <error> [concrete = <error>]
@@ -698,9 +859,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @DeletedConversionTest(%s.param: %DeletedConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %DeletedConversion = name_ref s, %s
// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -741,9 +902,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConstructorTest(%s.param: %Source) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %Source = name_ref s, %s
// CHECK:STDOUT: %.loc11_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc21_36: %ExplicitConstructor = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_13: type = splice_block %ExplicitConstructor.ref [concrete = constants.%ExplicitConstructor] {
// CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %ExplicitConstructor.ref: type = name_ref ExplicitConstructor, imports.%ExplicitConstructor.decl [concrete = constants.%ExplicitConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %ExplicitConstructor = wrapper_binding _, <error> [concrete = <error>]
@@ -756,9 +917,9 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @ExplicitConversionTest(%s.param: %ExplicitConversion) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %s.ref: %ExplicitConversion = name_ref s, %s
// CHECK:STDOUT: %.loc20_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc20_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %.loc38_21: %Dest.980 = converted %s.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc38_13: type = splice_block %Dest.ref [concrete = constants.%Dest.980] {
// CHECK:STDOUT: %Cpp.ref.loc38: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Dest.ref: type = name_ref Dest, imports.%Dest.decl [concrete = constants.%Dest.980]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %Dest.980 = wrapper_binding _, <error> [concrete = <error>]
@@ -881,28 +1042,28 @@ fn InitFromStruct() {
// CHECK:STDOUT: fn @IntConstructorTest(%u.param: %u32) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %u.ref: %u32 = name_ref u, %u
// CHECK:STDOUT: %.loc12_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc12_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc12_31.1
// CHECK:STDOUT: %.loc24_31.1: ref %IntConstructor = temporary_storage
// CHECK:STDOUT: %.loc24_31.2: %i32 = converted %u.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %addr: %ptr.100 = addr_of %.loc24_31.1
// CHECK:STDOUT: %IntConstructor__carbon_thunk.call: init %empty_tuple.type = call imports.%IntConstructor__carbon_thunk.decl(<error>, %addr)
// CHECK:STDOUT: %.loc12_31.3: init %IntConstructor to %.loc12_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc12_31.4: init %IntConstructor = converted %u.ref, %.loc12_31.3
// CHECK:STDOUT: %.loc12_31.5: ref %IntConstructor = temporary %.loc12_31.1, %.loc12_31.4
// CHECK:STDOUT: %.loc12_31.6: %IntConstructor = acquire_value %.loc12_31.5
// CHECK:STDOUT: %.loc12_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %.loc24_31.3: init %IntConstructor to %.loc24_31.1 = mark_in_place_init %IntConstructor__carbon_thunk.call
// CHECK:STDOUT: %.loc24_31.4: init %IntConstructor = converted %u.ref, %.loc24_31.3
// CHECK:STDOUT: %.loc24_31.5: ref %IntConstructor = temporary %.loc24_31.1, %.loc24_31.4
// CHECK:STDOUT: %.loc24_31.6: %IntConstructor = acquire_value %.loc24_31.5
// CHECK:STDOUT: %.loc24_13: type = splice_block %IntConstructor.ref [concrete = constants.%IntConstructor] {
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %IntConstructor.ref: type = name_ref IntConstructor, imports.%IntConstructor.decl [concrete = constants.%IntConstructor]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc12_31.6
// CHECK:STDOUT: %_: %IntConstructor = wrapper_binding _, %.loc24_31.6
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt: %pattern_type.c4e = value_binding_pattern _ [concrete = constants.%_.patt.151]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc12_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc12_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc12_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc12_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc12_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc12_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_31.1: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.7: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.1 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %Destroy.facet.loc24_31.2: %Destroy.type = facet_value constants.%IntConstructor, (constants.%DestroyImpl.impl_witness.1d9, constants.%custom_witness.576) [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: %.loc24_31.8: %Destroy.type = converted constants.%IntConstructor, %Destroy.facet.loc24_31.2 [concrete = constants.%Destroy.facet]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc12_31.5)
// CHECK:STDOUT: %SelfDestruct.call: init %empty_tuple.type = call %SelfDestruct.specific_fn(%.loc24_31.5)
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1223,31 +1384,8 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromTuple() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc15_29.1: %tuple.type.985 = tuple_literal (%int_1.loc15) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc15_29.2: %Aggregate = converted %.loc15_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc15: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc19_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc19, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc19_31.2: %Aggregate = converted %.loc19_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_27.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
@@ -1256,6 +1394,29 @@ fn InitFromStruct() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_29.1: %tuple.type.985 = tuple_literal (%int_1.loc32) [concrete = constants.%tuple.378]
// CHECK:STDOUT: %.loc32_29.2: %Aggregate = converted %.loc32_29.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_31.1: %tuple.type.f94 = tuple_literal (%int_1.loc46, %int_2) [concrete = constants.%tuple.ad8]
// CHECK:STDOUT: %.loc46_31.2: %Aggregate = converted %.loc46_31.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1286,31 +1447,8 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc11_27.2: %Aggregate = converted %.loc11_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %Aggregate.ref.loc11 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc11: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc11: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc11: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc15_33.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc15_33.2: %Aggregate = converted %.loc15_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc15_13: type = splice_block %Aggregate.ref.loc15 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc15: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc15: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc15: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc19_41.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc19_41.2: %Aggregate = converted %.loc19_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_27.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_27.2: %Aggregate = converted %.loc19_27.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %Aggregate.ref.loc19 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc19: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
@@ -1319,6 +1457,29 @@ fn InitFromStruct() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc32: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc32_33.1: %struct_type.x = struct_literal (%int_1.loc32) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc32_33.2: %Aggregate = converted %.loc32_33.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc32_13: type = splice_block %Aggregate.ref.loc32 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc32: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc32: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc32: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc32: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc46: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc46_41.1: %struct_type.x.y = struct_literal (%int_1.loc46, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc46_41.2: %Aggregate = converted %.loc46_41.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc46_13: type = splice_block %Aggregate.ref.loc46 [concrete = constants.%Aggregate] {
// CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Aggregate.ref.loc46: type = name_ref Aggregate, imports.%Aggregate.decl [concrete = constants.%Aggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc46: %Aggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc46: %pattern_type.5dc = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -1525,31 +1686,8 @@ fn InitFromStruct() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @InitFromStruct() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc11_30.2: %NonAggregate = converted %.loc11_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc11_13: type = splice_block %NonAggregate.ref.loc11 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc11: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc11: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc11: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc15_36.1: %struct_type.x = struct_literal (%int_1.loc15) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc15_36.2: %NonAggregate = converted %.loc15_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc15_13: type = splice_block %NonAggregate.ref.loc15 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc15: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc15: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc15: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc19_44.1: %struct_type.x.y = struct_literal (%int_1.loc19, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc19_44.2: %NonAggregate = converted %.loc19_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_30.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
// CHECK:STDOUT: %.loc19_30.2: %NonAggregate = converted %.loc19_30.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc19_13: type = splice_block %NonAggregate.ref.loc19 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc19: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
@@ -1558,6 +1696,29 @@ fn InitFromStruct() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc19: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc33: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %.loc33_36.1: %struct_type.x = struct_literal (%int_1.loc33) [concrete = constants.%struct.147]
// CHECK:STDOUT: %.loc33_36.2: %NonAggregate = converted %.loc33_36.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc33_13: type = splice_block %NonAggregate.ref.loc33 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc33: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc33: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc33: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
// CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
// CHECK:STDOUT: %.loc48_44.1: %struct_type.x.y = struct_literal (%int_1.loc48, %int_2) [concrete = constants.%struct.004]
// CHECK:STDOUT: %.loc48_44.2: %NonAggregate = converted %.loc48_44.1, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc48_13: type = splice_block %NonAggregate.ref.loc48 [concrete = constants.%NonAggregate] {
// CHECK:STDOUT: %Cpp.ref.loc48: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %NonAggregate.ref.loc48: type = name_ref NonAggregate, imports.%NonAggregate.decl [concrete = constants.%NonAggregate]
// CHECK:STDOUT: }
// CHECK:STDOUT: %_.loc48: %NonAggregate = wrapper_binding _, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %_.patt.loc48: %pattern_type.273 = value_binding_pattern _ [concrete = constants.%_.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+19 -4
View File
@@ -15,7 +15,11 @@
library "[[@TEST_NAME]]";
import Cpp inline '''
// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:1: error: unknown type name 'error' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+6]]:1
// CHECK:STDERR: -> │ error has_error;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: unknown type name 'error' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
error has_error;
#define macro_with_error has_error.member
@@ -23,10 +27,21 @@ error has_error;
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+5]]:3-22: error: failed to parse macro Cpp.macro_with_error to a valid constant expression [InCppMacroEvaluation]
// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+4]]:3-22: note: in `Cpp` name lookup for `macro_with_error` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.macro_with_error;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.macro_with_error to a valid constant
// CHECK:STDERR: · │ ┃ expression
// CHECK:STDERR: · │ ┃ [InCppMacroEvaluation]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `macro_with_error` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_macro_with_error.carbon:[[@LINE+2]]:3-22: error: member name `macro_with_error` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_macro_with_error.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.macro_with_error;
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `macro_with_error` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.macro_with_error;
//@dump-sem-ir-end
+264 -60
View File
@@ -41,7 +41,6 @@ fn F() {
}
// --- bad_suffix.h
// CHECK:STDERR: expanded from macro defined at: ./bad_suffix.h:[[@LINE+1]]:24 [InCppMacroExpansion]
#define CONFIG_VALUE 42f
// --- fail_import_bad_suffix.carbon
@@ -51,19 +50,35 @@ library "[[@TEST_NAME]]";
import Cpp library "bad_suffix.h";
fn F() {
// CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+8]]:6: error: invalid digit 'f' in decimal constant [CppInteropParseError]
// CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+7]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./bad_suffix.h [InCppMacroExpansion]
// CHECK:STDERR: ├─┤ fail_import_bad_suffix.carbon:[[@LINE+24]]:6
// CHECK:STDERR: -> │ #define CONFIG_VALUE 42f
// CHECK:STDERR: · ───┳────┬───────
// CHECK:STDERR: · ┗━━━━━━━┫ error: invalid digit 'f' in decimal constant
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+5]]:3-18: error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant expression [InCppMacroEvaluation]
// CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_bad_suffix.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.CONFIG_VALUE;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.CONFIG_VALUE to a valid constant
// CHECK:STDERR: · │ ┃ expression
// CHECK:STDERR: · │ ┃ [InCppMacroEvaluation]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_bad_suffix.carbon:[[@LINE+2]]:3-18: error: member name `CONFIG_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_bad_suffix.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.CONFIG_VALUE;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `CONFIG_VALUE` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.CONFIG_VALUE;
}
// --- integer_literal_too_big.h
// CHECK:STDERR: expanded from macro defined at: ./integer_literal_too_big.h:[[@LINE+1]]:22 [InCppMacroExpansion]
#define CONFIG_VALUE 18446744073709551616
// --- fail_import_integer_literal_too_big.carbon
@@ -73,8 +88,15 @@ library "[[@TEST_NAME]]";
import Cpp library "integer_literal_too_big.h";
fn F() {
// CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+3]]:6: error: integer literal is too large to be represented in any integer type [CppInteropParseError]
// CHECK:STDERR: fail_import_integer_literal_too_big.carbon:[[@LINE+2]]:3-18: note: in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./integer_literal_too_big.h [InCppMacroExpansion]
// CHECK:STDERR: ├─┤ fail_import_integer_literal_too_big.carbon:[[@LINE+9]]:6
// CHECK:STDERR: -> │ #define CONFIG_VALUE 18446744073709551616
// CHECK:STDERR: · ───┳────────────
// CHECK:STDERR: · ┗━━┫ error: integer literal is too large to be represented in any integer
// CHECK:STDERR: · │ ┃ type
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `CONFIG_VALUE` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.CONFIG_VALUE;
}
@@ -86,7 +108,11 @@ library "[[@TEST_NAME]]";
import Cpp library "integer_literal_replacement_token.h";
fn F() {
// CHECK:STDERR: fail_assign_to_object_like_macro.carbon:[[@LINE+2]]:3-18: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_assign_to_object_like_macro.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ Cpp.CONFIG_VALUE = 3;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.CONFIG_VALUE = 3;
}
@@ -106,7 +132,13 @@ import Cpp library "macro_in_nested_scope.h";
fn F() {
let unused a: i32 = Cpp.CONFIG_VALUE;
// CHECK:STDERR: fail_import_macro_in_nested_scope.carbon:[[@LINE+2]]:23-40: error: member name `CONFIG_VALUE` not found in `Cpp.N` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_macro_in_nested_scope.carbon:[[@LINE+8]]:23
// CHECK:STDERR: -> │ let unused b: i32 = Cpp.N.CONFIG_VALUE;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `CONFIG_VALUE` not found in
// CHECK:STDERR: · ┃ `Cpp.N`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused b: i32 = Cpp.N.CONFIG_VALUE;
}
@@ -146,10 +178,20 @@ import Cpp library "no_replacement_token.h";
fn F() {
// TODO: Get rid of the second error.
// CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+5]]:3-16: error: semantics TODO: `Unsupported: macro with 0 replacement tokens` [SemanticsTodo]
// CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+4]]:3-16: note: in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_no_replacement_token.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.MACRO_NAME;
// CHECK:STDERR: · ━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `Unsupported: macro with 0 replacement tokens`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MACRO_NAME` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_no_replacement_token.carbon:[[@LINE+2]]:3-16: error: member name `MACRO_NAME` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_no_replacement_token.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.MACRO_NAME;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `MACRO_NAME` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.MACRO_NAME;
}
@@ -264,22 +306,55 @@ library "[[@TEST_NAME]]";
import Cpp library "unsupported_string_literal_types.h";
fn F() {
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char16_t[6]` [SemanticsTodo]
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2
// CHECK:STDERR: -> │ Cpp.Utf16Greeting;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const char16_t[6]`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `Utf16Greeting` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf16Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2
// CHECK:STDERR: -> │ Cpp.Utf16Greeting;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `Utf16Greeting` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Utf16Greeting;
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-18: error: semantics TODO: `Unsupported: string literal type: const char32_t[6]` [SemanticsTodo]
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-18: note: in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2
// CHECK:STDERR: -> │ Cpp.Utf32Greeting;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const char32_t[6]`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `Utf32Greeting` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-18: error: member name `Utf32Greeting` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2
// CHECK:STDERR: -> │ Cpp.Utf32Greeting;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `Utf32Greeting` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.Utf32Greeting;
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+5]]:2-17: error: semantics TODO: `Unsupported: string literal type: const wchar_t[6]` [SemanticsTodo]
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+4]]:2-17: note: in `Cpp` name lookup for `WideGreeting` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+16]]:2
// CHECK:STDERR: -> │ Cpp.WideGreeting;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · │ ┃ `Unsupported: string literal type: const wchar_t[6]`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `WideGreeting` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_unsupported_string_literal_types.carbon:[[@LINE+2]]:2-17: error: member name `WideGreeting` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_string_literal_types.carbon:[[@LINE+7]]:2
// CHECK:STDERR: -> │ Cpp.WideGreeting;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `WideGreeting` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.WideGreeting;
}
@@ -293,10 +368,20 @@ import Cpp inline '''
''';
fn F() {
// CHECK:STDERR: fail_bad_string.carbon:[[@LINE+5]]:2-14: error: failed to parse macro Cpp.BadString to a valid constant expression [InCppMacroEvaluation]
// CHECK:STDERR: fail_bad_string.carbon:[[@LINE+4]]:2-14: note: in `Cpp` name lookup for `BadString` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_bad_string.carbon:[[@LINE+15]]:2
// CHECK:STDERR: -> │ Cpp.BadString;
// CHECK:STDERR: · ━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: failed to parse macro Cpp.BadString to a valid constant expression
// CHECK:STDERR: · │ ┃ [InCppMacroEvaluation]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `BadString` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_bad_string.carbon:[[@LINE+2]]:2-14: error: member name `BadString` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_bad_string.carbon:[[@LINE+7]]:2
// CHECK:STDERR: -> │ Cpp.BadString;
// CHECK:STDERR: · ━━━━━━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `BadString` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.BadString;
}
@@ -330,10 +415,21 @@ library "[[@TEST_NAME]]";
import Cpp library "unsupported_floating_point_literal_macro.h";
fn F() {
// CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+5]]:3-18: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: long double` [SemanticsTodo]
// CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+4]]:3-18: note: in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+16]]:3
// CHECK:STDERR: -> │ Cpp.MyLongDouble;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · │ ┃ `Unsupported: macro evaluated to a constant of type: long double`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MyLongDouble` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+2]]:3-18: error: member name `MyLongDouble` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_floating_point_literal_macro.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.MyLongDouble;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `MyLongDouble` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.MyLongDouble;
}
@@ -345,7 +441,11 @@ library "[[@TEST_NAME]]";
import Cpp library "floating_point_literal_macro.h";
fn F() {
// CHECK:STDERR: fail_import_assign_to_float.carbon:[[@LINE+2]]:3-14: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_import_assign_to_float.carbon:[[@LINE+6]]:3
// CHECK:STDERR: -> │ Cpp.MyDouble = 1.0;
// CHECK:STDERR: · ━━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.MyDouble = 1.0;
}
@@ -398,7 +498,6 @@ fn F() {
// --- multiple_characters.h
// CHECK:STDERR: expanded from macro defined at: ./multiple_characters.h:[[@LINE+1]]:24 [InCppMacroExpansion]
#define MULTIPLE_CHARS 'AB'
// --- import_multiple_characters.carbon
@@ -408,8 +507,15 @@ library "[[@TEST_NAME]]";
import Cpp library "multiple_characters.h";
fn F() {
// CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+3]]:25: warning: multi-character character constant [CppInteropParseWarning]
// CHECK:STDERR: import_multiple_characters.carbon:[[@LINE+2]]:22-39: note: in `Cpp` name lookup for `MULTIPLE_CHARS` [InCppNameLookup]
// CHECK:STDERR: ╷ ╭── expanded from macro defined at: ./multiple_characters.h [InCppMacroExpansion]
// CHECK:STDERR: ├─┤ import_multiple_characters.carbon:[[@LINE+9]]:25
// CHECK:STDERR: -> │ #define MULTIPLE_CHARS 'AB'
// CHECK:STDERR: · ───┳─────┬────────
// CHECK:STDERR: · ┗━━━━━━━━┫ warning: multi-character character constant
// CHECK:STDERR: · │ ┃ [CppInteropParseWarning]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `MULTIPLE_CHARS`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: i32 = Cpp.MULTIPLE_CHARS;
}
@@ -427,22 +533,61 @@ library "[[@TEST_NAME]]";
import Cpp library "unsupported_character_literal_types.h";
fn F() {
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char16_t` [SemanticsTodo]
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF16_CHAR` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23
// CHECK:STDERR: -> │ let unused a: char = Cpp.M_UTF16_CHAR;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: char16_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_UTF16_CHAR`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF16_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ let unused a: char = Cpp.M_UTF16_CHAR;
// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `M_UTF16_CHAR` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: char = Cpp.M_UTF16_CHAR;
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-38: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: char32_t` [SemanticsTodo]
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-38: note: in `Cpp` name lookup for `M_UTF32_CHAR` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23
// CHECK:STDERR: -> │ let unused b: char = Cpp.M_UTF32_CHAR;
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: char32_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_UTF32_CHAR`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-38: error: member name `M_UTF32_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ let unused b: char = Cpp.M_UTF32_CHAR;
// CHECK:STDERR: · ━┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `M_UTF32_CHAR` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused b: char = Cpp.M_UTF32_CHAR;
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+5]]:23-37: error: semantics TODO: `Unsupported: macro evaluated to a constant of type: wchar_t` [SemanticsTodo]
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+4]]:23-37: note: in `Cpp` name lookup for `M_WIDE_CHAR` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+18]]:23
// CHECK:STDERR: -> │ let unused c: char = Cpp.M_WIDE_CHAR;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: macro evaluated to a constant of type: wchar_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `M_WIDE_CHAR`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_unsupported_character_literal_types.carbon:[[@LINE+2]]:23-37: error: member name `M_WIDE_CHAR` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_unsupported_character_literal_types.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ let unused c: char = Cpp.M_WIDE_CHAR;
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `M_WIDE_CHAR` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: char = Cpp.M_WIDE_CHAR;
}
@@ -454,7 +599,11 @@ library "[[@TEST_NAME]]";
import Cpp library "character_literals.h";
fn F() {
// CHECK:STDERR: fail_assign_to_character_literals.carbon:[[@LINE+2]]:2-16: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_assign_to_character_literals.carbon:[[@LINE+6]]:2
// CHECK:STDERR: -> │ Cpp.M_LOWERCASE = 'b';
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.M_LOWERCASE = 'b';
}
@@ -506,7 +655,11 @@ library "[[@TEST_NAME]]";
import Cpp library "boolean_literal_macro.h";
fn F() {
// CHECK:STDERR: fail_assign_to_boolean_literal_macro.carbon:[[@LINE+2]]:2-11: error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╭─┤ fail_assign_to_boolean_literal_macro.carbon:[[@LINE+6]]:2
// CHECK:STDERR: -> │ Cpp.M_TRUE = false;
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: expression is not assignable [AssignmentToNonAssignable]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.M_TRUE = false;
}
@@ -650,7 +803,12 @@ library "[[@TEST_NAME]]";
import Cpp library "macro_undefined.h";
fn F() {
// CHECK:STDERR: fail_macro_undefined.carbon:[[@LINE+2]]:23-37: error: member name `UNDEF_VALUE` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_macro_undefined.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ let unused a: i32 = Cpp.UNDEF_VALUE;
// CHECK:STDERR: · ━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `UNDEF_VALUE` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: i32 = Cpp.UNDEF_VALUE;
}
@@ -677,16 +835,23 @@ fn F() {
// --- macro_defined_twice.h
#define TWICE_DEF 1
// CHECK:STDERR: ╷ ╭── included from: import_macro_defined_twice.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./macro_defined_twice.h:[[@LINE+10]]:9
// CHECK:STDERR: │ #define TWICE_DEF 1
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ previous definition is here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ #define TWICE_DEF 2
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ warning: 'TWICE_DEF' macro redefined [CppInteropParseWarning]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
#define TWICE_DEF 2
// --- import_macro_defined_twice.carbon
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: import_macro_defined_twice.carbon:[[@LINE+4]]:10 [InCppInclude]
// CHECK:STDERR: ./macro_defined_twice.h:3:9: warning: 'TWICE_DEF' macro redefined [CppInteropParseWarning]
// CHECK:STDERR: ./macro_defined_twice.h:2:9: note: previous definition is here [CppInteropParseNote]
// CHECK:STDERR:
import Cpp library "macro_defined_twice.h";
fn F() {
@@ -710,7 +875,12 @@ library "[[@TEST_NAME]]";
import Cpp library "function_like_macros.h";
fn F() {
// CHECK:STDERR: fail_todo_import_function_like_macros.carbon:[[@LINE+2]]:23-29: error: member name `MAX` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_todo_import_function_like_macros.carbon:[[@LINE+7]]:23
// CHECK:STDERR: -> │ let unused a: i32 = Cpp.MAX(1,2);
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `MAX` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused a: i32 = Cpp.MAX(1,2);
}
@@ -730,7 +900,13 @@ library "[[@TEST_NAME]]";
import Cpp library "predefined_macros.h";
fn F() {
// CHECK:STDERR: fail_todo_import_predefined_macros.carbon:[[@LINE+2]]:30-41: error: member name `__LINE__` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_todo_import_predefined_macros.carbon:[[@LINE+8]]:30
// CHECK:STDERR: -> │ let unused line_num: i32 = Cpp.__LINE__;
// CHECK:STDERR: · ┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `__LINE__` not found in
// CHECK:STDERR: · ┃ `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused line_num: i32 = Cpp.__LINE__;
}
@@ -755,7 +931,12 @@ library "[[@TEST_NAME]]";
import Cpp library "header_guard_macros.h";
fn F() {
// CHECK:STDERR: fail_import_header_guard_macros.carbon:[[@LINE+2]]:3-27: error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_header_guard_macros.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.HEADER_GUARD_MACRO_H_;
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `HEADER_GUARD_MACRO_H_` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.HEADER_GUARD_MACRO_H_;
}
@@ -833,11 +1014,24 @@ Struct s;
''';
fn F() {
// CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+6]]:3-7: error: semantics TODO: `lvalue path contains an array type` [SemanticsTodo]
// CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+5]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+19]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `lvalue path contains an array type`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `m` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+3]]:3-11: error: cannot implicitly convert expression of type `Core.IntLiteral` to `array(i32, 3)` [ConversionFailure]
// CHECK:STDERR: fail_todo_assign_array.carbon:[[@LINE+2]]:3-11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(array(i32, 3))` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_assign_array.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `array(i32, 3)`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(array(i32, 3))`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.m = 2;
}
@@ -855,10 +1049,20 @@ struct DerivedB : BaseA {} b_obj;
''';
fn F() {
// CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+5]]:3-7: error: semantics TODO: `lvalue path contains a base class subobject` [SemanticsTodo]
// CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+4]]:3-7: note: in `Cpp` name lookup for `m` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_todo_assign_base_class_member.carbon:[[@LINE+15]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `lvalue path contains a base class subobject`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `m` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_assign_base_class_member.carbon:[[@LINE+2]]:3-7: error: member name `m` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_todo_assign_base_class_member.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.m = 2;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: member name `m` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.m = 2;
}
@@ -2050,7 +2254,7 @@ let _: C(1) = {} as C(Cpp.COUNT);
// CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %TWICE_DEF.ref: %i32 = name_ref TWICE_DEF, constants.%int_2 [concrete = constants.%int_2]
// CHECK:STDOUT: %i32.loc12: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: %i32.loc8: type = type_literal constants.%i32 [concrete = constants.%i32]
// CHECK:STDOUT: %a: %i32 = wrapper_binding a, %TWICE_DEF.ref
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %a.patt: %pattern_type.d94 = value_binding_pattern a [concrete = constants.%a.patt]
@@ -64,7 +64,12 @@ class C {}
inline Cpp '''
Carbon::C* p;
// CHECK:STDERR: fail_current_package_not_in_carbon.carbon:[[@LINE+2]]:25: error: expected namespace name [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_current_package_not_in_carbon.carbon:[[@LINE+7]]:25
// CHECK:STDERR: -> │ namespace Bad = Carbon::SelfPkg;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: expected namespace name
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
namespace Bad = Carbon::SelfPkg;
''';
@@ -77,7 +82,12 @@ class C {}
inline Cpp '''
Carbon::C* p;
// CHECK:STDERR: fail_main_package_not_in_carbon.carbon:[[@LINE+2]]:25: error: expected namespace name [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_main_package_not_in_carbon.carbon:[[@LINE+7]]:25
// CHECK:STDERR: -> │ namespace Bad = Carbon::Main;
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: expected namespace name
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
namespace Bad = Carbon::Main;
''';
+81 -17
View File
@@ -40,7 +40,12 @@ library "[[@TEST_NAME]]";
import Cpp library "single.h";
fn MyF() {
// CHECK:STDERR: fail_import_namespace_wrong_member_name.carbon:[[@LINE+2]]:3-26: error: member name `not_foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_namespace_wrong_member_name.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.my_namespace.not_foo();
// CHECK:STDERR: · ━━━━━━━━━━━━┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `not_foo` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.my_namespace.not_foo();
}
@@ -52,7 +57,12 @@ library "[[@TEST_NAME]]";
import Cpp library "single.h";
fn MyF() {
// CHECK:STDERR: fail_import_namespace_wrong_name.carbon:[[@LINE+2]]:3-22: error: member name `not_my_namespace` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_namespace_wrong_name.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.not_my_namespace.foo();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `not_my_namespace` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.not_my_namespace.foo();
}
@@ -128,15 +138,33 @@ fn MyF() {
// file split.
// TODO: Pass a location into Clang when performing C++ name lookup so that
// its error has a location attached.
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+5]]:3-7: error: name `error` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_import_inline_ambiguity.carbon:[[@LINE+25]]:3
// CHECK:STDERR: -> │ error;
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: name `error` not found [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: -> ╭─┤ <no location>
// CHECK:STDERR: · ┗━━┫ error: reference to 'N' is ambiguous [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./inline_ambiguity.h:2:11
// CHECK:STDERR: │ namespace N { void foo(); }
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate found by name lookup is 'N' [CppInteropParseNote]
// CHECK:STDERR: │ inline namespace { namespace N {} }
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate found by name lookup is '(anonymous
// CHECK:STDERR: · │ namespace)::N'
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_inline_ambiguity.carbon
// CHECK:STDERR: │ Cpp.N.foo();
// CHECK:STDERR: · ──┬──
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `N` [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: error: reference to 'N' is ambiguous [CppInteropParseError]
// CHECK:STDERR: ./inline_ambiguity.h:2:11: note: candidate found by name lookup is 'N' [CppInteropParseNote]
// CHECK:STDERR: ./inline_ambiguity.h:3:30: note: candidate found by name lookup is '(anonymous namespace)::N' [CppInteropParseNote]
error;
// CHECK:STDERR: fail_import_inline_ambiguity.carbon:[[@LINE+2]]:3-7: note: in `Cpp` name lookup for `N` [InCppNameLookup]
// CHECK:STDERR:
Cpp.N.foo();
}
@@ -177,7 +205,12 @@ library "[[@TEST_NAME]]";
import Cpp library "special_name.h";
fn MyF() {
// CHECK:STDERR: fail_import_special_name_call_unescpaed.carbon:[[@LINE+2]]:3-10: error: member name `base` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_import_special_name_call_unescpaed.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ Cpp.base.foo();
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: member name `base` not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.base.foo();
}
@@ -228,6 +261,15 @@ fn Use(y: Cpp.Y) -> i32 {
library "[[@TEST_NAME]]";
// CHECK:STDERR: ╷ ╭── imported from: fail_indirect_namespace_no_import.carbon [InImport]
// CHECK:STDERR: ├─┤ namespace_alias.carbon:[[@LINE+8]]:1
// CHECK:STDERR: -> │ import Cpp library "single.h";
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `indirect import of C++ declaration with no direct Cpp import`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
import Cpp library "single.h";
alias MyNamespaceAlias = Cpp.my_namespace;
@@ -240,9 +282,6 @@ fn CallFoo() {
library "[[@TEST_NAME]]";
// CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+6]]:1 [InImport]
// CHECK:STDERR: namespace_alias.carbon:4:1-30: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo]
// CHECK:STDERR:
// CHECK:STDERR: imported from: fail_indirect_namespace_no_import.carbon:[[@LINE+3]]:1 [InImport]
// CHECK:STDERR: namespace_alias.carbon: error: semantics TODO: `indirect import of C++ declaration with no direct Cpp import` [SemanticsTodo]
// CHECK:STDERR:
@@ -251,11 +290,21 @@ import library "namespace_alias";
fn F() {
// Imports are not implicitly re-exported, so lookup is expected to fail,
// regardless of whether a lookup was performed in the imported file.
// CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_import.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ MyNamespaceAlias.foo();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
MyNamespaceAlias.foo();
// CHECK:STDERR: fail_indirect_namespace_no_import.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_import.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ MyNamespaceAlias.bar();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
MyNamespaceAlias.bar();
}
@@ -273,11 +322,21 @@ import Cpp;
fn F() {
// Imports are not implicitly re-exported, so name lookup is expected to
// fail, regardless of whether a lookup was performed in the imported file.
// CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_local_decl.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ MyNamespaceAlias.foo();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
MyNamespaceAlias.foo();
// CHECK:STDERR: fail_indirect_namespace_no_local_decl.carbon:[[@LINE+2]]:3-22: error: member name `bar` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_indirect_namespace_no_local_decl.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ MyNamespaceAlias.bar();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `bar` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
MyNamespaceAlias.bar();
}
@@ -311,7 +370,12 @@ namespace my_namespace {
fn F() {
// Cpp imports are not implicitly re-exported, so name lookup is expected to
// fail.
// CHECK:STDERR: fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+2]]:3-22: error: member name `foo` not found in `Cpp.my_namespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_indirect_namespace_different_contents_invalid.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ MyNamespaceAlias.foo();
// CHECK:STDERR: · ━━━━━━━━━━┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `foo` not found in `Cpp.my_namespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
MyNamespaceAlias.foo();
}
@@ -30,17 +30,33 @@ using namespace Carbon::N;
// triggering typo correction) and resolve to `Fallback`. Following the normal
// Carbon name poisoning rules, these then trigger poisoning errors when those
// names are defined in Carbon.
// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+1]]:10: error: name `LaterFn` used before it was declared [NameUseBeforeDecl]
// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ int *a = LaterFn();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: name `LaterFn` used before it was declared
// CHECK:STDERR: · ┃ [NameUseBeforeDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn LaterFn() -> i32;
// CHECK:STDERR: · ───┬───
// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int *a = LaterFn();
// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning.carbon:[[@LINE+11]]:10
// CHECK:STDERR: -> │ int *b = LaterNestedFn();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: name `LaterNestedFn` used before it was declared
// CHECK:STDERR: · ┃ [NameUseBeforeDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn N.LaterNestedFn() -> i32;
// CHECK:STDERR: · ──────┬──────
// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
int *b = LaterNestedFn();
''';
// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+3]]:4-10: note: declared here [NameUseBeforeDeclNote]
// CHECK:STDERR:
// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE-5]]:10: error: name `LaterNestedFn` used before it was declared [NameUseBeforeDecl]
fn LaterFn() -> i32;
// CHECK:STDERR: fail_declare_after_poisoning.carbon:[[@LINE+2]]:6-18: note: declared here [NameUseBeforeDeclNote]
// CHECK:STDERR:
fn N.LaterNestedFn() -> i32;
inline Cpp '''
@@ -64,16 +80,30 @@ void TestLookupFailureInNested() {
// second is a Carbon error for declaring a poisoned name. Normally we would
// suppress the first error when we produce the second, but we don't do that
// when the first error is produced by Clang.
// CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+3]]:19-31: error: no member named 'LaterInNested' in namespace 'Carbon::Nested' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+19]]:19
// CHECK:STDERR: -> │ Carbon::Nested::LaterInNested();
// CHECK:STDERR: · ┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'LaterInNested' in namespace
// CHECK:STDERR: · ┃ 'Carbon::Nested'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: ╭─┤ fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+11]]:19
// CHECK:STDERR: -> │ Carbon::Nested::LaterInNested();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: name `LaterInNested` used before it was declared
// CHECK:STDERR: · ┃ [NameUseBeforeDecl]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn Nested.LaterInNested() {}
// CHECK:STDERR: · ──────┬──────
// CHECK:STDERR: · ╰──┤ declared here [NameUseBeforeDeclNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+1]]:19: error: name `LaterInNested` used before it was declared [NameUseBeforeDecl]
Carbon::Nested::LaterInNested();
Carbon::Nested::EarlyFn();
}
''';
// CHECK:STDERR: fail_declare_after_poisoning_with_lookup_failure.carbon:[[@LINE+2]]:11-23: note: declared here [NameUseBeforeDeclNote]
// CHECK:STDERR:
fn Nested.LaterInNested() {}
inline Cpp '''
@@ -98,9 +128,18 @@ inline Cpp '''
Carbon::ExportedType* p1 = nullptr;
void TestTypoInCarbon() {
// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+4]]:11: error: no type named 'ExportedTyp' in namespace 'Carbon'; did you mean 'ExportedType'? [CppInteropParseError]
// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+3]]:11-21: note: replace with `ExportedType` [CppInteropFixItReplacement]
// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE-12]]:20: note: 'ExportedType' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_typo_in_carbon_namespace.carbon:[[@LINE+13]]:11
// CHECK:STDERR: │ class ExportedType {
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'ExportedType' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::ExportedTyp* p_typo = p1;
// CHECK:STDERR: · ───────╴┎┬─────────
// CHECK:STDERR: · ┗━━━┫ error: no type named 'ExportedTyp' in namespace 'Carbon'; did
// CHECK:STDERR: · │ ┃ you mean 'ExportedType'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ replace with `ExportedType` [CppInteropFixItReplacement]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::ExportedTyp* p_typo = p1;
@@ -109,7 +148,12 @@ void TestTypoInCarbon() {
// subsequent name lookups still work properly.
Carbon::EarlyFn();
Carbon::ExportedType* p2 = p1;
// CHECK:STDERR: fail_typo_in_carbon_namespace.carbon:[[@LINE+2]]:11-21: error: no member named 'NotDeclared' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_typo_in_carbon_namespace.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::NotDeclared();
// CHECK:STDERR: · ━━━━━┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'NotDeclared' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::NotDeclared();
}
@@ -141,7 +185,13 @@ class MyClass {
inline Cpp '''
void TestTypoInClass() {
// TODO: It'd be nice if Clang's typo correction could correct this.
// CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+2]]:20-31: error: no member named 'StaticMetho1' in 'Carbon::Main::MyClass' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_typo_in_carbon_class.carbon:[[@LINE+8]]:20
// CHECK:STDERR: -> │ Carbon::MyClass::StaticMetho1();
// CHECK:STDERR: · ┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'StaticMetho1' in
// CHECK:STDERR: · ┃ 'Carbon::Main::MyClass'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::MyClass::StaticMetho1();
@@ -153,9 +203,20 @@ void TestTypoInClass() {
static_assert(sizeof(Carbon::MyClass) == 4);
// Typo correction does work once we've exported the name.
// CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+4]]:20-31: error: no member named 'StaticMetho1' in 'Carbon::Main::MyClass'; did you mean 'StaticMethod1'? [CppInteropParseError]
// CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE+3]]:20-31: note: replace with `StaticMethod1` [CppInteropFixItReplacement]
// CHECK:STDERR: fail_typo_in_carbon_class.carbon:[[@LINE-22]]:21: note: 'StaticMethod1' declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_typo_in_carbon_class.carbon:[[@LINE+15]]:20
// CHECK:STDERR: │ fn StaticMethod1();
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ 'StaticMethod1' declared here [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::MyClass::StaticMetho1();
// CHECK:STDERR: · ┳━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'StaticMetho1' in
// CHECK:STDERR: · │ ┃ 'Carbon::Main::MyClass'; did you mean
// CHECK:STDERR: · │ ┃ 'StaticMethod1'?
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ replace with `StaticMethod1`
// CHECK:STDERR: · │ [CppInteropFixItReplacement]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::MyClass::StaticMetho1();
}
@@ -68,7 +68,12 @@ void F();
void G() {
// This is not found because it looks for the identifier `Cpp`, not the keyword `Cpp`.
// CHECK:STDERR: fail_carbon_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_carbon_cpp.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::Cpp::F();
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::Cpp::F();
}
@@ -85,9 +90,19 @@ inline Cpp '''
void FRaw();
void GRaw() {
// CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+4]]:16: error: semantics TODO: `interop with translation unit decl` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_carbon_raw_cpp.carbon:[[@LINE+14]]:16
// CHECK:STDERR: -> │ Carbon::Cpp::FRaw();
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `interop with translation unit decl`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_carbon_raw_cpp.carbon:[[@LINE+2]]:11: error: no member named 'Cpp' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_carbon_raw_cpp.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::Cpp::FRaw();
// CHECK:STDERR: · ───────╴╻
// CHECK:STDERR: · ┗━━┫ error: no member named 'Cpp' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::Cpp::FRaw();
}
@@ -51,16 +51,44 @@ enum class EC { e1, e2, e3 };
''';
fn TestEnumClass(a: Cpp.EC, b: Cpp.EC) {
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a & b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a & b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a | b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a | b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-23: error: cannot access member of interface `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = a ^ b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.EC)` in type `Cpp.EC` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = a ^ b;
// CHECK:STDERR: fail_enum_class_bitwise_operators.carbon:[[@LINE+2]]:19-20: error: cannot access member of interface `Core.BitComplement` in type `Cpp.EC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_enum_class_bitwise_operators.carbon:[[@LINE+9]]:19
// CHECK:STDERR: -> │ let _: Cpp.EC = ^a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.EC` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: Cpp.EC = ^a;
}
@@ -137,105 +165,334 @@ struct ConvertibleToFloat {
fn TestInteger(a: Cpp.ConvertibleToInt, b: Cpp.ConvertibleToInt) {
// Test arithmetic.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a + b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a + b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a - b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a - b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a * b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a * b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a / b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a / b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.ModWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a % b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.ModWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a % b;
// Test bitwise.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitAndWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a & b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a & b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitOrWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a | b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitOrWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a | b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.BitXorWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a ^ b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitXorWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a ^ b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a << b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.LeftShiftWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a << b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-21: error: cannot access member of interface `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: i32 = a >> b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.RightShiftWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = a >> b;
// Test comparison.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a == b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a == b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a != b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a != b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a < b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a < b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a <= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a <= b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a > b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a > b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToInt)` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a >= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToInt)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToInt` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a >= b);
// Test unary.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: i32 = -a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in
// CHECK:STDERR: · ┃ type `Cpp.ConvertibleToInt` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = -a;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.BitComplement` in type `Cpp.ConvertibleToInt` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: i32 = ^a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitComplement` in type `Cpp.ConvertibleToInt`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: i32 = ^a;
}
fn TestFloat(a: Cpp.ConvertibleToFloat, b: Cpp.ConvertibleToFloat) {
// Test arithmetic.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.AddWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a + b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a + b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.SubWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a - b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.SubWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a - b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.MulWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a * b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.MulWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a * b;
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-20: error: cannot access member of interface `Core.DivWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:16
// CHECK:STDERR: -> │ let _: f32 = a / b;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.DivWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = a / b;
// Test comparison.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a == b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a == b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.EqWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a != b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a != b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a < b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a < b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a <= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a <= b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a > b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a > b);
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:18-23: error: cannot access member of interface `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+10]]:18
// CHECK:STDERR: -> │ let _: bool = (a >= b);
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.ConvertibleToFloat)` in type
// CHECK:STDERR: · ┃ `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: bool = (a >= b);
// Test unary.
// CHECK:STDERR: fail_convert_all_operands.carbon:[[@LINE+2]]:16-17: error: cannot access member of interface `Core.Negate` in type `Cpp.ConvertibleToFloat` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_convert_all_operands.carbon:[[@LINE+9]]:16
// CHECK:STDERR: -> │ let _: f32 = -a;
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Negate` in
// CHECK:STDERR: · ┃ type `Cpp.ConvertibleToFloat` that does not implement
// CHECK:STDERR: · ┃ that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let _: f32 = -a;
}
+21 -3
View File
@@ -62,7 +62,13 @@ public:
''';
fn TestDerefPass(var int_ptr: Cpp.MultiDeref) -> ref i32 {
// CHECK:STDERR: fail_todo_multi_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_multi_deref.carbon:[[@LINE+8]]:10
// CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `operator* overload sets not implemented yet`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return int_ptr.(Core.CppUnsafeDeref.Op)();
}
@@ -89,7 +95,13 @@ public:
''';
fn TestDerefPass(var int_ptr: Cpp.MaybeDeref(i32)) -> ref i32 {
// CHECK:STDERR: fail_todo_maybe_deref.carbon:[[@LINE+2]]:10-41: error: semantics TODO: `operator* overload sets not implemented yet` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_maybe_deref.carbon:[[@LINE+8]]:10
// CHECK:STDERR: -> │ return int_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `operator* overload sets not implemented yet`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return int_ptr.(Core.CppUnsafeDeref.Op)();
}
@@ -103,7 +115,13 @@ class NotAPtr {};
''';
fn TestDerefFail(not_ptr: Cpp.NotAPtr) {
// CHECK:STDERR: fail_not_a_ptr.carbon:[[@LINE+2]]:3-34: error: cannot access member of interface `Core.CppUnsafeDeref` in type `Cpp.NotAPtr` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_not_a_ptr.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ not_ptr.(Core.CppUnsafeDeref.Op)();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.CppUnsafeDeref` in type
// CHECK:STDERR: · ┃ `Cpp.NotAPtr` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
not_ptr.(Core.CppUnsafeDeref.Op)();
}
+222 -43
View File
@@ -93,13 +93,52 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct NeqBoolish {
auto operator==(NeqBoolish) const -> bool;
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator!=(NeqBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
// CHECK:STDERR: · ─────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator!=(NeqBoolish) const -> int;
};
struct EqBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator==(EqBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬───────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator==(EqBoolish) const -> int*;
auto operator!=(EqBoolish) const -> bool;
};
@@ -109,28 +148,55 @@ struct BothBoolish {
False,
True,
};
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Equal(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬───────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator==(BothBoolish) const -> Result;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator!=(BothBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ default fn NotEqual(self, other: Other) -> bool {
// CHECK:STDERR: · ─────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator!=(BothBoolish) const -> Result;
};
''';
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-12]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-13]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:13:3-39: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-16]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-17]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:14:3-51: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
x == y;
x != y;
@@ -168,19 +234,45 @@ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
}
fn Test(default_eq_only: Cpp.DefaultEqOnly,
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+2]]:33-56: error: member name `DefaultSpaceshipOnly` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+8]]:33
// CHECK:STDERR: -> │ default_spaceship_only: Cpp.DefaultSpaceshipOnly,
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `DefaultSpaceshipOnly`
// CHECK:STDERR: · ┃ not found in `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
default_spaceship_only: Cpp.DefaultSpaceshipOnly,
only_eq_declared: Cpp.OnlyEqDeclared) {
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-42: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-11]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_eq_only, default_eq_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(default_eq_only, default_eq_only);
EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE+3]]:3-44: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_comparison_rewrites.carbon:[[@LINE-18]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_comparison_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_eq_declared, only_eq_declared);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_eq_declared, only_eq_declared);
}
@@ -235,46 +327,133 @@ fn Test(only_neq: Cpp.OnlyNeq,
deleted_neq: Cpp.DeletedNeq,
non_const_eq: Cpp.NonConstEq,
a2: Cpp.A2, b2: Cpp.B2) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-28: error: cannot convert type `Cpp.OnlyNeq` into type implementing `Core.EqWith(Cpp.OnlyNeq)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-13]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(only_neq, only_neq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.OnlyNeq` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.OnlyNeq)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_neq, only_neq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+4]]:10-35: error: name `only_non_default_spaceship` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+16]]:10
// CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: · ━━━━━━━━━━━━━┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `only_non_default_spaceship` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+2]]:38-63: error: name `only_non_default_spaceship` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+9]]:38
// CHECK:STDERR: -> │ EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name
// CHECK:STDERR: · ┃ `only_non_default_spaceship`
// CHECK:STDERR: · ┃ not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(only_non_default_spaceship, only_non_default_spaceship);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-50: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.EqWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-24]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NoRelevantMembers)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-42: error: cannot convert type `Cpp.EqReturnsVoid` into type implementing `Core.EqWith(Cpp.EqReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-29]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(eq_returns_void, eq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.EqReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.EqReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(eq_returns_void, eq_returns_void);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-44: error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing `Core.EqWith(Cpp.NeqReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-34]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(neq_returns_void, neq_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NeqReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.NeqReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(neq_returns_void, neq_returns_void);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+5]]:34: error: overload resolution selected deleted operator '!=' [CppInteropParseError]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-55]]:8: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-41]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+20]]:34
// CHECK:STDERR: │ auto operator==(DeletedNeq) const -> bool;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ auto operator!=(DeletedNeq) const -> bool = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(deleted_neq, deleted_neq);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected
// CHECK:STDERR: · ┃ deleted operator '!='
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(deleted_neq, deleted_neq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-36: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-46]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(non_const_eq, non_const_eq);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(non_const_eq, non_const_eq);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-16: error: cannot convert type `Cpp.A2` into type implementing `Core.EqWith(Cpp.B2)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-51]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(a2, b2);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.A2` into type implementing
// CHECK:STDERR: · ┃ `Core.EqWith(Cpp.B2)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(a2, b2);
}
@@ -69,12 +69,25 @@ import Cpp library "prefix_inc_and_dec.h";
fn F() {
var prefix: Cpp.Prefix = Cpp.Prefix.Prefix();
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+13]]:9
// CHECK:STDERR: -> │ prefix++;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:3-11: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+7]]:3
// CHECK:STDERR: -> │ prefix++;
// CHECK:STDERR: · ━━━━┳━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `handle invalid parse trees in `check``
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
prefix++;
// CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+2]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_prefix_calling_postfix.carbon:[[@LINE+6]]:9
// CHECK:STDERR: -> │ prefix--;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
prefix--;
}
@@ -93,10 +106,22 @@ import Cpp library "postfix_inc_and_dec.h";
fn F() {
var postfix: Cpp.Postfix = Cpp.Postfix.Postfix();
// CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ ++postfix;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
++postfix;
// CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+2]]:3-11: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_postfix_calling_prefix.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ --postfix;
// CHECK:STDERR: · ┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix`
// CHECK:STDERR: · ┃ that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
--postfix;
}
@@ -211,8 +236,16 @@ fn F() {
var c: Cpp.BinaryC = {};
// Simple assignment.
// CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+3]]:3-8: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.BinaryC` [ConversionFailure]
// CHECK:STDERR: fail_todo_import_assignment.carbon:[[@LINE+2]]:3-8: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.BinaryC)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_todo_import_assignment.carbon:[[@LINE+11]]:3
// CHECK:STDERR: -> │ c = 42;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Core.IntLiteral` to
// CHECK:STDERR: · │ ┃ `Cpp.BinaryC`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.IntLiteral` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.BinaryC)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c = 42;
}
@@ -242,10 +275,26 @@ import Cpp library "binary_operators.h";
fn F() {
let c1: Cpp.BinaryC = Cpp.BinaryC.BinaryC();
// TODO: Include a list of non-viable candidate operators with this diagnostic.
// CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.BinaryC` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32
// CHECK:STDERR: -> │ let unused c2: Cpp.BinaryC = c1 + 5;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Core.IntLiteral)` in
// CHECK:STDERR: · ┃ type `Cpp.BinaryC` that does not
// CHECK:STDERR: · ┃ implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c2: Cpp.BinaryC = c1 + 5;
// CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+2]]:32-37: error: cannot access member of interface `Core.AddWith(Cpp.BinaryC)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_call_with_wrong_type.carbon:[[@LINE+10]]:32
// CHECK:STDERR: -> │ let unused c3: Cpp.BinaryC = 6 + c1;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.BinaryC)` in type
// CHECK:STDERR: · ┃ `Core.IntLiteral` that does not
// CHECK:STDERR: · ┃ implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.BinaryC = 6 + c1;
}
@@ -265,9 +314,20 @@ void operator+(AmbiguousC, short);
''';
fn Test(c: Cpp.AmbiguousC) {
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+4]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'const AmbiguousC' and 'int') [CppInteropParseError]
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-6]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_ambiguous.carbon:[[@LINE+15]]:5
// CHECK:STDERR: │ void operator+(AmbiguousC, char);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: │ void operator+(AmbiguousC, short);
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c + 1;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: use of overloaded operator '+' is ambiguous (with operand types
// CHECK:STDERR: · ┃ 'const AmbiguousC' and 'int')
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c + 1;
}
@@ -283,10 +343,23 @@ void operator+(DeletedC, void*) = delete;
''';
fn Test(c: Cpp.DeletedC) {
// CHECK:STDERR: fail_deleted.carbon:[[@LINE+5]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-6]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_deleted.carbon:[[@LINE-7]]:26-30: note: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_deleted.carbon:[[@LINE+18]]:5
// CHECK:STDERR: │ void operator+(DeletedC, int) = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ void operator+(DeletedC, void*) = delete;
// CHECK:STDERR: · ┬ ┬────
// CHECK:STDERR: · ╰──────────────────────┤ candidate function not viable
// CHECK:STDERR: · │ │ [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ no known conversion from 'int' to 'void *' for
// CHECK:STDERR: · │ 2nd argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ c + 1;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '+'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c + 1;
}
@@ -317,12 +390,26 @@ fn F() {
let unused greater_than: bool = c1 > c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:32-38: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ let unused less_than: bool = c1 < c2;
// CHECK:STDERR: · ━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused less_than: bool = c1 < c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+2]]:44-51: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_spaceship.carbon:[[@LINE+9]]:44
// CHECK:STDERR: -> │ let unused greater_than_or_equal: bool = c1 >= c2;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator>= using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused greater_than_or_equal: bool = c1 >= c2;
@@ -346,9 +433,19 @@ auto operator<(CDel lhs, BaseDel rhs) -> bool;
fn F(c: Cpp.CDel) -> bool {
// Note that we mention `operator '<=>'` in the diagnostic.
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+4]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError]
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-7]]:6: note: candidate function [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_rewrite_deleted.carbon:[[@LINE+14]]:12
// CHECK:STDERR: │ auto operator<=>(CDel lhs, CDel rhs) -> std::strong_ordering = delete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function has been explicitly deleted [CppInteropParseNote]
// CHECK:STDERR: │ auto operator<(CDel lhs, BaseDel rhs) -> bool;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ candidate function [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ return c < c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: overload resolution selected deleted operator '<=>'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return c < c;
}
@@ -376,7 +473,14 @@ fn F() {
let unused equal: bool = c1 == c2;
// Rewrite.
// CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+2]]:32-39: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_rewrite_equal.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ let unused not_equal: bool = c1 != c2;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused not_equal: bool = c1 != c2;
//@dump-sem-ir-end
@@ -448,7 +552,17 @@ import Cpp library "plus_with_string_view_conversion.h";
fn F() {
let s1: str = "hello";
let s2: str = "world";
// CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+2]]:46-52: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+12]]:46
// CHECK:STDERR: -> │ let unused c: Cpp.StringViewConvertibleC = s1 + s2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ `Core.AddWith(str)` in
// CHECK:STDERR: · ┃ type `str` that does
// CHECK:STDERR: · ┃ not implement that
// CHECK:STDERR: · ┃ interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c: Cpp.StringViewConvertibleC = s1 + s2;
}
@@ -493,31 +607,73 @@ fn F() {
var c: Cpp.UnsupportedUnaryC = Cpp.UnsupportedUnaryC.UnsupportedUnaryC();
// Arithmetic.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:36: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+22]]:36
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:37: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:37
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:38: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:38
// CHECK:STDERR: -> │ let plus: Cpp.UnsupportedUnaryC = +c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace missing after binary
// CHECK:STDERR: · ┃ operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let plus: Cpp.UnsupportedUnaryC = +c;
// Increment and Decrement.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4
// CHECK:STDERR: -> │ c++;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c++;
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+6]]:4
// CHECK:STDERR: -> │ c--;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected `;` after expression statement [ExpectedExprSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
c--;
// Bitwise.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:41: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+15]]:41
// CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:41: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:41
// CHECK:STDERR: -> │ let not_value: Cpp.UnsupportedUnaryC = ~c;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `let` declarations must end
// CHECK:STDERR: · ┃ with a `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let not_value: Cpp.UnsupportedUnaryC = ~c;
// Logical.
// CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+2]]:51: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+9]]:51
// CHECK:STDERR: -> │ let not_result: Cpp.UnsupportedUnaryC = operator!(c1);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: `let` declarations
// CHECK:STDERR: · ┃ must end with a
// CHECK:STDERR: · ┃ `;`
// CHECK:STDERR: · ┃ [ExpectedDeclSemi]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let not_result: Cpp.UnsupportedUnaryC = operator!(c1);
@@ -552,24 +708,80 @@ fn F() {
var c1: Cpp.UnsupportedBinaryC = Cpp.UnsupportedBinaryC.UnsupportedBinaryC();
// Logical.
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:44-51: error: name `operator` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+34]]:44
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `operator` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+27]]:52
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace
// CHECK:STDERR: · ┃ missing around
// CHECK:STDERR: · ┃ binary operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:59-60: error: name `c2` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+18]]:59
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: name `c2`
// CHECK:STDERR: · ┃ not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:53: error: cannot take the address of non-reference expression [AddrOfNonRef]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:53
// CHECK:STDERR: -> │ let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot take the
// CHECK:STDERR: · ┃ address of
// CHECK:STDERR: · ┃ non-reference
// CHECK:STDERR: · ┃ expression
// CHECK:STDERR: · ┃ [AddrOfNonRef]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let and_result: Cpp.UnsupportedBinaryC = operator&&(c1, c2);
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+10]]:43-50: error: name `operator` not found [NameNotFound]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+40]]:43
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ━┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: name `operator` not found
// CHECK:STDERR: · ┃ [NameNotFound]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:51: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+33]]:51
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace missing
// CHECK:STDERR: · ┃ around binary
// CHECK:STDERR: · ┃ operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+6]]:52: error: expected expression [ExpectedExpr]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+24]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: expected
// CHECK:STDERR: · ┃ expression
// CHECK:STDERR: · ┃ [ExpectedExpr]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:52: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: whitespace
// CHECK:STDERR: · ┃ missing around
// CHECK:STDERR: · ┃ binary operator
// CHECK:STDERR: · ┃ [BinaryOperatorRequiresWhitespace]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+2]]:52: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+7]]:52
// CHECK:STDERR: -> │ let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let or_result: Cpp.UnsupportedBinaryC = operator||(c1, c2);
}
@@ -654,7 +866,15 @@ fn F() {
//@dump-sem-ir-begin
let c1: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C();
let c2: Cpp.GlobalOpN.C = Cpp.GlobalOpN.C.C();
// CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.GlobalOpN.C)` in type `Cpp.GlobalOpN.C` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+10]]:36
// CHECK:STDERR: -> │ let unused c3: Cpp.GlobalOpN.C = c1 + c2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.GlobalOpN.C)`
// CHECK:STDERR: · ┃ in type `Cpp.GlobalOpN.C` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.GlobalOpN.C = c1 + c2;
//@dump-sem-ir-end
@@ -761,7 +981,15 @@ import Cpp library "not_found.h";
fn F() {
let c1: Cpp.NoOperators = Cpp.NoOperators.NoOperators();
let c2: Cpp.NoOperators = Cpp.NoOperators.NoOperators();
// CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+2]]:36-42: error: cannot access member of interface `Core.AddWith(Cpp.NoOperators)` in type `Cpp.NoOperators` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_import_not_found.carbon:[[@LINE+10]]:36
// CHECK:STDERR: -> │ let unused c3: Cpp.NoOperators = c1 + c2;
// CHECK:STDERR: · ┳━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.NoOperators)`
// CHECK:STDERR: · ┃ in type `Cpp.NoOperators` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused c3: Cpp.NoOperators = c1 + c2;
}
@@ -784,9 +1012,20 @@ library "[[@TEST_NAME]]";
import Cpp library "incomplete.h";
fn F() {
// CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+4]]:34-57: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: included from: fail_import_incomplete_unary.carbon:[[@LINE-4]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete_unary.carbon:[[@LINE+15]]:34
// CHECK:STDERR: -> │ let unused result_unary: i32 = -*Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
// CHECK:STDERR: · ┃ incomplete operand type
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_unary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result_unary: i32 = -*Cpp.CreateIncomplete();
}
@@ -799,9 +1038,20 @@ import Cpp library "incomplete.h";
fn F() {
var complete: Cpp.Complete = Cpp.Complete.Complete();
// CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+4]]:35-68: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: included from: fail_import_incomplete_binary.carbon:[[@LINE-5]]:10 [InCppInclude]
// CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_import_incomplete_binary.carbon:[[@LINE+15]]:35
// CHECK:STDERR: -> │ let unused result_binary: i32 = complete + *Cpp.CreateIncomplete();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with
// CHECK:STDERR: · ┃ incomplete operand type
// CHECK:STDERR: · ┃ `Cpp.Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ ╭── included from: fail_import_incomplete_binary.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./incomplete.h
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result_binary: i32 = complete + *Cpp.CreateIncomplete();
}
@@ -825,8 +1075,17 @@ fn CreateIncomplete() -> Incomplete*;
fn F() {
var complete: Cpp.CompleteCpp = Cpp.CompleteCpp.CompleteCpp();
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+3]]:28-57: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-6]]:1-17: note: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_incomplete_operand_carbon_type.carbon:[[@LINE+12]]:28
// CHECK:STDERR: │ class Incomplete;
// CHECK:STDERR: · ────────┬────────
// CHECK:STDERR: · ╰──┤ class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ let unused result: i32 = *CreateIncomplete() + complete;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: looking up a C++ operator with incomplete
// CHECK:STDERR: · ┃ operand type `Incomplete`
// CHECK:STDERR: · ┃ [IncompleteOperandTypeInCppOperatorLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused result: i32 = *CreateIncomplete() + complete;
}
@@ -860,7 +1119,20 @@ library "[[@TEST_NAME]]";
import Cpp inline '''
template<typename T> struct FailTemplateB {};
template<typename T> struct FailTemplateA {
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+1]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+14]]:19
// CHECK:STDERR: -> │ friend typename T::error operator+(FailTemplateB<FailTemplateA>, FailTem...
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: type 'int' cannot be used prior to '::' because it
// CHECK:STDERR: · ┃ has no members
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ return x + x;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ in instantiation of template class 'FailTemplateA<int>'
// CHECK:STDERR: · │ requested here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
friend typename T::error operator+(FailTemplateB<FailTemplateA>, FailTemplateB<FailTemplateA>);
};
@@ -868,9 +1140,14 @@ using FailTemplateX = FailTemplateB<FailTemplateA<int>>;
''';
fn F(x: Cpp.FailTemplateX) -> i32 {
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:12: note: in instantiation of template class 'FailTemplateA<int>' requested here [CppInteropParseNote]
// CHECK:STDERR:
// CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+2]]:10-14: error: cannot access member of interface `Core.AddWith(Cpp.FailTemplateB)` in type `Cpp.FailTemplateB` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_indirect_template_instantiation_error.carbon:[[@LINE+9]]:10
// CHECK:STDERR: -> │ return x + x;
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.FailTemplateB)` in type
// CHECK:STDERR: · ┃ `Cpp.FailTemplateB` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
return x + x;
}
@@ -2152,7 +2429,7 @@ fn F() {
// CHECK:STDOUT: %T.09f: %SubobjectDestroy.type = symbolic_binding T, 0 [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.type.dea: type = fn_type @T.as_type.as.DestroyImpl.impl.Op, @T.as_type.as.DestroyImpl.impl(%T.09f) [symbolic]
// CHECK:STDOUT: %T.as_type.as.DestroyImpl.impl.Op.6e5: %T.as_type.as.DestroyImpl.impl.Op.type.dea = struct_value () [symbolic]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc32 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.type.687: type = fn_type @SubobjectDestroy.WithSelf.Op.loc46 [concrete]
// CHECK:STDOUT: %SubobjectDestroy.WithSelf.Op.30f: %SubobjectDestroy.WithSelf.Op.type.687 = struct_value () [concrete]
// CHECK:STDOUT: %custom_witness.b80: <witness> = custom_witness (%SubobjectDestroy.WithSelf.Op.30f), @SubobjectDestroy [concrete]
// CHECK:STDOUT: %SubobjectDestroy.facet.a87: %SubobjectDestroy.type = facet_value bool, (%custom_witness.b80) [concrete]
@@ -2249,45 +2526,45 @@ fn F() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete = constants.%greater_than.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc24: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc24: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc24: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc31: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc31: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc31: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than: bool = wrapper_binding less_than, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete = constants.%less_than.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc29: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc29: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc29: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc43: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc43: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc43: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %greater_than_or_equal: bool = wrapper_binding greater_than_or_equal, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete = constants.%greater_than_or_equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc32: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc32: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc32_41.1: %C = acquire_value %c1.ref.loc32
// CHECK:STDOUT: %.loc32_47.1: %C = acquire_value %c2.ref.loc32
// CHECK:STDOUT: %.loc32_41.2: ref %C = value_as_ref %.loc32_41.1
// CHECK:STDOUT: %addr.loc32_44.1: %ptr.0a2 = addr_of %.loc32_41.2
// CHECK:STDOUT: %.loc32_47.2: ref %C = value_as_ref %.loc32_47.1
// CHECK:STDOUT: %addr.loc32_44.2: %ptr.0a2 = addr_of %.loc32_47.2
// CHECK:STDOUT: %.loc32_44.1: ref bool = temporary_storage
// CHECK:STDOUT: %addr.loc32_44.3: %ptr.bb2 = addr_of %.loc32_44.1
// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc32_44.1, %addr.loc32_44.2, %addr.loc32_44.3)
// CHECK:STDOUT: %.loc32_44.2: init bool to %.loc32_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call
// CHECK:STDOUT: %.loc32_44.3: ref bool = temporary %.loc32_44.1, %.loc32_44.2
// CHECK:STDOUT: %.loc32_44.4: bool = acquire_value %.loc32_44.3
// CHECK:STDOUT: %.loc32_34: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc32_44.4
// CHECK:STDOUT: %c1.ref.loc46: ref %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc46: ref %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc46_41.1: %C = acquire_value %c1.ref.loc46
// CHECK:STDOUT: %.loc46_47.1: %C = acquire_value %c2.ref.loc46
// CHECK:STDOUT: %.loc46_41.2: ref %C = value_as_ref %.loc46_41.1
// CHECK:STDOUT: %addr.loc46_44.1: %ptr.0a2 = addr_of %.loc46_41.2
// CHECK:STDOUT: %.loc46_47.2: ref %C = value_as_ref %.loc46_47.1
// CHECK:STDOUT: %addr.loc46_44.2: %ptr.0a2 = addr_of %.loc46_47.2
// CHECK:STDOUT: %.loc46_44.1: ref bool = temporary_storage
// CHECK:STDOUT: %addr.loc46_44.3: %ptr.bb2 = addr_of %.loc46_44.1
// CHECK:STDOUT: %operator_LessEqual__carbon_thunk.call: init %empty_tuple.type = call imports.%operator_LessEqual__carbon_thunk.decl(%addr.loc46_44.1, %addr.loc46_44.2, %addr.loc46_44.3)
// CHECK:STDOUT: %.loc46_44.2: init bool to %.loc46_44.1 = mark_in_place_init %operator_LessEqual__carbon_thunk.call
// CHECK:STDOUT: %.loc46_44.3: ref bool = temporary %.loc46_44.1, %.loc46_44.2
// CHECK:STDOUT: %.loc46_44.4: bool = acquire_value %.loc46_44.3
// CHECK:STDOUT: %.loc46_34: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %less_than_or_equal: bool = wrapper_binding less_than_or_equal, %.loc46_44.4
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete = constants.%less_than_or_equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %Destroy.facet.loc32_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc32_44.5: %Destroy.type = converted bool, %Destroy.facet.loc32_44.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc32_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc32_44.6: %Destroy.type = converted bool, %Destroy.facet.loc32_44.2 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc46_44.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc46_44.5: %Destroy.type = converted bool, %Destroy.facet.loc46_44.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc46_44.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc46_44.6: %Destroy.type = converted bool, %Destroy.facet.loc46_44.2 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %SelfDestruct.call.loc32: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc32_44.3)
// CHECK:STDOUT: %SelfDestruct.call.loc46: init %empty_tuple.type = call %SelfDestruct.specific_fn.1(%.loc46_44.3)
// CHECK:STDOUT: %Destroy.facet.loc19_38.1: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %.loc19_38.5: %Destroy.type = converted bool, %Destroy.facet.loc19_38.1 [concrete = constants.%Destroy.facet.e68]
// CHECK:STDOUT: %Destroy.facet.loc19_38.2: %Destroy.type = facet_value bool, (constants.%DestroyImpl.impl_witness.778, constants.%custom_witness.b80) [concrete = constants.%Destroy.facet.e68]
@@ -2309,7 +2586,7 @@ fn F() {
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc32(%self.param: ref bool) = "no_op";
// CHECK:STDOUT: fn @SubobjectDestroy.WithSelf.Op.loc46(%self.param: ref bool) = "no_op";
// CHECK:STDOUT:
// CHECK:STDOUT: --- fail_todo_rewrite_equal.carbon
// CHECK:STDOUT:
@@ -2430,9 +2707,9 @@ fn F() {
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete = constants.%equal.patt]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref.loc21: ref %EqualC = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc21: ref %EqualC = name_ref c2, %c2
// CHECK:STDOUT: %.loc21: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %c1.ref.loc28: ref %EqualC = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref.loc28: ref %EqualC = name_ref c2, %c2
// CHECK:STDOUT: %.loc28: type = type_literal bool [concrete = bool]
// CHECK:STDOUT: %not_equal: bool = wrapper_binding not_equal, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete = constants.%not_equal.patt]
@@ -2884,10 +3161,10 @@ fn F() {
// CHECK:STDOUT: }
// CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
// CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
// CHECK:STDOUT: %.loc12: type = splice_block %C.ref.loc12 [concrete = constants.%C] {
// CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalOpN.ref.loc12: <namespace> = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN]
// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %.loc20: type = splice_block %C.ref.loc20 [concrete = constants.%C] {
// CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %GlobalOpN.ref.loc20: <namespace> = name_ref GlobalOpN, imports.%GlobalOpN [concrete = imports.%GlobalOpN]
// CHECK:STDOUT: %C.ref.loc20: type = name_ref C, imports.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: }
// CHECK:STDOUT: %c3: %C = wrapper_binding c3, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
@@ -118,9 +118,26 @@ library "[[@TEST_NAME]]";
import Cpp inline '''c++
struct LessReturnsBoolish {
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+3]]:8: error: cannot implicitly convert expression of type `i32` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:8: note: type `i32` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<(LessReturnsBoolish) const -> int;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `i32` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<(LessReturnsBoolish) const -> int;
auto operator<=(LessReturnsBoolish) const -> bool;
auto operator>(LessReturnsBoolish) const -> bool;
@@ -129,6 +146,28 @@ struct LessReturnsBoolish {
struct LessEqualReturnsBoolish {
auto operator<(LessEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator<=(LessEqualReturnsBoolish) const -> int*;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `Core.Optional(i32* as Core.OptionalStorage)` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Core.Optional(i32* as Core.OptionalStorage)` does not
// CHECK:STDERR: · │ implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<=(LessEqualReturnsBoolish) const -> int*;
auto operator>(LessEqualReturnsBoolish) const -> bool;
auto operator>=(LessEqualReturnsBoolish) const -> bool;
@@ -139,6 +178,28 @@ struct GreaterEqualReturnsBoolish {
auto operator<(GreaterEqualReturnsBoolish) const -> bool;
auto operator<=(GreaterEqualReturnsBoolish) const -> bool;
auto operator>(GreaterEqualReturnsBoolish) const -> bool;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+22]]:8
// CHECK:STDERR: -> │ auto operator>=(GreaterEqualReturnsBoolish) const -> Result;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Result` to
// CHECK:STDERR: · │ ┃ `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Result` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>=(GreaterEqualReturnsBoolish) const -> Result;
};
@@ -154,45 +215,93 @@ struct GreaterReturnsBoolish {
};
struct AllReturnBoolish {
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Less(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn LessOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬──────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator<=(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn Greater(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>(AllReturnBoolish) const -> double;
// CHECK:STDERR: ╭─┤ fail_todo_returns_boolish.carbon:[[@LINE+20]]:8
// CHECK:STDERR: -> │ auto operator>=(AllReturnBoolish) const -> double;
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `f64` to `bool`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `f64` does not implement interface `Core.ImplicitAs(bool)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ┆
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/operators/comparison.carbon
// CHECK:STDERR: │ fn GreaterOrEquivalent(self, other: Other) -> bool;
// CHECK:STDERR: · ─────────────┬─────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while building thunk to match the signature of this function
// CHECK:STDERR: · │ [ThunkSignature]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto operator>=(AllReturnBoolish) const -> double;
};
''';
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+32]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-34]]:8: error: cannot implicitly convert expression of type `Core.Optional(i32* as Core.OptionalStorage)` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-35]]:8: note: type `Core.Optional(i32* as Core.OptionalStorage)` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+27]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-29]]:8: error: cannot implicitly convert expression of type `Cpp.Result` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-30]]:8: note: type `Cpp.Result` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+22]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-19]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-20]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:28:3-38: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+17]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-23]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-24]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:29:3-50: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+12]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-27]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-28]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:30:3-41: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+7]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-31]]:8: error: cannot implicitly convert expression of type `f64` to `bool` [ConversionFailure]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE-32]]:8: note: type `f64` does not implement interface `Core.ImplicitAs(bool)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: {{.*}}/prelude/operators/comparison.carbon:31:3-53: note: while building thunk to match the signature of this function [ThunkSignature]
// CHECK:STDERR: fail_todo_returns_boolish.carbon:[[@LINE+2]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR:
fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
x < y;
x <= y;
@@ -276,33 +385,93 @@ fn Test(missing_less: Cpp.MissingLess,
no_relevant_members: Cpp.NoRelevantMembers,
less_returns_void: Cpp.LessReturnsVoid,
less_non_const: Cpp.LessNonConst) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-41: error: cannot convert type `Cpp.MissingLess` into type implementing `Core.OrderedWith(Cpp.MissingLess)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-15]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less, missing_less);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLess` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLess)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_less, missing_less);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-53: error: cannot convert type `Cpp.MissingLessEqual` into type implementing `Core.OrderedWith(Cpp.MissingLessEqual)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-20]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_less_equal, missing_less_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingLessEqual` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingLessEqual)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_less_equal, missing_less_equal);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-47: error: cannot convert type `Cpp.MissingGreater` into type implementing `Core.OrderedWith(Cpp.MissingGreater)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater, missing_greater);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreater` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.MissingGreater)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_greater, missing_greater);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-59: error: cannot convert type `Cpp.MissingGreaterEqual` into type implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-30]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(missing_greater_equal, missing_greater_equal);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.MissingGreaterEqual` into type
// CHECK:STDERR: · ┃ implementing `Core.OrderedWith(Cpp.MissingGreaterEqual)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(missing_greater_equal, missing_greater_equal);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-55: error: cannot convert type `Cpp.NoRelevantMembers` into type implementing `Core.OrderedWith(Cpp.NoRelevantMembers)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-35]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.NoRelevantMembers` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.NoRelevantMembers)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(no_relevant_members, no_relevant_members);
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-51: error: cannot convert type `Cpp.LessReturnsVoid` into type implementing `Core.OrderedWith(Cpp.LessReturnsVoid)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-40]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(less_returns_void, less_returns_void);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.LessReturnsVoid` into type implementing
// CHECK:STDERR: · ┃ `Core.OrderedWith(Cpp.LessReturnsVoid)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(less_returns_void, less_returns_void);
@@ -152,31 +152,96 @@ fn Test(default_spaceship_only: Cpp.DefaultSpaceshipOnly,
returns_partial_ordering: Cpp.ReturnsPartialOrdering,
cross_type_lhs: Cpp.CrossTypeLhs,
cross_type_rhs: Cpp.CrossTypeRhs) {
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-56: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-23]]:1-51: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬─────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator!= using operator== is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-61: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-21]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(default_spaceship_only, default_spaceship_only);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-63: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-25]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-65: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-29]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(returns_partial_ordering, returns_partial_ordering);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+3]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-33]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(cross_type_lhs, cross_type_rhs);
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE+5]]:3-45: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-37]]:1-61: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE+20]]:3
// CHECK:STDERR: │ fn OrderedWith[U: type, T: Core.OrderedWith(U)](x: T, y: U) {
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ OrderedWith(cross_type_rhs, cross_type_lhs);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Rewriting operator< using operator<=> is not supported`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_todo_spaceship_rewrites.carbon:[[@LINE-28]]:9-54: warning: binding `returns_weak_ordering` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_todo_spaceship_rewrites.carbon:[[@LINE-88]]:9
// CHECK:STDERR: -> │ returns_weak_ordering: Cpp.ReturnsWeakOrdering,
// CHECK:STDERR: · ━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `returns_weak_ordering` unused
// CHECK:STDERR: · ┃ [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
OrderedWith(cross_type_rhs, cross_type_lhs);
}
@@ -190,8 +255,18 @@ import Cpp library "three_way_comparable_types.h";
fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
fn Test(returns_strong_ordering: Cpp.ReturnsStrongOrdering) {
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE+3]]:3-58: error: cannot convert type `Cpp.ReturnsStrongOrdering` into type implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)` [ConversionFailureTypeToFacet]
// CHECK:STDERR: fail_never_valid.carbon:[[@LINE-4]]:1-65: note: while deducing parameters of generic declared here [DeductionGenericHere]
// CHECK:STDERR: ╭─┤ fail_never_valid.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ fn EqWith[U: type, T: Core.EqWith(U)](unused x: T, unused y: U) {}
// CHECK:STDERR: · ─────────────────────────┬───────────────────────────────────────
// CHECK:STDERR: · ╰──┤ while deducing parameters of generic declared here
// CHECK:STDERR: · │ [DeductionGenericHere]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ EqWith(returns_strong_ordering, returns_strong_ordering);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert type `Cpp.ReturnsStrongOrdering` into type
// CHECK:STDERR: · ┃ implementing `Core.EqWith(Cpp.ReturnsStrongOrdering)`
// CHECK:STDERR: · ┃ [ConversionFailureTypeToFacet]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
EqWith(returns_strong_ordering, returns_strong_ordering);
}
@@ -52,8 +52,15 @@ import Cpp;
fn F() {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+3]]:25-39: error: semantics TODO: `Unsupported: builtin type: long double` [SemanticsTodo]
// CHECK:STDERR: fail_todo_unsupported_types.carbon:[[@LINE+2]]:25-39: note: in `Cpp` name lookup for `long_double` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_todo_unsupported_types.carbon:[[@LINE+10]]:25
// CHECK:STDERR: -> │ let cpp_long_double : Cpp.long_double = 1.0 as f64;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · │ ┃ `Unsupported: builtin type: long double`
// CHECK:STDERR: · │ ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰────┤ in `Cpp` name lookup for `long_double`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let cpp_long_double : Cpp.long_double = 1.0 as f64;
let unused carbon_long_double: f64 = cpp_long_double;
@@ -67,7 +74,13 @@ library "[[@TEST_NAME]]";
import Cpp;
fn F() {
// CHECK:STDERR: fail_not_builtin.carbon:[[@LINE+2]]:28-42: error: member name `not_builtin` not found in `Cpp` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_not_builtin.carbon:[[@LINE+8]]:28
// CHECK:STDERR: -> │ let unused not_builtin : Cpp.not_builtin = 1;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `not_builtin` not found in
// CHECK:STDERR: · ┃ `Cpp`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused not_builtin : Cpp.not_builtin = 1;
}
@@ -81,7 +94,13 @@ namespace MyNamespace {}
''';
fn F() {
// CHECK:STDERR: fail_lookup_in_other_scopes.carbon:[[@LINE+2]]:21-40: error: member name `long` not found in `Cpp.MyNamespace` [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╭─┤ fail_lookup_in_other_scopes.carbon:[[@LINE+8]]:21
// CHECK:STDERR: -> │ let unused long : Cpp.MyNamespace.long = 1;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: member name `long` not found in
// CHECK:STDERR: · ┃ `Cpp.MyNamespace`
// CHECK:STDERR: · ┃ [MemberNameNotFoundInInstScope]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused long : Cpp.MyNamespace.long = 1;
}
@@ -493,21 +512,21 @@ fn F() {
// CHECK:STDOUT: fn @F() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.6da]
// CHECK:STDOUT: %f64.loc11: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
// CHECK:STDOUT: %f64.loc18: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
// CHECK:STDOUT: %impl.elem0: %.dac = impl_witness_access constants.%As.impl_witness.553, element0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.882]
// CHECK:STDOUT: %bound_method.loc11_47.1: <bound method> = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound]
// CHECK:STDOUT: %bound_method.loc18_47.1: <bound method> = bound_method %float, %impl.elem0 [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.bound]
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.FloatLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.As.impl.Convert.specific_fn]
// CHECK:STDOUT: %bound_method.loc11_47.2: <bound method> = bound_method %float, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc11_47.2(%float) [concrete = constants.%float.a71]
// CHECK:STDOUT: %.loc11_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71]
// CHECK:STDOUT: %.loc11_47.2: %f64.761 = converted %float, %.loc11_47.1 [concrete = constants.%float.a71]
// CHECK:STDOUT: %bound_method.loc18_47.2: <bound method> = bound_method %float, %specific_fn [concrete = constants.%bound_method]
// CHECK:STDOUT: %Core.FloatLiteral.as.As.impl.Convert.call: init %f64.761 = call %bound_method.loc18_47.2(%float) [concrete = constants.%float.a71]
// CHECK:STDOUT: %.loc18_47.1: %f64.761 = value_of_initializer %Core.FloatLiteral.as.As.impl.Convert.call [concrete = constants.%float.a71]
// CHECK:STDOUT: %.loc18_47.2: %f64.761 = converted %float, %.loc18_47.1 [concrete = constants.%float.a71]
// CHECK:STDOUT: <elided>
// CHECK:STDOUT: %cpp_long_double: <error> = wrapper_binding cpp_long_double, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %cpp_long_double.patt: <error> = value_binding_pattern cpp_long_double [concrete = <error>]
// CHECK:STDOUT: }
// CHECK:STDOUT: %cpp_long_double.ref: <error> = name_ref cpp_long_double, %cpp_long_double [concrete = <error>]
// CHECK:STDOUT: %f64.loc12: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
// CHECK:STDOUT: %f64.loc19: type = type_literal constants.%f64.761 [concrete = constants.%f64.761]
// CHECK:STDOUT: %carbon_long_double: %f64.761 = wrapper_binding carbon_long_double, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
// CHECK:STDOUT: %carbon_long_double.patt: %pattern_type.667 = value_binding_pattern carbon_long_double [concrete = constants.%carbon_long_double.patt]
@@ -63,7 +63,11 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+2]]:1-8: error: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+6]]:1
// CHECK:STDERR: -> │ class C;
// CHECK:STDERR: · ━━━━┳━━━
// CHECK:STDERR: · ┗━━┫ error: class was forward declared here [ClassForwardDeclaredHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
class C;
@@ -71,8 +75,17 @@ fn F() -> array(C, 5)*;
inline Cpp '''
void G() {
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE+3]]:33: error: subscript of pointer to incomplete type 'Carbon::Main::C' [CppInteropParseError]
// CHECK:STDERR: fail_incomplete.carbon:[[@LINE-7]]:8: note: forward declaration of 'Carbon::Main::C' [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_incomplete.carbon:[[@LINE+12]]:33
// CHECK:STDERR: │ class C;
// CHECK:STDERR: · ┬
// CHECK:STDERR: · ╰──┤ forward declaration of 'Carbon::Main::C' [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Carbon::C *p = &(*Carbon::F())[0];
// CHECK:STDERR: · ─────────────╴╻
// CHECK:STDERR: · ┗━━┫ error: subscript of pointer to incomplete
// CHECK:STDERR: · ┃ type 'Carbon::Main::C'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::C *p = &(*Carbon::F())[0];
}
@@ -20,6 +20,12 @@ import Cpp inline '''
auto GetWC() -> wchar_t;
''';
// CHECK:STDERR: fail_todo_wide_char_t.carbon:[[@LINE+2]]:32-42: error: semantics TODO: `Unsupported: return type: wchar_t` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_wide_char_t.carbon:[[@LINE+8]]:32
// CHECK:STDERR: -> │ fn CallGetWC() -> u32 { return Cpp.GetWC(); }
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: return type: wchar_t`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
fn CallGetWC() -> u32 { return Cpp.GetWC(); }
@@ -85,8 +85,17 @@ import Cpp;
fn F() {
let carbon_i64: i64 = 1;
// CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+3]]:35-44: error: cannot implicitly convert expression of type `i64` to `Cpp.long` [ConversionFailure]
// CHECK:STDERR: fail_implicit_conversion_i64_to_long.carbon:[[@LINE+2]]:35-44: note: type `i64` does not implement interface `Core.ImplicitAs(Cpp.long)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_i64_to_long.carbon:[[@LINE+12]]:35
// CHECK:STDERR: -> │ let unused cpp_long: Cpp.long = carbon_i64;
// CHECK:STDERR: · ┳━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert
// CHECK:STDERR: · │ ┃ expression of type `i64` to
// CHECK:STDERR: · │ ┃ `Cpp.long`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i64` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.long)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused cpp_long: Cpp.long = carbon_i64;
}
@@ -210,10 +219,22 @@ import Cpp;
fn ComparisonsHeterogeneousLongAndI128() {
let a: Cpp.long = 1;
let b: i128 = 1;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a == b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i128)` in type
// CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a == b;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ b == a;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type
// CHECK:STDERR: · ┃ `i128` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b == a;
}
@@ -314,10 +335,24 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {}
fn ArithmeticHeterogeneousLongAndI128() {
let x: Cpp.long = 1;
let y: i128 = 1;
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(x + y, y);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(i128)` in type `Cpp.long` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(x + y, y);
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(y + x, y);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i128` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(y + x, y);
}
@@ -420,10 +455,24 @@ fn BitWiseHeterogeneousLongAndI128() {
let a: Cpp.long = 1;
let b: i128 = 1;
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(a & b, b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(i128)` in type `Cpp.long` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(a & b, b);
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(b & a, b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i128` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(b & a, b);
}
@@ -523,7 +572,13 @@ import Cpp;
fn CompoundAssignmentHeterogeneousLongAndI64() {
var a: Cpp.long = 1;
// CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a += (1 as i64);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i64)` in
// CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a += (1 as i64);
}
@@ -581,8 +636,17 @@ fn F() {
// For portability reasons, this is not allowed even though `u64`
// happens to fit in `unsigned long` on this target.
// CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+3]]:53-62: error: cannot implicitly convert expression of type `u64` to `Cpp.unsigned_long` [ConversionFailure]
// CHECK:STDERR: fail_pass_u64_to_ulong.carbon:[[@LINE+2]]:53-62: note: type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_pass_u64_to_ulong.carbon:[[@LINE+12]]:53
// CHECK:STDERR: -> │ let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64;
// CHECK:STDERR: · ━━━━━┳━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: cannot implicitly convert expression of type `u64` to
// CHECK:STDERR: · ┃ `Cpp.unsigned_long`
// CHECK:STDERR: · ┃ [ConversionFailure]
// CHECK:STDERR: · ╭────────────────────────────────────────────────────────╯
// CHECK:STDERR: · │ type `u64` does not implement interface `Core.ImplicitAs(Cpp.unsigned_long)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused cpp_unsigned_long: Cpp.unsigned_long = carbon_u64;
}
@@ -79,8 +79,16 @@ import Cpp;
fn F() {
let cpp_long: Cpp.long = 1;
// CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+3]]:32-39: error: cannot implicitly convert expression of type `long` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_implicit_conversion_long_to_i32.carbon:[[@LINE+2]]:32-39: note: type `Cpp.long` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_to_i32.carbon:[[@LINE+11]]:32
// CHECK:STDERR: -> │ let unused carbon_i32: i32 = cpp_long;
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `long` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused carbon_i32: i32 = cpp_long;
}
@@ -191,10 +199,22 @@ import Cpp;
fn ComparisonsHeterogeneousLongAndI16() {
let a: Cpp.long = 1;
let b: i16 = 1;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a == b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i16)` in type
// CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a == b;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ b == a;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type
// CHECK:STDERR: · ┃ `i16` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b == a;
}
@@ -208,10 +228,22 @@ import Cpp;
fn ComparisonsHeterogeneousLongAndI128() {
let a: Cpp.long = 1;
let b: i128 = 1;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a == b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i128)` in type
// CHECK:STDERR: · ┃ `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a == b;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_and_i128.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ b == a;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long)` in type
// CHECK:STDERR: · ┃ `i128` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b == a;
}
@@ -313,11 +345,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {}
fn ArithmeticHeterogeneousLongAndI16() {
let x: Cpp.long = 1;
let y: i16 = 1;
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(x + y, x);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(i16)` in type `Cpp.long` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(x + y, x);
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(y + x, x);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i16` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(y + x, x);
}
@@ -333,11 +379,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {}
fn ArithmeticHeterogeneousLongAndI128() {
let x: Cpp.long = 1;
let y: i128 = 1;
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(x + y, y);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(i128)` in type `Cpp.long` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(x + y, y);
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(y + x, y);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long)` in type `i128` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(y + x, y);
}
@@ -441,10 +501,24 @@ fn BitWiseHeterogeneousLongAndI16() {
let a: Cpp.long = 1;
let b: i16 = 1;
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(a & b, a);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(i16)` in type `Cpp.long` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(a & b, a);
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i16` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i16.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(b & a, a);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i16` that does
// CHECK:STDERR: · ┃ not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(b & a, a);
}
@@ -461,10 +535,24 @@ fn BitWiseHeterogeneousLongAndI128() {
let a: Cpp.long = 1;
let b: i128 = 1;
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i128)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(a & b, b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(i128)` in type `Cpp.long` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(a & b, b);
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long)` in type `i128` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_and_i128.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(b & a, b);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long)` in type `i128` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(b & a, b);
}
@@ -553,7 +641,13 @@ import Cpp;
fn CompoundAssignmentHeterogeneousI16Long() {
var a: Cpp.long = 1;
// CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i16)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_compound_assignment_heterogeneous_long_and_i16.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a += (1 as i16);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i16)` in
// CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a += (1 as i16);
}
@@ -566,7 +660,13 @@ import Cpp;
fn CompoundAssignmentHeterogeneousI64Long() {
var a: Cpp.long = 1;
// CHECK:STDERR: fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i64)` in type `Cpp.long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_and_i64.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a += (1 as i64);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i64)` in
// CHECK:STDERR: · ┃ type `Cpp.long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a += (1 as i64);
}
@@ -624,10 +724,22 @@ fn F() {
// For portability reasons, this is not allowed even though `unsigned long`
// happens to fit in `u32` on this target.
// CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+5]]:25-41: error: cannot implicitly convert expression of type `unsigned_long` to `u32` [ConversionFailure]
// CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+4]]:25-41: note: type `Cpp.unsigned_long` does not implement interface `Core.ImplicitAs(u32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+17]]:25
// CHECK:STDERR: -> │ let carbon_u32: u32 = cpp_unsigned_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `unsigned_long` to `u32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(u32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_no_ulong_to_u32.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u32` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_no_ulong_to_u32.carbon:[[@LINE+6]]:7
// CHECK:STDERR: -> │ let carbon_u32: u32 = cpp_unsigned_long;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `carbon_u32` unused [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let carbon_u32: u32 = cpp_unsigned_long;
}
@@ -78,8 +78,16 @@ import Cpp;
fn F() {
let cpp_long_long: Cpp.long_long = 1;
// CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+3]]:32-44: error: cannot implicitly convert expression of type `long_long` to `i64` [ConversionFailure]
// CHECK:STDERR: fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+2]]:32-44: note: type `Cpp.long_long` does not implement interface `Core.ImplicitAs(i64)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_implicit_conversion_long_long_to_i64.carbon:[[@LINE+11]]:32
// CHECK:STDERR: -> │ let unused carbon_i64: i64 = cpp_long_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression
// CHECK:STDERR: · │ ┃ of type `long_long` to `i64`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.long_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(i64)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused carbon_i64: i64 = cpp_long_long;
}
@@ -177,10 +185,22 @@ import Cpp;
fn ComparisonsHeterogeneousLongLongAndI32() {
let a: Cpp.long_long = 1;
let b: i32 = 1;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a == b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i32)` in type
// CHECK:STDERR: · ┃ `Cpp.long_long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a == b;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ b == a;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in
// CHECK:STDERR: · ┃ type `i32` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b == a;
}
@@ -207,10 +227,22 @@ import Cpp;
fn ComparisonsHeterogeneousLongLongAndI256() {
let a: Cpp.long_long = 1;
let b: i256 = 1;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(i256)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a == b;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(i256)` in type
// CHECK:STDERR: · ┃ `Cpp.long_long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a == b;
// CHECK:STDERR: fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+2]]:3-8: error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in type `i256` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_comparisons_heterogeneous_long_long_and_i256.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ b == a;
// CHECK:STDERR: · ┳━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.EqWith(Cpp.long_long)` in
// CHECK:STDERR: · ┃ type `i256` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
b == a;
}
@@ -295,11 +327,25 @@ fn AssertSameType[T: type](unused a: T, unused b: T) {}
fn ArithmeticHeterogeneousLongLongAndI32() {
let x: Cpp.long_long = 1;
let y: i32 = 1;
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(x + y, x);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(i32)` in type `Cpp.long_long` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(x + y, x);
// CHECK:STDERR: fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.AddWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_arithmetic_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(y + x, x);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.AddWith(Cpp.long_long)` in type `i32` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(y + x, x);
}
@@ -401,10 +447,24 @@ fn BitWiseHeterogeneousLongLongAndI32() {
let a: Cpp.long_long = 1;
let b: i32 = 1;
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(a & b, a);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(i32)` in type `Cpp.long_long` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(a & b, a);
// CHECK:STDERR: fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:18-22: error: cannot access member of interface `Core.BitAndWith(Cpp.long_long)` in type `i32` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_bitwise_heterogeneous_long_long_and_i32.carbon:[[@LINE+9]]:18
// CHECK:STDERR: -> │ AssertSameType(b & a, a);
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface
// CHECK:STDERR: · ┃ `Core.BitAndWith(Cpp.long_long)` in type `i32` that
// CHECK:STDERR: · ┃ does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
AssertSameType(b & a, a);
}
@@ -509,7 +569,13 @@ import Cpp;
fn CompoundAssignmentHeterogeneousLongLongAndI32() {
var a: Cpp.long_long = 1;
// CHECK:STDERR: fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+2]]:3-17: error: cannot access member of interface `Core.AddAssignWith(i32)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_todo_compound_assignment_heterogeneous_long_long_and_i32.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a += (1 as i32);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i32)` in
// CHECK:STDERR: · ┃ type `Cpp.long_long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a += (1 as i32);
}
@@ -522,7 +588,13 @@ import Cpp;
fn CompoundAssignmentHeterogeneousLongLongAndI128() {
var a: Cpp.long_long = 1;
// CHECK:STDERR: fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+2]]:3-18: error: cannot access member of interface `Core.AddAssignWith(i128)` in type `Cpp.long_long` that does not implement that interface [MissingImplInMemberAccess]
// CHECK:STDERR: ╭─┤ fail_compound_assignment_heterogeneous_long_long_and_i128.carbon:[[@LINE+8]]:3
// CHECK:STDERR: -> │ a += (1 as i128);
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot access member of interface `Core.AddAssignWith(i128)` in
// CHECK:STDERR: · ┃ type `Cpp.long_long` that does not implement that interface
// CHECK:STDERR: · ┃ [MissingImplInMemberAccess]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
a += (1 as i128);
}
@@ -580,10 +652,22 @@ fn F() {
// For portability reasons, this is not allowed even though `unsigned long
// long` happens to fit in `u64` on this target.
// CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+5]]:25-46: error: cannot implicitly convert expression of type `unsigned_long_long` to `u64` [ConversionFailure]
// CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+4]]:25-46: note: type `Cpp.unsigned_long_long` does not implement interface `Core.ImplicitAs(u64)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+17]]:25
// CHECK:STDERR: -> │ let carbon_u64: u64 = cpp_unsigned_long_long;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type
// CHECK:STDERR: · │ ┃ `unsigned_long_long` to `u64`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.unsigned_long_long` does not implement
// CHECK:STDERR: · │ interface `Core.ImplicitAs(u64)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
// CHECK:STDERR: fail_pass_ulonglong_to_u64.carbon:[[@LINE+2]]:7-21: warning: binding `carbon_u64` unused [UnusedBinding]
// CHECK:STDERR: ╭─┤ fail_pass_ulonglong_to_u64.carbon:[[@LINE+6]]:7
// CHECK:STDERR: -> │ let carbon_u64: u64 = cpp_unsigned_long_long;
// CHECK:STDERR: · ━━━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ warning: binding `carbon_u64` unused [UnusedBinding]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let carbon_u64: u64 = cpp_unsigned_long_long;
}
@@ -27,8 +27,18 @@ library "[[@TEST_NAME]]";
import Cpp;
fn G() {
// CHECK:STDERR: fail_void_abstract.carbon:[[@LINE+3]]:17-24: error: binding pattern has abstract type `Cpp.void` in `var` pattern [AbstractTypeInVarPattern]
// CHECK:STDERR: {{.*}}/prelude/types/cpp/void.carbon:24:1-35: note: class was declared abstract here [ClassAbstractHere]
// CHECK:STDERR: ╭─┤ fail_void_abstract.carbon:[[@LINE+13]]:17
// CHECK:STDERR: -> │ var unused x: Cpp.void;
// CHECK:STDERR: · ┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: binding pattern has abstract type `Cpp.void` in
// CHECK:STDERR: · ┃ `var` pattern
// CHECK:STDERR: · ┃ [AbstractTypeInVarPattern]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ {{.*}}/prelude/types/cpp/void.carbon
// CHECK:STDERR: │ abstract class CppCompat.VoidBase {
// CHECK:STDERR: · ─────────────────┬─────────────────
// CHECK:STDERR: · ╰──┤ class was declared abstract here [ClassAbstractHere]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unused x: Cpp.void;
}
@@ -40,17 +50,35 @@ library "[[@TEST_NAME]]";
import Cpp inline "void F(int);";
fn G(v: Cpp.void) {
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError]
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE-4]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE-5]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_void_argument.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ void F(int);
// CHECK:STDERR: · ┬ ┬──
// CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ cannot convert argument of incomplete type 'void' to 'int' for 1st
// CHECK:STDERR: · │ argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.F(v);
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.F(v);
}
fn H(p: Cpp.void*) {
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE+4]]:3-7: error: no matching function for call to 'F' [CppInteropParseError]
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE-12]]:6: note: candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: fail_void_argument.carbon:[[@LINE-13]]:8-10: note: cannot convert argument of incomplete type 'void' to 'int' for 1st argument [CppInteropParseNoteReason]
// CHECK:STDERR: ╭─┤ fail_void_argument.carbon:[[@LINE+13]]:3
// CHECK:STDERR: │ void F(int);
// CHECK:STDERR: · ┬ ┬──
// CHECK:STDERR: · ╰────┤ candidate function not viable [CppInteropParseNote]
// CHECK:STDERR: · ╰────┤ cannot convert argument of incomplete type 'void' to 'int' for 1st
// CHECK:STDERR: · │ argument
// CHECK:STDERR: · │ [CppInteropParseNoteReason]
// CHECK:STDERR: ┆
// CHECK:STDERR: -> │ Cpp.F(*p);
// CHECK:STDERR: · ━━┳━━
// CHECK:STDERR: · ┗━━┫ error: no matching function for call to 'F' [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Cpp.F(*p);
}
@@ -76,8 +76,16 @@ struct S {};
fn F(input: Cpp.void*) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+3]]:26-40: error: cannot convert expression of type `void*` to `Cpp.S*` with `as` [ConversionFailure]
// CHECK:STDERR: fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+2]]:26-40: note: type `Cpp.void*` does not implement interface `Core.As(Cpp.S*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_cpp_class_pointer.carbon:[[@LINE+11]]:26
// CHECK:STDERR: -> │ let unused p: Cpp.S* = input as Cpp.S*;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*`
// CHECK:STDERR: · │ ┃ to `Cpp.S*` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface
// CHECK:STDERR: · │ `Core.As(Cpp.S*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused p: Cpp.S* = input as Cpp.S*;
//@dump-sem-ir-end
@@ -93,8 +101,16 @@ class C {}
fn F(input: Cpp.void*) {
//@dump-sem-ir-begin
// CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+3]]:22-32: error: cannot convert expression of type `void*` to `C*` with `as` [ConversionFailure]
// CHECK:STDERR: fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+2]]:22-32: note: type `Cpp.void*` does not implement interface `Core.As(C*)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_explicit_as_from_void_pointer_to_carbon_class_pointer.carbon:[[@LINE+11]]:22
// CHECK:STDERR: -> │ let unused p: C* = input as C*;
// CHECK:STDERR: · ┳━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot convert expression of type `void*` to
// CHECK:STDERR: · │ ┃ `C*` with `as`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.void*` does not implement interface
// CHECK:STDERR: · │ `Core.As(C*)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused p: C* = input as C*;
//@dump-sem-ir-end
@@ -398,14 +414,14 @@ fn F(input: Cpp.void*) {
// CHECK:STDOUT: fn @F(%input.param: %ptr.00a) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input
// CHECK:STDOUT: %Cpp.ref.loc13_35: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc13_38: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc13_40: type = ptr_type %S.ref.loc13_38 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %.loc13_32: %ptr.037 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc13_22: type = splice_block %ptr.loc13_22 [concrete = constants.%ptr.037] {
// CHECK:STDOUT: %Cpp.ref.loc13_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc13_20: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc13_22: type = ptr_type %S.ref.loc13_20 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %Cpp.ref.loc21_35: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc21_38: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc21_40: type = ptr_type %S.ref.loc21_38 [concrete = constants.%ptr.037]
// CHECK:STDOUT: %.loc21_32: %ptr.037 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_22: type = splice_block %ptr.loc21_22 [concrete = constants.%ptr.037] {
// CHECK:STDOUT: %Cpp.ref.loc21_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %S.ref.loc21_20: type = name_ref S, imports.%S.decl [concrete = constants.%S]
// CHECK:STDOUT: %ptr.loc21_22: type = ptr_type %S.ref.loc21_20 [concrete = constants.%ptr.037]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.037 = wrapper_binding p, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
@@ -429,12 +445,12 @@ fn F(input: Cpp.void*) {
// CHECK:STDOUT: fn @F(%input.param: %ptr.00a) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %input.ref: %ptr.00a = name_ref input, %input
// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc13_32: type = ptr_type %C.ref.loc13_31 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %.loc13_28: %ptr.6b6 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc13_18: type = splice_block %ptr.loc13_18 [concrete = constants.%ptr.6b6] {
// CHECK:STDOUT: %C.ref.loc13_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc13_18: type = ptr_type %C.ref.loc13_17 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %C.ref.loc21_31: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc21_32: type = ptr_type %C.ref.loc21_31 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: %.loc21_28: %ptr.6b6 = converted %input.ref, <error> [concrete = <error>]
// CHECK:STDOUT: %.loc21_18: type = splice_block %ptr.loc21_18 [concrete = constants.%ptr.6b6] {
// CHECK:STDOUT: %C.ref.loc21_17: type = name_ref C, file.%C.decl [concrete = constants.%C]
// CHECK:STDOUT: %ptr.loc21_18: type = ptr_type %C.ref.loc21_17 [concrete = constants.%ptr.6b6]
// CHECK:STDOUT: }
// CHECK:STDOUT: %p: %ptr.6b6 = wrapper_binding p, <error> [concrete = <error>]
// CHECK:STDOUT: name_binding_decl {
File diff suppressed because it is too large. Load diff
@@ -45,8 +45,19 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_too_few_arguments.carbon:[[@LINE+3]]:26: error: too few template arguments for class template 'TwoTypes' [CppInteropParseError]
// CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_too_few_arguments.carbon:[[@LINE+14]]:26
// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: too few template arguments for class
// CHECK:STDERR: · ┃ template 'TwoTypes'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./templates.h
// CHECK:STDERR: │ template<typename T, typename U> struct TwoTypes {};
// CHECK:STDERR: · ──────────────────────────────── ┬
// CHECK:STDERR: · ╰──┤ template is declared here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTypes(Cpp.A);
@@ -56,8 +67,19 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_too_many_arguments.carbon:[[@LINE+3]]:38-40: error: too many template arguments for class template 'TwoTypes' [CppInteropParseError]
// CHECK:STDERR: ./templates.h:5:41: note: template is declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_too_many_arguments.carbon:[[@LINE+14]]:38
// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A);
// CHECK:STDERR: · ┳━━
// CHECK:STDERR: · ┗━━┫ error: too many template arguments for
// CHECK:STDERR: · ┃ class template 'TwoTypes'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./templates.h
// CHECK:STDERR: │ template<typename T, typename U> struct TwoTypes {};
// CHECK:STDERR: · ──────────────────────────────── ┬
// CHECK:STDERR: · ╰──┤ template is declared here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTypes(Cpp.A, Cpp.A, Cpp.A);
@@ -88,13 +110,39 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+3]]:57: error: too few template arguments for class template 'Inner' [CppInteropParseError]
// CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_fixed_size_pack_wrong_size.carbon:[[@LINE+18]]:57
// CHECK:STDERR: -> │ var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: too few
// CHECK:STDERR: · ┃ template
// CHECK:STDERR: · ┃ arguments
// CHECK:STDERR: · ┃ for class
// CHECK:STDERR: · ┃ template
// CHECK:STDERR: · ┃ 'Inner'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./templates.h
// CHECK:STDERR: │ template<True<T> ...U> struct Inner {};
// CHECK:STDERR: · ────────────────────── ┬
// CHECK:STDERR: · ╰──┤ template is declared here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var too_few: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B);
// CHECK:STDERR: fail_fixed_size_pack_wrong_size.carbon:[[@LINE+3]]:70-72: error: too many template arguments for class template 'Inner' [CppInteropParseError]
// CHECK:STDERR: ./templates.h:15:33: note: template is declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_fixed_size_pack_wrong_size.carbon:[[@LINE+14]]:70
// CHECK:STDERR: -> │ var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B);
// CHECK:STDERR: · ━┳━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: too many template arguments for class template 'Inner'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./templates.h
// CHECK:STDERR: │ template<True<T> ...U> struct Inner {};
// CHECK:STDERR: · ────────────────────── ┬
// CHECK:STDERR: · ╰──┤ template is declared here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var too_many: Cpp.FixedSizePack(Cpp.A, Cpp.A).Inner(Cpp.B, Cpp.B, Cpp.B);
@@ -23,7 +23,13 @@ fn CarbonSide[template T: type](p: T) -> T;
inline Cpp '''c++
template<typename T>
// CHECK:STDERR: fail_todo_bidirectional_intorp_too_deep.carbon:[[@LINE+2]]:6: error: semantics TODO: `maximum depth for bidirectional Carbon/C++ interop is 10` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_todo_bidirectional_intorp_too_deep.carbon:[[@LINE+8]]:6
// CHECK:STDERR: -> │ auto AddTypeWrapper(T x) -> T {
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `maximum depth for bidirectional Carbon/C++ interop is 10`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
auto AddTypeWrapper(T x) -> T {
// Calls into to Carbon, adding a layer of Wrap(...) to the type T that
@@ -41,8 +41,16 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+3]]:1-22: error: cannot implicitly convert expression of type `Cpp.Simple` to `Cpp.Simple` [ConversionFailure]
// CHECK:STDERR: fail_int_param_mismatch.carbon:[[@LINE+2]]:1-22: note: type `Cpp.Simple` does not implement interface `Core.ImplicitAs(Cpp.Simple)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_int_param_mismatch.carbon:[[@LINE+11]]:1
// CHECK:STDERR: -> │ var s: Cpp.Simple(456) = Cpp.MakeSimple123();
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of type `Cpp.Simple` to
// CHECK:STDERR: · │ ┃ `Cpp.Simple`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `Cpp.Simple` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(Cpp.Simple)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var s: Cpp.Simple(456) = Cpp.MakeSimple123();
@@ -135,8 +143,16 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+3]]:26-30: error: cannot implicitly convert expression of type `type` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:26-30: note: type `type` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+11]]:26
// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, Cpp.A) = {};
// CHECK:STDERR: · ┳━━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `type` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `type` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoNonType(1, Cpp.A) = {};
@@ -148,8 +164,16 @@ import Cpp library "templates.h";
var n: i32;
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:26-27: error: cannot implicitly convert expression of type `i32*` to `i32` [ConversionFailure]
// CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+2]]:26-27: note: type `i32*` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_no_conversion.carbon:[[@LINE+11]]:26
// CHECK:STDERR: -> │ var x: Cpp.TwoNonType(1, &n) = {};
// CHECK:STDERR: · ┳━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert expression of
// CHECK:STDERR: · │ ┃ type `i32*` to `i32`
// CHECK:STDERR: · │ ┃ [ConversionFailure]
// CHECK:STDERR: · ╰────┤ type `i32*` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(i32)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoNonType(1, &n) = {};
@@ -36,10 +36,33 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
//@dump-sem-ir-begin
// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+5]]:35: error: too few template arguments for class template 'C' [CppInteropParseError]
// CHECK:STDERR: fail_template_mismatch.carbon:[[@LINE+4]]:35: note: template template argument has different template parameters than its corresponding template template parameter [CppInteropParseNote]
// CHECK:STDERR: ./templates.h:6:66: note: previous template template parameter is here [CppInteropParseNote]
// CHECK:STDERR: ./templates.h:4:37: note: template is declared here [CppInteropParseNote]
// CHECK:STDERR: ╭─┤ fail_template_mismatch.carbon:[[@LINE+28]]:35
// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, Cpp.C);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: too few template arguments for
// CHECK:STDERR: · │ ┃ class template 'C'
// CHECK:STDERR: · │ ┃ [CppInteropParseError]
// CHECK:STDERR: · ╰────┤ template template argument has
// CHECK:STDERR: · │ different template parameters than its
// CHECK:STDERR: · │ corresponding template template
// CHECK:STDERR: · │ parameter
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ ./templates.h
// CHECK:STDERR: │ template<typename, typename> struct C {};
// CHECK:STDERR: · ──────────────────────────── ┬
// CHECK:STDERR: · ╰──┤ template is declared here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: │
// CHECK:STDERR: │ template<template<typename> typename, template<typename> typename>
// CHECK:STDERR: · ────────────────── ┬
// CHECK:STDERR: · ╰──┤ previous
// CHECK:STDERR: · │ template
// CHECK:STDERR: · │ template
// CHECK:STDERR: · │ parameter
// CHECK:STDERR: · │ is here
// CHECK:STDERR: · │ [CppInteropParseNote]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTemplates(Cpp.A, Cpp.C);
//@dump-sem-ir-end
@@ -52,7 +75,14 @@ import Cpp library "templates.h";
class X {}
// CHECK:STDERR: fail_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_type_argument.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, X);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: template argument for template
// CHECK:STDERR: · ┃ template parameter must be a class
// CHECK:STDERR: · ┃ template or type alias template
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTemplates(Cpp.A, X);
@@ -62,7 +92,14 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:32: error: template argument for template template parameter must be a class template or type alias template [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+9]]:32
// CHECK:STDERR: -> │ var x: Cpp.TwoTemplates(Cpp.A, true);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: template argument for template
// CHECK:STDERR: · ┃ template parameter must be a class
// CHECK:STDERR: · ┃ template or type alias template
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTemplates(Cpp.A, true);
@@ -43,8 +43,16 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+3]]:28-31: error: cannot implicitly convert non-type value of type `bool` to `type` [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: fail_non_type_argument.carbon:[[@LINE+2]]:28-31: note: type `bool` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╭─┤ fail_non_type_argument.carbon:[[@LINE+11]]:28
// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, true);
// CHECK:STDERR: · ┳━━━
// CHECK:STDERR: · ┗━━┫ error: cannot implicitly convert non-type value
// CHECK:STDERR: · │ ┃ of type `bool` to `type`
// CHECK:STDERR: · │ ┃ [ConversionFailureNonTypeToFacet]
// CHECK:STDERR: · ╰────┤ type `bool` does not implement interface
// CHECK:STDERR: · │ `Core.ImplicitAs(type)`
// CHECK:STDERR: · │ [MissingImplInMemberAccessInContext]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTypes(Cpp.A, true);
@@ -54,7 +62,13 @@ library "[[@TEST_NAME]]";
import Cpp library "templates.h";
// CHECK:STDERR: fail_unsupported_type.carbon:[[@LINE+2]]:28-29: error: semantics TODO: `unsupported type used as template argument` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_unsupported_type.carbon:[[@LINE+8]]:28
// CHECK:STDERR: -> │ var x: Cpp.TwoTypes(Cpp.A, {});
// CHECK:STDERR: · ━┳
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `unsupported type used as template argument`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var x: Cpp.TwoTypes(Cpp.A, {});
+12 -2
View File
@@ -28,13 +28,23 @@ library "[[@TEST_NAME]]";
import Cpp;
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:5-21: error: semantics TODO: `failed to map Carbon type to C++` [SemanticsTodo]
// CHECK:STDERR: ╭─┤ fail_var_unsupported_type.carbon:[[@LINE+7]]:5
// CHECK:STDERR: -> │ var unsupported_x: () = ();
// CHECK:STDERR: · ━━━━━━━━┳━━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: semantics TODO: `failed to map Carbon type to C++`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
var unsupported_x: () = ();
inline Cpp '''
void F() {
// CHECK:STDERR: fail_var_unsupported_type.carbon:[[@LINE+2]]:11-23: error: no member named 'unsupported_x' in namespace 'Carbon' [CppInteropParseError]
// CHECK:STDERR: ╭─┤ fail_var_unsupported_type.carbon:[[@LINE+7]]:11
// CHECK:STDERR: -> │ Carbon::unsupported_x;
// CHECK:STDERR: · ━━━━━┳━━━━━━━
// CHECK:STDERR: · ┗━━┫ error: no member named 'unsupported_x' in namespace 'Carbon'
// CHECK:STDERR: · ┃ [CppInteropParseError]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
Carbon::unsupported_x;
}
@@ -41,6 +41,21 @@ fn MyF() {
// --- unsupported_type.h
// CHECK:STDERR: ╷ ╭── included from: fail_import_unsupported_type.carbon [InCppInclude]
// CHECK:STDERR: ├─┤ ./unsupported_type.h:[[@LINE+14]]:7
// CHECK:STDERR: -> │ using UnusupportedType = _BitInt(23);
// CHECK:STDERR: · ┳
// CHECK:STDERR: · ┗━━┫ error: semantics TODO:
// CHECK:STDERR: · ┃ `Unsupported: Type declaration: UnusupportedType`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: ┆
// CHECK:STDERR: ├─┤ fail_import_unsupported_type.carbon
// CHECK:STDERR: │ let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
// CHECK:STDERR: · ──────────┬─────────
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for `UnusupportedType`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
using UnusupportedType = _BitInt(23);
UnusupportedType unsupported_global;
@@ -48,15 +63,19 @@ UnusupportedType unsupported_global;
library "[[@TEST_NAME]]";
// CHECK:STDERR: included from: fail_import_unsupported_type.carbon:[[@LINE+2]]:10 [InCppInclude]
// CHECK:STDERR: ./unsupported_type.h:2:7: error: semantics TODO: `Unsupported: Type declaration: UnusupportedType` [SemanticsTodo]
import Cpp library "unsupported_type.h";
fn MyF() {
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+5]]:21-40: note: in `Cpp` name lookup for `UnusupportedType` [InCppNameLookup]
// CHECK:STDERR:
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+3]]:44-65: error: semantics TODO: `Unsupported: var type: UnusupportedType` [SemanticsTodo]
// CHECK:STDERR: fail_import_unsupported_type.carbon:[[@LINE+2]]:44-65: note: in `Cpp` name lookup for `unsupported_global` [InCppNameLookup]
// CHECK:STDERR: ╭─┤ fail_import_unsupported_type.carbon:[[@LINE+11]]:44
// CHECK:STDERR: -> │ let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
// CHECK:STDERR: · ┳━━━━━━━━━━━━━━━━━━━━━
// CHECK:STDERR: · ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
// CHECK:STDERR: · ┃ error: semantics TODO: `Unsupported: var type: UnusupportedType`
// CHECK:STDERR: · ┃ [SemanticsTodo]
// CHECK:STDERR: · ╰──┤ in `Cpp` name lookup for
// CHECK:STDERR: · │ `unsupported_global`
// CHECK:STDERR: · │ [InCppNameLookup]
// CHECK:STDERR: ╰────
// CHECK:STDERR:
let unused local: Cpp.UnusupportedType = Cpp.unsupported_global;
}
@@ -212,10 +231,10 @@ fn MyF() {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @MyF() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Cpp.ref.loc14_44: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc18_44: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %unsupported_global.ref: <error> = name_ref unsupported_global, <error> [concrete = <error>]
// CHECK:STDOUT: %.1: <error> = splice_block <error> [concrete = <error>] {
// CHECK:STDOUT: %Cpp.ref.loc14_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %Cpp.ref.loc18_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
// CHECK:STDOUT: %UnusupportedType.ref: <error> = name_ref UnusupportedType, <error> [concrete = <error>]
// CHECK:STDOUT: }
// CHECK:STDOUT: %local: <error> = wrapper_binding local, <error> [concrete = <error>]