diff --git a/toolchain/check/testdata/interop/cpp/bad_flags.carbon b/toolchain/check/testdata/interop/cpp/basics/bad_flags.carbon similarity index 86% rename from toolchain/check/testdata/interop/cpp/bad_flags.carbon rename to toolchain/check/testdata/interop/cpp/basics/bad_flags.carbon index 096b3f628a6a..0ab862dcc308 100644 --- a/toolchain/check/testdata/interop/cpp/bad_flags.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/bad_flags.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/bad_flags.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/bad_flags.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/bad_flags.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/bad_flags.carbon // CHECK:STDERR: error: unable to read PCH file does_not_exist.pch: 'No such file or directory' [CppInteropParseError] // CHECK:STDERR: // CHECK:STDERR: error: PCH file 'does_not_exist.pch' not found: module file not found [CppInteropParseError] diff --git a/toolchain/check/testdata/interop/cpp/cpp_diagnostics.carbon b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/cpp_diagnostics.carbon rename to toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon index ba2d8580ba08..7152fc5a9e33 100644 --- a/toolchain/check/testdata/interop/cpp/cpp_diagnostics.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/cpp_diagnostics.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/cpp_diagnostics.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/cpp_diagnostics.carbon // ============================================================================ // One error diff --git a/toolchain/check/testdata/interop/cpp/bad_import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon similarity index 96% rename from toolchain/check/testdata/interop/cpp/bad_import.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon index 7219feea84ba..d0ab023892ad 100644 --- a/toolchain/check/testdata/interop/cpp/bad_import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/bad_import.carbon +// 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/bad_import.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/bad_import.carbon // --- fail_import_cpp_library_empty.carbon diff --git a/toolchain/check/testdata/interop/cpp/cpp_namespace.carbon b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon similarity index 97% rename from toolchain/check/testdata/interop/cpp/cpp_namespace.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon index 82a7aa8ed39a..22f7096fefe1 100644 --- a/toolchain/check/testdata/interop/cpp/cpp_namespace.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/cpp_namespace.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/cpp_namespace.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/cpp_namespace.carbon // --- header.h diff --git a/toolchain/check/testdata/interop/cpp/fail_fuzzing.carbon b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon similarity index 83% rename from toolchain/check/testdata/interop/cpp/fail_fuzzing.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon index d4fe9c879a70..fa4c714bd70e 100644 --- a/toolchain/check/testdata/interop/cpp/fail_fuzzing.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/fail_fuzzing.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/fail_fuzzing.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/fail_fuzzing.carbon +// 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+4]]:1: error: `Cpp` import found during fuzzing [CppInteropFuzzing] // CHECK:STDERR: import Cpp library "file.h"; diff --git a/toolchain/check/testdata/interop/cpp/file_not_found.carbon b/toolchain/check/testdata/interop/cpp/basics/import/file_not_found.carbon similarity index 82% rename from toolchain/check/testdata/interop/cpp/file_not_found.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/file_not_found.carbon index fdc1b5b5f14d..22e73899ccd6 100644 --- a/toolchain/check/testdata/interop/cpp/file_not_found.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/file_not_found.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/file_not_found.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/file_not_found.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/file_not_found.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/file_not_found.carbon // --- fail_cpp_file_not_found.carbon diff --git a/toolchain/check/testdata/interop/cpp/import.carbon b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon similarity index 98% rename from toolchain/check/testdata/interop/cpp/import.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/import.carbon index dee8f2dd70cb..b1649ad95718 100644 --- a/toolchain/check/testdata/interop/cpp/import.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/import.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/import.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/import.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/import.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/import.carbon // ============================================================================ // Import C++ namespace indirectly diff --git a/toolchain/check/testdata/interop/cpp/include.carbon b/toolchain/check/testdata/interop/cpp/basics/import/include.carbon similarity index 85% rename from toolchain/check/testdata/interop/cpp/include.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/include.carbon index 66595f121256..e360785402dc 100644 --- a/toolchain/check/testdata/interop/cpp/include.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/include.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/include.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/include.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/include.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/include.carbon // --- included_file.h diff --git a/toolchain/check/testdata/interop/cpp/include_paths.carbon b/toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon similarity index 85% rename from toolchain/check/testdata/interop/cpp/include_paths.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon index 6557639718f6..d201548d2266 100644 --- a/toolchain/check/testdata/interop/cpp/include_paths.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/include_paths.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/include_paths.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/include_paths.carbon // --- include_stddef.h diff --git a/toolchain/check/testdata/interop/cpp/multiple_imports.carbon b/toolchain/check/testdata/interop/cpp/basics/import/multiple_imports.carbon similarity index 84% rename from toolchain/check/testdata/interop/cpp/multiple_imports.carbon rename to toolchain/check/testdata/interop/cpp/basics/import/multiple_imports.carbon index 2f36fa7b0769..14f919fac4b1 100644 --- a/toolchain/check/testdata/interop/cpp/multiple_imports.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/import/multiple_imports.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/multiple_imports.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/import/multiple_imports.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/multiple_imports.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/import/multiple_imports.carbon // --- file1.h diff --git a/toolchain/check/testdata/interop/cpp/inline_decl.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon similarity index 96% rename from toolchain/check/testdata/interop/cpp/inline_decl.carbon rename to toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon index f417303c551d..96dbe7597629 100644 --- a/toolchain/check/testdata/interop/cpp/inline_decl.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/inline_decl.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/inline_decl.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/inline/decl.carbon // --- inline_decl.carbon diff --git a/toolchain/check/testdata/interop/cpp/inline.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/import.carbon similarity index 96% rename from toolchain/check/testdata/interop/cpp/inline.carbon rename to toolchain/check/testdata/interop/cpp/basics/inline/import.carbon index e8bb7ca7b311..5c574872b584 100644 --- a/toolchain/check/testdata/interop/cpp/inline.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/import.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/inline.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/inline/import.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/inline.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/inline/import.carbon // --- use_inline_function_decl.carbon diff --git a/toolchain/check/testdata/interop/cpp/modules.carbon b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon similarity index 95% rename from toolchain/check/testdata/interop/cpp/modules.carbon rename to toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon index 4d52d6e13f72..d0ce04f26983 100644 --- a/toolchain/check/testdata/interop/cpp/modules.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/modules.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/modules.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/inline/modules.carbon // --- fail_export_module_in_inline_cpp.carbon diff --git a/toolchain/check/testdata/interop/cpp/unsupported_decl_type.carbon b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon similarity index 92% rename from toolchain/check/testdata/interop/cpp/unsupported_decl_type.carbon rename to toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon index 18d2066a89f4..a2e284bdda8b 100644 --- a/toolchain/check/testdata/interop/cpp/unsupported_decl_type.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/unsupported_decl_type.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/unsupported_decl_type.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/unsupported_decl_type.carbon // --- structured_binding.h diff --git a/toolchain/check/testdata/interop/cpp/unused_internal.carbon b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon similarity index 88% rename from toolchain/check/testdata/interop/cpp/unused_internal.carbon rename to toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon index 9b94930b95b6..27c40a5ec7da 100644 --- a/toolchain/check/testdata/interop/cpp/unused_internal.carbon +++ b/toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/unused_internal.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/unused_internal.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon // --- unused.carbon diff --git a/toolchain/check/testdata/interop/cpp/reverse/function.carbon b/toolchain/check/testdata/interop/cpp/function/export/function.carbon similarity index 95% rename from toolchain/check/testdata/interop/cpp/reverse/function.carbon rename to toolchain/check/testdata/interop/cpp/function/export/function.carbon index a11b40e72588..994ac1b663a1 100644 --- a/toolchain/check/testdata/interop/cpp/reverse/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/function.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/reverse/function.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/export/function.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/reverse/function.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/export/function.carbon // --- other.carbon diff --git a/toolchain/check/testdata/interop/cpp/reverse/thunk_ast.carbon b/toolchain/check/testdata/interop/cpp/function/export/thunk_ast.carbon similarity index 95% rename from toolchain/check/testdata/interop/cpp/reverse/thunk_ast.carbon rename to toolchain/check/testdata/interop/cpp/function/export/thunk_ast.carbon index 4eee7c28525d..b233524790d7 100644 --- a/toolchain/check/testdata/interop/cpp/reverse/thunk_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/function/export/thunk_ast.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/reverse/thunk_ast.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/export/thunk_ast.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/reverse/thunk_ast.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/export/thunk_ast.carbon // CHECK:STDOUT: TranslationUnitDecl {{0x[a-f0-9]+}} <> // CHECK:STDOUT: |-NamespaceDecl {{0x[a-f0-9]+}} <> Carbon diff --git a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon rename to toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon index 21a62ee2fd65..c6f21f0e38ca 100644 --- a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/arithmetic_types_bridged.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_bridged.carbon // Tests for the case where we need a thunk when calling a C++ function from // Carbon, because the parameter and return types might have a non-trivial diff --git a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_direct.carbon b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/arithmetic_types_direct.carbon rename to toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon index de862af6d4fb..a8543d81f0a6 100644 --- a/toolchain/check/testdata/interop/cpp/function/arithmetic_types_direct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/arithmetic_types_direct.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/arithmetic_types_direct.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/arithmetic_types_direct.carbon // Tests for the case where we can directly call a C++ function from Carbon, // because the parameter and return types are known to have a sufficiently diff --git a/toolchain/check/testdata/interop/cpp/function/class.carbon b/toolchain/check/testdata/interop/cpp/function/import/class.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/class.carbon rename to toolchain/check/testdata/interop/cpp/function/import/class.carbon index 5d0a0e9464a8..c62c5f05fec9 100644 --- a/toolchain/check/testdata/interop/cpp/function/class.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/class.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/class.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/class.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/class.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/class.carbon // ============================================================================ // Forward-declared class as parameter type diff --git a/toolchain/check/testdata/interop/cpp/constexpr.carbon b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon similarity index 79% rename from toolchain/check/testdata/interop/cpp/constexpr.carbon rename to toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon index 4e317d92e756..e1779468f9dd 100644 --- a/toolchain/check/testdata/interop/cpp/constexpr.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon @@ -7,60 +7,11 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/constexpr.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/constexpr.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/constexpr.carbon -// --- bool.carbon - -library "[[@TEST_NAME]]"; - -import Cpp inline ''' -constexpr bool b = true; -'''; - -class C(B:! bool) {} -fn F() -> C(Cpp.b); -let x: C(true) = F(); - -// --- int.carbon - -library "[[@TEST_NAME]]"; - -import Cpp inline ''' -constexpr int i = 123; -'''; - -class C(I:! i32) {} -fn F() -> C(Cpp.i); -let x: C(123) = F(); - -// --- float.carbon - -library "[[@TEST_NAME]]"; - -import Cpp inline ''' -constexpr float flt = 123.5; -'''; - -class C(V:! f32) {} -fn F() -> C(Cpp.flt); -let x: C(123.5) = F(); - -// --- pointer.carbon - -library "[[@TEST_NAME]]"; - -import Cpp inline ''' -int i = 123; -constexpr int* _Nonnull ptr = &i; -'''; - -class C(V:! i32*) {} -fn F() -> C(Cpp.ptr); -let x: C(&Cpp.i) = F(); - -// --- function.carbon +// --- basic.carbon library "[[@TEST_NAME]]"; @@ -70,7 +21,7 @@ constexpr int f(int a, int b) { return a + b; } let a: array(i32, Cpp.f(1, 2)) = (1, 2, 3); -// --- function_bool_param.carbon +// --- bool_param.carbon library "[[@TEST_NAME]]"; @@ -82,7 +33,7 @@ constexpr int f(bool b) { let a: array(i32, Cpp.f(true)) = (1, 2, 3); -// --- function_float_param.carbon +// --- float_param.carbon library "[[@TEST_NAME]]"; @@ -94,7 +45,7 @@ constexpr int f(float b) { let a: array(i32, Cpp.f(3.0)) = (1, 2, 3); -// --- function_return_bool.carbon +// --- return_bool.carbon library "[[@TEST_NAME]]"; diff --git a/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/decayed_param.carbon rename to toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon index 05aeb31c5f17..01f4618b9cbb 100644 --- a/toolchain/check/testdata/interop/cpp/function/decayed_param.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/decayed_param.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/decayed_param.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/decayed_param.carbon // --- params.h diff --git a/toolchain/check/testdata/interop/cpp/function/default_arg.carbon b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/default_arg.carbon rename to toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon index a4629bf0cbef..4c6b6c928f3a 100644 --- a/toolchain/check/testdata/interop/cpp/function/default_arg.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/default_arg.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/default_arg.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/default_arg.carbon // --- functions.h diff --git a/toolchain/check/testdata/interop/cpp/function/extern_c.carbon b/toolchain/check/testdata/interop/cpp/function/import/extern_c.carbon similarity index 98% rename from toolchain/check/testdata/interop/cpp/function/extern_c.carbon rename to toolchain/check/testdata/interop/cpp/function/import/extern_c.carbon index fec1421e7023..8b37cca15517 100644 --- a/toolchain/check/testdata/interop/cpp/function/extern_c.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/extern_c.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/extern_c.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/extern_c.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/extern_c.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/extern_c.carbon // --- extern_c_function.carbon diff --git a/toolchain/check/testdata/interop/cpp/function/full_semir.carbon b/toolchain/check/testdata/interop/cpp/function/import/full_semir.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/full_semir.carbon rename to toolchain/check/testdata/interop/cpp/function/import/full_semir.carbon index 8249b21ada02..d50e7479e9df 100644 --- a/toolchain/check/testdata/interop/cpp/function/full_semir.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/full_semir.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/full_semir.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/full_semir.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/full_semir.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/full_semir.carbon // ============================================================================ // Function with short parameter diff --git a/toolchain/check/testdata/interop/cpp/function/function.carbon b/toolchain/check/testdata/interop/cpp/function/import/function.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/function.carbon rename to toolchain/check/testdata/interop/cpp/function/import/function.carbon index 276c102080f4..7a7fcafa5696 100644 --- a/toolchain/check/testdata/interop/cpp/function/function.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/function.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/function.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/function.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/function.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/function.carbon // ============================================================================ // Global diff --git a/toolchain/check/testdata/interop/cpp/function/in_template.carbon b/toolchain/check/testdata/interop/cpp/function/import/in_template.carbon similarity index 97% rename from toolchain/check/testdata/interop/cpp/function/in_template.carbon rename to toolchain/check/testdata/interop/cpp/function/import/in_template.carbon index 3f93791e1e03..e8296cbf6a00 100644 --- a/toolchain/check/testdata/interop/cpp/function/in_template.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/in_template.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/in_template.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/in_template.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/in_template.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/in_template.carbon // --- class_template.h diff --git a/toolchain/check/testdata/interop/cpp/function/inline.carbon b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/inline.carbon rename to toolchain/check/testdata/interop/cpp/function/import/inline.carbon index 8d199d312b6b..e3355b87a989 100644 --- a/toolchain/check/testdata/interop/cpp/function/inline.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/inline.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/inline.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/inline.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/inline.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/inline.carbon // ============================================================================ // With definition diff --git a/toolchain/check/testdata/interop/cpp/function/multiple_too_few_args_calls.carbon b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon similarity index 94% rename from toolchain/check/testdata/interop/cpp/function/multiple_too_few_args_calls.carbon rename to toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon index d26efd11f0b5..32fc26d17b8e 100644 --- a/toolchain/check/testdata/interop/cpp/function/multiple_too_few_args_calls.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/multiple_too_few_args_calls.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/multiple_too_few_args_calls.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/multiple_too_few_args_calls.carbon // --- fail_call_too_few_args.carbon diff --git a/toolchain/check/testdata/interop/cpp/function/overloads.carbon b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/overloads.carbon rename to toolchain/check/testdata/interop/cpp/function/import/overloads.carbon index 5d7ec58a58a0..aae611fd9234 100644 --- a/toolchain/check/testdata/interop/cpp/function/overloads.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/overloads.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/overloads.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/overloads.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/overloads.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/overloads.carbon // ============================================================================ // Overloaded sets tests diff --git a/toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon similarity index 97% rename from toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon rename to toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon index d0b5b7389364..c2e5a4d6bc08 100644 --- a/toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/param_unsupported.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/param_unsupported.carbon // ============================================================================ // Unsupported primitive type diff --git a/toolchain/check/testdata/interop/cpp/function/pointer.carbon b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/pointer.carbon rename to toolchain/check/testdata/interop/cpp/function/import/pointer.carbon index 3145008d759e..e4edeae5d255 100644 --- a/toolchain/check/testdata/interop/cpp/function/pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/pointer.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/pointer.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/pointer.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/pointer.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/pointer.carbon // ============================================================================ // Non-nullable pointer as a parameter type diff --git a/toolchain/check/testdata/interop/cpp/function/qualified_param.carbon b/toolchain/check/testdata/interop/cpp/function/import/qualified_param.carbon similarity index 98% rename from toolchain/check/testdata/interop/cpp/function/qualified_param.carbon rename to toolchain/check/testdata/interop/cpp/function/import/qualified_param.carbon index 766544eefb7f..fb0afbdb2343 100644 --- a/toolchain/check/testdata/interop/cpp/function/qualified_param.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/qualified_param.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/qualified_param.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/qualified_param.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/qualified_param.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/qualified_param.carbon // --- qualifiers.h diff --git a/toolchain/check/testdata/interop/cpp/function/reference.carbon b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/reference.carbon rename to toolchain/check/testdata/interop/cpp/function/import/reference.carbon index fe278b5a890e..8d5f23dc55a5 100644 --- a/toolchain/check/testdata/interop/cpp/function/reference.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/reference.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/reference.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/reference.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/reference.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/reference.carbon // ============================================================================ // Lvalue reference as a parameter type diff --git a/toolchain/check/testdata/interop/cpp/function/return.carbon b/toolchain/check/testdata/interop/cpp/function/import/return.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/return.carbon rename to toolchain/check/testdata/interop/cpp/function/import/return.carbon index a3d4d11505de..e732c2711ed9 100644 --- a/toolchain/check/testdata/interop/cpp/function/return.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/return.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/return.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/return.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/return.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/return.carbon // ============================================================================ // Multiple function with a return value diff --git a/toolchain/check/testdata/interop/cpp/function/struct.carbon b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/struct.carbon rename to toolchain/check/testdata/interop/cpp/function/import/struct.carbon index 3483557a0ff5..74389332d291 100644 --- a/toolchain/check/testdata/interop/cpp/function/struct.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/struct.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/struct.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/struct.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/struct.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/struct.carbon // ============================================================================ // Forward-declared struct as parameter type diff --git a/toolchain/check/testdata/interop/cpp/function/template.carbon b/toolchain/check/testdata/interop/cpp/function/import/template.carbon similarity index 95% rename from toolchain/check/testdata/interop/cpp/function/template.carbon rename to toolchain/check/testdata/interop/cpp/function/import/template.carbon index 6a360d5920bf..c74e5be79024 100644 --- a/toolchain/check/testdata/interop/cpp/function/template.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/template.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/template.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/template.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/template.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/template.carbon // --- deduced_or_explicit.carbon diff --git a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon b/toolchain/check/testdata/interop/cpp/function/import/thunk_ast.carbon similarity index 96% rename from toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon rename to toolchain/check/testdata/interop/cpp/function/import/thunk_ast.carbon index 19bd32ad3a4f..c7d7db7e452a 100644 --- a/toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/thunk_ast.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/thunk_ast.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/thunk_ast.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/thunk_ast.carbon // CHECK:STDOUT: TranslationUnitDecl {{0x[a-f0-9]+}} <> // CHECK:STDOUT: |-NamespaceDecl {{0x[a-f0-9]+}} <> Carbon diff --git a/toolchain/check/testdata/interop/cpp/function/thunk_cpp26.carbon b/toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon similarity index 83% rename from toolchain/check/testdata/interop/cpp/function/thunk_cpp26.carbon rename to toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon index dad0bd7b2c2f..0345a8b3266d 100644 --- a/toolchain/check/testdata/interop/cpp/function/thunk_cpp26.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/thunk_cpp26.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/thunk_cpp26.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/thunk_cpp26.carbon // --- thunk_required.h diff --git a/toolchain/check/testdata/interop/cpp/function/union.carbon b/toolchain/check/testdata/interop/cpp/function/import/union.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/union.carbon rename to toolchain/check/testdata/interop/cpp/function/import/union.carbon index 8abe21fbb26d..131b5131899f 100644 --- a/toolchain/check/testdata/interop/cpp/function/union.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/union.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/union.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/union.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/union.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/union.carbon // ============================================================================ // Forward-declared union as parameter type diff --git a/toolchain/check/testdata/interop/cpp/function/variadic.carbon b/toolchain/check/testdata/interop/cpp/function/import/variadic.carbon similarity index 98% rename from toolchain/check/testdata/interop/cpp/function/variadic.carbon rename to toolchain/check/testdata/interop/cpp/function/import/variadic.carbon index 314c151695dc..aa85d5b3934d 100644 --- a/toolchain/check/testdata/interop/cpp/function/variadic.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/variadic.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/variadic.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/variadic.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/variadic.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/variadic.carbon // --- variadic.h diff --git a/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/function/import/void_pointer.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/void_pointer.carbon rename to toolchain/check/testdata/interop/cpp/function/import/void_pointer.carbon index 69a1ea9f0a85..5871fd06b666 100644 --- a/toolchain/check/testdata/interop/cpp/function/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/function/import/void_pointer.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/void_pointer.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/import/void_pointer.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/void_pointer.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/import/void_pointer.carbon // --- non_nullable_param.carbon diff --git a/toolchain/check/testdata/interop/cpp/macros.carbon b/toolchain/check/testdata/interop/cpp/macros/macros.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/macros.carbon rename to toolchain/check/testdata/interop/cpp/macros/macros.carbon index f907cb93a235..c9282b8954c9 100644 --- a/toolchain/check/testdata/interop/cpp/macros.carbon +++ b/toolchain/check/testdata/interop/cpp/macros/macros.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/macros.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/macros/macros.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/macros.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/macros/macros.carbon // ============================================================================ // object-like macros diff --git a/toolchain/check/testdata/interop/cpp/namespace/export.carbon b/toolchain/check/testdata/interop/cpp/namespace/export.carbon index 20654e439307..4ead808fc749 100644 --- a/toolchain/check/testdata/interop/cpp/namespace/export.carbon +++ b/toolchain/check/testdata/interop/cpp/namespace/export.carbon @@ -10,6 +10,33 @@ // TIP: To dump output, run: // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/namespace/export.carbon +// --- other.carbon +package Other; +namespace Nested; +namespace Nested.Again; + +class Class1; +// --- namespace.carbon + +library "[[@TEST_NAME]]"; + +import Other; +import Cpp inline ''' +namespace X = Carbon::Other; +namespace Y = Carbon::Other::Nested; +namespace Z = Carbon::Other::Nested::Again; +Carbon::Other::Class1 *glbl; + +template void f1() { + T* v; +} + +void f2() { + f1(); +} + +'''; + // --- alias_identity.carbon import Cpp; diff --git a/toolchain/check/testdata/interop/cpp/deref.carbon b/toolchain/check/testdata/interop/cpp/operators/deref.carbon similarity index 98% rename from toolchain/check/testdata/interop/cpp/deref.carbon rename to toolchain/check/testdata/interop/cpp/operators/deref.carbon index 1b316d1826d5..87dbd3087763 100644 --- a/toolchain/check/testdata/interop/cpp/deref.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/deref.carbon @@ -8,9 +8,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/deref.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/operators/deref.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/deref.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/operators/deref.carbon // --- const_deref.carbon diff --git a/toolchain/check/testdata/interop/cpp/function/operators.carbon b/toolchain/check/testdata/interop/cpp/operators/operators.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/function/operators.carbon rename to toolchain/check/testdata/interop/cpp/operators/operators.carbon index cde851266ba8..55d493fc05fc 100644 --- a/toolchain/check/testdata/interop/cpp/function/operators.carbon +++ b/toolchain/check/testdata/interop/cpp/operators/operators.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/operators.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/operators/operators.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/operators.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/operators/operators.carbon // ============================================================================ // Unary operators diff --git a/toolchain/check/testdata/interop/cpp/builtins.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/builtins.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon index b983ea275442..6dbd863ed0a7 100644 --- a/toolchain/check/testdata/interop/cpp/builtins.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/builtins.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/builtins.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/arithmetic.carbon // --- supported_types.carbon diff --git a/toolchain/check/testdata/interop/cpp/fail_todo_arithmetic_types_unmapped.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon similarity index 82% rename from toolchain/check/testdata/interop/cpp/fail_todo_arithmetic_types_unmapped.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon index a6a054368230..34d147be63a0 100644 --- a/toolchain/check/testdata/interop/cpp/fail_todo_arithmetic_types_unmapped.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/fail_todo_arithmetic_types_unmapped.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/fail_todo_arithmetic_types_unmapped.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/fail_todo_arithmetic_types_unmapped.carbon // Ensure we get a diagnostic when using a type that doesn't yet have a mapping // from C++ to Carbon. diff --git a/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/builtins.llp64.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon index 75ad51d0e022..80f591708169 100644 --- a/toolchain/check/testdata/interop/cpp/builtins.llp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/builtins.llp64.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/builtins.llp64.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.llp64.carbon // --- long_long.carbon diff --git a/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/builtins.lp64.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon index b1791e5eb885..447e7ea1388c 100644 --- a/toolchain/check/testdata/interop/cpp/builtins.lp64.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon @@ -7,9 +7,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/builtins.lp64.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/builtins.lp64.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/long_and_long_long.lp64.carbon // --- long.carbon diff --git a/toolchain/check/testdata/interop/cpp/void.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon similarity index 94% rename from toolchain/check/testdata/interop/cpp/void.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/void.carbon index 1d6e38e5b713..3b2ac73a372b 100644 --- a/toolchain/check/testdata/interop/cpp/void.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/void.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/void.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/void.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/void.carbon // --- void_not_incomplete.carbon diff --git a/toolchain/check/testdata/interop/cpp/void_pointer.carbon b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon similarity index 99% rename from toolchain/check/testdata/interop/cpp/void_pointer.carbon rename to toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon index 5a38792e2a9d..4a14628d404b 100644 --- a/toolchain/check/testdata/interop/cpp/void_pointer.carbon +++ b/toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon @@ -6,9 +6,9 @@ // // AUTOUPDATE // TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/void_pointer.carbon +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon // TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/void_pointer.carbon +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/primitive_types/void_pointer.carbon // --- implicit_as_from_cpp_class_pointer_to_void_pointer.carbon diff --git a/toolchain/check/testdata/interop/cpp/reverse/simple.carbon b/toolchain/check/testdata/interop/cpp/reverse/simple.carbon deleted file mode 100644 index a6dcca482860..000000000000 --- a/toolchain/check/testdata/interop/cpp/reverse/simple.carbon +++ /dev/null @@ -1,38 +0,0 @@ -// Part of the Carbon Language project, under the Apache License v2.0 with LLVM -// Exceptions. See /LICENSE for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon -// -// AUTOUPDATE -// TIP: To test this file alone, run: -// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/reverse/simple.carbon -// TIP: To dump output, run: -// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/reverse/simple.carbon - -// --- other.carbon -package Other; -namespace Nested; -namespace Nested.Again; - -class Class1; -// --- namespace.carbon - -library "[[@TEST_NAME]]"; - -import Other; -import Cpp inline ''' -namespace X = Carbon::Other; -namespace Y = Carbon::Other::Nested; -namespace Z = Carbon::Other::Nested::Again; -Carbon::Other::Class1 *glbl; - -template void f1() { - T* v; -} - -void f2() { - f1(); -} - -'''; diff --git a/toolchain/check/testdata/interop/cpp/var/constexpr.carbon b/toolchain/check/testdata/interop/cpp/var/constexpr.carbon new file mode 100644 index 000000000000..f313eb26f905 --- /dev/null +++ b/toolchain/check/testdata/interop/cpp/var/constexpr.carbon @@ -0,0 +1,61 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/full.carbon +// EXTRA-ARGS: --clang-arg=--std=c++20 +// +// AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/var/constexpr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/var/constexpr.carbon + +// --- bool.carbon + +library "[[@TEST_NAME]]"; + +import Cpp inline ''' +constexpr bool b = true; +'''; + +class C(B:! bool) {} +fn F() -> C(Cpp.b); +let x: C(true) = F(); + +// --- int.carbon + +library "[[@TEST_NAME]]"; + +import Cpp inline ''' +constexpr int i = 123; +'''; + +class C(I:! i32) {} +fn F() -> C(Cpp.i); +let x: C(123) = F(); + +// --- float.carbon + +library "[[@TEST_NAME]]"; + +import Cpp inline ''' +constexpr float flt = 123.5; +'''; + +class C(V:! f32) {} +fn F() -> C(Cpp.flt); +let x: C(123.5) = F(); + +// --- pointer.carbon + +library "[[@TEST_NAME]]"; + +import Cpp inline ''' +int i = 123; +constexpr int* _Nonnull ptr = &i; +'''; + +class C(V:! i32*) {} +fn F() -> C(Cpp.ptr); +let x: C(&Cpp.i) = F();